:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #1e2326;
  --muted: #677078;
  --line: #d9d4c7;
  --panel: #fffdf8;
  --green: #2f6f5e;
  --red: #ad3f3f;
  --blue: #375f8f;
  --gold: #926b20;
  --shadow: 0 14px 34px rgba(31, 35, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 7px;
  background: rgba(247, 245, 239, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  transition: transform 0.18s ease;
  will-change: transform;
}

.topbar.topbar-hidden {
  transform: translateY(calc(-100% - 1px));
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

main {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 10px 14px 40px;
}

.tabs {
  position: sticky;
  top: 50px;
  z-index: 4;
  display: flex;
  gap: 0;
  overflow-x: auto;
  margin: -10px -14px 12px;
  padding: 8px 14px 0;
  border-bottom: 1px solid #d7d9d4;
  background: rgba(247, 245, 239, 0.94);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
  transition: top 0.18s ease;
}

.tabs::-webkit-scrollbar {
  display: none;
}

body.topbar-hidden .tabs {
  top: 0;
}

.view-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 0 14px;
}

.tab,
button {
  border: 0;
  font: inherit;
}

.tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.tab-badge {
  position: absolute;
  top: 1px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: #c84444;
  color: white;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(120, 35, 35, 0.24);
}

.tab-badge[hidden] {
  display: none;
}

.tab.active {
  margin-bottom: -1px;
  border-color: #d7d9d4;
  border-bottom-color: var(--bg);
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 -3px 9px rgba(31, 35, 37, 0.04);
}

.tab.active::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--green);
  content: "";
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c9d5d0;
  border-radius: 999px;
  background: #eef4f1;
  color: #2d4c43;
  font-size: 13px;
  font-weight: 800;
}

.filter-chip.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.search-box {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 125, 99, 0.14);
}

.integration-panel,
.mail-rules-panel,
.action-queue-panel,
.operations-panel {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

.panel-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-mode .view-filters {
  display: none;
}

.home-dashboard {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
}

.home-attention-panel {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e1d4b6;
  border-left: 5px solid #b38a32;
  border-radius: 8px;
  background: #fff8e8;
  box-shadow: var(--shadow);
}

.home-attention-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-attention-head h2 {
  font-size: 18px;
  line-height: 1.25;
}

.home-attention-head small {
  color: #735622;
  font-size: 12px;
  font-weight: 900;
}

.home-attention-list {
  display: grid;
  gap: 7px;
}

.home-attention-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #ead9b4;
  border-radius: 8px;
  background: #fffdf8;
}

.home-attention-item h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}

.home-attention-item p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-attention-item button {
  min-width: 54px;
  min-height: 32px;
  border-radius: 8px;
  background: #f0eadb;
  color: #5e4517;
  font-size: 13px;
  font-weight: 900;
}

.home-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
  box-shadow: var(--shadow);
}

.home-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-panel-head h2 {
  font-size: 19px;
  line-height: 1.25;
}

.home-panel-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.home-kicker {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-notice-list,
.home-codex-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid #e0dccf;
  border-radius: 8px;
  background: white;
}

.home-notice-item,
.home-codex-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 10px 10px 12px;
  border-bottom: 1px solid #e7e2d6;
  border-left: 5px solid #8d9aa1;
  background: #fffefa;
}

.home-notice-item:last-child,
.home-codex-item:last-child {
  border-bottom: 0;
}

.home-source-ai {
  border-left-color: #396f92;
}

.home-source-beauty {
  border-left-color: #b06a82;
}

.home-source-business,
.home-source-manual {
  border-left-color: #9a7a31;
}

.home-source-schedule {
  border-left-color: var(--gold);
}

.home-source-reminder {
  border-left-color: var(--green);
}

.home-notice-main,
.home-codex-item > div {
  min-width: 0;
}

.home-codex-side {
  display: grid;
  gap: 4px;
  justify-items: end;
  align-self: center;
}

.home-codex-action {
  min-width: 44px;
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.home-codex-action:disabled {
  background: #d8ddd8;
  color: #68726c;
}

.home-notice-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.home-source-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf1f3;
  color: #334047;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.home-source-ai .home-source-chip {
  background: #e2ebf5;
  color: #315f7d;
}

.home-source-beauty .home-source-chip {
  background: #f7e3ec;
  color: #7c3150;
}

.home-source-schedule .home-source-chip {
  background: #f0eadb;
  color: #6f5520;
}

.home-source-reminder .home-source-chip {
  background: #e0f0e9;
  color: #27614e;
}

