@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #202a2b;
  --muted: #7a8582;
  --line: #e7eae6;
  --paper: #f4f5f2;
  --white: #fff;
  --green: #237664;
  --green-dark: #1c6254;
  --green-pale: #e7f1ed;
  --orange: #db7545;
  --mono: "DM Mono", Consolas, monospace;
  --sans: "DM Sans", "Segoe UI", sans-serif;
  --display: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; width: 248px; flex-direction: column; padding: 29px 17px 20px; background: #202c2c; color: #f2f3ef; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: #31544d; color: #a4d2c3; }
.brand-mark svg { width: 24px; height: 24px; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-family: var(--display); font-size: 12px; letter-spacing: 1.7px; }
.brand-copy small { color: #a3afaa; font-family: var(--mono); font-size: 8px; letter-spacing: 1.1px; }
.nav-label { margin: 57px 9px 13px; color: #899692; font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; }
.tool-nav { display: grid; gap: 5px; }
.nav-item { display: flex; height: 43px; align-items: center; gap: 11px; border: 0; border-radius: 7px; padding: 0 11px; background: transparent; color: #b9c3be; cursor: pointer; text-align: left; font-size: 12px; transition: background .18s, color .18s; }
.nav-item:hover { background: #2a3a38; color: white; }
.nav-item.active { background: #304a43; color: #d9f0e6; }
.nav-icon { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 5px; background: #3a574f; color: #a8d2c1; font-size: 15px; }
.post-icon { font-size: 19px; }
.sidebar-note { display: flex; gap: 10px; margin: auto 5px 20px; padding: 14px 11px; border: 1px solid #394541; border-radius: 8px; background: #263331; }
.note-indicator, .status-dot { flex: none; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #75b69a; box-shadow: 0 0 0 3px #345247; }
.sidebar-note strong { font-size: 10px; font-weight: 600; }
.sidebar-note p { margin: 5px 0 0; color: #a1aea8; font-size: 10px; }
.sidebar-footer { display: flex; justify-content: space-between; padding: 0 8px; color: #82908b; font-family: var(--mono); font-size: 8px; letter-spacing: .7px; }
.sidebar-footer span { color: #adb6b2; }
.main { min-height: 100vh; margin-left: 248px; }
.topbar { display: flex; height: 58px; align-items: center; justify-content: space-between; padding: 0 48px; border-bottom: 1px solid #e9ebe7; background: rgba(255,255,255,.54); }
.breadcrumb { display: flex; gap: 10px; color: #66716e; font-family: var(--mono); font-size: 9px; letter-spacing: 1px; }
.breadcrumb span:first-child { color: #9ba39f; }
.crumb-slash { color: #c2c8c3; }
.topbar-right { display: flex; align-items: center; gap: 9px; color: #7a8582; font-size: 10px; }
.topbar-right .status-dot { width: 6px; height: 6px; margin: 0; box-shadow: none; }
.content { width: min(1200px, 100%); margin: 0 auto; padding: 38px 48px 25px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.eyebrow, .section-kicker { display: flex; align-items: center; gap: 8px; color: var(--green); font-family: var(--mono); font-size: 9px; letter-spacing: 1.35px; }
.eyebrow-line { width: 17px; height: 1px; background: #4e9d84; }
h1, h2, p { margin-top: 0; }
h1 { margin: 10px 0 7px; font-family: var(--display); font-size: clamp(27px, 3vw, 36px); font-weight: 700; letter-spacing: -1.8px; line-height: 1.15; }
h1 > span { color: var(--orange); }
.page-heading p { margin: 0; color: #78827e; font-size: 12px; }
.heading-badge { display: flex; align-items: center; gap: 9px; margin-bottom: 3px; padding: 8px 11px; border: 1px solid #e4e8e3; border-radius: 7px; background: rgba(255,255,255,.52); color: #89938f; font-family: var(--mono); font-size: 8px; line-height: 1.8; letter-spacing: .4px; }
.heading-badge strong { color: #4b5752; font-size: 9px; font-weight: 500; }
.badge-icon { color: #4a8c78; font-size: 21px; }
.workspace { display: grid; grid-template-columns: minmax(260px, .78fr) minmax(380px, 1.32fr); align-items: start; gap: 17px; }
.workspace[hidden] { display: none; }
.panel { border: 1px solid #e7eae6; border-radius: 9px; background: var(--white); box-shadow: 0 2px 7px rgba(34,48,42,.025); }
.input-panel { padding: 20px 20px 16px; }
.panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.panel-icon { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 7px; background: var(--green-pale); color: var(--green); }
.panel-icon svg { width: 21px; height: 21px; }
.panel-heading h2 { margin: 0 0 3px; font-family: var(--display); font-size: 13px; font-weight: 700; }
.panel-heading p { margin: 0; color: #85908b; font-size: 10px; }
.field-label { display: block; margin: 14px 0 6px; color: #46524d; font-size: 10px; font-weight: 600; }
.required { color: var(--orange); }
.input-wrap { display: flex; height: 39px; align-items: center; border: 1px solid #dfe4de; border-radius: 6px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: #6aa28d; box-shadow: 0 0 0 3px rgba(63,140,112,.10); }
.input-wrap input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0 11px; background: transparent; color: #263430; font-family: var(--mono); font-size: 12px; }
.input-wrap > span { padding: 0 11px; color: #9ba49f; font-family: var(--mono); font-size: 9px; }
.field-hint { margin: 5px 0 0; color: #929b96; font-size: 9px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field-label { white-space: nowrap; }
.primary-button { display: flex; width: 100%; height: 41px; align-items: center; justify-content: space-between; margin-top: 20px; border: 0; border-radius: 6px; padding: 0 13px; background: var(--green); color: white; cursor: pointer; font-size: 11px; font-weight: 600; transition: background .16s, transform .16s; }
.primary-button:hover { transform: translateY(-1px); background: var(--green-dark); }
.primary-button span:last-child { font-size: 17px; font-weight: 400; }
.formula-note { display: flex; gap: 10px; margin-top: 15px; padding: 11px 10px; border-radius: 6px; background: #f5f7f4; color: #78827d; font-size: 9px; line-height: 1.65; }
.formula-note strong { color: #53605a; font-size: 9px; font-weight: 600; }
.formula-symbol { color: #39826b; font-family: Georgia, serif; font-size: 16px; font-style: italic; }
.results-column { display: grid; gap: 12px; }
.results-panel { overflow: hidden; }
.results-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid #edf0ed; }
.results-header h2, .history-heading h2 { margin: 6px 0 0; font-family: var(--display); font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.section-kicker { font-size: 8px; letter-spacing: 1.25px; }
.result-count { min-width: 27px; height: 25px; display: grid; place-items: center; border-radius: 6px; background: #edf4f0; color: var(--green); font-family: var(--mono); font-size: 10px; }
.results-body { max-height: 326px; overflow: auto; padding: 0 18px; }
.results-table { width: 100%; border-collapse: collapse; text-align: left; }
.results-table th { height: 35px; color: #98a19c; font-family: var(--mono); font-size: 8px; font-weight: 400; letter-spacing: .5px; text-transform: uppercase; }
.results-table td { height: 42px; border-top: 1px solid #eff1ef; color: #58645e; font-size: 10px; }
.results-table tbody tr { cursor: pointer; transition: background .15s; }
.results-table tbody tr:hover, .results-table tbody tr.selected { background: #f1f7f3; }
.results-table td:first-child { color: #2c3833; font-family: var(--mono); font-size: 11px; font-weight: 500; }
.results-table td:last-child { color: var(--green); font-family: var(--mono); font-size: 10px; font-weight: 500; }
.mini-bar { display: flex; width: 84px; height: 13px; align-items: stretch; gap: 2px; margin: auto 0; }
.mini-bar i { flex: 1; min-width: 2px; background: #78a894; }
.mini-bar b { width: 4px; background: #bcc8c1; }
.results-foot { padding: 10px 18px; border-top: 1px solid #edf0ed; color: #929b96; font-size: 9px; }
.empty-state { display: grid; min-height: 194px; align-content: center; justify-items: center; text-align: center; }
.empty-icon { margin-bottom: 10px; color: #79a18f; font-size: 24px; }
.empty-state strong { color: #53605a; font-size: 11px; }
.empty-state p { margin: 5px 0 0; color: #9aa39e; font-size: 10px; }
.form-error { margin-top: 11px; border-radius: 5px; padding: 9px 10px; background: #fff0eb; color: #a34328; font-size: 10px; line-height: 1.45; }
.detail-panel { min-height: 84px; padding: 14px 17px; }
.detail-placeholder { display: flex; min-height: 52px; align-items: center; gap: 11px; color: #65716a; }
.detail-mark { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 6px; background: #f1f5f1; color: #58927a; font-size: 17px; }
.detail-placeholder strong, .detail-placeholder small { display: block; }
.detail-placeholder strong { margin-bottom: 4px; font-size: 10px; font-weight: 600; }
.detail-placeholder small { color: #8d9791; font-size: 9px; }
.detail-content { display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; gap: 14px; }
.detail-copy h3 { margin: 0 0 6px; font-family: var(--display); font-size: 12px; }
.detail-copy p { margin: 0; color: #7d8882; font-size: 9px; line-height: 1.6; }
.detail-copy strong { color: #31745f; font-family: var(--mono); font-size: 10px; font-weight: 500; }
.drawing { width: 100%; height: 69px; border-radius: 5px; background: #f5f7f5; }
.drawing line, .drawing rect { stroke: #91a39a; stroke-width: 1.4; }
.drawing .bar { fill: #6b9b85; stroke: none; }
.drawing .dimension { stroke: #d18b65; stroke-width: 1; }
.drawing text { fill: #7a8781; font-family: var(--mono); font-size: 7px; }
.post-result-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 17px 13px; }
.metric { padding: 10px; border-radius: 6px; background: #f5f7f5; }
.metric span { display: block; margin-bottom: 6px; color: #8b9690; font-size: 8px; }
.metric strong { color: #326f5d; font-family: var(--mono); font-size: 14px; font-weight: 500; }
.post-drawing-wrap { padding: 0 17px 14px; }
.post-drawing-wrap .drawing { height: 77px; }
.combined-layout-list { display: grid; }
.combined-layout { display: flex; width: 100%; min-height: 62px; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid #eff1ef; padding: 10px 11px; background: transparent; cursor: pointer; text-align: left; }
.combined-layout:hover, .combined-layout.selected { background: #f1f7f3; }
.combined-layout-main strong, .combined-layout-main small { display: block; }
.combined-layout-main strong { margin-bottom: 4px; color: #34423b; font-size: 11px; }
.combined-layout-main small { color: #78847e; font-size: 10px; line-height: 1.45; }
.combined-layout-arrow { color: #729481; font-size: 18px; }
.combined-detail { display: grid; gap: 9px; }
.combined-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 1px 2px 4px; }
.combined-detail-heading strong, .combined-detail-heading small { display: block; }
.combined-detail-heading strong { margin-bottom: 4px; color: var(--ink); font-size: 11px; }
.combined-detail-heading small { color: var(--readable-muted); font-size: 9px; }
.combined-bar-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 7px; max-height: 220px; overflow-y: auto; padding: 2px; }
.combined-bar-option { display: grid; gap: 5px; min-height: 57px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: var(--white); cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.combined-bar-option:hover, .combined-bar-option.selected { border-color: #79a994; background: var(--green-pale); }
.combined-bar-option-count { color: var(--ink); font-size: 10px; font-weight: 600; }
.combined-bar-option-detail { color: var(--readable-muted); font-family: var(--mono); font-size: 9px; }
.combined-select-hint { margin: 0; color: var(--readable-muted); font-size: 10px; }
:root[data-theme="dark"] .combined-bar-option { border-color: #414d47; background: #1d2522; }
:root[data-theme="dark"] .combined-bar-option:hover,
:root[data-theme="dark"] .combined-bar-option.selected { border-color: #77a98e; background: #29382f; }
:root[data-theme="dark"] .combined-bar-option-count { color: #e1e8e3; }
.combined-drawing { display: block; width: 100%; height: auto; aspect-ratio: 500 / 238; overflow: visible; }
.combined-drawing .rail-post { fill: #c6d0ca; stroke: #899b91; stroke-width: 1; }
.combined-drawing .rail-line { stroke: #aebbb3; stroke-width: 1; }
.combined-drawing .bar { fill: #6b9b85; stroke: none; }
.combined-drawing .extension { stroke: #87968d; stroke-width: 1; stroke-dasharray: 2 2; }
.combined-drawing .dimension { stroke: #bf5d36; stroke-width: 1.1; }
.combined-drawing .dimension-leader { stroke: #bf5d36; stroke-width: .9; }
.combined-drawing .arrow-head { fill: #bf5d36; }
.combined-drawing .dimension-label { fill: #34453c; font-family: var(--mono); font-size: 9px; font-weight: 500; }
.combined-drawing .dimension-callout { font-size: 8px; }
.combined-drawing .bar-sample { fill: #347c64; stroke: none; }
.combined-drawing .diagram-note { fill: #75817a; font-family: var(--mono); font-size: 8px; }
:root[data-theme="dark"] .combined-layout { border-color: #343e39; }
:root[data-theme="dark"] .combined-layout:hover,
:root[data-theme="dark"] .combined-layout.selected { background: #2b3a32; }
:root[data-theme="dark"] .combined-layout-main strong { color: #e1e8e3; }
:root[data-theme="dark"] .combined-layout-main small { color: #a2aea7; }
:root[data-theme="dark"] .combined-drawing .rail-post { fill: #46554c; stroke: #82958a; }
:root[data-theme="dark"] .combined-drawing .rail-line { stroke: #73887b; }
:root[data-theme="dark"] .combined-drawing .bar { fill: #78b596; }
:root[data-theme="dark"] .combined-drawing .dimension,
:root[data-theme="dark"] .combined-drawing .dimension-leader { stroke: #f0966d; }
:root[data-theme="dark"] .combined-drawing .arrow-head { fill: #f0966d; }
:root[data-theme="dark"] .combined-drawing .dimension-label { fill: #e1e9e3; }
:root[data-theme="dark"] .combined-drawing .bar-sample { fill: #83c4a8; }
:root[data-theme="dark"] .combined-drawing .diagram-note { fill: #b0bcb4; }
.history-section { margin-top: 29px; }
.history-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.history-heading h2 { font-size: 15px; }
.text-button { border: 0; padding: 5px 0; background: transparent; color: #78847e; cursor: pointer; font-size: 9px; }
.text-button:hover { color: #a34d36; }
.text-button span { margin-left: 4px; font-size: 15px; vertical-align: -1px; }
.history-list { display: grid; gap: 7px; }
.history-empty { padding: 17px; border: 1px dashed #dfe4de; border-radius: 7px; color: #89938e; font-size: 10px; text-align: center; }
.history-item { display: grid; grid-template-columns: 30px minmax(0,1fr) auto 18px; align-items: center; gap: 11px; min-height: 53px; border: 1px solid #e7eae6; border-radius: 7px; padding: 8px 13px; background: #fff; cursor: pointer; text-align: left; transition: border-color .15s, transform .15s; }
.history-item:hover { transform: translateY(-1px); border-color: #9ab9a8; }
.history-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 6px; background: #edf4f0; color: #43816a; font-size: 14px; }
.history-main strong, .history-main small { display: block; }
.history-main strong { margin-bottom: 4px; color: #3e4944; font-size: 10px; font-weight: 600; }
.history-main small { color: #929b96; font-size: 9px; }
.history-value { color: #4a7967; font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.history-arrow { color: #a3ada7; font-size: 15px; }
.page-footer { display: flex; justify-content: space-between; margin-top: 28px; padding-top: 13px; border-top: 1px solid #e5e9e4; color: #9aa39e; font-size: 9px; }
.page-footer span:first-child { font-family: var(--mono); font-size: 8px; letter-spacing: 1px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 4; max-width: min(380px, calc(100vw - 44px)); transform: translateY(12px); border-radius: 6px; padding: 11px 14px; background: #273b34; color: white; box-shadow: 0 8px 25px #17282130; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { transform: translateY(0); opacity: 1; }

.auth-screen { display: grid; min-height: 100vh; align-content: center; justify-items: center; gap: 27px; padding: 30px 18px; background: var(--paper); }
.auth-screen[hidden], #authenticated-view[hidden] { display: none; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand .brand-copy strong { color: var(--ink); }
.auth-brand .brand-copy small { color: var(--readable-muted); }
.auth-card { width: min(100%, 440px); border: 1px solid var(--line); border-radius: 12px; padding: 29px; background: var(--white); box-shadow: 0 10px 35px rgba(34,48,42,.07); }
.auth-eyebrow { display: flex; align-items: center; gap: 8px; color: var(--green); font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px; }
.auth-card h1 { margin: 14px 0 7px; font-size: 30px; }
.auth-lead { margin-bottom: 20px; color: var(--readable-muted); font-size: 14px; line-height: 1.55; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 19px; border-radius: 7px; padding: 4px; background: var(--paper); }
.auth-tab { min-height: 37px; border: 0; border-radius: 5px; background: transparent; color: var(--readable-muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.auth-tab.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 4px rgba(30,45,37,.1); }
.auth-tab:disabled { cursor: not-allowed; opacity: .5; }
.auth-form[hidden] { display: none; }
.auth-form .field-label { margin-top: 14px; }
.auth-input { width: 100%; min-height: 43px; border: 1px solid #dfe4de; border-radius: 6px; outline: 0; padding: 0 11px; background: var(--white); color: var(--ink); font-size: 14px; }
.auth-input:focus { border-color: #6aa28d; box-shadow: 0 0 0 3px rgba(63,140,112,.12); }
.auth-hint { margin: 5px 0 0; color: var(--readable-muted); font-size: 11px; line-height: 1.5; }
.auth-submit { margin-top: 20px; }
.approval-note { margin: 12px 0 0; border-left: 2px solid var(--orange); padding: 3px 0 3px 10px; color: var(--readable-muted); font-size: 11px; line-height: 1.55; }
.auth-message, .auth-setup-notice { margin: 14px 0 0; border-radius: 6px; padding: 11px 12px; background: var(--green-pale); color: var(--ink); font-size: 12px; line-height: 1.55; }
.auth-message[data-kind="error"], .auth-setup-notice { background: #fff0eb; color: #963c24; }
.auth-message[hidden], .auth-setup-notice[hidden] { display: none; }
.auth-security-note { display: flex; align-items: center; gap: 9px; margin: 19px 0 0; color: var(--readable-muted); font-size: 11px; line-height: 1.5; }
.auth-security-note .status-dot { width: 6px; height: 6px; margin: 0; box-shadow: none; }
.auth-footer { margin: 0; color: var(--readable-muted); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }
.auth-footer span { margin: 0 5px; color: var(--orange); }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.account-menu { display: flex; align-items: center; gap: 11px; border-left: 1px solid var(--line); padding-left: 17px; }
.account-name { color: var(--ink); font-size: 12px; font-weight: 600; }
.logout-button { border: 0; border-radius: 5px; padding: 7px 9px; background: #edf2ee; color: #40564b; cursor: pointer; font-size: 11px; font-weight: 600; }
.logout-button:hover { background: #e0ebe3; }
.admin-nav-label { margin-top: 22px; }
.nav-item[hidden], .nav-label[hidden] { display: none; }
.admin-workspace { display: grid; max-width: 900px; gap: 14px; }
.admin-workspace[hidden] { display: none; }
.admin-intro { display: flex; align-items: center; gap: 13px; margin: 0 1px 3px; }
.admin-intro h2 { margin: 0 0 4px; font-family: var(--display); font-size: 15px; }
.admin-intro p { margin: 0; color: var(--readable-muted); font-size: 12px; line-height: 1.55; }
.admin-panel { overflow: hidden; }
.admin-panel-heading { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.admin-panel-heading h2 { margin: 6px 0 0; font-family: var(--display); font-size: 16px; }
.admin-list-status { margin: 0; padding: 17px 18px; color: var(--readable-muted); font-size: 12px; }
.admin-list-status[hidden] { display: none; }
.admin-user-list { display: grid; }
.admin-user-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(145px, auto) auto; align-items: center; gap: 14px; min-height: 73px; border-bottom: 1px solid var(--line); padding: 12px 18px; }
.admin-user-row:last-child { border-bottom: 0; }
.admin-user-info strong, .admin-user-info small { display: block; }
.admin-user-info strong { margin-bottom: 4px; color: var(--ink); font-size: 13px; }
.admin-user-info small { color: var(--readable-muted); font-size: 11px; line-height: 1.45; }
.account-status { width: fit-content; border-radius: 20px; padding: 5px 9px; background: #edf2ee; color: #53645a; font-size: 10px; font-weight: 600; }
.account-status.pending { background: #fff2df; color: #87551b; }
.account-status.approved { background: #e5f2ea; color: #286846; }
.account-status.rejected, .account-status.blocked { background: #fbe9e5; color: #934431; }
.admin-user-actions { display: flex; justify-content: flex-end; gap: 7px; }
.admin-action { min-height: 33px; border: 1px solid transparent; border-radius: 5px; padding: 0 10px; cursor: pointer; font-size: 11px; font-weight: 600; }
.admin-action:disabled { cursor: wait; opacity: .6; }
.admin-action.approve { background: var(--green); color: white; }
.admin-action.approve:hover { background: var(--green-dark); }
.admin-action.reject { border-color: #ead1c9; background: transparent; color: #914832; }
.admin-action.secondary { border-color: #d7dfd9; background: transparent; color: #51675a; }
.admin-action.delete { border-color: #ead1c9; background: transparent; color: #914832; }
.admin-action.delete:hover { background: #fbe9e5; }
:root[data-theme="dark"] .auth-screen { background: var(--paper); }
:root[data-theme="dark"] .auth-card { border-color: #39443f; box-shadow: 0 10px 35px rgba(0,0,0,.2); }
:root[data-theme="dark"] .auth-tabs { background: #19211e; }
:root[data-theme="dark"] .auth-tab.active { background: #2a342f; }
:root[data-theme="dark"] .auth-input { border-color: #414d47; }
:root[data-theme="dark"] .auth-message[data-kind="error"],
:root[data-theme="dark"] .auth-setup-notice { background: #452b25; color: #ffb69b; }
:root[data-theme="dark"] .logout-button { background: #304239; color: #d1e1d7; }
:root[data-theme="dark"] .logout-button:hover { background: #395448; }
:root[data-theme="dark"] .admin-panel-heading { border-color: #36413b; }
:root[data-theme="dark"] .account-status { background: #303a35; color: #d0dbd4; }
:root[data-theme="dark"] .account-status.pending { background: #493a25; color: #f1c485; }
:root[data-theme="dark"] .account-status.approved { background: #274233; color: #a0d6b3; }
:root[data-theme="dark"] .account-status.rejected,
:root[data-theme="dark"] .account-status.blocked { background: #472e28; color: #ffad96; }
:root[data-theme="dark"] .admin-action.reject { border-color: #694439; color: #ffb49c; }
:root[data-theme="dark"] .admin-action.secondary { border-color: #4b5b51; color: #d2e0d6; }
:root[data-theme="dark"] .admin-action.delete { border-color: #694439; color: #ffb49c; }
:root[data-theme="dark"] .admin-action.delete:hover { background: #472e28; }
:root[data-theme="dark"] .admin-action.reset-password { border-color: #4b5b51; color: #d2e0d6; }
:root[data-theme="dark"] .admin-reset-result p { color: #a0aca5; }
.account-settings-panel { padding: 19px; }
.account-password-form { max-width: 440px; }
.account-password-form .field-label { margin-top: 15px; }
.account-password-submit { margin-top: 17px; }
.admin-action.reset-password { border-color: #d7dfd9; background: transparent; color: #51675a; }
.admin-action.reset-password:hover { background: var(--green-pale); }
.admin-reset-result { display: grid; gap: 13px; padding: 18px; }
.admin-reset-result strong { color: var(--ink); font-size: 13px; }
.admin-reset-result p { margin: 6px 0 0; color: var(--readable-muted); font-size: 12px; line-height: 1.55; }
.admin-reset-password-row { display: flex; gap: 9px; }
.admin-reset-password-row .auth-input { flex: 1; min-width: 0; font-family: var(--mono); }
.admin-reset-result[hidden] { display: none; }
.account-password-form .form-error[hidden] { display: none; }

@media (min-width: 1440px) {
  .content { padding-top: 48px; }
}
@media (max-width: 1050px) {
  .sidebar { width: 214px; }
  .main { margin-left: 214px; }
  .topbar { padding: 0 30px; }
  .content { padding: 32px 30px 22px; }
  .workspace { grid-template-columns: minmax(240px, .8fr) minmax(330px, 1.2fr); gap: 12px; }
  .input-panel { padding: 17px 15px 14px; }
  .field-row { gap: 8px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; height: auto; padding: 12px 16px 10px; }
  .brand { padding: 0 2px; }
  .brand-mark { width: 33px; height: 33px; }
  .nav-label, .sidebar-note, .sidebar-footer { display: none; }
  .tool-nav { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
  .nav-item { height: 35px; flex: 1 1 calc(33% - 5px); justify-content: center; gap: 6px; padding: 0 6px; font-size: 10px; }
  .nav-icon { width: 20px; height: 20px; font-size: 13px; }
  .main { margin-left: 0; }
  .topbar { height: 43px; padding: 0 17px; }
  .topbar-right { font-size: 9px; }
  .content { padding: 25px 16px 20px; }
  .page-heading { margin-bottom: 20px; }
  .heading-badge { display: none; }
  h1 { font-size: 29px; }
  .page-heading p { max-width: 300px; font-size: 11px; line-height: 1.5; }
  .workspace { grid-template-columns: 1fr; gap: 12px; }
  .input-panel { padding: 17px; }
  .results-column { gap: 10px; }
  .results-body { max-height: 300px; }
  .history-section { margin-top: 24px; }
  .topbar-actions { gap: 9px; }
  .account-menu { gap: 6px; padding-left: 9px; }
  .account-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .logout-button { padding: 6px; font-size: 10px; }
  .admin-user-row { grid-template-columns: minmax(100px, 1fr) auto; gap: 9px; }
  .admin-user-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 420px) {
  .nav-item { font-size: 9px; }
  .nav-icon { display: none; }
  .breadcrumb { gap: 6px; font-size: 8px; }
  .topbar-right { font-size: 8px; }
  .history-item { grid-template-columns: 28px minmax(0,1fr) 14px; gap: 8px; padding: 8px; }
  .history-value { display: none; }
  .detail-content { grid-template-columns: 1fr; }
  .drawing { max-height: none; }
  .combined-detail-heading { align-items: flex-start; flex-direction: column; }
  .combined-bar-options { grid-template-columns: 1fr; }
  .results-header { padding: 13px 14px; }
  .results-body { padding: 0 12px; }
  .results-table th { font-size: 7px; }
  .results-table td { font-size: 9px; }
}
@media (max-width: 520px) {
  .admin-reset-password-row { align-items: stretch; flex-direction: column; }
  .admin-reset-password-row .admin-action { min-height: 40px; }
}

.settings-nav-label { margin: 28px 9px 8px; }
.settings-icon { font-size: 13px; }
.settings-workspace { display: grid; max-width: 790px; gap: 13px; }
.settings-workspace[hidden] { display: none; }
.settings-intro { display: flex; align-items: center; gap: 13px; margin: 0 1px 3px; }
.settings-intro-icon, .settings-panel-icon { display: grid; flex: none; width: 40px; height: 40px; place-items: center; border-radius: 9px; background: var(--green-pale); color: var(--green); font-size: 19px; }
.settings-intro h2 { margin: 0 0 4px; font-family: var(--display); font-size: 13px; }
.settings-intro p { max-width: 540px; margin: 0; color: #78827e; font-size: 10px; line-height: 1.6; }
.settings-panel { padding: 19px; }
.settings-panel-heading { display: flex; align-items: center; gap: 11px; padding-bottom: 16px; border-bottom: 1px solid #edf0ed; }
.settings-panel-heading h2 { margin: 0 0 4px; font-family: var(--display); font-size: 13px; }
.settings-panel-heading p { margin: 0; color: #85908b; font-size: 10px; }
.settings-panel-icon { width: 34px; height: 34px; border-radius: 7px; font-size: 17px; }
.theme-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin: 16px 0 0; border: 0; padding: 0; }
.theme-picker legend { margin-bottom: 9px; padding: 0; color: #46524d; font-size: 10px; font-weight: 600; }
.theme-option { position: relative; display: grid; grid-template-columns: 75px minmax(0, 1fr) 18px; align-items: center; gap: 11px; min-height: 73px; border: 1px solid #e2e7e2; border-radius: 7px; padding: 9px; background: #fff; cursor: pointer; transition: border-color .16s, background .16s; }
.theme-option:hover { border-color: #9ab9a8; }
.theme-option:has(input:checked) { border-color: #57977c; background: #f5f9f6; box-shadow: 0 0 0 1px #57977c; }
.theme-option input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.theme-option input:focus-visible ~ .theme-option-copy { outline: 2px solid #57977c; outline-offset: 3px; border-radius: 2px; }
.theme-option-preview { display: flex; height: 45px; flex-direction: column; gap: 4px; overflow: hidden; border: 1px solid #e4e8e3; border-radius: 4px; padding: 6px; }
.light-preview { background: #f4f5f2; }
.dark-preview { border-color: #39443f; background: #171e1d; }
.theme-option-preview i { display: block; height: 5px; border-radius: 2px; background: #fff; }
.theme-option-preview i:first-child { width: 72%; background: #6b9b85; }
.theme-option-preview i:nth-child(2) { width: 92%; }
.theme-option-preview i:nth-child(3) { width: 58%; }
.dark-preview i:not(:first-child) { background: #303b36; }
.theme-option-copy strong, .theme-option-copy small { display: block; }
.theme-option-copy strong { margin-bottom: 4px; color: #3e4944; font-size: 10px; }
.theme-option-copy small { color: #89938e; font-size: 8px; line-height: 1.4; }
.theme-check { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid #d9e0da; border-radius: 50%; color: transparent; font-size: 10px; }
.theme-option input:checked ~ .theme-check { border-color: #39826b; background: #39826b; color: white; }
.settings-saved { display: flex; align-items: center; gap: 7px; margin: 14px 0 0; color: #828d87; font-size: 9px; }
.settings-saved-dot { width: 6px; height: 6px; border-radius: 50%; background: #65a587; }
.future-settings { display: flex; min-height: 63px; align-items: center; gap: 11px; padding: 12px 15px; }
.future-settings-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; background: #f1f5f1; color: #62917c; font-size: 18px; }
.future-settings strong, .future-settings small { display: block; }
.future-settings strong { margin-bottom: 4px; color: #53605a; font-size: 10px; }
.future-settings small { color: #8d9791; font-size: 9px; }
.coming-soon { margin-left: auto; border-radius: 4px; padding: 5px 7px; background: #f3f5f2; color: #89938e; font-family: var(--mono); font-size: 7px; letter-spacing: .7px; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4ebe7;
  --muted: #a4b0aa;
  --line: #39443f;
  --paper: #171e1d;
  --white: #222b28;
  --green: #83c4a8;
  --green-dark: #57977c;
  --green-pale: #2c443a;
  --orange: #f09a70;
}
:root[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
:root[data-theme="dark"] .topbar { border-color: #303a36; background: rgba(31,40,37,.9); }
:root[data-theme="dark"] .breadcrumb { color: #b5c0ba; }
:root[data-theme="dark"] .breadcrumb span:first-child,
:root[data-theme="dark"] .crumb-slash { color: #7e8a83; }
:root[data-theme="dark"] .topbar-right,
:root[data-theme="dark"] .page-heading p,
:root[data-theme="dark"] .settings-intro p { color: #a5b0aa; }
:root[data-theme="dark"] .heading-badge { border-color: #39443f; background: #202825; color: #a4b0aa; }
:root[data-theme="dark"] .heading-badge strong { color: #d5ddd8; }
:root[data-theme="dark"] .panel { border-color: #333e39; background: var(--white); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
:root[data-theme="dark"] .panel-heading p,
:root[data-theme="dark"] .settings-panel-heading p { color: #a0aca5; }
:root[data-theme="dark"] .field-label,
:root[data-theme="dark"] .theme-picker legend { color: #d0d9d3; }
:root[data-theme="dark"] .input-wrap { border-color: #414d47; background: #1d2522; }
:root[data-theme="dark"] .input-wrap input { color: #e4ebe7; }
:root[data-theme="dark"] .input-wrap > span,
:root[data-theme="dark"] .field-hint { color: #98a59d; }
:root[data-theme="dark"] .formula-note { background: #29332e; color: #b1bcb5; }
:root[data-theme="dark"] .formula-note strong { color: #d7dfda; }
:root[data-theme="dark"] .results-header,
:root[data-theme="dark"] .settings-panel-heading { border-color: #36413b; }
:root[data-theme="dark"] .result-count { background: #30473b; color: #9bd4b8; }
:root[data-theme="dark"] .results-table th { color: #9aa79f; }
:root[data-theme="dark"] .results-table td { border-color: #343e39; color: #c0cbc4; }
:root[data-theme="dark"] .results-table tbody tr:hover,
:root[data-theme="dark"] .results-table tbody tr.selected { background: #2b3a32; }
:root[data-theme="dark"] .results-table td:first-child { color: #e2e9e4; }
:root[data-theme="dark"] .mini-bar i { background: #70a98d; }
:root[data-theme="dark"] .mini-bar b { background: #56645b; }
:root[data-theme="dark"] .results-foot { border-color: #36413b; color: #a0aca5; }
:root[data-theme="dark"] .empty-state strong,
:root[data-theme="dark"] .detail-copy h3,
:root[data-theme="dark"] .settings-intro h2,
:root[data-theme="dark"] .settings-panel-heading h2 { color: #e1e8e3; }
:root[data-theme="dark"] .empty-state p,
:root[data-theme="dark"] .detail-placeholder small,
:root[data-theme="dark"] .detail-copy p { color: #a2aea7; }
:root[data-theme="dark"] .detail-placeholder { color: #d1dad4; }
:root[data-theme="dark"] .detail-mark,
:root[data-theme="dark"] .future-settings-icon { background: #2d3a33; color: #8bc3a5; }
:root[data-theme="dark"] .drawing { background: #1d2522; }
:root[data-theme="dark"] .drawing line,
:root[data-theme="dark"] .drawing rect { stroke: #73887b; }
:root[data-theme="dark"] .drawing .bar { fill: #78b596; stroke: none; }
:root[data-theme="dark"] .drawing text { fill: #b0bcb4; }
:root[data-theme="dark"] .metric { background: #2a342f; }
:root[data-theme="dark"] .metric span { color: #a2aea7; }
:root[data-theme="dark"] .history-empty { border-color: #414c46; color: #a9b4ad; }
:root[data-theme="dark"] .history-item { border-color: #35403a; background: #222b28; }
:root[data-theme="dark"] .history-item:hover { border-color: #77a98e; }
:root[data-theme="dark"] .history-icon { background: #30473b; color: #9bd4b8; }
:root[data-theme="dark"] .history-main strong,
:root[data-theme="dark"] .future-settings strong { color: #dbe4de; }
:root[data-theme="dark"] .history-main small,
:root[data-theme="dark"] .future-settings small { color: #a0aca5; }
:root[data-theme="dark"] .page-footer { border-color: #333e39; color: #9ba79f; }
:root[data-theme="dark"] .theme-option { border-color: #414d47; background: #1d2522; }
:root[data-theme="dark"] .theme-option:hover { border-color: #77a98e; }
:root[data-theme="dark"] .theme-option:has(input:checked) { border-color: #77a98e; background: #29382f; }
:root[data-theme="dark"] .theme-option-copy strong { color: #e1e8e3; }
:root[data-theme="dark"] .theme-option-copy small { color: #a5b0aa; }
:root[data-theme="dark"] .theme-check { border-color: #59665e; }
:root[data-theme="dark"] .future-settings-icon { color: #8bc3a5; }
:root[data-theme="dark"] .coming-soon { background: #303a35; color: #b3beb7; }

.detail-content { grid-template-columns: minmax(0, 1fr); gap: 9px; }
.drawing { display: block; height: auto; overflow: visible; }
.post-drawing-wrap .drawing { height: auto; }
.fill-drawing { aspect-ratio: 2 / 1; }
.post-drawing { aspect-ratio: 360 / 178; }
.drawing .rail-post { fill: #c6d0ca; stroke: #899b91; stroke-width: 1; }
.drawing .rail-line { stroke: #aebbb3; stroke-width: 1; }
.drawing .extension { stroke: #87968d; stroke-width: 1; stroke-dasharray: 2 2; }
.drawing .dimension { stroke: #bf5d36; stroke-width: 1.1; }
.drawing .dimension-leader { stroke: #bf5d36; stroke-width: .9; }
.drawing .bar-measure { stroke: #347c64; stroke-width: 1.1; }
.drawing .bar-sample { fill: #6b9b85; stroke: none; }
.drawing .arrow-head { fill: #bf5d36; }
.drawing .bar-measure + .bar-sample + .dimension-label { fill: #286d56; font-size: 8px; }
.drawing .dimension-label { fill: #34453c; font-size: 9px; font-weight: 500; }
.drawing .dimension-callout { font-size: 8px; }
.drawing .diagram-note { fill: #68766e; font-size: 8px; }
:root[data-theme="dark"] .drawing .rail-post { fill: #71857a; stroke: #a3b3a9; }
:root[data-theme="dark"] .drawing .rail-line { stroke: #718078; }
:root[data-theme="dark"] .drawing .extension { stroke: #9caaa1; }
:root[data-theme="dark"] .drawing .dimension,
:root[data-theme="dark"] .drawing .dimension-leader { stroke: #f0966d; }
:root[data-theme="dark"] .drawing .bar-measure { stroke: #8bd0ac; }
:root[data-theme="dark"] .drawing .bar-sample { fill: #78b596; }
:root[data-theme="dark"] .drawing .arrow-head { fill: #f0966d; }
:root[data-theme="dark"] .drawing .bar-measure + .bar-sample + .dimension-label { fill: #a4dfbd; }
:root[data-theme="dark"] .drawing .dimension-label { fill: #e1e9e3; }
:root[data-theme="dark"] .drawing .diagram-note { fill: #bdc9c1; }

@media (max-width: 760px) {
  .settings-nav-label { display: none; }
}
@media (max-width: 520px) {
  .theme-picker { grid-template-columns: 1fr; }
}

/* Keep supporting text readable without changing the existing layout. */
:root {
  --readable-text: #59655f;
  --readable-muted: #68746e;
  --readable-subtle: #748079;
  --action: #237664;
  --action-hover: #1c6254;
}
:root[data-theme="dark"] {
  --readable-text: #d0d9d3;
  --readable-muted: #bac5be;
  --readable-subtle: #aab6ae;
  --action: #286b55;
  --action-hover: #347d65;
}
body { font-size: 15px; line-height: 1.55; }
.brand-copy strong { font-size: 13px; }
.brand-copy small, .sidebar-footer { font-size: 9px; }
.nav-label { font-size: 10px; }
.nav-item { min-height: 45px; font-size: 13px; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note p { font-size: 11px; }
.breadcrumb { font-size: 10px; }
.topbar-right { font-size: 12px; }
.eyebrow { font-size: 10px; }
.page-heading p { font-size: 14px; line-height: 1.55; }
.heading-badge { font-size: 9px; }
.heading-badge strong { font-size: 10px; }
.panel-heading h2, .settings-intro h2, .settings-panel-heading h2 { font-size: 15px; }
.panel-heading p, .settings-panel-heading p { font-size: 12px; }
.field-label, .theme-picker legend { font-size: 12px; }
.input-wrap { min-height: 43px; }
.input-wrap input { font-size: 14px; }
.input-wrap > span { font-size: 11px; }
.field-hint { font-size: 11px; line-height: 1.55; }
.primary-button { min-height: 45px; font-size: 13px; }
.formula-note, .formula-note strong { font-size: 11px; }
.results-header h2, .history-heading h2 { font-size: 16px; }
.section-kicker { font-size: 10px; }
.results-table th { font-size: 10px; }
.results-table td { font-size: 12px; }
.results-table td:first-child, .results-table td:last-child { font-size: 13px; }
.results-foot { font-size: 11px; line-height: 1.55; }
.empty-state strong { font-size: 13px; }
.empty-state p { font-size: 12px; }
.detail-placeholder strong { font-size: 12px; }
.detail-placeholder small { font-size: 11px; line-height: 1.5; }
.detail-copy h3 { font-size: 14px; }
.detail-copy p { font-size: 11px; }
.detail-copy strong { font-size: 12px; }
.drawing text { font-size: 8px; }
.metric span { font-size: 10px; }
.history-empty { font-size: 12px; }
.history-main strong { font-size: 12px; }
.history-main small { font-size: 11px; line-height: 1.45; }
.history-value { font-size: 11px; }
.text-button { font-size: 11px; }
.page-footer { font-size: 11px; }
.page-footer span:first-child { font-size: 9px; }
.settings-intro p { font-size: 12px; }
.theme-option-copy strong { font-size: 12px; }
.theme-option-copy small { font-size: 10px; }
.settings-saved { font-size: 11px; }
.future-settings strong { font-size: 12px; }
.future-settings small { font-size: 11px; }
.coming-soon { font-size: 9px; }
.toast { font-size: 13px; line-height: 1.5; }
.page-heading p,
.panel-heading p,
.settings-panel-heading p,
.field-hint,
.input-wrap > span,
.formula-note,
.detail-placeholder small,
.detail-copy p,
.metric span,
.history-main small,
.history-empty,
.settings-intro p,
.theme-option-copy small,
.future-settings small,
.settings-saved { color: var(--readable-muted); }
.sidebar-note p { color: #c0cbc5; }
.sidebar-footer, .sidebar-footer span { color: #b2bdb7; }
.breadcrumb span:first-child, .crumb-slash { color: #77837d; }
.results-table th { color: #68756e; }
.detail-copy p, .detail-placeholder small { color: var(--readable-muted); }
.history-main small, .history-empty { color: var(--readable-muted); }
.theme-option-copy small, .future-settings small { color: var(--readable-muted); }
.coming-soon { color: #68746e; }
.page-footer { color: #68746e; }
.heading-badge { color: #68746e; }
.primary-button { background: var(--action); }
.primary-button:hover { background: var(--action-hover); }

:root[data-theme="dark"] .sidebar-note p { color: #c0cbc5; }
:root[data-theme="dark"] .sidebar-footer,
:root[data-theme="dark"] .sidebar-footer span { color: #b2bdb7; }
:root[data-theme="dark"] .breadcrumb span:first-child,
:root[data-theme="dark"] .crumb-slash,
:root[data-theme="dark"] .results-table th,
:root[data-theme="dark"] .page-footer,
:root[data-theme="dark"] .coming-soon { color: var(--readable-muted); }
:root[data-theme="dark"] .detail-copy strong,
:root[data-theme="dark"] .metric strong,
:root[data-theme="dark"] .formula-symbol { color: #9bd4b8; }
:root[data-theme="dark"] .heading-badge,
:root[data-theme="dark"] .page-heading p,
:root[data-theme="dark"] .panel-heading p,
:root[data-theme="dark"] .settings-panel-heading p,
:root[data-theme="dark"] .field-hint,
:root[data-theme="dark"] .input-wrap > span,
:root[data-theme="dark"] .formula-note,
:root[data-theme="dark"] .detail-placeholder small,
:root[data-theme="dark"] .detail-copy p,
:root[data-theme="dark"] .metric span,
:root[data-theme="dark"] .history-main small,
:root[data-theme="dark"] .history-empty,
:root[data-theme="dark"] .settings-intro p,
:root[data-theme="dark"] .theme-option-copy small,
:root[data-theme="dark"] .future-settings small,
:root[data-theme="dark"] .settings-saved,
:root[data-theme="dark"] .text-button { color: var(--readable-muted); }

@media (max-width: 760px) {
  .nav-item { min-height: 42px; font-size: 12px; }
  .topbar-right { font-size: 11px; }
  .page-heading p { font-size: 13px; }
  .results-table th { font-size: 9px; }
}
@media (max-width: 420px) {
  .nav-item { min-height: 40px; font-size: 11px; }
  .breadcrumb { font-size: 9px; }
  .topbar-right { font-size: 10px; }
  .results-table th { font-size: 8px; }
  .results-table td { font-size: 11px; }
  .history-main small { font-size: 10px; }
  .tool-nav { flex-wrap: wrap; }
  .tool-nav .nav-item { flex: 1 1 calc(50% - 5px); }
  .topbar-actions { gap: 7px; }
  .topbar-right { display: none; }
  .account-menu { border-left: 0; padding-left: 0; }
  .auth-card { padding: 23px 19px; }
  .admin-user-row { grid-template-columns: 1fr; }
  .account-status { grid-row: 2; }
  .admin-user-actions { grid-row: 3; }
}
