:root {
  --sidebar: #2d2a27;
  --sidebar-2: #211f1d;
  --sidebar-line: #47423d;
  --canvas: #e8e6df;
  --paper: #fbfaf6;
  --paper-2: #f4f1e9;
  --ink: #252b2f;
  --muted: #6d7477;
  --line: #d9d5ca;
  --line-strong: #c4beb1;
  --accent: #b85f3b;
  --accent-dark: #8f4328;
  --accent-soft: #f5e7df;
  --blue: #315f78;
  --blue-soft: #e4edf1;
  --green: #4d765d;
  --green-soft: #e8f0e9;
  --amber: #9a6b23;
  --amber-soft: #f7eedc;
  --shadow: 0 14px 40px rgba(43, 47, 47, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), transparent 65%);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 20;
  display: flex; flex-direction: column; overflow: auto;
  color: #e7e6df; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-right: 1px solid #111719;
}
.brand { min-height: 91px; padding: 19px 20px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: inherit; text-decoration: none; border-bottom: 1px solid var(--sidebar-line); }
.brand img { display: block; width: 146px; height: auto; filter: saturate(.8) brightness(1.35); }
.project-switcher { padding: 20px; border-bottom: 1px solid var(--sidebar-line); }
.project-switcher label, .sidebar-heading > span, .sidebar-footer > p { display: block; margin: 0 0 9px; color: #8e999d; font: 700 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .14em; }
.project-switcher select { width: 100%; min-height: 39px; padding: 0 31px 0 10px; border: 1px solid #575049; border-radius: 4px; color: #f1f1ed; background: #24211f; }
.text-button { margin-top: 10px; padding: 0; border: 0; color: #d0d4d4; background: transparent; font-size: 12px; cursor: pointer; }
.text-button:hover { color: white; }
.sidebar-section { padding: 20px; }
.recent-section { min-height: 0; flex: 1; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; }
.sidebar-heading > span { margin: 0; }
.sidebar-heading button { padding: 0; border: 0; color: #778286; background: transparent; font-size: 10px; cursor: pointer; }
.sidebar-heading button:hover { color: #d6dada; }
.recent-list { margin-top: 12px; display: grid; gap: 5px; }
.recent-entry { position: relative; min-width: 0; }
.recent-item { width: 100%; padding: 10px 30px 10px 10px; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; border: 1px solid transparent; border-radius: 5px; color: #d8dada; background: transparent; text-align: left; cursor: pointer; }
.recent-item > span:last-child { min-width: 0; overflow: hidden; }
.recent-item:hover, .recent-item.active { border-color: #5a534c; background: rgba(255,255,255,.045); }
.recent-delete { position: absolute; top: 50%; right: 7px; width: 23px; height: 23px; padding: 0; display: grid; place-items: center; transform: translateY(-50%); border: 0; border-radius: 3px; color: #747d80; background: transparent; font-size: 14px; cursor: pointer; opacity: 0; }
.recent-entry:hover .recent-delete, .recent-delete:focus-visible { opacity: 1; }
.recent-delete:hover { color: #f0c2b0; background: rgba(184,95,59,.16); }
.recent-code { display: grid; place-items: center; width: 34px; height: 30px; border: 1px solid #696159; border-radius: 3px; color: #dbc1b5; font: 700 10px/1 ui-monospace, monospace; }
.recent-item strong { display: block; max-width: 100%; overflow: hidden; color: #eef0ee; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.recent-item small { display: block; max-width: 100%; margin-top: 3px; overflow: hidden; color: #899397; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.empty-recent { padding: 17px 4px; color: #7f8a8e; font-size: 11px; line-height: 1.5; }
.sidebar-footer { padding: 18px 20px 20px; border-top: 1px solid var(--sidebar-line); }
.session-row { display: flex; gap: 10px; align-items: center; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; color: #f8ede7; background: var(--accent); font: 700 11px/1 ui-monospace, monospace; }
.session-row strong { display: block; font-size: 12px; }
.session-row small { display: block; margin-top: 3px; color: #8e999d; font-size: 9px; }
.sidebar-actions { margin-top: 14px; display: flex; align-items: center; gap: 14px; }
.sidebar-actions a, .sidebar-actions button { height: 28px; padding: 0; display: inline-flex; align-items: center; border: 0; color: #929da1; background: none; font-size: 10px; line-height: 1; text-decoration: none; cursor: pointer; }
.sidebar-actions form { height: 28px; margin: 0; display: flex; align-items: center; }
.sidebar-actions [hidden] { display: none; }
.sidebar-actions a:hover, .sidebar-actions button:hover { color: #fff; }

.work-area { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; min-height: 64px; padding: 0 28px; display: flex; align-items: center; border-bottom: 1px solid var(--line-strong); background: color-mix(in srgb, var(--paper), transparent 4%); backdrop-filter: blur(12px); }
.topbar nav { display: flex; gap: 4px; align-items: center; }
.topbar nav button { min-height: 37px; padding: 0 14px; border: 0; border-radius: 4px; color: #4e5659; background: transparent; font-size: 12px; font-weight: 650; cursor: pointer; }
.topbar nav button:hover, .topbar nav button.active { color: var(--ink); background: #dedbd2; }
.topbar nav button.primary-nav { color: #fff; background: var(--accent); }
.topbar nav button.primary-nav:hover { background: var(--accent-dark); }
.topbar nav button span { margin-right: 4px; }
.topbar nav button .mobile-label { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.prototype-badge { padding: 5px 8px; border: 1px solid #c9a696; border-radius: 3px; color: #8c5137; background: #f7ebe4; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
.icon-button { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--paper); font-size: 11px; cursor: pointer; }
.mobile-menu { display: none; border: 0; background: transparent; color: var(--ink); font-size: 20px; }

.page-frame { width: min(1440px, 100%); margin: 0 auto; padding: 27px 28px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 238px; gap: 22px; align-items: start; }
.page-frame.context-hidden { width: min(1220px, 100%); grid-template-columns: minmax(0, 1fr); }
#main-content { min-width: 0; }
#main-content:focus { outline: none; }
.paper { min-height: calc(100vh - 152px); padding: 42px 48px 55px; position: relative; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 2px; box-shadow: var(--shadow); }
.paper::before { content: ""; position: absolute; inset: 14px 14px auto; height: 1px; background: #ece8df; }
.document-header { padding-bottom: 26px; display: flex; gap: 28px; justify-content: space-between; border-bottom: 1px solid var(--line); }
.kicker, .eyebrow { display: block; margin: 0 0 11px; color: var(--accent); font: 700 10px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .13em; }
.document-header h1, .hero h1 { max-width: 760px; margin: 0; color: #272b2d; font: 500 clamp(29px, 4vw, 44px)/1.08 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
.document-header p, .hero p { max-width: 680px; margin: 13px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.doc-stamp { flex: 0 0 118px; align-self: flex-start; padding: 10px; border: 1px solid var(--line-strong); text-align: center; }
.doc-stamp span { display: block; color: var(--muted); font: 700 8px/1.3 ui-monospace, monospace; letter-spacing: .12em; }
.doc-stamp strong { display: block; margin-top: 5px; font: 600 17px/1 Georgia, serif; }
.doc-stamp small { display: block; margin-top: 7px; color: var(--accent); font-size: 9px; }
.hero { padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 25px; }
.hero-actions { flex: 0 0 auto; display: flex; gap: 8px; }
.dashboard-head { padding-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.dashboard-head h1 { margin: 0; font: 500 clamp(27px, 3.5vw, 38px)/1.1 Georgia, "Times New Roman", serif; }
.dashboard-head p { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.dashboard-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.button { min-height: 38px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 4px; font-size: 11px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button.primary { color: white; border-color: var(--accent); background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--ink); border-color: var(--line-strong); background: var(--paper); }
.button.secondary:hover { background: var(--paper-2); }
.button.ghost { min-height: 32px; padding: 0 10px; color: var(--muted); border-color: var(--line); background: transparent; }
.status-strip { margin-top: 24px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.status-cell { min-height: 75px; padding: 14px 16px; border-right: 1px solid var(--line); }
.status-cell:last-child { border-right: 0; }
.status-cell span { display: block; color: var(--muted); font: 700 8px/1.2 ui-monospace, monospace; letter-spacing: .11em; }
.status-cell strong { display: block; margin-top: 8px; font: 600 15px/1.2 Georgia, serif; }
.status-cell small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }

.section { padding: 30px 0 0; }
.section + .section { margin-top: 31px; border-top: 1px solid var(--line); }
.section-title { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-title h2 { margin: 0; font: 500 22px/1.2 Georgia, serif; }
.section[aria-labelledby="quick-actions-title"] { padding-top: 0; }
#quick-actions-title { margin: 0; font: 500 clamp(27px, 3.5vw, 38px)/1.1 Georgia, "Times New Roman", serif; }
.section-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.section-title > span { color: var(--muted); font: 700 9px/1.2 ui-monospace, monospace; }
.workflow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.workflow-card { padding: 16px; border: 1px solid var(--line); background: #fdfcf9; }
.workflow-card span { color: var(--accent); font: 700 10px/1 ui-monospace, monospace; }
.workflow-card strong { display: block; margin-top: 14px; font: 600 14px/1.2 Georgia, serif; }
.workflow-card p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.panel { padding: 20px; border: 1px solid var(--line); background: #fdfcf9; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head h3 { margin: 0; font: 600 16px/1.2 Georgia, serif; }
.panel-head button { padding: 0; border: 0; color: var(--accent); background: none; font-size: 10px; cursor: pointer; }
.quick-list { margin-top: 15px; display: grid; gap: 8px; }
.quick-item { width: 100%; padding: 12px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); color: var(--ink); background: var(--paper); text-align: left; cursor: pointer; }
.quick-item:hover { border-color: #c49d89; background: #fffaf6; }
.quick-item .code { color: var(--accent); font: 700 11px/1 ui-monospace, monospace; }
.quick-item strong { display: block; font-size: 11px; }
.quick-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.quick-item .arrow { color: var(--accent); }
.project-card { min-height: 100%; padding: 22px; display: flex; flex-direction: column; color: var(--ink); border: 1px solid var(--line); background: #fdfcf9; }
.project-card .kicker { color: var(--accent); }
.project-card h3 { margin: 0; font: 500 24px/1.16 Georgia, serif; }
.project-card > p { margin: 8px 0 22px; color: var(--muted); font-size: 11px; }
.project-progress { margin-top: auto; }
.project-progress div { height: 5px; overflow: hidden; background: #4a555a; }
.project-progress span { display: block; width: 35%; height: 100%; background: var(--accent); }
.project-progress p { margin: 8px 0 0; color: #9eaaad; font-size: 9px; }
.work-table { border-top: 1px solid var(--line); }
.work-row { min-height: 65px; display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: stretch; border-bottom: 1px solid var(--line); }
.work-open { width: 100%; padding: 12px 8px; display: grid; grid-template-columns: 54px minmax(0, 1fr) 120px 90px 24px; gap: 12px; align-items: center; border: 0; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.work-open:hover, .work-row:has(.work-delete:hover) { background: #f7f3eb; }
.work-row .code { color: var(--accent); font: 700 10px/1 ui-monospace, monospace; }
.work-row strong { display: block; overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.work-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.work-row time { color: var(--muted); font-size: 9px; }
.work-row .state { width: fit-content; padding: 5px 7px; color: var(--amber); background: var(--amber-soft); font: 700 8px/1 ui-monospace, monospace; }
.work-row .arrow { color: var(--accent); }
.work-delete { margin: 0; padding: 0; border: 0; border-left: 1px solid transparent; color: #9c9890; background: transparent; font-size: 16px; cursor: pointer; }
.work-delete:hover { color: var(--accent); border-left-color: var(--line); background: var(--accent-soft); }
.project-facts { margin: 16px 0 0; display: grid; gap: 11px; }
.project-facts div { padding-bottom: 10px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.project-facts dt { color: var(--muted); font-size: 9px; }
.project-facts dd { margin: 0; color: var(--ink); font-size: 10px; text-align: right; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action-card { min-height: 112px; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); color: var(--ink); background: #fdfcf9; text-align: left; cursor: pointer; }
.action-card:hover { border-color: #c49d89; background: #fffaf6; }
.action-card span { color: var(--accent); font: 700 9px/1 ui-monospace, monospace; }
.action-card strong { margin-top: 15px; font: 600 14px/1.2 Georgia, serif; }
.action-card small { margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.45; }

.filter-row { margin: 24px 0 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 250px; }
.search-box input { width: 100%; min-height: 40px; padding: 0 13px 0 35px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink); background: #fff; }
.search-box::before { content: "⌕"; position: absolute; left: 12px; top: 8px; color: var(--muted); font-size: 18px; }
.filter-chip { min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--paper); font-size: 10px; cursor: pointer; }
.filter-chip.active { color: var(--accent-dark); border-color: #c99178; background: var(--accent-soft); }
.catalog-list { border-top: 1px solid var(--line); }
.catalog-item { width: 100%; padding: 17px 8px; display: grid; grid-template-columns: 62px 1fr 126px 26px; gap: 12px; align-items: center; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.catalog-item:hover { background: #f7f3eb; }
.catalog-code { color: var(--accent); font: 700 11px/1 ui-monospace, monospace; }
.catalog-copy strong { display: block; font: 600 15px/1.25 Georgia, serif; }
.catalog-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.status { width: fit-content; padding: 5px 7px; border-radius: 3px; font: 700 8px/1 ui-monospace, monospace; letter-spacing: .05em; }
.status.prototype { color: var(--blue); background: var(--blue-soft); }
.status.planned { color: var(--amber); background: var(--amber-soft); }
.status.legacy { color: var(--green); background: var(--green-soft); }
.status.verified { color: var(--green); background: var(--green-soft); }
.status.unverified { color: var(--amber); background: var(--amber-soft); }
.catalog-arrow { color: #a5a19a; font-size: 16px; }

.form-section { margin-top: 28px; }
.form-section + .form-section { padding-top: 29px; border-top: 1px solid var(--line); }
.form-section-head { margin-bottom: 17px; display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: start; }
.section-number { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid #cda994; border-radius: 50%; color: var(--accent); font: 700 10px/1 ui-monospace, monospace; }
.form-section-head h2 { margin: 1px 0 0; font: 500 20px/1.2 Georgia, serif; }
.form-section-head p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field > span, .field > label { color: #50575a; font-size: 10px; font-weight: 750; }
.input-unit { display: grid; grid-template-columns: 1fr auto; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--ink); background: #fff; }
.field textarea { min-height: 72px; resize: vertical; }
.input-unit input { border-radius: 3px 0 0 3px; }
.input-unit em { min-width: 58px; padding: 0 10px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 3px 3px 0; color: var(--muted); background: var(--paper-2); font-size: 9px; font-style: normal; }
.field small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.info-banner { margin: 17px 0; padding: 13px 15px; display: flex; gap: 10px; border-left: 3px solid var(--blue); color: #40545e; background: var(--blue-soft); font-size: 10px; line-height: 1.55; }
.warning-banner { margin: 17px 0; padding: 13px 15px; border-left: 3px solid var(--amber); color: #6e542a; background: var(--amber-soft); font-size: 10px; line-height: 1.55; }
.calculation-actions { margin-top: 22px; display: flex; align-items: center; gap: 9px; }
.calculation-actions .saved-note { margin-left: auto; color: var(--muted); font-size: 9px; }
.formula-block { margin-top: 17px; padding: 18px; border: 1px solid var(--line); background: #f7f5ef; }
.formula-block span { color: var(--muted); font: 700 8px/1.2 ui-monospace, monospace; letter-spacing: .1em; }
.formula-block code { display: block; margin-top: 9px; color: #3e484d; font: 600 14px/1.5 "SFMono-Regular", Consolas, monospace; }
.result-grid { margin-top: 17px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.result { min-height: 100px; padding: 17px; border-right: 1px solid var(--line); }
.result:last-child { border-right: 0; }
.result span { color: var(--muted); font: 700 8px/1.2 ui-monospace, monospace; letter-spacing: .08em; }
.result strong { display: block; margin-top: 9px; font: 500 25px/1 Georgia, serif; }
.result small { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }
.result.pass strong { color: var(--green); }
.result.pending strong { color: var(--amber); font-size: 17px; }
.reference-list { margin: 14px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.reference-list li { padding: 12px 0; display: grid; grid-template-columns: 75px 1fr; gap: 12px; border-bottom: 1px solid var(--line); font-size: 10px; line-height: 1.5; }
.reference-list code { color: var(--accent); font: 700 9px/1.5 ui-monospace, monospace; }
.route-trace { margin-top: 18px; display: flex; align-items: stretch; gap: 6px; }
.route-step { flex: 1; padding: 13px; border: 1px solid var(--line); background: #fdfcf9; }
.route-step span { color: var(--accent); font: 700 8px/1 ui-monospace, monospace; }
.route-step strong { display: block; margin-top: 8px; font-size: 10px; line-height: 1.45; }
.route-arrow { display: grid; place-items: center; color: #aaa59b; }

.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.data-card { min-height: 150px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); color: var(--ink); background: #fdfcf9; text-align: left; }
button.data-card { width: 100%; cursor: pointer; }
button.data-card:hover { border-color: #c49d89; background: #fffaf6; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(50,45,40,.06); }
.data-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.data-card .code { color: var(--accent); font: 700 9px/1 ui-monospace, monospace; }
.data-card h3 { margin: 14px 0 0; font: 600 16px/1.2 Georgia, serif; }
.data-card p { margin: 7px 0 14px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.data-card footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 9px; }
.data-records { margin-top: 18px; border-top: 1px solid var(--line); }
.data-record { padding: 14px 0; display: grid; grid-template-columns: 150px 1fr 110px; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); }
.data-record code { color: var(--accent); font: 700 9px/1.4 ui-monospace, monospace; }
.data-record strong { display: block; font-size: 11px; }
.data-record small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.data-record span { color: var(--muted); font-size: 9px; text-align: right; }
.lock-note { margin-bottom: 22px; padding: 15px 17px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid #cfd8dc; background: var(--blue-soft); }
.lock-note strong { display: block; color: #365b6e; font-size: 11px; }
.lock-note p { margin: 4px 0 0; color: #5c747f; font-size: 10px; line-height: 1.5; }

.project-list { margin-top: 23px; display: grid; gap: 11px; }
.project-row { padding: 17px; display: grid; grid-template-columns: 46px 1fr 120px auto; gap: 15px; align-items: center; border: 1px solid var(--line); background: #fdfcf9; }
.project-initials { display: grid; place-items: center; width: 42px; height: 42px; color: #6a4332; background: var(--accent-soft); font: 700 11px/1 ui-monospace, monospace; }
.project-row strong { display: block; font: 600 15px/1.2 Georgia, serif; }
.project-row small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.project-meta span { display: block; color: var(--muted); font-size: 9px; }
.project-meta strong { margin-top: 4px; font: 650 10px/1.2 ui-sans-serif, sans-serif; }
.project-tabs { margin: 24px 0 0; display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.project-tabs button { min-height: 39px; padding: 0 13px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; }
.project-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.fluid-list { margin-top: 18px; border-top: 1px solid var(--line); }
.fluid-row { min-height: 76px; padding: 13px 8px; display: grid; grid-template-columns: 64px minmax(0, 1fr) 130px 95px auto; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.fluid-code { color: var(--accent); font: 700 10px/1 ui-monospace, monospace; }
.fluid-row strong { display: block; font: 600 13px/1.3 Georgia, serif; }
.fluid-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.fluid-source { color: var(--blue); font: 700 8px/1 ui-monospace, monospace; text-transform: uppercase; }
.fluid-property { color: var(--muted); font-size: 9px; }
.row-actions { display: flex; gap: 5px; }
.row-actions button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.row-actions button:hover { color: var(--ink); background: var(--paper-2); }
.row-actions button.danger-link:hover { color: var(--accent); border-color: #d1a18c; background: var(--accent-soft); }
.empty-state { padding: 36px 20px; border: 1px dashed var(--line-strong); text-align: center; }
.empty-state strong { display: block; font: 600 16px/1.2 Georgia, serif; }
.empty-state p { margin: 8px auto 16px; max-width: 480px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.context-panel { position: sticky; top: 91px; display: grid; gap: 12px; }
.context-card { padding: 16px; border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--paper), transparent 10%); }
.context-card h3 { margin: 0 0 13px; color: #555d60; font: 700 9px/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.outline-list { margin: 0; padding: 0; list-style: none; }
.outline-list li { padding: 7px 0; display: flex; gap: 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.35; }
.outline-list li:last-child { border-bottom: 0; }
.outline-list span { color: var(--accent); font: 700 8px/1.5 ui-monospace, monospace; }
.context-meta { margin: 0; display: grid; gap: 11px; }
.context-meta div { display: grid; gap: 3px; }
.context-meta dt { color: var(--muted); font: 700 8px/1.2 ui-monospace, monospace; letter-spacing: .08em; }
.context-meta dd { margin: 0; font-size: 10px; line-height: 1.4; }
.context-note { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }

.modal { width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--ink); background: var(--paper); box-shadow: 0 28px 80px rgba(20,25,27,.3); }
.modal.fluid-modal { width: min(760px, calc(100% - 32px)); }
.modal::backdrop { background: rgba(23, 29, 31, .64); backdrop-filter: blur(3px); }
.modal form { padding: 28px; }
.modal-head { margin-bottom: 22px; display: flex; justify-content: space-between; gap: 20px; }
.modal h2 { margin: 0; font: 500 24px/1.2 Georgia, serif; }
.close-button { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: transparent; font-size: 20px; cursor: pointer; }
.modal label { margin-top: 14px; display: grid; gap: 7px; color: #535a5d; font-size: 10px; font-weight: 750; }
.modal input { width: 100%; min-height: 41px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; }
.form-note { margin: 15px 0 0; color: var(--muted); font-size: 9px; }
.modal-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 9px; }
.button.danger { color: #fff; border-color: #9f3d31; background: #9f3d31; }
.button.danger:hover { background: #7e2e26; }
.confirm-name { margin: 0; padding: 14px 16px; border: 1px solid var(--line); color: var(--ink); background: var(--paper-2); font: 600 14px/1.4 Georgia, serif; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 360px; padding: 12px 15px; border-radius: 4px; color: white; background: #2e373b; box-shadow: 0 14px 35px rgba(0,0,0,.25); font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

html[data-theme="dark"] {
  --canvas: #151a1d; --paper: #22292d; --paper-2: #293136; --ink: #e7e7e2; --muted: #9aa3a5;
  --line: #3a4449; --line-strong: #4a555a; --accent-soft: #442d24; --blue-soft: #283b44;
  --green-soft: #273b2f; --amber-soft: #403625; --shadow: 0 14px 40px rgba(0,0,0,.2);
  color-scheme: dark;
}
html[data-theme="dark"] .document-header h1, html[data-theme="dark"] .hero h1 { color: #efeee8; }
html[data-theme="dark"] .topbar { background: rgba(34,41,45,.95); }
html[data-theme="dark"] .topbar nav button:hover, html[data-theme="dark"] .topbar nav button.active { background: #343d42; }
html[data-theme="dark"] .prototype-badge { color: #e5a78a; border-color: #6b4d40; background: #3c2b24; }
html[data-theme="dark"] .paper::before { background: #313a3f; }
html[data-theme="dark"] .workflow-card, html[data-theme="dark"] .panel, html[data-theme="dark"] .quick-item,
html[data-theme="dark"] .route-step, html[data-theme="dark"] .data-card, html[data-theme="dark"] .project-row { background: #242c30; }
html[data-theme="dark"] .quick-item:hover, html[data-theme="dark"] .catalog-item:hover { background: #2c353a; }
html[data-theme="dark"] button.data-card:hover { background: #2c353a; }
html[data-theme="dark"] .work-open:hover, html[data-theme="dark"] .work-row:has(.work-delete:hover), html[data-theme="dark"] .action-card:hover { background: #2c353a; }
html[data-theme="dark"] .action-card { background: #242c30; }
html[data-theme="dark"] .project-card { background: #242c30; }
html[data-theme="dark"] .project-card { background: linear-gradient(155deg, #303a3f, #1a2023); }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .search-box input, html[data-theme="dark"] .modal input { color: var(--ink); background: #1b2225; }
html[data-theme="dark"] .formula-block { background: #1d2427; }
html[data-theme="dark"] .formula-block code { color: #d2d7d6; }
html[data-theme="dark"] .context-card { background: #20272b; }

@media (max-width: 1120px) {
  .page-frame { grid-template-columns: minmax(0, 1fr); }
  .context-panel { position: static; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 264px; transition: transform .2s ease; box-shadow: 18px 0 50px rgba(0,0,0,.28); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-menu { display: block; margin-right: 8px; }
  .paper { padding: 34px 30px 45px; }
  .workflow, .status-strip { grid-template-columns: repeat(2, 1fr); }
  .status-cell:nth-child(2) { border-right: 0; }
  .status-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar { padding: 0 14px; }
  .topbar nav button { padding: 0 9px; }
  .topbar nav button .desktop-label { display: none; }
  .topbar nav button .mobile-label { display: inline; margin: 0; }
  .prototype-badge, [data-theme-label] { display: none; }
  .page-frame { padding: 16px 12px 38px; }
  .paper { min-height: 0; padding: 29px 20px 38px; }
  .document-header, .hero-row { display: block; }
  .dashboard-head { display: block; }
  .dashboard-actions { margin-top: 18px; }
  .doc-stamp { width: 118px; margin-top: 18px; }
  .hero-actions { margin-top: 18px; }
  .workflow, .data-grid, .field-grid, .field-grid.three, .context-panel { grid-template-columns: 1fr; }
  .status-strip, .result-grid { grid-template-columns: 1fr; }
  .status-cell, .status-cell:nth-child(2), .result { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-cell:last-child, .result:last-child { border-bottom: 0; }
  .catalog-item { grid-template-columns: 48px 1fr 22px; }
  .catalog-item .status { grid-column: 2; grid-row: 2; }
  .catalog-arrow { grid-column: 3; grid-row: 1; }
  .project-row { grid-template-columns: 42px 1fr auto; }
  .project-meta { display: none; }
  .project-tabs { overflow-x: auto; }
  .project-tabs button { flex: 0 0 auto; }
  .fluid-row { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .fluid-source, .fluid-property { display: none; }
  .work-open { grid-template-columns: 46px minmax(0, 1fr) 24px; }
  .work-row time, .work-row .state { display: none; }
  .route-trace { flex-direction: column; }
  .route-arrow { transform: rotate(90deg); }
  .data-record { grid-template-columns: 90px 1fr; }
  .data-record span { grid-column: 2; text-align: left; }
}