.home-notice-row time {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.home-notice-item h3,
.home-codex-item h3 {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-notice-item p,
.home-codex-item p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-notice-item button {
  min-width: 54px;
  min-height: 32px;
  border-radius: 8px;
  background: #ecede9;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.home-empty {
  padding: 16px;
  background: #eef4f1;
  color: #2d4c43;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.integration-summary,
.mail-rules-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.mail-rules-summary {
  grid-template-columns: repeat(4, 1fr);
}

.integration-summary div,
.mail-rules-summary div {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e0dccf;
  border-radius: 8px;
  background: white;
}

.integration-summary span,
.mail-rules-summary span {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.integration-summary small,
.mail-rules-summary small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.integration-list,
.mail-rules-list {
  display: grid;
  gap: 8px;
}

.integration-group,
.mail-rule-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.integration-group summary,
.mail-rule-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.integration-group summary small,
.mail-rule-group summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.integration-items,
.mail-rule-items {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.integration-item,
.mail-rule-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-top: 1px solid #eee8da;
}

.integration-item:first-child,
.mail-rule-item:first-child {
  border-top: 0;
}

.integration-item h3,
.mail-rule-item h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.integration-item p,
.mail-rule-item p {
  margin-top: 4px;
  color: #3f484d;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.mail-rules-sheet {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mail-rules-sheet a {
  color: #315f7d;
  font-weight: 800;
}

.mail-rule-form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(112px, 0.8fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #e0dccf;
  border-radius: 8px;
  background: white;
}

.mail-rule-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mail-rule-form input,
.mail-rule-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.mail-rule-form button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.quick-actions button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cfd7d4;
  border-radius: 8px;
  background: #edf4f1;
  color: #234d42;
  font-weight: 800;
}

.action-requests {
  display: grid;
  gap: 8px;
}

.background-plan,
.safety-policy,
.operations-history {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.safety-policy {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operation-setting-item,
.safety-policy-item,
.operation-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.operation-setting-item h3,
.safety-policy-item h3,
.operation-history-item h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.operation-setting-item p,
.safety-policy-item p,
.operation-meta,
.operation-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.compact-head {
  margin-top: 14px;
  margin-bottom: 0;
}

.compact-head small {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.action-request-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.action-request-item h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.action-request-meta,
.action-request-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.request-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.status-pill {
  min-width: 54px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf1f3;
  color: #334047;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.integration-item[data-status="done"] .status-pill {
  background: #e0f0e9;
  color: #27614e;
}

.integration-item[data-status="partial"] .status-pill {
  background: #f0eadb;
  color: #6f5520;
}

.integration-item[data-status="todo"] .status-pill {
  background: #f7e3df;
  color: #7d2b2b;
}

.safety-policy-item[data-mode="one_tap"] .status-pill,
.operation-history-item[data-status="completed"] .status-pill {
  background: #e0f0e9;
  color: #27614e;
}

.safety-policy-item[data-mode="confirm_required"] .status-pill,
.operation-history-item[data-status="running"] .status-pill,
.operation-history-item[data-status="pending_codex"] .status-pill,
.operation-history-item[data-status="needs_codex"] .status-pill {
  background: #f0eadb;
  color: #6f5520;
}

.safety-policy-item[data-mode="codex_bridge"] .status-pill {
  background: #e2ebf5;
  color: #315f7d;
}

.safety-policy-item[data-mode="blocked"] .status-pill,
.operation-history-item[data-status="failed"] .status-pill {
  background: #f7e3df;
  color: #7d2b2b;
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
}

.card-group {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
}

.card-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.card-group-head h2 {
  font-size: 18px;
}

.card-group-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.card-group-list {
  display: grid;
  gap: 10px;
}

.group-empty {
  padding: 16px;
  border: 1px dashed #c9d5d0;
  border-radius: 8px;
  background: #eef4f1;
  color: #2d4c43;
  font-weight: 800;
  text-align: center;
}

.reply-draft-list {
  display: grid;
  gap: 10px;
}

.reply-draft-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

.reply-draft-item h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.reply-draft-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.reply-draft-message {
  width: 100%;
  min-height: 180px;
  max-height: 220px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid #e4dfd2;
  border-radius: 8px;
  background: white;
  color: #30383d;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  resize: vertical;
}

.reply-draft-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.reply-draft-actions button {
  min-height: 34px;
  border-radius: 8px;
  background: #ecede9;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.schedule-overview {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.schedule-overview-head,
.schedule-owner-head,
.schedule-owner-period-title,
.schedule-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-overview-head h2 {
  font-size: 19px;
  line-height: 1.3;
}

.schedule-overview-head small,
.schedule-owner-head small,
.schedule-owner-period-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.schedule-kicker {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.schedule-owner-sections,
.schedule-owner-periods {
  display: grid;
  gap: 12px;
}

.schedule-owner-section,
.schedule-owner-period {
  display: grid;
  gap: 8px;
}

.schedule-owner-head {
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 900;
}

.schedule-owner-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.schedule-owner-period-title {
  padding: 3px 2px 1px;
  color: #5f4716;
  font-weight: 900;
}

.schedule-owner-period-week .schedule-owner-period-title {
  color: #2d4a68;
}

.schedule-owner-self .schedule-owner-head,
.schedule-lane-self h3 {
  background: #e8f2ef;
  color: #254b41;
}

.schedule-owner-recruit .schedule-owner-head,
.schedule-lane-nagao_fukuzawa h3,
.schedule-lane-recruit h3 {
  background: #f2e8ef;
  color: #65314e;
}

.schedule-owner-internal .schedule-owner-head,
.schedule-lane-internal h3 {
  background: #e9eef4;
  color: #2d4a68;
}

.schedule-owner-pr .schedule-owner-head,
.schedule-lane-pr h3 {
  background: #fff0d9;
  color: #6a4310;
}

.schedule-item-list {
  display: grid;
  gap: 6px;
}

.schedule-item {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid #e3ded2;
  border-radius: 8px;
  background: #fffefa;
}

.schedule-item-main strong {
  color: var(--gold);
  font-size: 13px;
  white-space: nowrap;
}

.schedule-item-main span {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.schedule-item p,
.schedule-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.schedule-empty {
  padding: 12px;
  border: 1px dashed #cbd5dc;
  border-radius: 8px;
  background: #f5f7f8;
  text-align: center;
  font-weight: 800;
}

.reminder-candidate-list {
  display: grid;
  gap: 8px;
}

.reminder-candidate-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reminder-candidate-item h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.reminder-candidate-item p {
  margin: 0;
  color: #30383d;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.owner-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.owner-self {
  background: #e8f2ef;
  color: #254b41;
}

.owner-nagao_fukuzawa,
.owner-recruit {
  background: #f2e8ef;
  color: #65314e;
}

.owner-internal {
  background: #e9eef4;
  color: #2d4a68;
}

.owner-pr {
  background: #fff0d9;
  color: #6a4310;
}

.reminder-candidate-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.reminder-candidate-actions button {
  min-height: 34px;
  border-radius: 8px;
  background: #ecede9;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.mail-digest-batches {
  display: grid;
  gap: 14px;
}

.mail-digest-batch {
  display: grid;
  gap: 8px;
}

.mail-digest-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #d7e0dc;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #edf4f1;
}

.mail-digest-batch-head h3 {
  margin: 0;
  color: #1d4e42;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.2;
}

.mail-digest-batch-head small {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fffefa;
  color: #2f6f5e;
  font-size: 12px;
  font-weight: 900;
}

.mail-digest-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mail-digest-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #e7e2d6;
  background: #fffefa;
}

.mail-digest-item:last-child {
  border-bottom: 0;
}

.mail-digest-row,
.mail-digest-subrow {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.mail-digest-row {
  justify-content: flex-start;
}

.mail-digest-subrow {
  justify-content: space-between;
}

.mail-digest-time {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.mail-digest-item h3 {
  flex: 1 1 auto;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-digest-from {
  flex: 1 1 auto;
  overflow: hidden;
  margin: 0;
  color: #15191c;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-digest-summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mail-account-chip {
  flex: 0 0 auto;
  max-width: 112px;
  overflow: hidden;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-account-chip[data-account-tone="green"] {
  background: #e0f0e9;
  color: #27614e;
}

.mail-account-chip[data-account-tone="blue"] {
  background: #e2ebf5;
  color: #315f7d;
}

.mail-account-chip[data-account-tone="gold"] {
  background: #f0eadb;
  color: #6f5520;
}

.mail-account-chip[data-account-tone="red"] {
  background: #f7e3df;
  color: #7d2b2b;
}

.mail-account-chip[data-account-tone="purple"] {
  background: #eee6f4;
  color: #60427d;
}

.mail-digest-detail {
  flex: 0 0 auto;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 9px;
  background: #ecede9;
  color: #20262a;
  font-size: 12px;
  font-weight: 800;
}

.news-batches {
  display: grid;
  gap: 14px;
}

.news-batch {
  display: grid;
  gap: 8px;
}

.news-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #d8dde4;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #eef3f8;
}

.news-batch-head h3 {
  margin: 0;
  color: #294f76;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.2;
}

.news-batch-head small {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fffefa;
  color: #375f8f;
  font-size: 12px;
  font-weight: 900;
}

.news-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.news-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #e7e2d6;
  border-left: 5px solid #8d9aa1;
  background: #fffefa;
}

.news-item:last-child {
  border-bottom: 0;
}

.news-topic-ai {
  border-left-color: #396f92;
}

.news-topic-beauty {
  border-left-color: #b06a82;
}

.news-topic-business {
  border-left-color: #9a7a31;
}

.news-row {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.news-topic-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.news-topic-ai .news-topic-chip {
  background: #e2ebf5;
  color: #315f7d;
}

.news-topic-beauty .news-topic-chip {
  background: #f7e3ec;
  color: #7c3150;
}

.news-topic-business .news-topic-chip {
  background: #f0eadb;
  color: #6f5520;
}

.news-time {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.news-item h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.news-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 2px;
}

.news-actions button {
  min-height: 31px;
  border-radius: 8px;
  background: #ecede9;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card[data-priority="urgent"] {
  border-left-color: var(--red);
}

.card[data-source="news"] {
  border-left-color: var(--blue);
}

.card[data-source="schedule"] {
  border-left-color: var(--gold);
}

.card[data-status="done"] {
  opacity: 0.72;
}

.card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-title {
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf1f3;
  color: #334047;
  font-size: 12px;
  font-weight: 700;
}

.badge.priority-urgent {
  background: #f7e3df;
  color: #7d2b2b;
}

.duplicate-badge {
  background: #f0eadb;
  color: #6f5520;
}

.body {
  white-space: pre-wrap;
  color: #30383d;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.body a,
.detail-body a {
  color: #1b6c8f;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.mail-instruction-note {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #d9cfae;
  border-radius: 8px;
  background: #fff8e5;
}

.mail-instruction-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mail-instruction-note-head span {
  color: #6f5520;
  font-size: 13px;
  font-weight: 900;
}

.mail-instruction-note-head small {
  flex: 0 0 auto;
  color: #806f4b;
  font-size: 11px;
  font-weight: 800;
}

.mail-instruction-note p {
  margin: 0;
  color: #3f3a2d;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mail-instruction-note-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mail-instruction-note-actions button {
  min-height: 31px;
  border-radius: 8px;
  background: #f0eadb;
  color: #4f421f;
  font-size: 13px;
  font-weight: 900;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.meta-action {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1b6c8f;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.actions button,
.primary,
.icon-button {
  min-height: 34px;
  border-radius: 8px;
  background: #ecede9;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.actions button:hover,
.primary:hover,
.icon-button:hover {
  filter: brightness(0.96);
}

.actions .primary-action,
.primary {
  background: var(--green);
  color: white;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  font-size: 22px;
}

.topbar .icon-button {
  min-height: 34px;
  width: 38px;
  min-width: 38px;
  font-size: 20px;
}

.empty {
  margin-top: 28px;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  margin-top: 10px;
  text-align: left;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 18px;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

dialog {
  width: min(560px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(30, 35, 38, 0.35);
}

.dialog-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  font-size: 18px;
}

.dialog-source {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.like-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #c9d5d0;
  border-radius: 999px;
  background: #eef4f1;
  color: #2f6f5e;
  font-size: 13px;
  font-weight: 900;
}

.like-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
}

.like-button-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.like-button.is-liked {
  border-color: #b8ded3;
  background: #dcefe7;
  color: #1f6b55;
}

.like-button.is-liked .like-button-icon svg {
  fill: currentColor;
}

.detail-dialog-body {
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
}

.menu-dialog-body {
  max-height: min(640px, calc(100vh - 32px));
  overflow: auto;
}

.menu-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

.menu-section h3 {
  margin: 0;
  font-size: 15px;
}

.menu-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.menu-search {
  margin: 0;
}

.notification-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.menu-meta {
  color: var(--muted);
  font-size: 12px;
}

.mini-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #f0eee8;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.system-status {
  display: grid;
  gap: 8px;
}

.system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.system-row strong {
  color: var(--ink);
  font-size: 12px;
}

.system-badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.system-badge.ok {
  background: #dcefe7;
  color: #1f6b55;
}

.system-badge.warn {
  background: #efeee8;
  color: #6b6257;
}

.system-links {
  display: grid;
  gap: 4px;
}

.system-links a {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.system-queue {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.background-summary {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #d8ded9;
  border-radius: 8px;
  background: white;
}

.background-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.background-summary-head strong {
  font-size: 14px;
}

.background-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.background-summary-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid #e2e0d8;
  border-radius: 7px;
  background: #fbfaf5;
}

.background-summary-grid span,
.background-summary-grid strong {
  display: block;
}

.background-summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.background-summary-grid strong {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.detail-body {
  margin: 0;
  white-space: pre-wrap;
  color: #30383d;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.detail-sources {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.detail-sources h3 {
  margin: 0;
  font-size: 13px;
}

.detail-source-links {
  display: grid;
  gap: 6px;
}

.detail-source-links a {
  display: block;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f6;
  color: #315f7d;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  max-width: calc(100% - 28px);
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 760px) {
  .topbar {
    padding-inline: 28px;
  }

  main {
    padding-inline: 24px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar {
    transition: none;
  }

  .tabs {
    transition: none;
  }
}

@media (max-width: 430px) {
  .mail-rules-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .mail-rule-form {
    grid-template-columns: 1fr;
  }

  .safety-policy {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions button {
    min-height: 44px;
  }
}
