/* LegalOS UI system — quiet legal workspace. */
:root {
  --canvas: #f6f4ef;
  --surface: #fffefa;
  --surface-muted: #f5f3ee;
  --ink: #172538;
  --ink-soft: #435268;
  --muted: #647185;
  --line: #dce0df;
  --line-strong: #788594;
  --navy: #173451;
  --navy-hover: #0e2944;
  --gold: #76592f;
  --green: #2e6a4f;
  --amber: #916c24;
  --red: #a33e36;
  --focus: #245d92;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgb(21 36 58 / 0.04), 0 10px 28px rgb(21 36 58 / 0.05);
  --shadow-overlay: 0 12px 28px rgb(23 36 55 / 0.12);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
}

/* Shared communication review */
.conversation-layout { display: grid; grid-template-columns: minmax(260px, 0.9fr) minmax(420px, 1.6fr); gap: 18px; align-items: start; }
.conversation-panel { min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.conversation-layout > .conversation-panel:last-child { min-height: 360px; }
.conversation-panel-head, .conversation-page { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.conversation-panel label { display: block; margin: 12px 0; color: var(--ink-soft); font-weight: 600; }
.conversation-panel input:not([type="checkbox"]), .conversation-panel select { display: block; width: 100%; min-height: 36px; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: white; color: var(--ink); }
.conversation-item, .conversation-message { display: block; width: 100%; margin: 6px 0; padding: 10px; text-align: left; color: var(--ink); background: var(--surface-muted); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.conversation-item:hover, .conversation-message:hover, .conversation-item.active { border-color: var(--navy); background: #edf1f4; }
.conversation-page { margin-top: 14px; }
.conversation-body { margin: 12px 0; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-muted); border-radius: var(--radius-sm); }
.conversation-confirm { display: flex !important; align-items: flex-start; gap: 8px; }
.conversation-confirm input { margin-top: 3px; }
.conversation-new-matter { margin-top: 18px; }
@media (max-width: 780px) { .conversation-layout { grid-template-columns: 1fr; } }
@media (max-width: 780px) { .conversation-layout > .conversation-panel:last-child { min-height: 280px; } }

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 27px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.2; }
h2 { margin-bottom: 5px; font-size: 16px; font-weight: 650; line-height: 1.35; }
h3 { margin: 22px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.015em; }
small, .muted, .hint { color: var(--muted); }

/* Application shell */
.portal { width: min(1360px, 100%); margin: 0 auto; padding: 0 32px 48px; }
.portal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--navy); font-size: 14px; font-weight: 750; letter-spacing: 0.085em; }
.profile { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.profile form { margin: 0; }
.profile-link { display: inline-flex; min-height: 35px; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.profile-link:hover { border-color: var(--navy); background: #efeee9; }
.profile-link small { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.profile-link strong { color: var(--navy); font-size: 12px; }
.language-switch { display: inline-flex; min-height: 35px; align-items: center; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--navy); font-size: 12px; font-weight: 700; }
.language-switch:hover { border-color: var(--navy); background: #efeee9; }
.profile button, .logout-button { min-height: 35px; padding: 7px 11px; border: 1px solid #c99490; border-radius: var(--radius-sm); background: #fff8f7; color: var(--red); font-weight: 700; }
.profile button:hover, .logout-button:hover { border-color: var(--red); background: #fcecea; color: #87332d; }
.account-strip { display: flex; justify-content: flex-end; width: min(1360px, calc(100% - 64px)); margin: 14px auto -4px; }

.workspace-title { max-width: 650px; margin: 42px 0 28px; }
.workspace-title p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.eyebrow, .section-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; padding-top: 20px; color: var(--muted); font-size: 12px; }
.breadcrumb a:hover, .back-link:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.back-link { display: inline-flex; min-height: 35px; align-items: center; margin: 26px 0 18px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--navy); font-size: 12px; font-weight: 650; }
.portal-bar .back-link { margin: 0 0 0 auto; }
.back-action { margin-top: 22px; margin-bottom: 22px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--navy); font-weight: 650; }
.back-action:hover { border-color: var(--navy); background: #efeee9; text-decoration: none; }

/* Module hub */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.module-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  min-height: 145px;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
}
.module-card:hover { border-color: #abb2b9; background: #fff; }
.module-icon, .mailbox-card .icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--navy);
  background: var(--surface-muted);
  font-size: 15px;
}
.module-card h2 { margin: 3px 0 5px; }
.module-card p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.module-open { grid-column: 2; align-self: end; margin-top: 11px; color: var(--navy); font-size: 12px; font-weight: 650; }
.empty-card { border-style: dashed; background: transparent; }

/* Contextual module navigation */
.module-frame { display: grid; grid-template-columns: 204px minmax(0, 1fr); gap: 38px; margin-top: 24px; }
.breadcrumb + .module-frame { margin-top: 18px; }
.module-sidebar { align-self: start; padding: 0 12px 12px 0; border-right: 1px solid var(--line); }
.module-name { margin-bottom: 10px; padding: 0 8px 14px; border-bottom: 1px solid var(--line); color: var(--navy); font-size: 13px; font-weight: 700; }
.module-name small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.module-sidebar a { display: block; margin: 1px 0; padding: 8px; border-left: 2px solid transparent; color: var(--ink-soft); font-size: 13px; }
.module-sidebar a:hover { color: var(--navy); background: #efeee9; }
.module-sidebar a.active { border-left-color: var(--gold); color: var(--navy); font-weight: 650; background: #efeee9; }
.module-sidebar .admin-link { color: #4f5d71; }
.mailbox-content { min-width: 0; }
.mailbox-content > .muted { margin-bottom: 0; }

/* Quiet hierarchy, not a dashboard widget */
.tree-card { margin: 22px 0 29px; padding: 0 0 0 15px; border-left: 2px solid #c9bcaa; color: var(--ink-soft); font-size: 12px; }
.tree-root { color: var(--navy); font-weight: 700; }
.tree-branch { display: grid; gap: 2px; margin: 5px 0 0 14px; }
.tree-branch > span, .tree-branch em { color: var(--muted); font-size: 11px; font-style: normal; }
.tree-branch a { width: fit-content; color: var(--navy); }
.tree-branch a:hover { text-decoration: underline; text-underline-offset: 3px; }
.nested { margin-left: 10px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 13px; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { margin-top: 3px; color: var(--muted); font-size: 13px; }

/* Workspace surfaces */
.mailbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 14px; }
.mailbox-card {
  display: flex;
  min-height: 162px;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
}
.mailbox-card:hover { border-color: #abb2b9; background: #fff; }
.mailbox-card .icon { margin-bottom: 17px; }
.mailbox-card h2 { margin: 0 0 4px; font-size: 15px; }
.mailbox-card p { margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.module-status { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 17px; color: var(--ink-soft); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* Operational email inbox */
.stats { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 24px 0 18px; }
.stat { min-width: 154px; padding: 0 16px 0 0; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat small { display: block; font-size: 11px; letter-spacing: .02em; text-transform: uppercase; }
.stat strong { display: block; margin-top: 2px; color: var(--navy); font-size: 23px; font-weight: 650; }
.category-tabs { display: flex; gap: 7px; overflow-x: auto; margin: 0 0 17px; padding: 2px 0 5px; border-bottom: 1px solid var(--line); }
.mail-search { margin: 0 0 15px; }
.mail-search label { display: block; margin: 0 0 5px; }
.mail-search > div { display: flex; gap: 8px; }
.mail-search input { flex: 1; min-width: 0; }
.mail-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.mail-pagination button:disabled { cursor: not-allowed; opacity: .5; }
.plan-evidence { padding-left: 22px; overflow-wrap: anywhere; }
.plan-evidence li { margin-bottom: 9px; }
#plan-editor { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
#plan-editor form { display: grid; gap: 10px; }
#plan-editor label { display: grid; gap: 5px; margin: 0; }
#plan-editor label:has(.action-enabled) { display: flex; align-items: center; }
#plan-editor fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
#plan-editor fieldset legend { font-weight: 700; }
#plan-editor textarea { width: 100%; }
.task-source a, #detail .back-link { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.attachment-preview-button { margin: 0 0 8px 8px; }
.attachment-segment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.attachment-segment strong { color: var(--navy); font-size: 12px; }
.attachment-segment p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.category-tab { flex: 0 0 auto; min-height: 30px; padding: 5px 9px; border-color: var(--line-strong); background: var(--surface); color: var(--ink-soft); font-size: 11px; }
.category-tab i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; }
.category-tab:hover { border-color: var(--navy); background: #efeee9; color: var(--navy); }
.category-tab.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.layout { display: grid; grid-template-columns: minmax(310px, .88fr) minmax(430px, 1.12fr); min-height: 520px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.panel { min-width: 0; padding: 18px 0; }
.panel:first-child { padding-right: 22px; border-right: 1px solid var(--line); }
.panel + .panel { padding-left: 25px; }
.panel h2 { margin-bottom: 12px; }
.mail {
  display: block;
  width: 100%;
  padding: 12px 11px;
  border: 0;
  border-bottom: 1px solid #e9e7e2;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease;
}
.mail:hover, .mail.active { background: #eeece7; }
.mail.unread { border-left-color: var(--gold); font-weight: 650; }
.mail .muted { font-size: 12px; }
.body { max-height: 300px; overflow: auto; padding: 13px 14px; border-left: 2px solid #c8cdd3; background: var(--surface-muted); color: #2f3a49; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.attachment { display: block; padding: 7px 0; border-bottom: 1px solid #e9e7e2; color: var(--navy); font-size: 13px; }
.attachment:hover { text-decoration: underline; text-underline-offset: 3px; }
.tag { display: inline-flex; align-items: center; margin: 5px 5px 0 0; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink-soft); background: var(--surface-muted); font-size: 11px; }
.email-detail-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.email-detail-header h2 { margin: 0; font-size: 17px; }
.detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.detail-section { padding: 16px 0; border-bottom: 1px solid #e9e7e2; }
.detail-section:last-child { border-bottom: 0; }
.detail-section .section-kicker { margin-bottom: 7px; }
.message-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.message-meta dt { margin-bottom: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.message-meta dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; }
.original-email { background: transparent; }
.classification { padding-top: 13px; }
.reminder-row { display: flex; align-items: center; gap: 5px; min-height: 30px; color: var(--ink-soft); font-size: 13px; }
.assistant-section { background: #fbfaf6; }
.assistant-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.assistant-heading h3 { margin: 0 0 3px; color: var(--navy); font-size: 14px; }
.assistant-heading p { max-width: 470px; margin: 0; font-size: 12px; }
.assistant-summary { margin: 12px 0; padding: 10px 12px; border-left: 2px solid var(--gold); background: var(--surface); color: var(--ink-soft); line-height: 1.55; }
.assistant-proposals { display: grid; gap: 7px; }
.assistant-proposal { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.assistant-proposal p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.assistant-proposal .row-actions { flex: 0 0 auto; }
.draft { margin-top: 8px; padding: 8px 9px; border-left: 2px solid #c8cdd3; background: var(--surface-muted); color: var(--ink-soft); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.draft strong { display: block; margin-bottom: 3px; color: var(--ink); }

/* Forms and actions */
.simple-page { max-width: 1100px; }
.config-grid { display: grid; grid-template-columns: minmax(330px, .95fr) minmax(280px, .68fr); gap: 44px; max-width: 970px; }
.context-card, .card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.context-card + .context-card { padding-left: 30px; border-left: 1px solid var(--line); }
.context-card h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
label { display: block; margin: 15px 0 5px; color: #354153; font-size: 12px; font-weight: 650; }
input, select {
  width: 100%;
  height: 37px;
  margin-top: 5px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input::placeholder { color: #9299a2; }
input:focus, select:focus { border-color: var(--focus); box-shadow: 0 0 0 2px rgb(49 85 119 / 0.13); }
label input[type="checkbox"] { width: 14px; height: 14px; margin: 0 7px 0 0; accent-color: var(--navy); vertical-align: -2px; }

button, .button, .action {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  transition: background 150ms ease, border-color 150ms ease;
}
button:hover, .button:hover, .action:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
button:focus-visible, .button:focus-visible, .action:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
form > button:not(.mini):not(.secondary) { margin-top: 19px; }
.secondary, .mini { border-color: var(--line-strong); background: transparent; color: var(--ink-soft); }
.secondary:hover, .mini:hover { border-color: #a7a59f; background: #efeee9; color: var(--ink); }
.sync { border-color: var(--navy); background: var(--navy); }
.delete-action, .danger, .mini.danger { border-color: #d6a4a0; background: transparent; color: var(--red); }
.delete-action:hover, .danger:hover, .mini.danger:hover { border-color: var(--red); background: #fdf0ef; color: #87332d; }
.action { margin: 2px 6px 12px 0; }
.mini { min-height: 27px; padding: 4px 7px; font-size: 11px; }
.hidden { display: none !important; }
.error { color: var(--red); font-size: 13px; }
.ok { color: var(--green); font-size: 13px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.rule { padding: 13px 0; border-bottom: 1px solid var(--line); }
.rule small { display: block; margin: 4px 0; }
.color-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; }
.color-palette { display: flex; align-items: center; gap: 7px; margin: 8px 0 4px; }
.color-choice { width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; outline: 1px solid var(--line-strong); background: var(--choice); }
.color-choice:hover { border-color: var(--surface); background: var(--choice); outline-color: var(--ink-soft); }
.color-choice.selected { outline: 2px solid var(--navy); outline-offset: 2px; }
.color-clear { min-height: 25px; padding: 4px 7px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 500; }
.color-clear:hover { background: transparent; color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.reminder-note { color: var(--gold) !important; }
hr { margin: 25px 0; border: 0; border-top: 1px solid var(--line); }

/* Legacy pages still use these class names during the visual transition. */
nav { display: flex; align-items: center; gap: 16px; min-height: 58px; padding: 0 max(24px, calc((100% - 1240px) / 2)); border-bottom: 1px solid var(--line); background: var(--surface); }
nav a { color: var(--ink-soft); font-size: 13px; }
nav a:hover { color: var(--navy); }
.spacer { margin-left: auto; }
.wrap { width: min(1240px, 100%); margin: 30px auto; padding: 0 28px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; }
.mailbox { padding: 13px 0; border-bottom: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }

/* Visual refinement — shared spacing, calmer surfaces, and stronger hierarchy. */
body { background: radial-gradient(circle at 88% -10%, #ebe9e1 0, transparent 29rem), var(--canvas); line-height: 1.55; }
h1 { margin-bottom: 9px; font-size: clamp(26px, 3vw, 32px); font-weight: 680; letter-spacing: -0.035em; }
h2 { margin-bottom: 8px; font-size: 16px; }
h3 { margin: 24px 0 10px; }
.portal { width: min(1400px, 100%); padding: 0 36px 64px; }
.simple-page { max-width: 1180px; }
.portal-bar { min-height: 76px; gap: 16px; }
.portal-bar .profile { margin-left: auto; }
.brand { display: inline-flex; align-items: center; min-height: 36px; font-size: 13px; letter-spacing: .11em; }
.profile { gap: 8px; }
.profile-link { min-height: 36px; padding: 6px 11px; box-shadow: 0 1px 1px rgb(21 36 58 / .02); }
.workspace-title { max-width: 720px; margin: 52px 0 34px; }
.workspace-title p { max-width: 680px; font-size: 15px; line-height: 1.65; }
.breadcrumb { gap: 9px; padding-top: 26px; }
.back-link { margin: 0; }
.back-action { margin: 26px 0 0; }
.eyebrow, .section-kicker { margin-bottom: 9px; font-size: 10px; letter-spacing: .13em; }

.module-grid { gap: 18px; }
.module-card { min-height: 164px; gap: 16px; padding: 23px; border-color: var(--line); box-shadow: var(--shadow-card); }
.module-card:hover, .mailbox-card:hover { border-color: #b7bdb7; box-shadow: 0 11px 26px rgb(21 36 58 / .07); transform: translateY(-1px); }
.module-card, .mailbox-card { transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.module-card h2 { margin: 1px 0 6px; font-size: 17px; }
.module-card p { line-height: 1.55; }
.module-open { margin-top: 14px; color: var(--gold); }
.module-icon, .mailbox-card .icon { width: 35px; height: 35px; border-radius: 9px; background: #f2f4f1; }

.module-frame { grid-template-columns: 222px minmax(0, 1fr); gap: 30px; margin-top: 26px; }
.module-sidebar { position: sticky; top: 20px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgb(255 255 255 / .68); box-shadow: 0 1px 2px rgb(21 36 58 / .02); }
.module-name { margin-bottom: 8px; padding: 5px 6px 15px; }
.module-sidebar a { margin: 2px 0; padding: 8px 9px; border-radius: 5px; }
.module-sidebar a.active { border-left-color: transparent; box-shadow: inset 2px 0 0 var(--gold); }
.tree-card { margin: 26px 0 34px; padding: 18px 20px; border: 1px solid var(--line); border-left: 3px solid #c9bcaa; border-radius: var(--radius); background: rgb(255 255 255 / .62); }
.section-heading { margin-bottom: 17px; }

.mailbox-grid { gap: 18px; }
.mailbox-card { min-height: 178px; padding: 21px; box-shadow: var(--shadow-card); }
.mailbox-card .icon { margin-bottom: 19px; }
.module-status { padding-top: 19px; }

.stats { gap: 0; margin: 28px 0 22px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { min-height: 52px; padding: 0 22px; }
.stat:first-child { padding-left: 0; }
.stat:last-child { padding-right: 0; }
.stat label { margin: 0; }
.stat select { min-width: 180px; }
.category-tabs { margin-bottom: 20px; padding-bottom: 9px; }
.category-tab { min-height: 32px; border-radius: 16px; padding: 6px 11px; }
.layout { min-height: 560px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); overflow: hidden; }
.panel { padding: 22px; }
.panel:first-child { padding-right: 22px; }
.panel + .panel { padding-left: 25px; }
.mail { padding: 14px 13px; }
.mail:first-child { border-top: 1px solid #e9e7e2; }
.mail:hover, .mail.active { background: #f3f4f0; }
.body { max-height: 340px; padding: 14px 15px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.detail-section { padding: 19px 0; }
.tag { margin-top: 4px; padding: 3px 7px; border-radius: 999px; }
.assistant-section { margin: 4px -6px; padding: 20px 14px; border: 1px solid #e6dfd3; border-radius: var(--radius-sm); background: #fcfaf5; }
.assistant-proposal { padding: 12px; }

.config-grid { gap: 18px; max-width: none; align-items: start; }
.context-card, .card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.context-card + .context-card { padding-left: 24px; border-left: 1px solid var(--line); }
.context-card h2 { margin-bottom: 17px; padding-bottom: 12px; }
.profile-card { width: min(100%, 510px); }
form { display: grid; gap: 13px; }
label { margin: 0; }
label small { display: block; margin-top: 5px; font-weight: 400; }
input, select { height: 40px; margin-top: 6px; border-radius: 7px; }
input:focus, select:focus { box-shadow: 0 0 0 3px rgb(49 85 119 / .12); }
form > button:not(.mini):not(.secondary) { justify-self: start; margin-top: 7px; }
button, .button, .action { min-height: 38px; padding: 9px 13px; border-radius: 7px; }
.list-row { min-height: 65px; padding: 13px 0; }
.mailbox { padding: 15px 0; }
.rule { padding: 16px 0; }
.hint { margin: 18px 0 0; padding: 11px 12px; border-left: 2px solid #c9bcaa; background: var(--surface-muted); line-height: 1.55; }
.ok, .error { display: inline-block; margin: 0 0 16px; padding: 8px 10px; border-radius: 6px; background: #f4f8f4; }
.error { background: #fff4f3; }

/* Task Hub — intentionally more prominent than the supporting configuration views. */
.task-dashboard { max-width: 1320px; }
.task-dashboard-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 38px 0 26px; }
.task-dashboard-header h1 { margin-bottom: 7px; }
.task-dashboard-header p { max-width: 720px; margin: 0; color: var(--ink-soft); font-size: 15px; }
.task-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.task-stat { display: block; min-height: 112px; padding: 18px; border: 1px solid var(--line); border-top: 4px solid #c9bcaa; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); text-align: left; }
.task-stat:nth-child(2) { border-top-color: #5b8bb4; }
.task-stat:nth-child(3) { border-top-color: #659470; }
.task-stat:nth-child(4) { border-top-color: #b86a61; }
.task-stat:nth-child(5) { border-top-color: #a66d4a; }
.task-stat:nth-child(6) { border-top-color: #8a8397; }
.task-stat:hover { border-color: #aeb7bd; background: #fff; }
.task-stat.active { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy), var(--shadow-card); }
.task-stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.task-stat strong { display: block; margin-top: 4px; color: var(--navy); font-size: 33px; line-height: 1; }
.task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 2px 12px; border-bottom: 1px solid var(--line); }
.task-toolbar strong { display: block; color: var(--navy); font-size: 16px; }
.task-toolbar .muted { display: block; margin-top: 2px; font-size: 12px; }
.task-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; padding: 20px 0; }
.task-create-form, .task-filters { margin: 0 0 20px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.task-create-form h2 { margin: 0 0 14px; color: var(--navy); font-size: 16px; }
.today-composer > summary { cursor: pointer; color: var(--navy); font-size: 16px; font-weight: 700; }
.today-composer > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.today-composer[open] > summary { margin-bottom: 14px; }
.today-composer form > button[type="submit"] { margin-top: 12px; }
.task-filter-grid, .task-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.task-filter-grid label, .task-filters label { display: grid; gap: 5px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.task-filter-grid input, .task-filter-grid select, .task-filter-grid textarea, .task-filters input, .task-filters select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
.task-filter-grid textarea { resize: vertical; }
.task-description-field { grid-column: 1 / -1; }
.task-create-form > button { margin-top: 12px; }
.task-edit-form { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.task-edit-form[hidden] { display: none; }
.task-edit-form label { display: grid; gap: 5px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.task-edit-form input, .task-edit-form select, .task-edit-form textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
.task-edit-form textarea { resize: vertical; }
.task-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.task-activity { display: grid; gap: 8px; margin: 12px 0 0; padding: 12px 12px 12px 30px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }
.task-activity li span { display: block; margin-top: 3px; color: var(--muted); }
.task-activity[hidden] { display: none; }
.task-filters { margin-top: 20px; }
.task-filters .overdue-filter { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; min-height: 38px; }
.task-filters .overdue-filter input { width: 17px; min-height: 17px; margin: 0; }
.task-filter-actions { display: flex; gap: 8px; }
.task-filter-actions > button { flex: 1 1 auto; }
.task-meta.overdue { color: #a3342d; font-weight: 750; }
.task-pagination { display: flex; align-items: center; justify-content: center; gap: 0; padding: 3px 0 28px; }
.task-page-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 126px; min-height: 38px; border-radius: var(--radius-sm); font-weight: 650; }
.task-page-info { display: inline-flex; align-items: center; justify-content: center; align-self: stretch; min-width: 125px; padding: 0 13px; border-block: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); font-size: 12px; font-weight: 650; white-space: nowrap; }
.task-pagination .task-page-button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.task-pagination .task-page-button:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.task-card { display: flex; min-height: 230px; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-left: 4px solid #9da7ae; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.task-card.priority-urgent { border-left-color: #b7473f; }
.task-card.priority-high { border-left-color: #c88736; }
.task-card.priority-normal { border-left-color: #5b8bb4; }
.task-card.priority-low { border-left-color: #7c9b83; }
.task-card-top, .task-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.task-card h2 { margin: 17px 0 7px; color: var(--navy); font-size: 16px; }
.task-create-disclosure { padding: 13px 18px; border-top-width: 1px; }
.task-create-disclosure > summary { color: var(--navy); font-weight: 700; cursor: pointer; }
.task-create-disclosure[open] > summary { margin-bottom: 16px; }
.task-create-disclosure form { padding-top: 14px; border-top: 1px solid var(--line); }
.assistant-layout { grid-template-columns: minmax(250px, .72fr) minmax(460px, 1.45fr); }
.assistant-list-panel { background: #fbfaf7; }
.assistant-list-panel > label { display: grid; gap: 5px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 650; }
.assistant-list-panel select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; color: var(--ink); font: inherit; }
.assistant-detail-panel > h2:first-child { font-size: 20px; }
.assistant-detail-panel > h3 { margin-top: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--navy); font-size: 14px; }
.assistant-detail-panel .assistant-proposal { display: grid; gap: 7px; margin: 10px 0; padding: 16px; border-left: 3px solid var(--gold); background: #fbfaf7; }
.assistant-detail-panel .assistant-proposal > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.assistant-detail-panel .assistant-proposal p { line-height: 1.55; }

/* Plan review: original email vs. proposed reply thread */
.reply-thread { display: grid; gap: 10px; margin: 10px 0 4px; }
.reply-message { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.reply-message-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.reply-message-head .muted { font-size: 11px; }
.reply-message-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.reply-original { border-left: 3px solid var(--line-strong); background: var(--surface-muted); }
.reply-draft { border-left: 3px solid var(--gold); background: #fdfbf5; }
.reply-subject { display: block; margin-bottom: 6px; color: var(--navy); font-size: 13px; }
.reply-body { max-height: 260px; overflow: auto; color: var(--ink-soft); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-draft .reply-body { color: var(--ink); }

/* Plan review: tool history stays collapsed until needed */
.assistant-activity { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.assistant-activity > summary { cursor: pointer; color: var(--ink-soft); font-size: 13px; font-weight: 650; list-style-position: inside; }
.assistant-activity > summary:hover { color: var(--navy); }
.assistant-activity #activity { margin-top: 8px; }
.assistant-list-panel .assistant-plan { width: 100%; text-align: left; }
.assistant-list-panel .assistant-plan b { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; font-size: 13px; }
.assistant-list-panel .assistant-plan .muted { font-size: 11px; }
.assistant-list-panel .assistant-plan.active { border-color: var(--navy); box-shadow: inset 3px 0 var(--gold), var(--shadow-card); }
.assistant-plan[aria-pressed="true"] { background: #edf1f4; }
.task-filters { margin-top: 8px; }
#today-content > section { margin: 28px 0; }
#today-content > section > h2 { margin-bottom: 12px; }
#today-content > section > p { padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.today-composer { border-top: 1px solid var(--line); }
.task-description { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.priority-badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: #edf0f2; color: #405362; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.priority-badge.urgent { background: #fff0ef; color: #9c342e; }
.priority-badge.high { background: #fff6e9; color: #926020; }
.priority-badge.normal { background: #eef4f9; color: #426d91; }
.priority-badge.low { background: #eef6f0; color: #4f7957; }
.task-source, .task-meta { color: var(--muted); font-size: 11px; }
.task-card-footer { margin-top: auto; padding-top: 17px; }
.deadline { color: #8e5920; font-weight: 650; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.task-actions .task-complete { width: 100%; }
.task-actions .mini { flex: 1 1 130px; }
.task-complete { margin-top: 0; }
.task-error { margin: 14px 0 0; padding: 8px 9px; border-radius: var(--radius-sm); background: #fff1f0; color: #9c342e; font-size: 12px; }
.task-note { margin: 14px 0 0; padding: 8px 9px; border-radius: var(--radius-sm); background: #fff8ea; color: #785c21; font-size: 12px; }
.task-empty { grid-column: 1 / -1; padding: 44px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-soft); text-align: center; }
.task-empty strong { color: var(--navy); }

nav { min-height: 68px; padding: 0 max(24px, calc((100% - 1328px) / 2)); background: rgb(255 255 255 / .92); }
.wrap { width: min(1328px, 100%); margin: 38px auto; padding: 0 28px 48px; }
.grid { gap: 20px; }

.app-loader {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(21 36 58 / 0.12);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.app-loader.visible { opacity: 1; pointer-events: auto; }
.app-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 168px;
  padding: 13px 16px;
  border: 1px solid rgb(255 255 255 / .72);
  border-radius: 9px;
  background: rgb(255 255 255 / .96);
  box-shadow: 0 18px 44px rgb(21 36 58 / .18);
  color: var(--navy);
  font-size: 13px;
  font-weight: 650;
}
.app-loader-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid #d6dce2;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: legalos-spin .72s linear infinite;
}
@keyframes legalos-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .app-loader, .app-loader-spinner { animation: none; transition: none; } }

@media (max-width: 900px) {
  .portal { padding: 0 20px 42px; }
  .module-frame, .layout, .config-grid, .grid { grid-template-columns: 1fr; }
  .module-sidebar { position: static; display: flex; overflow: auto; padding: 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  .module-name { display: none; }
  .module-sidebar a { flex: 0 0 auto; }
  .panel:first-child { padding-right: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel + .panel { padding-left: 0; }
  .context-card + .context-card { padding: 24px; border: 1px solid var(--line); }
  .task-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assistant-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  h1 { font-size: 23px; }
  .portal { padding: 0 16px 30px; }
  .portal-bar { min-height: 58px; }
  .portal-bar { flex-wrap: wrap; padding: 10px 0; }
  .portal-bar .profile { width: 100%; justify-content: space-between; }
  .workspace-title { margin: 30px 0 22px; }
  .module-grid, .mailbox-grid { grid-template-columns: 1fr; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; }
  .stat { min-width: 0; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
  .stat:nth-last-child(-n + 2) { border-bottom: 0; }
  .stat select { min-width: 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .layout { min-height: 0; }
  .email-detail-header { align-items: stretch; flex-direction: column; }
  .detail-actions { justify-content: flex-start; }
  .assistant-heading, .assistant-proposal { align-items: stretch; flex-direction: column; }
  .message-meta { grid-template-columns: 1fr; gap: 8px; }
  .context-card, .card { padding: 19px; }
  .panel { padding: 18px; }
  .wrap { margin-top: 24px; padding: 0 18px 36px; }
  .task-dashboard-header { align-items: start; flex-direction: column; margin: 30px 0 22px; }
  .task-dashboard-header .button { width: 100%; }
  .task-summary { gap: 8px; }
  .task-stat { min-height: 90px; padding: 14px; }
  .task-stat strong { font-size: 27px; }
  .task-toolbar { align-items: start; flex-direction: column; }
  .task-toolbar .mini { width: 100%; }
  .task-board { grid-template-columns: 1fr; }
}

/* Shared navigation and controls. Kept separate from the legacy page rules
   while templates are consolidated into reusable views. */
.primary-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-height: 60px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.primary-nav-links { display: flex; align-items: stretch; gap: 4px; min-height: 60px; }
.primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-bottom: 3px solid transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}
.primary-nav a:hover { color: var(--navy); background: rgb(23 52 81 / .055); }
.primary-nav a[aria-current="page"] { border-bottom-color: var(--gold); color: var(--navy); }
.primary-nav-personal { margin-left: auto; }
.nav-badge { display: inline-grid; min-width: 18px; height: 18px; padding: 0 5px; place-items: center; border-radius: 999px; background: #b42318; color: #fff; font-size: 11px; font-weight: 750; line-height: 1; vertical-align: 1px; }
.nav-badge[hidden] { display: none; }
.reminder-bell { position: relative; margin-left: auto; }
.reminder-bell-button { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 42px; padding: 7px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--navy); font-size: 17px; cursor: pointer; }
.reminder-bell-button:hover { border-color: var(--navy); background: #efeee9; }
.reminder-bell-button .nav-badge { position: absolute; top: -7px; right: -8px; }
.reminder-popover { position: absolute; z-index: 100; top: calc(100% + 8px); right: 0; width: min(390px, calc(100vw - 28px)); padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-overlay); }
.reminder-popover[hidden] { display: none; }
.reminder-popover-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 5px 9px; border-bottom: 1px solid var(--line); font-size: 13px; }
.reminder-popover-head a { color: var(--navy); font-size: 12px; font-weight: 650; }
.reminder-popover-item { display: grid; width: 100%; gap: 2px; padding: 10px 7px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.reminder-popover-item:hover { background: var(--surface-muted); }
.reminder-popover-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.reminder-popover-item span, .reminder-empty { margin: 0; color: var(--muted); font-size: 12px; }
.reminder-dialog { width: min(600px, calc(100vw - 28px)); max-height: min(720px, calc(100vh - 28px)); padding: 0; border: 0; border-radius: var(--radius); color: var(--ink); background: var(--surface); box-shadow: var(--shadow-overlay); }
.reminder-dialog::backdrop { background: rgb(23 37 56 / .48); }
.reminder-dialog-card { position: relative; padding: 28px; }
.reminder-dialog-card h2 { margin: 0 32px 20px 0; color: var(--navy); font-size: 21px; }
.reminder-dialog-card dl { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; margin: 0; padding: 16px 0; border-block: 1px solid var(--line); }
.reminder-dialog-card dt { color: var(--muted); font-size: 12px; font-weight: 650; }
.reminder-dialog-card dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.reminder-dialog-card dd a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.reminder-dialog-card h3 { margin-top: 18px; }
.reminder-dialog-description { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-soft); }
.reminder-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.work-panel { background: #fbfaf6; }
.work-panel #email-work-form { margin-top: 14px; }
.work-panel #email-work-form .task-create-form { margin: 0; box-shadow: none; }
.email-linked-tasks { margin: 6px 0 12px; padding-left: 20px; }
.email-linked-tasks:empty { display: none; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-muted); color: var(--ink-soft); font-size: 23px; line-height: 1; cursor: pointer; }
.dialog-close:hover { background: #e9e7e2; color: var(--navy); }
.primary-nav-caption { color: var(--muted); font-size: 12px; white-space: nowrap; }
.skip-link { position: absolute; z-index: 1200; top: -100px; left: 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--navy); color: #fff; font-weight: 700; }
.skip-link:focus { top: 12px; }
.conversation-back { display: none; margin-bottom: 16px; }
.mail-back { display: none; margin-bottom: 16px; }
.conversation-item[aria-current="true"] { border-color: var(--navy); box-shadow: inset 3px 0 0 var(--gold); }

.portal-bar { border-bottom: 0; }
.breadcrumb { padding-top: 20px; }
.workspace-title { margin-top: 38px; }
.task-dashboard-header { margin-top: 28px; }
.dashboard-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.task-create-form[hidden] { display: none; }
.task-create-form, .task-filters, .conversation-panel { box-shadow: var(--shadow-card); }
.task-create-form { border-top: 3px solid var(--gold); }
.task-card { transition: border-color 150ms ease, box-shadow 150ms ease; }
.task-card:hover { border-color: var(--line-strong); box-shadow: 0 7px 28px rgb(21 36 58 / .08); }
.task-stat { min-height: 116px; }
.task-stat span, .task-filter-grid label, .task-filters label, .task-edit-form label { font-size: 13px; }
.task-source, .task-meta, .task-activity, .task-toolbar .muted { font-size: 12px; }
.task-description { font-size: 14px; }
.task-card h2 { font-size: 17px; }
.layout { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.layout .panel { padding: 24px; }
.layout .panel:first-child { padding-right: 24px; }
.layout .panel + .panel { padding-left: 24px; }
.mail { padding: 15px 13px; font-size: 14px; }
.mail:hover, .mail.active { background: #f3f1ea; }
.category-tab { min-height: 40px; padding: 8px 12px; font-size: 13px; }
.body { max-height: 460px; padding: 18px; border-left-width: 3px; font-size: 15px; line-height: 1.7; }
.message-meta dt { font-size: 12px; }
.message-meta dd { font-size: 14px; }
.tag { padding: 5px 9px; font-size: 12px; }
.detail-section { padding-block: 20px; }

input, select, textarea,
.task-filter-grid input, .task-filter-grid select, .task-filter-grid textarea,
.task-filters input, .task-filters select,
.task-edit-form input, .task-edit-form select, .task-edit-form textarea,
.conversation-panel input:not([type="checkbox"]), .conversation-panel select {
  min-height: 44px;
  font-size: 14px;
}
button, .button, .action, .back-link, .profile-link, .profile button, .logout-button { min-height: 44px; font-size: 13px; }
.mini, .color-clear { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.color-choice { width: 32px; min-width: 32px; height: 32px; min-height: 32px; }
label input[type="checkbox"] { width: 20px; height: 20px; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; }

a:focus-visible, button:focus-visible, .button:focus-visible, .action:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: none; }
.error, .task-error { font-weight: 650; }

@media (max-width: 900px) {
  .primary-nav-caption { display: none; }
  .primary-nav { overflow-x: auto; scrollbar-width: thin; }
  .primary-nav-links { min-width: max-content; }
  .conversation-layout { grid-template-columns: 1fr; }
  .layout .panel:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .layout .panel + .panel { padding-left: 24px; }
}
@media (max-width: 780px) {
  .conversation-layout:not(.show-detail) > .conversation-panel:last-child,
  .conversation-layout.show-detail > .conversation-panel:first-child { display: none; }
  .conversation-back { display: inline-flex; }
  .mailbox-content .layout:not(.show-detail) > .panel:last-child,
  .mailbox-content .layout.show-detail > .panel:first-child { display: none; }
  .mailbox-content .layout .panel:first-child { border-bottom: 0; }
  .mail-back { display: inline-flex; }
}
@media (max-width: 560px) {
  .primary-nav { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0 8px; overflow: visible; margin: 0 -16px 4px; width: calc(100% + 32px); padding: 0 8px; }
  .primary-nav-links { grid-column: 1 / -1; grid-row: 2; min-width: 0; min-height: 0; flex-wrap: wrap; overflow: visible; }
  .primary-nav-personal { grid-column: 1; grid-row: 1; margin-left: 0; }
  .reminder-bell { grid-column: 2; grid-row: 1; margin: 0; }
  .primary-nav a { min-height: 40px; padding: 8px 10px; font-size: 13px; }
  .task-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-card { min-height: 0; }
  .dashboard-actions { width: 100%; flex-wrap: wrap; }
  .dashboard-actions > * { flex: 1 1 150px; }
  .task-actions .mini { flex-basis: 100%; }
  .task-pagination { width: 100%; }
  .task-page-button { min-width: 0; flex: 1 1 0; padding-inline: 8px; }
  .task-page-info { min-width: 106px; padding-inline: 7px; }
  .conversation-panel { padding: 16px; }
  .conversation-panel-head, .conversation-page { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Layout consolidation: shared shell and form primitives for all portal views. */
:root { --portal-max: 1320px; --content-max: 1180px; --control-height: 44px; }
.portal { width: min(var(--portal-max), 100%); padding-inline: 32px; }
.portal.simple-page { max-width: var(--content-max); }
.portal-bar { min-height: 72px; gap: 12px; }
.profile { flex-wrap: wrap; justify-content: flex-end; }
.language-switch, .profile-link, .profile button, .logout-button { min-height: var(--control-height); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; align-items: end; }
.form-grid label { display: grid; gap: 6px; }
.form-actions { display: flex; align-items: end; min-height: var(--control-height); }
.form-actions .button { width: 100%; }
.users-table { display: grid; }
.users-row { display: grid; grid-template-columns: minmax(180px, 1fr) 130px minmax(310px, 1.15fr); gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.users-head { min-height: 42px; padding-top: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.password-reset-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.password-reset-form label { margin: 0; }
.password-reset-form input { margin-top: 0; }
.self-password-link { justify-self: start; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.portal-bar > .back-link { margin-left: auto; }
.portal-bar > .back-link + .profile { margin-left: 0; }
.simple-page > .context-card + .context-card { margin-top: 20px; }
.config-grid > .context-card { min-width: 0; }
.config-grid input, .config-grid select, .config-grid textarea { max-width: 100%; }
.section-heading > :last-child { flex: 0 0 auto; }
@media (max-width: 760px) {
  .portal { padding-inline: 16px; }
  .portal-bar { align-items: flex-start; flex-direction: column; padding-block: 14px; }
  .portal-bar .profile { width: 100%; justify-content: flex-start; }
  .profile { gap: 6px; }
  .users-head { display: none; }
  .users-row { grid-template-columns: 1fr; gap: 8px; padding-block: 18px; }
  .password-reset-form { grid-template-columns: 1fr; }
  .password-reset-form .mini, .self-password-link { width: 100%; }
  .portal-bar > .back-link { order: 3; width: 100%; margin-left: 0; }
  .section-heading > :last-child { width: 100%; }
}

/* Mail workspace: keep controls and panes on the same visual rhythm. */
.module-sidebar { min-width: 0; }
.module-sidebar a { display: flex; align-items: center; min-height: var(--control-height); }
.mailbox-content > h1 { margin-bottom: 6px; }
.mailbox-content > .stats { align-items: stretch; }
.mailbox-content > .stats .stat { display: flex; flex: 1 1 220px; flex-direction: column; justify-content: center; min-height: 88px; }
.mailbox-content > .stats .stat label { display: grid; gap: 6px; }
.mailbox-content .mail-search > div { align-items: stretch; }
.mailbox-content .mail-search button { flex: 0 0 auto; }
.mailbox-content .category-tabs { scroll-padding-inline: 8px; }
.mailbox-content .layout .panel { min-width: 0; }
.mailbox-content .layout .panel > h2:first-child { margin-top: 0; }
.mailbox-content .detail-actions { gap: 8px; }
.mailbox-content .detail-actions button { flex: 1 1 170px; }
.config-grid { align-items: stretch; }
.config-grid > .context-card { display: flex; flex-direction: column; }
.config-grid > .context-card form { display: grid; gap: 13px; }
.config-grid > .context-card hr { width: 100%; margin: 22px 0; border: 0; border-top: 1px solid var(--line); }
.config-grid > .context-card .delete-action { margin-top: auto; align-self: flex-start; }
.draft .copy-draft { display: block; margin-top: 10px; }

/* Conversations and AI plans use the same compact review rhythm as mail. */
.conversation-layout { min-width: 0; }
.conversation-panel { min-width: 0; }
.conversation-panel > h2:first-child, .conversation-panel-head h2 { margin-top: 0; }
.conversation-panel-head { gap: 12px; }
.conversation-panel-head .mini { flex: 0 0 auto; }
.conversation-page { gap: 10px; padding-top: 14px; }
.conversation-message, .conversation-item { overflow-wrap: anywhere; }
#analysis-section, #matter-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
#analysis-section h3, #matter-section h3 { margin-top: 0; }
#analysis-section .conversation-review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#matter-form, #new-matter-form { max-width: 560px; }
.simple-page .layout .assistant-proposal { align-items: stretch; }
.simple-page .layout .assistant-proposal .copy-draft { align-self: flex-start; }

@media (max-width: 760px) {
  .conversation-panel-head { align-items: stretch; flex-direction: column; }
  .conversation-panel-head .mini { width: 100%; }
  #analysis-section .conversation-review-actions > button { flex: 1 1 150px; }
  .simple-page .layout .assistant-proposal .copy-draft { width: 100%; }
}

/* User administration: a predictable form and an actual data table. */
.users-page { max-width: 1120px; }
.users-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.users-card-heading h2 { margin: 0 0 4px; }
.users-card-heading .muted { margin: 0; font-size: 13px; }
.users-count { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface-muted); font-size: 12px; }
.user-create-form { gap: 18px; }
.user-form-fields { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(200px, .9fr) minmax(250px, 1.1fr); gap: 16px; align-items: start; }
.user-form-fields label { display: grid; gap: 6px; }
.user-create-actions { display: flex; justify-content: flex-end; padding-top: 2px; border-top: 1px solid var(--line); }
.user-create-actions .button { min-width: 190px; }
.users-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.users-table { display: table; width: 100%; min-width: 720px; border-collapse: collapse; }
.users-table th, .users-table td { padding: 15px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.users-table th { color: var(--muted); background: var(--surface-muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.users-table th:nth-child(1) { width: 33%; }
.users-table th:nth-child(2) { width: 22%; }
.users-table tbody tr:last-child td { border-bottom: 0; }
.users-table tbody tr:hover { background: #fbfaf6; }
.users-table td > strong { display: block; overflow-wrap: anywhere; }
.current-user { display: inline-block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.users-table .tag { margin: 0; }
.users-table .password-reset-form { grid-template-columns: minmax(180px, 1fr) auto; max-width: 390px; }
.users-table .password-reset-form input { min-width: 0; }
.users-table .self-password-link { white-space: nowrap; }
.users-empty { color: var(--muted); text-align: center !important; }

@media (max-width: 760px) {
  .users-card-heading { align-items: stretch; flex-direction: column; gap: 8px; }
  .users-count { align-self: flex-start; }
  .user-form-fields { grid-template-columns: 1fr; }
  .user-create-actions .button { width: 100%; }
  .users-table-wrap { overflow: visible; border: 0; }
  table.users-table, .users-table tbody, .users-table tr, .users-table td { display: block; min-width: 0; width: 100%; }
  .users-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .users-table tbody { display: grid; gap: 12px; }
  .users-table tr { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
  .users-table td { padding: 7px 0; border: 0; }
  .users-table td::before { display: block; margin-bottom: 3px; color: var(--muted); content: attr(data-label); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
  .users-table .password-reset-form { grid-template-columns: 1fr; max-width: none; }
  .users-table .password-reset-form .mini, .users-table .self-password-link { width: 100%; }
  .users-empty { padding: 20px !important; }
  .users-empty::before { display: none !important; }
}

@media (max-width: 900px) {
  .module-sidebar { align-self: stretch; }
  .module-sidebar a { justify-content: center; }
}
@media (max-width: 760px) {
  .mailbox-content > .stats .stat { min-height: 0; }
  .mailbox-content .mail-search > div { flex-direction: column; }
  .mailbox-content .mail-search button { width: 100%; }
  .mailbox-content .detail-actions { flex-direction: column; }
  .mailbox-content .detail-actions button { width: 100%; }
  .config-grid > .context-card .delete-action { width: 100%; }
}

.recipient-picks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.recipient-picks legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.recipient-picks label { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; }
.recipient-picks input[type="checkbox"] { width: 18px; min-height: 18px; margin: 0; accent-color: var(--navy); }
.matter-layout { align-items: start; }
.matter-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: left; cursor: pointer; }
.matter-item + .matter-item { margin-top: 8px; }
.matter-item.active { border-color: var(--navy); background: #f4f6f8; }
.matter-item-next-step { display: -webkit-box; width: 100%; box-sizing: border-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); }
.matter-item-next-step strong { color: var(--ink); }
@media (max-width: 900px) {
  .matter-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .matter-layout .panel { padding: 18px; }
  .matter-layout .panel:first-child { padding-right: 18px; }
  .matter-layout .panel + .panel { padding-left: 18px; }
}
@media (max-width: 560px) {
  .matter-layout .panel { padding: 14px; }
  .matter-layout .panel:first-child { padding-right: 14px; }
  .matter-layout .panel + .panel { padding-left: 14px; }
  #matter-load-more { width: 100%; }
}
.matter-related-list { display: grid; gap: 9px; padding-left: 20px; }
.matter-related-list li { padding-left: 2px; }
.matter-related-list .muted { display: inline-block; margin-left: 8px; }
.matter-assignment { display: grid; gap: 10px; }
.matter-assignment h3 { margin: 0; }
.matter-assignment form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.matter-assignment label { flex: 1 1 220px; }
.matter-context h3 { margin-top: 0; }
.matter-context-form { display: grid; gap: 12px; }
.matter-context-form label { display: grid; gap: 6px; font-weight: 600; }
.matter-context-form textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.matter-task-form h3 { margin-top: 0; }
.matter-task-form form { display: grid; gap: 10px; }
.matter-task-form label { display: grid; gap: 5px; }
.matter-task-title-group { display: grid; justify-items: start; gap: 8px; }
.task-matter-link { margin-left: auto; }
.reminder-calendar-links { margin: 8px 0 0; }
.reminder-calendar-action { margin-top: 12px; }
.reminder-calendar-action summary { cursor: pointer; color: var(--navy); font-weight: 650; }
.reminder-calendar-action form { display: grid; gap: 10px; margin-top: 10px; }
.task-status-dialog { width: min(560px, calc(100vw - 32px)); max-width: 560px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface); box-shadow: var(--shadow-card); }
.task-status-dialog::backdrop { background: rgb(14 26 41 / 48%); }
.task-status-dialog .task-create-form { margin: 0; box-shadow: none; }

/* ————————————————————————————————————————————————————————
   Modern refresh (2026-10): keeps the quiet legal brand
   (warm paper, navy, gold) and modernizes the execution —
   glass sticky bar, pill navigation, layered shadows,
   gradient primary actions, calmer inputs, micro-motion.
   ———————————————————————————————————————————————————————— */
:root {
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgb(21 36 58 / .05), 0 18px 44px -18px rgb(21 36 58 / .16);
  --shadow-overlay: 0 28px 70px -18px rgb(23 36 55 / .30);
  --shadow-pop: 0 10px 28px -8px rgb(21 36 58 / .22);
  --navy: #173c68;
  --navy-hover: #102c4f;
  --gold: #8a6a24;
  --gold-bright: #c9a24a;
  --focus: #2f6fd0;
  --ring: rgb(47 111 208 / .22);
}

body {
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

::selection { background: rgb(23 60 104 / .18); }
* { scrollbar-width: thin; scrollbar-color: #c4cbd4 transparent; }

h1 { font-weight: 720; letter-spacing: -.04em; }
h2 { font-weight: 680; letter-spacing: -.015em; }

/* Sticky glass application bar */
.portal > .portal-bar {
  position: sticky;
  z-index: 60;
  top: 0;
  margin-inline: -8px;
  padding-inline: 8px;
  border-bottom: 1px solid var(--line);
  background: rgb(246 244 239 / .78);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}
.brand { position: relative; padding-left: 18px; font-size: 13px; letter-spacing: .14em; }
.brand::before {
  position: absolute;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 0 3px rgb(201 162 74 / .22);
  content: "";
}

/* Pill primary navigation */
.primary-nav { gap: 16px; border-bottom-color: transparent; }
.primary-nav-links { gap: 6px; }
.primary-nav a {
  min-height: 40px;
  padding: 8px 15px;
  border-bottom: 0;
  border-radius: 999px;
  color: var(--ink-soft);
  transition: background 150ms ease, color 150ms ease;
}
.primary-nav a:hover { background: rgb(23 60 104 / .08); color: var(--navy); }
.primary-nav a[aria-current="page"] {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgb(16 44 79 / .45);
}
.primary-nav a[aria-current="page"]:hover { background: var(--navy-hover); color: #fff; }
.primary-nav a[aria-current="page"] .nav-badge { background: #fff; color: var(--navy); }
@media (max-width: 560px) {
  .primary-nav a { min-height: 38px; padding: 7px 12px; }
}

/* Modern primary action */
button, .button, .action {
  border-color: transparent;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #1d4a7e, var(--navy));
  box-shadow: 0 1px 2px rgb(16 28 44 / .16), inset 0 1px 0 rgb(255 255 255 / .14);
  letter-spacing: .01em;
  transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
button:hover, .button:hover, .action:hover {
  border-color: transparent;
  background: linear-gradient(180deg, #173c68, var(--navy-hover));
  box-shadow: var(--shadow-pop), inset 0 1px 0 rgb(255 255 255 / .12);
  transform: translateY(-1px);
}
button:active, .button:active, .action:active { transform: translateY(0); box-shadow: 0 1px 2px rgb(16 28 44 / .16); }

/* Quiet actions stay quiet: no gradient, no lift */
.secondary, .mini, .delete-action, .danger, .color-clear, .color-choice,
.category-tab, .task-page-button, .dialog-close, .reminder-bell-button,
.back-link, .back-action, .profile-link, .language-switch,
.profile button, .logout-button, .sync, .task-stat, .mail,
.conversation-item, .conversation-message, .matter-item, .reminder-popover-item {
  box-shadow: none;
  letter-spacing: normal;
}
.secondary:hover, .mini:hover, .delete-action:hover, .danger:hover,
.category-tab:hover, .task-page-button:hover, .dialog-close:hover,
.reminder-bell-button:hover, .back-action:hover, .profile-link:hover,
.language-switch:hover, .logout-button:hover, .profile button:hover {
  transform: none;
}
.secondary, .mini { border-radius: var(--radius-sm); background: rgb(255 255 255 / .55); }
.sync { border-color: transparent; background: linear-gradient(180deg, #1d4a7e, var(--navy)); box-shadow: 0 1px 2px rgb(16 28 44 / .16), inset 0 1px 0 rgb(255 255 255 / .14); }
.sync:hover { background: linear-gradient(180deg, #173c68, var(--navy-hover)); transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.category-tab.active {
  border-color: transparent;
  background: linear-gradient(180deg, #1d4a7e, var(--navy));
  box-shadow: 0 3px 10px -3px rgb(16 44 79 / .4);
}

/* Cards: softer borders, deeper hover lift, gradient icon tiles */
.module-card, .mailbox-card, .context-card, .card, .task-card, .task-stat,
.task-create-form, .task-filters, .conversation-panel, .layout, .tree-card {
  border-color: rgb(120 133 148 / .28);
}
.module-card, .mailbox-card { border-radius: 16px; }
.module-card:hover, .mailbox-card:hover {
  border-color: rgb(23 60 104 / .30);
  box-shadow: 0 22px 48px -16px rgb(21 36 58 / .20);
  transform: translateY(-3px);
}
.module-icon, .mailbox-card .icon {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #f6efdd, #e9dfc6);
  color: #6d5417;
  box-shadow: inset 0 0 0 1px rgb(138 106 36 / .12);
}
.module-open { font-weight: 700; }
.module-open [aria-hidden="true"] { display: inline-block; transition: transform 150ms ease; }
.module-card:hover .module-open [aria-hidden="true"] { transform: translateX(3px); }
.task-card:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -14px rgb(21 36 58 / .18); }
.task-stat { border-radius: 14px; transition: box-shadow 150ms ease, transform 150ms ease; }
.task-stat:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -14px rgb(21 36 58 / .16); }

/* Sidebar: calmer, modern active state */
.module-sidebar { border-color: rgb(120 133 148 / .24); background: rgb(255 255 255 / .78); backdrop-filter: blur(6px); }
.module-sidebar a { border-radius: 8px; transition: background 140ms ease, color 140ms ease; }
.module-sidebar a.active {
  box-shadow: none;
  background: rgb(23 60 104 / .08);
  color: var(--navy);
  font-weight: 700;
}

/* Inputs: softer, brighter, modern focus ring */
input, select, textarea,
.task-filter-grid input, .task-filter-grid select, .task-filter-grid textarea,
.task-filters input, .task-filters select,
.task-edit-form input, .task-edit-form select, .task-edit-form textarea,
.conversation-panel input:not([type="checkbox"]), .conversation-panel select {
  border-color: #c6cfd9;
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:hover, select:hover, textarea:hover { border-color: #a9b5c3; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--focus);
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

/* Pills, tags, badges */
.tag {
  border: 0;
  border-radius: 999px;
  background: rgb(23 60 104 / .07);
  color: var(--ink-soft);
  font-weight: 600;
}
.category-tab { border-radius: 999px; font-weight: 650; }
.priority-badge { letter-spacing: .06em; }

/* Stat strip: lighter, tabular numbers */
.stats { border-block-color: rgb(120 133 148 / .3); }
.stat strong { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* Dialogs and popovers: heavier elevation, softer corners */
.reminder-dialog, .reminder-popover, .task-status-dialog { border-radius: 16px; box-shadow: var(--shadow-overlay); }
.reminder-bell-button { border-radius: 10px; }

/* Login: split layout with a navy brand panel and a calm form panel */
.login-page { background: var(--canvas); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 6vw, 88px);
  overflow: hidden;
  background:
    radial-gradient(720px 480px at 110% -10%, rgb(201 162 74 / .16) 0, transparent 55%),
    radial-gradient(620px 520px at -20% 110%, rgb(46 95 150 / .32) 0, transparent 60%),
    linear-gradient(160deg, #1d3f63 0%, var(--navy) 45%, #0f2338 100%);
  color: #eef2f6;
}
.login-brand::after {
  content: "§";
  position: absolute;
  right: -0.12em;
  bottom: -0.34em;
  color: rgb(201 162 74 / .07);
  font-size: clamp(300px, 30vw, 480px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.login-mark { display: flex; align-items: center; gap: 13px; margin-bottom: clamp(30px, 5vh, 52px); }
.login-mark-icon {
  width: 46px;
  height: 46px;
  padding: 10px;
  border: 1px solid rgb(201 162 74 / .45);
  border-radius: 13px;
  background: rgb(255 255 255 / .06);
  color: #d9b96a;
}
.login-mark-name { color: #f4f6f8; font-size: 15px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.login-brand .eyebrow { color: #cfa95c; }
.login-brand h1 {
  max-width: 20ch;
  margin: 0 0 16px;
  color: #fff;
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.15;
}
.login-brand-tagline { max-width: 46ch; margin: 0 0 30px; color: rgb(238 242 246 / .82); font-size: 15px; line-height: 1.65; }
.login-brand-points { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.login-brand-points li { display: flex; align-items: flex-start; gap: 11px; color: rgb(238 242 246 / .9); font-size: 13.5px; }
.login-brand-points li::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #cfa95c; }
.login-brand-foot { margin: clamp(30px, 5vh, 56px) 0 0; color: rgb(238 242 246 / .48); font-size: 12px; }

.login-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: radial-gradient(circle at 85% -10%, #ebe9e1 0, transparent 26rem), var(--canvas);
}
.login-panel-inner { width: min(400px, 100%); }
.login-card {
  width: 100%;
  margin: 0;
  padding: 38px 34px 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 60px -28px rgb(21 36 58 / .28);
}
.login-card h2 { margin: 0 0 6px; color: var(--navy); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.login-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.login-card label { margin: 16px 0 6px; letter-spacing: .02em; }
.login-card input { height: 46px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.login-card .error {
  display: block;
  margin: 0 0 8px;
  padding: 9px 12px;
  border: 1px solid #ecc8c4;
  border-radius: 10px;
  background: #fff4f3;
}
.login-page .login-card button.login-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
  border-radius: 10px;
  font-size: 14px;
  letter-spacing: .02em;
}
.login-footnote { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.login-language { position: absolute; top: 20px; right: 24px; }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 34px 26px; }
  .login-mark { margin-bottom: 22px; }
  .login-brand h1 { max-width: none; font-size: 28px; }
  .login-brand-tagline { margin-bottom: 0; }
  .login-brand-points, .login-brand-foot, .login-brand::after { display: none; }
  .login-panel { padding: 32px 20px 56px; place-items: start center; }
}

@media (prefers-reduced-motion: reduce) {
  .module-card:hover, .mailbox-card:hover, .task-card:hover, .task-stat:hover,
  button:hover, .button:hover, .action:hover { transform: none; }
}

/* Bilingual BG/DE tabs for assistant summaries and rationales. */
.bilingual-tabs { display: inline-flex; gap: 4px; margin: 0 0 6px 10px; vertical-align: middle; }
.bilingual-tab { min-height: 26px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.bilingual-tab[aria-pressed="true"] { border-color: var(--navy); background: var(--navy); color: #fff; }
.bilingual h2 { margin: 0; }
