:root {
  --canvas: #e5e6e3;
  --surface: #f7f7f4;
  --surface-strong: #ffffff;
  --sidebar: #303331;
  --sidebar-soft: #3b3f3c;
  --ink: #252826;
  --muted: #575c58;
  --line: #d9dcd7;
  --line-dark: #c7cbc5;
  --accent: #6f8077;
  --accent-dark: #4f6259;
  --accent-soft: #e0e8e3;
  --warm: #7a4c2a;
  --warm-soft: #f2e7dc;
  --danger: #9d4e4b;
  --danger-soft: #f5e5e3;
  --shadow: 0 8px 24px rgb(38 43 39 / 5%);
  --sidebar-width: 252px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: -5rem; left: 1rem; padding: .65rem 1rem; border-radius: 8px; color: #fff; background: var(--sidebar); }
.skip-link:focus { top: 1rem; }

/* Application shell */
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; overflow-y: auto; padding: 28px 20px 22px; color: #f7f8f5; background: var(--sidebar); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; flex: none; place-items: center; border-radius: 13px; color: var(--sidebar); background: #f1f3ef; font-size: .8rem; font-weight: 850; letter-spacing: .04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .94rem; line-height: 1.15; }
.brand small { margin-top: .2rem; color: #adb4ae; font-size: .67rem; }
.primary-nav { display: grid; gap: 5px; margin-top: 54px; }
.nav-group { display: grid; gap: 4px; }
.nav-group + .nav-group { margin-top: 20px; padding-top: 18px; border-top: 1px solid rgb(255 255 255 / 9%); }
.nav-group-label { padding: 0 15px 6px; color: #929a94; font-size: .57rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.primary-nav a { position: relative; width: 100%; min-height: 43px; display: flex; align-items: center; gap: 13px; padding: 10px 12px 10px 15px; border: 0; border-radius: 8px; color: #c7cdc8; background: transparent; text-align: left; text-decoration: none; font-size: .84rem; font-weight: 700; cursor: pointer; transition: background .16s ease, color .16s ease; }
.primary-nav a:hover { color: #fff; background: rgb(255 255 255 / 6%); }
.primary-nav a.active { color: #fff; background: rgb(255 255 255 / 7%); }
.primary-nav a.active::before { position: absolute; inset: 8px auto 8px 0; width: 3px; border-radius: 2px; background: #aebdb4; content: ""; }
.sidebar-bottom { margin-top: auto; padding-top: 19px; border-top: 1px solid rgb(255 255 255 / 10%); }
.user-avatar { width: 34px; height: 34px; display: grid; flex: none; place-items: center; border-radius: 50%; color: var(--accent-dark); background: var(--accent-soft); font-size: .67rem; font-weight: 850; }
.account-menu summary { min-height: 48px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; list-style: none; cursor: pointer; transition: background .16s ease; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover, .account-menu[open] summary, .account-menu.is-current summary { background: rgb(255 255 255 / 6%); }
.account-identity strong, .account-identity small { display: block; }
.account-identity strong { overflow: hidden; color: #fff; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.account-identity small { margin-top: .12rem; color: #aeb5af; font-size: .62rem; }
.account-menu-dots { display: flex; gap: 2px; padding: 6px 2px; }
.account-menu-dots i { width: 3px; height: 3px; border-radius: 50%; background: #9fa6a0; }
.account-actions { display: grid; gap: 3px; margin-top: 5px; padding-top: 5px; border-top: 1px solid rgb(255 255 255 / 7%); }
.account-actions form { margin: 0; }
.account-actions a, .account-actions button { width: 100%; min-height: 37px; display: flex; align-items: center; gap: 11px; padding: 7px 10px; border: 0; border-radius: 8px; color: #c7cdc8; background: transparent; text-align: left; text-decoration: none; font-size: .71rem; font-weight: 700; cursor: pointer; }
.account-actions a:hover, .account-actions button:hover, .account-actions a.active { color: #fff; background: rgb(255 255 255 / 6%); }
.account-actions svg { width: 16px; height: 16px; }
.mobile-header { display: none; }

.page-shell { width: min(1180px, calc(100% - 64px)); min-height: 100vh; margin: 0 auto; padding: 56px 0 80px; }
.page-shell.with-sidebar { width: min(1180px, calc(100% - var(--sidebar-width) - 64px)); margin-left: calc(var(--sidebar-width) + max(32px, (100vw - var(--sidebar-width) - 1180px) / 2)); margin-right: 32px; }

/* Type and common controls */
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.16; }
h1 { margin-bottom: .55rem; font-size: clamp(2.05rem, 4vw, 3rem); font-weight: 690; letter-spacing: -.045em; }
h2 { margin-bottom: .55rem; font-size: 1.28rem; letter-spacing: -.025em; }
h3 { margin-bottom: .45rem; font-size: .96rem; }
p { margin-bottom: 1rem; }
.muted { color: var(--muted); }
.eyebrow, .card-kicker { display: block; margin-bottom: .55rem; color: var(--accent-dark); font-size: .68rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.card-kicker { margin-bottom: .3rem; color: var(--muted); font-size: .61rem; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 30px; }
.page-header > div:first-child { max-width: 740px; }
.page-header p { margin: 0; color: var(--muted); font-size: .92rem; }
.page-actions, .focus-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.page-actions form, .focus-actions form { margin: 0; }
.back-link { display: inline-block; margin-bottom: 24px; border: 0; color: var(--accent-dark); background: transparent; text-decoration: none; font-size: .73rem; font-weight: 800; }

.btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1rem; border: 1px solid transparent; border-radius: 9px; color: #fff; background: var(--sidebar); box-shadow: none; text-decoration: none; font-size: .8rem; font-weight: 780; white-space: nowrap; cursor: pointer; transition: background .14s ease, border-color .14s ease; }
.btn:hover { color: #fff; background: #202320; }
.btn-secondary { border-color: var(--line-dark); color: var(--ink); background: var(--surface-strong); box-shadow: none; }
.btn-secondary:hover { color: var(--ink); background: #eeeeea; }
.btn-danger { background: var(--danger); }
.btn-small { min-height: 32px; padding: .34rem .66rem; font-size: .7rem; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; box-shadow: none; }
.text-link { color: var(--accent-dark); text-decoration: none; font-size: .73rem; font-weight: 800; }

.card { margin-bottom: 1rem; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-header h2, .card-header p { margin-bottom: 0; }
.card-copy { min-height: 50px; margin: 22px 0 16px; color: var(--muted); font-size: .8rem; line-height: 1.6; }

.status-pill, .badge { width: fit-content; min-height: 27px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: 999px; color: var(--accent-dark); background: var(--accent-soft); font-size: .66rem; font-weight: 800; white-space: nowrap; vertical-align: middle; }
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-good, .badge-green { color: var(--accent-dark); background: var(--accent-soft); }
.status-warm, .badge-amber, .badge-red { color: var(--warm); background: var(--warm-soft); }
.status-neutral, .badge-gray, .badge-blue { color: #666b67; background: #e8e9e6; }

/* Workflow and dashboard */

.focus-card { min-height: 174px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; margin-bottom: 16px; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.focus-card-dark { border: 0; color: #fff; background: var(--sidebar); box-shadow: 0 18px 38px rgb(41 46 42 / 14%); }
.focus-card-dark h2 { color: #fff; }
.focus-card-dark .eyebrow { color: #cad4cd; }
.focus-card-dark p { color: #c4cbc6; }
.focus-card-dark .btn { color: var(--ink); background: #f5f6f2; box-shadow: none; }
.focus-card-success { border-color: #bac8c0; background: #f2f5f2; }
.focus-icon, .draft-icon { width: 52px; height: 52px; display: grid; flex: none; place-items: center; border-radius: 14px; color: var(--accent-dark); background: var(--accent-soft); font-size: 1.35rem; font-weight: 850; }
.focus-icon svg, .draft-icon svg { width: 24px; height: 24px; }
.focus-card-dark .focus-icon { color: #dfe7e2; background: rgb(255 255 255 / 10%); }
.focus-card-success .focus-icon { color: #fff; background: var(--accent); }
.focus-copy h2 { margin-bottom: .45rem; font-size: 1.45rem; }
.focus-copy p { max-width: 650px; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.empty-focus { margin-top: 1rem; }

/* Stateless old-PDF converter */
.legacy-converter-header { margin-bottom: 24px; }
.legacy-converter-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.legacy-upload-card { position: relative; min-height: 350px; padding: 30px; }
.legacy-upload-card > div { max-width: 620px; }
.legacy-upload-card > div p { color: var(--muted); font-size: .82rem; }
.legacy-step { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 10px; color: var(--accent-dark); background: var(--accent-soft); font-size: .72rem; font-weight: 850; }
.legacy-upload-card form { display: grid; justify-items: start; gap: 14px; margin-top: 24px; }
.legacy-file-drop { width: 100%; min-height: 116px; display: flex; align-items: center; gap: 15px; padding: 20px; border: 1px dashed var(--line-dark); border-radius: 11px; background: var(--surface-strong); cursor: pointer; }
.legacy-file-drop:hover { border-color: var(--accent); background: #f2f5f2; }
.legacy-file-drop input { width: min(100%, 330px); margin-left: auto; }
.legacy-file-drop strong, .legacy-file-drop small { display: block; }
.legacy-file-drop strong { font-size: .82rem; }
.legacy-file-drop small { margin-top: 3px; color: var(--muted); font-size: .67rem; }
.legacy-file-icon { width: 44px; height: 44px; display: grid; flex: none; place-items: center; border-radius: 10px; color: #fff; background: var(--sidebar); font-size: .62rem; font-weight: 850; }
.legacy-converter-notes ul { display: grid; gap: 8px; margin: 18px 0 24px; padding-left: 20px; color: var(--muted); font-size: .78rem; }
.legacy-privacy-note { padding: 14px; border-radius: 9px; background: var(--accent-soft); }
.legacy-privacy-note strong, .legacy-privacy-note small { display: block; }
.legacy-privacy-note strong { font-size: .76rem; }
.legacy-privacy-note small { margin-top: 3px; color: var(--accent-dark); font-size: .66rem; }
.legacy-converter-error, .legacy-converter-warning { display: grid; gap: 3px; margin-bottom: 16px; padding: 15px 17px; border: 1px solid #dcbfba; border-radius: 10px; color: #79413e; background: var(--danger-soft); font-size: .76rem; }
.legacy-converter-warning { border-color: #dec7ae; color: var(--warm); background: var(--warm-soft); }
.legacy-converter-warning ul { margin: 5px 0 0; padding-left: 18px; }
.legacy-review-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 14px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.legacy-review-intro h2 { margin-bottom: 5px; }
.legacy-review-intro p { max-width: 820px; margin: 0; color: var(--muted); font-size: .76rem; }
.legacy-review-intro code { padding: 2px 4px; border-radius: 4px; color: var(--ink); background: #e9ebe8; font-size: .69rem; }
.legacy-review-form { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.legacy-title-field { display: grid; gap: 6px; margin-bottom: 15px; }
.legacy-title-field > span { color: var(--muted); font-size: .68rem; font-weight: 800; }
.legacy-title-field input { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line-dark); border-radius: 8px; background: #fff; }
.legacy-title-field small { color: var(--muted); font-size: .63rem; line-height: 1.45; }
.legacy-upload-title { width: min(100%, 620px); margin-bottom: 0; }
.legacy-review-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.legacy-review-table { width: 100%; min-width: 1150px; border-collapse: collapse; table-layout: fixed; }
.legacy-review-table th { position: sticky; z-index: 1; top: 0; padding: 10px 8px; border-right: 1px solid var(--line); color: #fff; background: var(--sidebar); font-size: .65rem; text-align: center; }
.legacy-review-table th:nth-child(1) { width: 70px; }
.legacy-review-table th:nth-child(2) { width: 145px; }
.legacy-review-table td { padding: 6px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: middle; }
.legacy-review-table td:last-child, .legacy-review-table th:last-child { border-right: 0; }
.legacy-review-table input, .legacy-review-table textarea { width: 100%; border: 1px solid var(--line-dark); border-radius: 7px; color: var(--ink); background: #fff; font: inherit; font-size: .66rem; }
.legacy-review-table input { min-height: 38px; padding: 7px; text-align: center; }
.legacy-review-table textarea { min-height: 76px; padding: 7px; resize: vertical; line-height: 1.4; }
.legacy-review-table input:focus, .legacy-review-table textarea:focus, .legacy-title-field input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgb(111 128 119 / 14%); }
.legacy-review-actions { position: sticky; z-index: 4; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 14px; padding: 13px 14px; border: 1px solid var(--line-dark); border-radius: 10px; background: rgb(247 247 244 / 96%); box-shadow: 0 10px 28px rgb(37 40 38 / 10%); }
.legacy-review-actions strong, .legacy-review-actions small { display: block; }
.legacy-review-actions strong { font-size: .75rem; }
.legacy-review-actions small { margin-top: 2px; color: var(--muted); font-size: .64rem; }

.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.final-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.final-dashboard-card { min-height: 285px; display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.final-dashboard-card-wide { grid-column: 1 / -1; min-height: 245px; background: #f4f5f2; }
.final-card-heading { display: flex; align-items: center; gap: 13px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.final-card-heading h2 { margin: 2px 0 0; font-size: 1.12rem; }
.final-card-icon { width: 42px; height: 42px; display: grid; flex: none; place-items: center; border-radius: 11px; color: var(--accent-dark); background: var(--accent-soft); }
.final-card-icon svg { width: 21px; height: 21px; }
.final-card-version { display: grid; gap: 4px; margin: 24px 0; }
.final-card-version strong { font-size: 1.7rem; letter-spacing: -.04em; }
.final-card-version span { color: var(--ink); font-size: .75rem; font-weight: 740; }
.final-card-version small { color: var(--muted); font-size: .65rem; }
.final-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.final-card-empty { margin: 24px 0 18px; }
.final-card-empty strong { font-size: .82rem; }
.final-card-empty p { max-width: 510px; margin: 7px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.final-dashboard-card > .text-link { margin-top: auto; }
.schedule-set-layout { margin-bottom: 16px; }
.schedule-set-layout .card { margin: 0; }
.inline-create-form { display: flex; gap: 8px; margin-top: 20px; }
.inline-create-form input { min-width: 0; min-height: 42px; flex: 1; padding: .62rem .75rem; border: 1px solid var(--line-dark); border-radius: 9px; background: var(--surface-strong); }
.padded-card-header { padding: 20px 22px; }
.summary-card { margin: 0; }
.summary-card h2 { margin: 0; font-size: 1.1rem; }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0 18px; }
.metric-row div { padding-right: 8px; border-right: 1px solid var(--line); }
.metric-row div:last-child { border: 0; }
.metric-row strong, .metric-row span { display: block; }
.metric-row strong { font-size: 1.18rem; }
.metric-row span { margin-top: .1rem; color: var(--muted); font-size: .62rem; }

/* Drafts */
.draft-card { min-height: 150px; display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 14px; padding: 25px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.draft-icon { width: 48px; height: 48px; }
.draft-main { min-width: 0; flex: 1; }
.draft-title { display: flex; align-items: center; gap: 10px; }
.draft-title h2 { margin: 0; }
.draft-main p { margin: .3rem 0 .85rem; color: var(--muted); font-size: .7rem; }
.progress { overflow: hidden; height: 6px; border-radius: 99px; background: #e1e3df; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress-copy { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: .63rem; }
.progress-copy strong { color: var(--ink); }
.current-card { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 1rem; }
.current-card h2 { margin-bottom: .25rem; }
.current-card p { margin: 0; font-size: .77rem; }

.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 15px; }
.review-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.review-strip .review-stat { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--line); }
.review-strip .review-stat:last-child { border-right: 0; }
.review-stat { margin: 0; padding: 20px; }
.review-stat > span:first-child { display: block; margin-bottom: .55rem; color: var(--muted); font-size: .62rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.review-stat strong { display: block; margin-bottom: .6rem; font-size: 1.75rem; letter-spacing: -.03em; }
.review-stat small { color: var(--muted); font-size: .75rem; }
.issue-card { margin-top: 15px; padding: 18px; border: 1px solid #d9b5ad; border-radius: 12px; color: #71443d; background: var(--danger-soft); }
.issue-card > div:first-child { display: flex; gap: .5rem; flex-direction: column; }
.issue-card strong { font-size: .83rem; }
.issue-card span { font-size: .72rem; }
.issue-list { margin-top: .7rem; }
.issue-list p { margin: .35rem 0; font-size: .72rem; }

/* Expandable and lists */
.disclosure-card, .advanced-card { margin-top: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgb(247 247 244 / 70%); }
.disclosure-card summary, .advanced-card summary { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 13px 17px; cursor: pointer; list-style: none; }
.disclosure-card summary::-webkit-details-marker, .advanced-card summary::-webkit-details-marker { display: none; }
.disclosure-card summary strong, .disclosure-card summary small, .advanced-card summary strong, .advanced-card summary small { display: block; }
.disclosure-card summary strong, .advanced-card summary strong { font-size: .75rem; }
.disclosure-card summary small, .advanced-card summary small { margin-top: .18rem; color: var(--muted); font-size: .62rem; font-weight: 400; }
.disclosure-icon { transition: transform .16s ease; }
.disclosure-card[open] .disclosure-icon, .advanced-card[open] > summary .disclosure-icon { transform: rotate(45deg); }
.disclosure-card > div, .advanced-content { padding: 0 17px 17px; }
.advanced-section { padding: 19px 0; border-top: 1px solid var(--line); }
.advanced-section:first-child { border-top: 0; }
.advanced-section h2 { margin-bottom: .25rem; font-size: 1rem; }
.advanced-section > p { font-size: .75rem; }
.preview-columns, .two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.readiness-list { display: grid; gap: 6px; }
.readiness-item { min-height: 58px; display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.readiness-item:hover { background: #eceeeb; }
.readiness-status { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--warm); background: var(--warm-soft); font-size: .7rem; font-weight: 850; }
.readiness-item.is-ready .readiness-status { color: var(--accent-dark); background: var(--accent-soft); }
.readiness-item strong, .readiness-item small { display: block; }
.readiness-item strong { font-size: .75rem; }
.readiness-item small { margin-top: .13rem; color: var(--muted); font-size: .63rem; }
.readiness-action { color: var(--accent-dark); font-size: .65rem; font-weight: 800; }
.autosave { margin: 16px 0 0; color: var(--muted); font-size: .63rem; text-align: center; }

/* Tables and directory */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.grid th { color: var(--muted); background: #eceeeb; font-size: .63rem; font-weight: 850; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.grid th, .grid td { padding: .75rem .85rem; border-bottom: 1px solid var(--line); }
.grid td { color: #505652; font-size: .73rem; }
.grid tbody tr:hover { background: #f0f1ee; }
.filter-input, .field input, .field select, .search-box input, select { min-height: 40px; padding: .55rem .7rem; border: 1px solid var(--line-dark); border-radius: 9px; color: var(--ink); background: var(--surface-strong); }
.filter-input { width: min(270px, 100%); }
.directory-card { overflow: hidden; padding: 0; }
.scope-switcher { width: fit-content; display: flex; gap: 4px; margin: -8px 0 20px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #e8eae6; }
.scope-switcher a { min-height: 34px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 780; }
.scope-switcher a:hover { color: var(--ink); }
.scope-switcher a.active { color: var(--ink); background: var(--surface-strong); box-shadow: 0 3px 8px rgb(37 40 38 / 6%); }
.directory-tools { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.directory-tabs { display: flex; padding: 4px; border-radius: 9px; background: #e8eae6; }
.directory-tabs button { min-height: 32px; padding: 0 13px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: .68rem; font-weight: 780; cursor: pointer; }
.directory-tabs button.active { color: var(--ink); background: var(--surface-strong); box-shadow: 0 3px 8px rgb(37 40 38 / 6%); }
.search-box { min-width: 250px; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line-dark); border-radius: 9px; color: var(--muted); background: var(--surface-strong); }
.search-box svg { width: 17px; height: 17px; }
.search-box input { min-width: 0; flex: 1; min-height: 0; padding: 0; border: 0; outline: 0; background: transparent; font-size: .72rem; }
.directory-meta { display: flex; justify-content: space-between; padding: 11px 18px; color: var(--muted); background: #eeefec; font-size: .62rem; }
.directory-list { display: grid; grid-template-columns: repeat(2, 1fr); }
.directory-list > a { min-height: 76px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.directory-list > a:nth-child(odd) { border-right: 1px solid var(--line); }
.directory-list > a:hover { background: #edeeeb; }
.directory-avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; color: var(--accent-dark); background: var(--accent-soft); font-size: .62rem; font-weight: 850; }
.directory-list strong, .directory-list small { display: block; }
.directory-list strong { margin-bottom: .2rem; font-size: .73rem; }
.directory-list small { color: var(--muted); font-size: .62rem; }
.empty-inline { grid-column: 1 / -1; margin: 0; padding: 2rem; color: var(--muted); font-size: .75rem; }

/* Timetables */
.timetable-card { overflow: hidden; padding: 0; }
.weekly-grid { min-width: 950px; }
.weekly-grid thead th { padding: 14px; border-right: 1px solid var(--line); color: var(--muted); background: #e9ebe8; font-size: .63rem; font-weight: 850; letter-spacing: .05em; text-align: center; text-transform: uppercase; }
.weekly-grid thead th:first-child { width: 92px; }
.weekly-grid tbody th { padding: 16px 14px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.weekly-grid tbody th strong, .weekly-grid tbody th small { display: block; }
.weekly-grid tbody th strong { font-size: .68rem; }
.weekly-grid tbody th small { margin-top: .15rem; color: var(--muted); font-size: .57rem; font-weight: 400; }
.weekly-grid td { width: 172px; height: 102px; padding: 7px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.lesson-card { height: 100%; display: flex; flex-direction: column; padding: 10px; border-left: 3px solid var(--accent); border-radius: 9px; background: var(--accent-soft); }
.lesson-card strong { font-size: .67rem; }
.lesson-card span { margin-top: .2rem; color: #555c57; font-size: .59rem; }
.lesson-card small { margin-top: auto; color: #68706a; font-size: .57rem; }
.weekly-grid tr.break-row td, .weekly-grid tr.break-row th { height: 58px; padding-top: 5px; padding-bottom: 5px; }
.weekly-grid td:has(.timetable-break) { padding: 5px; vertical-align: middle; background: #edf2f0; }
.timetable-break { width: 100%; min-height: 100%; display: grid; align-content: center; justify-items: center; gap: 3px; padding: 10px 8px; border: 1px solid #cbd7d0; border-radius: 7px; color: #35463d; background: #e3ece7; text-align: center; }
.timetable-break-long { border-color: #c8d1d9; color: #364956; background: #e2e9ee; }
.timetable-break strong, .timetable-break span { display: block; }
.timetable-break strong { font-size: .78rem; line-height: 1.25; }
.timetable-break span { color: #5e6d65; font-size: .7rem; font-weight: 700; }
.agenda-break { min-height: 54px; display: grid; align-content: center; padding: 9px 11px; border: 1px solid #cbd7d0; border-radius: 8px; background: #e3ece7; }
.agenda-break strong { color: #35463d; }
.agenda-break span { color: #5e6d65; }
.free-slot, .unavailable-slot { height: 100%; display: grid; place-items: center; color: #a4a8a4; font-size: .58rem; }
.unavailable-slot { background: #f0f0ed; }

/* Notices, confirmation, and manual placement */
.messages { margin-bottom: 1rem; }
.message, .notice { margin-bottom: .7rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-size: .77rem; }
.message { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-left: 4px solid var(--accent); box-shadow: var(--shadow); }
.message-success, .notice-success { color: var(--accent-dark); background: var(--accent-soft); }
.message-error, .notice-danger { border-color: #dcb9b4; color: #7e4541; background: var(--danger-soft); }
.notice-warning, .message-warning { border-color: #dbc4aa; color: #765130; background: var(--warm-soft); }
.message button { padding: 0; border: 0; color: inherit; background: transparent; font-size: 1.1rem; cursor: pointer; }
.notice-info { background: #eceeeb; }
.notice ul { margin-bottom: 0; }
.field { display: grid; gap: .4rem; margin-bottom: .9rem; }
.field label { color: var(--ink); font-size: .7rem; font-weight: 800; }
.field input, .field select { width: 100%; }
.field input:focus, .field select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgb(111 128 119 / 14%); }
.field-note { color: var(--muted); font-size: .62rem; line-height: 1.45; }
.errorlist { margin: 0; padding: 0; color: var(--danger); font-size: .65rem; list-style: none; }
.field-error input { border-color: #c9817c; }

/* Profile */
.profile-header { margin-bottom: 24px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.profile-card { margin: 0; padding: 25px; }
.profile-section-heading { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; margin-bottom: 23px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.profile-section-heading h2 { margin-bottom: .25rem; font-size: 1.02rem; }
.profile-section-heading p { margin: 0; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.profile-section-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--accent-dark); background: var(--accent-soft); }
.profile-section-icon svg { width: 18px; height: 18px; }
.profile-name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profile-form .btn { margin-top: 5px; }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; color: var(--muted); font-size: .65rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--accent-soft); }
.legend .placed i { background: var(--accent); }
.legend .blocked i { background: var(--danger-soft); }
.placement-grid { min-width: 940px; }
.placement-grid th, .placement-grid td { text-align: center; }
.placement-grid td { min-width: 115px; height: 82px; }
.placement-grid .own { background: var(--accent-soft); }
.placement-grid .clash { color: var(--danger); background: var(--danger-soft); }
.break-slot { color: var(--muted); background: #efefec; }
.slot-link { min-height: 45px; display: grid; place-items: center; border-radius: 8px; color: var(--accent-dark); background: #eef2ef; text-decoration: none; font-size: .68rem; font-weight: 800; }
.remove-placement-form { margin-top: .5rem; }
.link-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.link-pill { display: inline-flex; min-height: 34px; align-items: center; padding: .38rem .65rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface-strong); text-decoration: none; font-size: .68rem; font-weight: 700; }
.link-pill:hover { background: var(--accent-soft); }
.pre-wrap { white-space: pre-wrap; }
.confirm-dialog { width: min(430px, calc(100% - 2rem)); padding: 28px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 70px rgb(24 27 25 / 24%); text-align: center; }
.confirm-dialog::backdrop { background: rgb(28 31 29 / 55%); backdrop-filter: blur(3px); }
.confirm-dialog-icon { width: 43px; height: 43px; display: grid; margin: 0 auto .8rem; place-items: center; border-radius: 50%; color: var(--accent-dark); background: var(--accent-soft); font-weight: 850; }
.confirm-dialog h2 { margin-bottom: .4rem; }
.confirm-dialog p { color: var(--muted); font-size: .78rem; }
.confirm-dialog-actions { display: flex; justify-content: center; gap: .55rem; margin-top: 1.2rem; }

/* Login */
.login-page { background: var(--surface); }
.login-page .page-shell { width: 100%; max-width: none; padding: 0; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(460px, 54%) 1fr; }
.login-panel { min-height: 100vh; display: flex; flex-direction: column; padding: 48px clamp(34px, 6vw, 90px); }
.login-brand { color: var(--ink); }
.login-brand .brand-mark { color: #fff; background: var(--sidebar); }
.login-brand small { color: var(--muted); }
.login-content { width: min(100%, 440px); margin: auto 0; }
.login-content h1 { font-size: clamp(2.1rem, 4vw, 2.7rem); }
.login-content > p { margin-bottom: 1.6rem; font-size: .82rem; }
.login-button { width: 100%; margin-top: .25rem; }
.login-help { margin: 1.5rem 0 0; color: var(--muted); font-size: .64rem; text-align: center; }
.login-aside { display: flex; flex-direction: column; justify-content: center; padding: clamp(52px, 6vw, 88px); color: #fff; background: var(--sidebar); }
.login-aside .eyebrow { color: #cbd4ce; }
.login-aside h2 { max-width: 560px; margin-bottom: 1rem; color: #fff; font-size: clamp(2.25rem, 4.2vw, 3.6rem); line-height: 1.04; letter-spacing: -.045em; }
.login-aside > p { max-width: 520px; margin-bottom: 2.2rem; color: #bfc7c1; font-size: .9rem; line-height: 1.65; }
.login-week { width: min(100%, 480px); display: grid; grid-template-columns: 48px 1fr 1fr; gap: 7px; margin-top: .5rem; padding: 15px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 11px; }
.login-week span { display: flex; align-items: center; color: #cbd4ce; font-size: .68rem; font-weight: 750; }
.login-week i { height: 26px; border-left: 3px solid #9aaca1; border-radius: 4px; background: rgb(255 255 255 / 8%); }

@media (max-width: 980px) {
  .sidebar { display: none; }
  .mobile-header { position: sticky; z-index: 30; top: 0; height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: #fff; background: var(--sidebar); }
  .mobile-header .brand-mark { width: 36px; height: 36px; }
  .nav-toggle { width: 40px; height: 40px; padding: 8px; border: 1px solid rgb(255 255 255 / 15%); border-radius: 9px; background: var(--sidebar-soft); }
  .nav-toggle span:not(.sr-only) { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: #fff; }
  .mobile-nav { position: absolute; top: 58px; right: 16px; width: min(270px, calc(100vw - 32px)); display: none; padding: 8px; border: 1px solid #4c514d; border-radius: 12px; background: var(--sidebar); box-shadow: 0 20px 40px rgb(0 0 0 / 24%); }
  .mobile-nav.is-open { display: grid; animation: menu-in 140ms ease-out; transform-origin: top right; }
  .mobile-nav .nav-group + .nav-group { margin-top: 7px; padding-top: 7px; }
  .mobile-nav .nav-group-label { padding: 7px 12px 3px; }
  .mobile-nav a, .mobile-nav button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 8px; color: #d7dcd8; background: transparent; text-decoration: none; font-size: .8rem; cursor: pointer; }
  .mobile-nav a svg, .mobile-nav button svg { width: 18px; height: 18px; }
  .mobile-nav a.active { color: #fff; background: rgb(255 255 255 / 8%); box-shadow: inset 3px 0 #aebdb4; }
  .mobile-nav a:hover, .mobile-nav button:hover { background: rgb(255 255 255 / 8%); }
  .mobile-nav form { margin: 0; }
  .page-shell.with-sidebar, .page-shell { width: min(100% - 36px, 780px); margin: 0 auto; padding-top: 40px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-panel { max-width: 600px; width: 100%; margin: auto; }
}

@media (max-width: 700px) {
  .page-shell.with-sidebar, .page-shell { width: min(100% - 24px, 560px); padding-top: 30px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 17px; margin-bottom: 24px; }
  .page-header > .status-pill { margin-top: -6px; }
  .page-actions { width: 100%; }
  h1 { font-size: 2.15rem; }
  .focus-card { grid-template-columns: 1fr; align-items: start; padding: 24px; }
  .focus-actions, .focus-actions .btn, .focus-actions form { width: 100%; }
  .summary-grid, .final-dashboard-grid, .review-grid, .review-strip, .preview-columns, .two-column, .directory-list, .profile-grid { grid-template-columns: 1fr; }
  .final-dashboard-card-wide { grid-column: auto; }
  .review-strip .review-stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .review-strip .review-stat:last-child { border-bottom: 0; }
  .directory-list > a:nth-child(odd) { border-right: 0; }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .metric-row div:nth-child(2) { border-right: 0; }
  .draft-card, .current-card { align-items: stretch; flex-direction: column; }
  .draft-card > .btn, .current-card .btn { width: 100%; }
  .draft-title { align-items: flex-start; flex-direction: column; }
  .progress-copy { gap: .4rem; flex-direction: column; }
  .directory-tools { align-items: stretch; flex-direction: column; }
  .directory-tabs { overflow-x: auto; }
  .directory-tabs button { flex: 1; }
  .search-box { min-width: 0; width: 100%; }
  .directory-meta { gap: .4rem; flex-direction: column; }
  .card-header { align-items: flex-start; flex-direction: column; }
  .filter-input { width: 100%; }
  .responsive-records thead { display: none; }
  .responsive-records, .responsive-records tbody, .responsive-records tr, .responsive-records td { display: block; width: 100%; }
  .responsive-records tr { padding: .75rem 0; border-bottom: 1px solid var(--line); }
  .responsive-records td { display: grid; grid-template-columns: 110px 1fr; gap: .6rem; padding: .35rem .7rem; border: 0; }
  .responsive-records td::before { color: var(--muted); content: attr(data-label); font-size: .62rem; font-weight: 850; text-transform: uppercase; }
  .readiness-item { grid-template-columns: 30px 1fr; }
  .readiness-action { grid-column: 2; }
  .login-panel { padding: 32px 22px; }
  .login-content { margin-top: auto; }
  .confirm-dialog-actions { flex-direction: column-reverse; }
  .confirm-dialog-actions .btn { width: 100%; }
  .profile-name-row { grid-template-columns: 1fr; gap: 0; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .sidebar, .mobile-header, .messages, .page-actions, .no-print, .back-link, .advanced-card { display: none !important; }
  body { background: #fff; }
  .page-shell.with-sidebar, .page-shell { width: 100%; margin: 0; padding: 0; }
  .card, .table-wrap { border: 0; box-shadow: none; }
}

/* Product polish and accessible interaction states */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
.brand small, .account-identity small, .account-actions a, .account-actions button { font-size: .75rem; }
.account-identity strong { font-size: .78rem; }
.eyebrow, .card-kicker { font-size: .75rem; }
.status-pill, .badge { font-size: .75rem; }
.metric-row span, .draft-main p, .progress-copy, .review-stat > span:first-child, .disclosure-card summary small, .advanced-card summary small, .readiness-item small, .readiness-action { font-size: .72rem; }
.grid th, .weekly-grid thead th { font-size: .72rem; }
.grid td, .directory-list strong, .search-box input { font-size: .8125rem; }
.directory-meta, .directory-list small, .directory-avatar, .weekly-grid tbody th small, .lesson-card span, .lesson-card small, .free-slot, .unavailable-slot { font-size: .75rem; }
.weekly-grid tbody th strong, .lesson-card strong { font-size: .8rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: 22px; color: var(--muted); font-size: .78rem; }
.sidebar :focus-visible, .mobile-header :focus-visible { outline-color: #fff; }
.breadcrumbs a { color: var(--accent-dark); font-weight: 750; text-decoration: none; }
.btn-quiet { border-color: transparent; color: var(--muted); background: transparent; box-shadow: none; }
.btn-quiet:hover { color: var(--ink); background: #eceeeb; }
.table-actions, .version-controls, .slot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.table-actions form, .version-controls form, .slot-actions form { margin: 0; }
.scroll-hint { display: none; margin: 0; padding: .65rem 1rem; color: var(--muted); background: #eef0ed; font-size: .75rem; }
.timetable-scroll { position: relative; box-shadow: inset -14px 0 16px -18px rgb(25 29 26 / 55%); }
.weekly-grid thead th, .placement-grid thead th { position: sticky; z-index: 3; top: 0; }
.weekly-grid thead th:first-child, .weekly-grid tbody th, .placement-grid thead th:first-child, .placement-grid tbody th { position: sticky; z-index: 2; left: 0; background: #e9ebe8; }
.weekly-grid thead th:first-child, .placement-grid thead th:first-child { z-index: 4; }
.weekly-grid thead th small { display: block; margin-top: 2px; color: var(--accent-dark); font-size: .63rem; letter-spacing: 0; text-transform: none; }
.weekly-grid thead th.is-today { color: var(--ink); box-shadow: inset 0 3px var(--accent); }
.free-slot, .unavailable-slot { color: #626862; }
.lesson-card span, .lesson-card small { color: var(--accent-dark); }
.room-badge { width: fit-content; margin-top: auto !important; padding: 2px 6px; border: 1px solid rgb(79 98 89 / 20%); border-radius: 4px; background: rgb(255 255 255 / 45%); font-weight: 750; }
.directory-tabs button, .account-actions a, .account-actions button, .link-pill, .btn-small { min-height: 44px; }
.directory-meta a { color: var(--accent-dark); font-weight: 750; text-decoration: none; }
.directory-empty { margin: 0; padding: 2rem; color: var(--muted); text-align: center; }
.mobile-agenda { display: none; }
.agenda-toggle { display: none; }
.agenda-row { display: grid; grid-template-columns: 116px 1fr; gap: .8rem; align-items: start; padding: .75rem 0; border-top: 1px solid var(--line); }
.agenda-row time { color: var(--muted); font-size: .76rem; font-weight: 750; }
.agenda-row strong, .agenda-row span, .agenda-row small { display: block; }
.agenda-row strong { font-size: .82rem; }
.agenda-row span, .agenda-row small { margin-top: .15rem; color: var(--muted); font-size: .75rem; }
.slot-reason { min-width: 105px; text-align: left; }
.slot-reason summary { min-height: 44px; display: grid; place-items: center; color: var(--danger); font-size: .73rem; font-weight: 750; cursor: pointer; }
.slot-reason small { display: block; padding: .45rem; color: #704743; font-size: .72rem; line-height: 1.4; }
.placement-grid td[draggable="true"] { cursor: grab; }
.placement-grid td.is-dragging { opacity: .45; }
.placement-grid td.is-drop-target { box-shadow: inset 0 0 0 3px var(--accent); }
.password-field { position: relative; display: flex; }
.password-field input { padding-right: 4.2rem; }
.password-field button { position: absolute; top: 3px; right: 3px; min-width: 52px; height: 34px; border: 0; border-radius: 7px; color: var(--accent-dark); background: #eef0ed; font-size: .72rem; font-weight: 750; cursor: pointer; }
.password-strength { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .75rem; margin: .35rem 0 0; padding: 0; color: var(--muted); font-size: .72rem; list-style: none; }
.password-strength li::before { margin-right: .35rem; content: "○"; }
.password-strength li.passed { color: var(--accent-dark); }
.password-strength li.passed::before { content: "✓"; }
.compact-form { max-width: 680px; }
.page-busy { position: fixed; z-index: 90; inset: 0; display: grid; place-content: center; padding: 2rem; color: #fff; background: rgb(36 40 37 / 78%); text-align: center; }
.page-busy[hidden] { display: none; }
.page-busy-panel { width: min(360px, calc(100vw - 40px)); display: grid; gap: .8rem; padding: 27px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 12px; background: var(--sidebar); box-shadow: 0 22px 60px rgb(0 0 0 / 24%); }
.page-busy-panel small { color: #bdc5bf; font-size: .74rem; }
.spinner { width: 38px; height: 38px; margin: auto; border: 3px solid rgb(255 255 255 / 25%); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
.confirm-dialog [data-confirm-proceed][data-tone="danger"] { background: var(--danger); }
.confirm-dialog [data-confirm-proceed][data-tone="warm"] { background: var(--warm); }
.error-page .focus-icon { font-size: .8rem; }

@media (max-width: 700px) {
  .page-actions > .btn, .page-actions > form, .page-actions > form .btn { width: 100%; }
  .timetable-card .timetable-scroll, .placement-grid { display: none; }
  .agenda-toggle { min-height: 44px; display: inline-flex; align-items: center; margin: .8rem 1rem 0; padding: 0 .8rem; border: 1px solid var(--line-dark); border-radius: 8px; color: var(--accent-dark); background: transparent; font-size: .75rem; font-weight: 750; cursor: pointer; }
  .mobile-agenda { display: block; padding: .8rem 1rem 1rem; }
  .mobile-agenda.hide-free .agenda-row-free { display: none; }
  .mobile-agenda section + section { margin-top: 1.25rem; }
  .mobile-agenda h2, .mobile-agenda h3 { margin: 0 0 .45rem; font-size: 1rem; }
  .scroll-hint { display: none; }
  .agenda-row { grid-template-columns: 104px 1fr; }
  .password-strength { grid-template-columns: 1fr; }
}

.profile-grid-balanced { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); }

@media (max-width: 700px) {
  .profile-grid-balanced { grid-template-columns: 1fr; }
}

@media (min-width: 701px) and (max-width: 1100px) {
  .scroll-hint { display: block; }
}

/* Focused data and timetable workflows */
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 30px 0 12px; }
.section-heading h2 { margin: .15rem 0; font-size: 1.2rem; }
.section-heading p { margin: 0; color: var(--muted); font-size: .76rem; }
.task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.task-card { min-height: 112px; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); text-decoration: none; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.task-card:hover { border-color: #b9c0ba; color: var(--ink); background: #f0f2ef; transform: translateY(-1px); }
.task-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; color: var(--accent-dark); background: var(--accent-soft); }
.task-icon svg { width: 18px; height: 18px; }
.task-card strong, .task-card small { display: block; }
.task-card strong { margin: 2px 0 5px; font-size: .82rem; }
.task-card small { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.task-card-form { padding: 0; }
.task-card-form button { width: 100%; height: 100%; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 18px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.issue-workspace { margin-top: 28px; }
.issue-groups { display: grid; gap: 7px; }
.issue-group { border: 1px solid #dec7ae; border-radius: 10px; background: var(--warm-soft); }
.issue-group summary { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 11px 15px; cursor: pointer; list-style: none; }
.issue-group summary::-webkit-details-marker { display: none; }
.issue-group summary strong, .issue-group summary small { display: block; }
.issue-group summary strong { font-size: .78rem; }
.issue-group summary small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.issue-group > div { border-top: 1px solid #dec7ae; background: #faf7f2; }
.issue-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 11px 15px; border-bottom: 1px solid #ead9c7; }
.issue-row:last-child { border-bottom: 0; }
.issue-row p { margin: 0; color: #654c37; font-size: .75rem; }
.generation-note { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.generation-note > strong { font-size: .76rem; }

.selection-card { overflow: hidden; padding: 0; }
.selection-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.selection-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 10px 17px; color: var(--muted); background: #eceeeb; font-size: .72rem; }
.selection-list { display: grid; grid-template-columns: repeat(2, 1fr); }
.selection-list > a { min-height: 80px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 17px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.selection-list > a:nth-child(odd) { border-right: 1px solid var(--line); }
.selection-list > a:hover { background: #eef0ed; }
.selection-copy strong, .selection-copy small { display: block; }
.selection-copy strong { font-size: .78rem; }
.selection-copy small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.selection-progress { color: var(--accent-dark); font-size: .7rem; font-weight: 800; white-space: nowrap; }
.selection-progress.needs-attention { color: var(--warm); }
.filter-chips { display: inline-flex; gap: 3px; padding: 3px; border-radius: 8px; background: #e6e8e4; }
.filter-chips button { min-height: 34px; padding: 0 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: .72rem; font-weight: 750; cursor: pointer; }
.filter-chips button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 7px rgb(37 40 38 / 7%); }
.text-button { padding: 0; border: 0; color: var(--accent-dark); background: transparent; font-size: .72rem; font-weight: 800; cursor: pointer; }
.text-button:hover, .text-button.active { color: var(--ink); text-decoration: underline; }
.picker-card { width: min(100%, 700px); padding: 24px; }
.picker-intro { display: grid; grid-template-columns: auto 1fr; gap: 13px; align-items: center; margin-bottom: 20px; }
.picker-intro h2, .picker-intro p { margin: 0; }
.picker-intro h2 { font-size: 1rem; }
.picker-intro p { margin-top: 4px; color: var(--muted); font-size: .74rem; }
.entity-picker label { display: block; margin-bottom: 6px; font-size: .72rem; font-weight: 800; }
.entity-picker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.entity-picker-row select { width: 100%; }
.preview-picker-bar { display: flex; align-items: end; justify-content: space-between; gap: 1.2rem; margin-bottom: 12px; padding: 14px 17px; }
.preview-picker-bar > div strong, .preview-picker-bar > div small { display: block; }
.preview-picker-bar > div strong { font-size: .76rem; }
.preview-picker-bar > div small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.preview-picker-bar .entity-picker { width: min(100%, 520px); }

.context-bar { min-height: 54px; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: #eceeeb; }
.context-bar p { flex: 1; margin: 0; color: var(--muted); font-size: .74rem; }
.context-bar a { font-size: .72rem; font-weight: 800; }
.context-bar-warm { border-color: #dec7ae; background: var(--warm-soft); }
.current-lessons-card, .available-times-card { margin-bottom: 12px; }
.current-lesson-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.current-lesson-list article { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 12px 17px; border-top: 1px solid var(--line); }
.current-lesson-list article:nth-child(odd) { border-right: 1px solid var(--line); }
.current-lesson-list strong, .current-lesson-list span { display: block; }
.current-lesson-list strong { font-size: .76rem; }
.current-lesson-list span { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.slot-filter { margin: 0 17px 12px; }
.available-slot-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.available-slot-list a { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.available-slot-list a:hover { background: #eef2ef; }
.available-slot-list strong, .available-slot-list small { display: block; }
.available-slot-list strong { font-size: .75rem; }
.available-slot-list small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.slot-availability { color: var(--accent-dark); font-size: .68rem; font-weight: 800; }
.full-week-content { padding-top: 14px; }
.full-week-content .legend { margin-bottom: 12px; }
.focused-choice { width: min(100%, 720px); padding: 26px; }
.choice-summary { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.choice-summary h2 { margin: .15rem 0; font-size: 1.15rem; }
.choice-summary p { margin: 0; color: var(--muted); font-size: .75rem; }

.directory-search-tools { display: flex; align-items: center; gap: 8px; }
.school-grid { min-width: 1420px; table-layout: fixed; }
.school-grid td { height: 148px; padding: 5px; }
.school-lessons { display: grid; gap: 4px; }
.school-lesson { padding: 6px 7px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--accent-soft); }
.school-lesson strong, .school-lesson span, .school-lesson small { display: block; }
.school-lesson strong { font-size: .7rem; }
.school-lesson span, .school-lesson small { margin-top: 1px; color: var(--accent-dark); font-size: .66rem; }
.school-agenda-row > div { display: grid; gap: 6px; }
.schedule-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 10px 13px; border-bottom: 1px solid var(--line); background: #eef0ed; }
.hide-free-periods .free-slot { visibility: hidden; }
.hide-free-periods .agenda-row-free { display: none; }

.output-dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 40px); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); box-shadow: 0 28px 70px rgb(24 27 25 / 25%); }
.output-dialog::backdrop { background: rgb(28 31 29 / 58%); backdrop-filter: blur(2px); }
.output-dialog > form { padding: 24px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 20px; }
.dialog-heading h2 { margin: 0; font-size: 1.25rem; }
.dialog-heading p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.dialog-close { width: 38px; height: 38px; border: 0; border-radius: 8px; color: var(--muted); background: #e8eae6; font-size: 1.25rem; cursor: pointer; }
.export-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.check-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin: 2px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.check-option input { margin-top: 3px; }
.check-option strong, .check-option small { display: block; }
.check-option strong { font-size: .75rem; }
.check-option small { margin-top: 2px; color: var(--muted); font-size: .69rem; }
.export-selection { border: 1px solid var(--line); border-radius: 10px; background: #f1f2ef; }
.export-selection > summary { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 11px 14px; cursor: pointer; list-style: none; }
.export-selection > summary::-webkit-details-marker { display: none; }
.export-selection > summary strong, .export-selection > summary small { display: block; }
.export-selection > summary strong { font-size: .75rem; }
.export-selection > summary small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.export-selection > div { padding: 0 13px 13px; }
.export-search { width: 100%; margin-bottom: 8px; }
.export-option-groups { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.export-option-groups > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.export-option-groups label { min-height: 42px; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: .7rem; }
.export-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 14px; padding: 13px 15px; border-radius: 9px; color: var(--accent-dark); background: var(--accent-soft); }
.export-summary strong, .export-summary small { display: block; }
.export-summary strong { font-size: 1.05rem; }
.export-summary small, .export-summary > span:last-child { font-size: .7rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.compact-output-dialog { width: min(540px, calc(100% - 28px)); padding: 24px; }
.output-choices { display: grid; gap: 8px; }
.output-choice { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; text-align: left; text-decoration: none; cursor: pointer; }
.output-choice:hover { color: var(--ink); background: #eef0ed; }
.output-choice.recommended { border-color: #aebcb3; background: var(--accent-soft); }
.output-choice strong, .output-choice small { display: block; }
.output-choice strong { font-size: .78rem; }
.output-choice small { margin-top: 2px; color: var(--muted); font-size: .7rem; }

.history-toolbar { display: grid; grid-template-columns: minmax(230px, 1fr) auto auto; gap: 8px; padding: 13px 17px; border-top: 1px solid var(--line); }
.history-toolbar .search-box { width: 100%; min-width: 0; }
.history-count { padding: 8px 17px; color: var(--muted); background: #eceeeb; font-size: .7rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 13px; font-size: .72rem; }
.pagination a { font-weight: 800; text-decoration: none; }
.editor-toolbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.editor-toolbar .search-box { width: min(420px, 100%); }
.editor-toolbar .muted { margin-left: auto; font-size: .69rem; }
.editor-status { min-width: 110px; color: var(--accent-dark); font-size: .71rem; font-weight: 800; }
.editor-status.is-working { color: var(--muted); }
.editor-status.is-error { color: var(--danger); }
.compact-disclosure { margin-bottom: 12px; }
.issue-list { display: grid; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--line); }
.issue-list p { margin: 0; color: var(--warm); font-size: .72rem; }
.cohort-editor { overflow: hidden; padding: 0; }
.cohort-editor .scroll-hint { padding: 11px 14px 0; }
.editor-grid { min-width: 1320px; table-layout: fixed; }
.editor-grid td { height: 150px; padding: 5px; transition: background .14s ease, box-shadow .14s ease; }
.editor-grid td.is-drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.editor-lessons { display: grid; gap: 5px; }
.editor-lesson { position: relative; padding: 8px 8px 7px; border: 1px solid #cbd4ce; border-left: 3px solid var(--accent); border-radius: 7px; background: #f4f6f3; cursor: grab; transition: border-color .14s ease, background .14s ease, opacity .14s ease; }
.editor-lesson:hover, .editor-lesson:focus-within { border-color: var(--accent); background: #fff; }
.editor-lesson.is-dragging { opacity: .4; }
.editor-lesson.is-drop-target { border-color: var(--accent-dark); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-dark); }
.editor-lesson strong, .editor-lesson span, .editor-lesson small { display: block; padding-right: 34px; }
.editor-lesson strong { font-size: .68rem; }
.editor-lesson span { margin-top: 2px; color: var(--muted); font-size: .61rem; }
.editor-lesson small { margin-top: 2px; color: var(--accent-dark); font-size: .61rem; }
.editor-lesson button { position: absolute; top: 6px; right: 5px; padding: 3px 5px; border: 0; border-radius: 5px; color: var(--accent-dark); background: #e4e9e5; font-size: .58rem; font-weight: 800; cursor: pointer; }
.editor-empty { display: grid; min-height: 42px; place-items: center; color: #8b908c; font-size: .62rem; }
.lesson-edit-dialog { width: min(620px, calc(100% - 28px)); }
.lesson-edit-dialog .export-grid { grid-template-columns: 1fr 1fr; }

@media (max-width: 900px) {
  .legacy-converter-grid { grid-template-columns: 1fr; }
  .legacy-file-drop { align-items: flex-start; flex-wrap: wrap; }
  .legacy-file-drop input { width: 100%; margin-left: 59px; }
  .task-grid, .available-slot-list { grid-template-columns: 1fr 1fr; }
  .selection-list { grid-template-columns: 1fr; }
  .selection-list > a:nth-child(odd) { border-right: 0; }
  .directory-search-tools { align-items: stretch; flex-direction: column; }
  .export-grid { grid-template-columns: 1fr 1fr; }
  .history-toolbar { grid-template-columns: 1fr 180px; }
  .editor-toolbar { align-items: stretch; flex-direction: column; }
  .editor-toolbar .muted { margin-left: 0; }
}

@media (max-width: 700px) {
  .legacy-review-intro, .legacy-review-actions { align-items: stretch; flex-direction: column; }
  .legacy-review-actions .btn { width: 100%; }
  .legacy-file-drop input { margin-left: 0; }
  .task-grid, .available-slot-list, .current-lesson-list, .export-grid { grid-template-columns: 1fr; }
  .selection-toolbar, .selection-summary, .preview-picker-bar, .context-bar, .schedule-toolbar { align-items: stretch; flex-direction: column; }
  .selection-list > a { grid-template-columns: auto 1fr; }
  .selection-progress { grid-column: 2; }
  .entity-picker-row { grid-template-columns: 1fr; }
  .current-lesson-list article:nth-child(odd) { border-right: 0; }
  .slot-filter { overflow-x: auto; }
  .directory-cohorts { width: 100%; }
  .directory-cohorts button { flex: 1; }
  .school-grid-wrap { display: none; }
  .school-panel .school-agenda { display: block; padding: 1rem; }
  .output-dialog > form, .compact-output-dialog { padding: 18px; }
  .export-option-groups > div { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
  .history-toolbar { grid-template-columns: 1fr; }
  .issue-row { align-items: flex-start; flex-direction: column; }
  .lesson-edit-dialog .export-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
