/* Lexa console. Builds on lexa.css tokens. */
body.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; background: var(--parch); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Sidebar */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; background: var(--leather); color: #E6DBD0; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 24px; color: var(--parch); }
.side-brand span { font-family: var(--font-display); font-size: 28px; line-height: 1; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; color: rgba(244, 238, 226, 0.74); transition: background-color var(--t-fast) ease, color var(--t-fast) ease; }
.side-nav a svg { flex: none; }
@media (hover: hover) and (pointer: fine) { .side-nav a:hover { background: rgba(244, 238, 226, 0.06); color: #fff; } }
.side-nav a[aria-current='page'] { background: rgba(244, 238, 226, 0.1); color: #fff; }
.side-nav a[aria-current='page']::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #E4A9A0; }
.side-nav a:focus-visible, .side-brand:focus-visible { outline-color: #E4A9A0; }
.side-foot { margin-top: auto; display: grid; gap: 16px; padding: 0 4px; }
.side-org { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; background: rgba(244, 238, 226, 0.05); font-size: 13px; line-height: 1.35; }
.side-org .muted { color: rgba(244, 238, 226, 0.62); font-size: 12px; }
.org-dot { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--ox); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.side-db { padding-left: 6px; color: rgba(244, 238, 226, 0.8); }

/* Main */
.main { min-width: 0; padding: 18px clamp(16px, 3vw, 36px) 40px; }
.demo-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 18px; border: 1px dashed var(--ox-line); border-radius: 8px; background: var(--ox-soft); color: var(--ox-deep); font-size: 12.5px; line-height: 1.4; }
.demo-banner svg { flex: none; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.top-kicker { font-size: 13px; color: var(--muted); }
.top-title { font-family: var(--font-display); font-weight: 400; font-size: 46px; line-height: 1.05; letter-spacing: -0.01em; }
.top-mark { display: none; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 22px; }
.view[data-entering] { animation: viewIn 320ms var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transition: background-color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--parch-2); } }
.icon-btn:active { transform: scale(0.95); }

/* Research */
.ask { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px; }
.ask-row { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease; }
.ask-row:focus-within { border-color: var(--ox); box-shadow: 0 0 0 4px var(--ox-soft); }
.ask-row svg { flex: none; color: var(--ox); }
.ask-row input { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: none; font-size: 15.5px; }
.ask-row input:lang(hi), .ask-row input.deva { font-family: 'Noto Sans Devanagari', var(--font-ui); }
.ask-row input.telu { font-family: 'Noto Sans Telugu', var(--font-ui); }
.ask-opts { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--parch); border: 1px solid var(--line); }
.seg button { padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); transition: background-color var(--t-fast) ease, color var(--t-fast) ease; }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--parch); }
.scope { font-size: 12.5px; color: var(--muted); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sg { max-width: 100%; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--parch); font-size: 13px; text-align: left; line-height: 1.35; transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.sg:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .sg:hover { border-color: var(--ox); } }
.sg[data-nf] { border-style: dashed; }
.sg.deva { font-family: 'Noto Sans Devanagari', var(--font-ui); }
.sg.telu { font-family: 'Noto Sans Telugu', var(--font-ui); }

.res-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.res-col { min-width: 0; }
.res-status { display: flex; align-items: center; gap: 8px; min-height: 20px; margin: 0 2px 10px; font-size: 13px; color: var(--muted); }
.res-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.res-status[data-state='search'] i { background: var(--ox); animation: pulse 1s var(--ease-in-out) infinite; }
.res-status[data-state='none'] i { background: var(--ox); }
.results { display: grid; gap: 10px; }
button.case { display: block; width: 100%; text-align: left; cursor: pointer; }
button.case:focus-visible { outline: 2px solid var(--ox); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { button.case:hover { border-color: var(--ox-line); } }
.case .para { font-size: 13.5px; }
.case-lang { margin-top: 8px; font-size: 13px; color: var(--ink-2); padding-left: 10px; border-left: 2px solid var(--line-2); }
.case-lang.deva { font-family: 'Noto Sans Devanagari', var(--font-ui); }
.case-lang.telu { font-family: 'Noto Sans Telugu', var(--font-ui); }
.nf-box { padding: 20px; border-radius: 10px; border: 1px dashed var(--ox-line); background: var(--surface); }
.nf-box .nf-flag { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13.5px; color: var(--ox); margin-bottom: 8px; }
.nf-box p { font-size: 14.5px; color: var(--ink-2); }
.nf-box .nf-checked { margin-top: 12px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.nf-box ul { margin-top: 12px; display: grid; gap: 4px; font-size: 14px; }
.nf-box ul li::before { content: '– '; color: var(--ox); }

.viewer { position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); min-height: 460px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line-2); box-shadow: 0 30px 60px -44px rgba(58, 22, 26, 0.6); overflow: hidden; min-width: 0; }
.vw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); background: var(--parch-2); }
.vw-t { min-width: 0; }
.vw-k { font-size: 12px; color: var(--ox); }
.vw-name { margin-top: 2px; font-family: var(--font-text); font-style: italic; font-size: 19px; line-height: 1.3; }
.vw-meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.vw-close { display: none; }
.vw-body { flex: 1; overflow: auto; padding: 18px 22px 26px; font-family: var(--font-text); font-size: 14.5px; line-height: 1.7; color: #2A211C; }
.vw-body .jp { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 6px; margin-bottom: 12px; padding: 6px 8px 6px 0; border-radius: 4px; transition: background-color 600ms var(--ease-out); }
.vw-body .jp b { font-family: var(--font-mono); font-weight: 400; font-size: 12.5px; color: var(--muted); text-align: right; padding-top: 2px; }
.vw-body .jp[data-hl] { background: var(--hl); box-shadow: inset 3px 0 0 var(--ox); }
.vw-body .jp[data-hl] b { color: var(--ox); font-weight: 700; }
.vw-body .jh { font-family: var(--font-ui); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 4px 0 12px; }
.vw-sample { margin-top: 18px; padding: 10px 12px; border: 1px dashed var(--ox-line); border-radius: 6px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ox-deep); }
.vw-empty { display: grid; place-items: center; align-content: center; gap: 10px; height: 100%; min-height: 300px; text-align: center; color: var(--muted); font-family: var(--font-ui); font-size: 14px; }
.vw-empty svg { color: var(--line-2); }
.vw-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--parch-2); }
.vw-foot[hidden] { display: none; }
.viewer-scrim { display: none; }

/* Bars, chips, tables */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bar-copy { color: var(--ink-2); font-size: 15px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; transition: background-color var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.chip:active { transform: scale(0.97); }
.chip b { font-weight: 500; color: var(--muted); font-size: 12px; }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--parch); border-color: var(--ink); }
.chip[aria-pressed='true'] b { color: rgba(244, 238, 226, 0.7); }
.table-wrap { border-radius: 12px; background: var(--surface); border: 1px solid var(--line); overflow: auto; }
table.matters { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
.matters th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: var(--parch-2); }
.matters td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.matters tr:last-child td { border-bottom: 0; }
.matters tbody tr { cursor: pointer; transition: background-color 120ms ease; }
@media (hover: hover) and (pointer: fine) { .matters tbody tr:hover { background: var(--parch); } }
.matters tbody tr:focus-visible { outline: 2px solid var(--ox); outline-offset: -2px; }
.matters .cl { font-weight: 600; }
.matters .sub2 { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.matters .when { white-space: nowrap; font-family: var(--font-mono); font-size: 13px; }
.stage-pill { display: inline-block; white-space: nowrap; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--parch-2); color: var(--ink-2); }
.stage-pill.soon { background: var(--ox-soft); color: var(--ox); }
.adv { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.adv i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--leather); color: var(--parch); }
.adv i.b { background: var(--green); }

/* Drafting */
.tpl-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tp { display: grid; gap: 4px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.tp:active { transform: scale(0.98); }
.tp b { font-size: 15px; font-weight: 600; }
.tp span { font-size: 13px; color: var(--muted); }
.tp[aria-checked='true'] { border-color: var(--ox); box-shadow: inset 0 0 0 1px var(--ox); }
.tp[aria-checked='true'] b { color: var(--ox); }
@media (hover: hover) and (pointer: fine) { .tp:hover { border-color: var(--ox-line); } }
.draft-grid { display: grid; grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr); gap: 16px; align-items: start; }
.facts-form { padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; min-width: 0; }
.ff-h { font-family: var(--font-ui); font-size: 15px; font-weight: 600; }
.ff-sub { font-size: 13px; color: var(--muted); margin-top: -8px; }
.fld { display: grid; gap: 5px; min-width: 0; }
.fld label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fld input, .fld select, .fld textarea { width: 100%; min-width: 0; height: 40px; padding: 0 11px; border-radius: 7px; border: 1px solid var(--line-2); background: #fff; font-size: 14px; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease; }
.fld textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 0; border-color: var(--ox); box-shadow: 0 0 0 3px var(--ox-soft); }
.fld-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.ff-regen { justify-self: start; }
.doc-col { min-width: 0; }
.doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-actions { display: flex; gap: 8px; }
.doc { position: relative; padding: 44px 52px 40px; border-radius: 4px; background: var(--paper); color: #2A211C; border: 1px solid var(--line); box-shadow: 0 30px 60px -44px rgba(58, 22, 26, 0.6); font-family: var(--font-text); font-size: 14.5px; line-height: 1.75; overflow: hidden; min-height: 560px; }
.doc::after { content: 'DRAFT · FOR ADVOCATE REVIEW'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-28deg); white-space: nowrap; font-family: var(--font-ui); font-weight: 700; font-size: clamp(22px, 3.4vw, 44px); letter-spacing: 0.14em; color: rgba(122, 31, 43, 0.075); pointer-events: none; }
.doc[contenteditable='true'] { outline: 2px dashed var(--ox-line); outline-offset: 4px; }
.doc .d-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 2px solid #2A211C; }
.doc .d-head b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.2; }
.doc .d-head span { font-family: var(--font-mono); font-size: 12px; color: #6A5D55; }
.doc .d-head .r { text-align: right; flex: none; }
.doc h4 { font-family: var(--font-text); font-weight: 700; font-size: 15px; text-align: center; letter-spacing: 0.06em; text-transform: uppercase; margin: 6px 0 16px; }
.doc p { margin: 0 0 12px; }
.doc ol { list-style: decimal; padding-left: 22px; margin: 0 0 12px; }
.doc ol li { margin-bottom: 8px; padding-left: 4px; }
.doc .sub-l { font-weight: 700; }
.doc .sign { margin-top: 26px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.doc .sign .todo { font-family: var(--font-mono); font-size: 12.5px; color: var(--ox); }
.doc .fact.empty { color: #9A8C82; font-weight: 400; border-bottom-style: dashed; }
.doc .dl { transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out); }
.doc .dl[data-enter] { opacity: 0; transform: translateY(6px); }
.doc-note { margin-top: 10px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Templates */
.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tcard { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.tcard-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tcard h3 { font-family: var(--font-display); font-size: 23px; line-height: 1.15; }
.tcard .own { flex: none; font-family: var(--font-mono); font-size: 11.5px; padding: 2px 7px; border-radius: 4px; background: var(--parch-2); color: var(--ink-2); }
.tcard .own.ch { background: var(--ox-soft); color: var(--ox); }
.tcard p { font-size: 14px; color: var(--ink-2); }
.tcard dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.tcard dl div { padding: 8px 10px; border-radius: 8px; background: var(--parch); min-width: 0; }
.tcard dt { font-size: 11.5px; color: var(--muted); }
.tcard dd { margin: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.tcard .tc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 6px; }
.tcard .tc-foot .mono { font-size: 12px; color: var(--muted); }
.tcard .btn { height: 36px; padding: 0 14px; font-size: 13.5px; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cal { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-title { font-family: var(--font-display); font-size: 26px; }
.cal-dow, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow span { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 4px 6px; }
.day { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 92px; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; text-align: left; min-width: 0; transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease; }
.day.out { background: transparent; border-color: transparent; color: var(--muted); }
.day .dn { font-family: var(--font-mono); font-size: 13px; }
.day.today .dn { display: inline-grid; place-items: center; align-self: flex-start; min-width: 24px; height: 24px; border-radius: 50%; background: var(--ox); color: #fff; }
.day[aria-pressed='true'] { border-color: var(--ox); box-shadow: inset 0 0 0 1px var(--ox); }
.day.holiday { background: var(--parch); }
.day .ev { display: block; font-size: 11.5px; line-height: 1.3; padding: 2px 5px; border-radius: 4px; background: var(--ox-soft); color: var(--ox-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .ev.b { background: var(--green-soft); color: var(--green); }
.day .more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.day .hol { font-size: 11px; color: var(--muted); font-style: italic; }
@media (hover: hover) and (pointer: fine) { .day:not(.out):hover { border-color: var(--ox-line); } }
.agenda { padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.agenda-h { font-family: var(--font-ui); font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.agenda-list { display: grid; gap: 0; }
.agenda-list li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.agenda-list li:first-child { border-top: 0; }
.ag-d { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.3; color: var(--ox); }
.ag-d b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 24px; color: var(--ink); }
.ag-t { font-weight: 600; font-size: 14px; }
.ag-m { font-size: 13px; color: var(--muted); }
.agenda-empty { padding: 20px 0; color: var(--muted); font-size: 14px; }

.demo-foot { margin-top: 28px; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }

/* Drawer */
.drawer-scrim, .viewer-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(42, 19, 22, 0.34); opacity: 0; transition: opacity 260ms ease; }
.drawer-scrim[data-open], .viewer-scrim[data-open] { opacity: 1; }
.drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(500px, 100%); display: flex; flex-direction: column; background: var(--paper); box-shadow: -30px 0 80px -30px rgba(42, 19, 22, 0.45); transform: translateX(100%); transition: transform 420ms var(--ease-drawer); visibility: hidden; }
.drawer[data-open] { transform: none; visibility: visible; }
.drawer:not([data-open]) { transition: transform 240ms var(--ease-out), visibility 0s 240ms; }
.dr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--parch-2); }
.dr-name { font-family: var(--font-display); font-size: 26px; line-height: 1.15; margin-top: 2px; }
.dr-body { flex: 1; overflow: auto; padding: 20px; display: grid; gap: 20px; align-content: start; }
.dr-h { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.dr-body p { font-size: 14.5px; color: var(--ink-2); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.fields div { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); min-width: 0; }
.fields dt { font-size: 11.5px; color: var(--muted); }
.fields dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.hist { display: grid; gap: 8px; }
.hist li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.hist .mono { color: var(--muted); font-size: 12.5px; }
.dr-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }

/* Responsive */
@media (max-width: 1240px) {
  .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draft-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
  .doc { padding: 34px 32px; }
}
@media (max-width: 1100px) {
  .draft-grid, .cal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  body.app { grid-template-columns: minmax(0, 1fr); padding-bottom: 76px; }
  .side { position: fixed; z-index: 60; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px -18px rgba(0, 0, 0, 0.5); }
  .side-brand, .side-foot { display: none; }
  .side-nav { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .side-nav a { flex-direction: column; gap: 4px; padding: 8px 2px; font-size: 11.5px; text-align: center; }
  .side-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-nav a[aria-current='page']::before { left: 30%; right: 30%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .top-mark { display: inline-flex; }
  .res-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; top: auto; max-height: 86vh; min-height: 0; height: 86vh; border-radius: 16px 16px 0 0; transform: translateY(100%); visibility: hidden; transition: transform 420ms var(--ease-drawer), visibility 0s 420ms; }
  .viewer[data-open] { transform: none; visibility: visible; transition: transform 420ms var(--ease-drawer); }
  .viewer-scrim { display: block; }
  .viewer-scrim[hidden] { display: none; }
  .vw-close { display: grid; }
  .tpl-pick { grid-template-columns: minmax(0, 1fr); }
  .tp { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .top-title { font-size: 36px; }
  .tpl-grid { grid-template-columns: minmax(0, 1fr); }
  .doc { padding: 26px 18px; font-size: 13.5px; min-height: 0; }
  .doc .d-head { flex-direction: column; gap: 6px; }
  .doc .d-head .r { text-align: left; }
  .fld-row { grid-template-columns: minmax(0, 1fr); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .cal { padding: 10px; }
  .cal-dow span { padding: 4px 2px; font-size: 10.5px; letter-spacing: 0; text-align: center; }
  .day { min-height: 54px; padding: 4px; align-items: center; }
  .day .ev, .day .more, .day .hol { display: none; }
  .day.has::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ox); margin-top: auto; }
  .day.today .dn { align-self: center; }
  .ask { padding: 12px; }
  .ask-row .btn { padding: 0 14px; }
  .vw-body { padding: 14px 14px 22px; font-size: 14px; }
  .vw-body .jp { grid-template-columns: 30px minmax(0, 1fr); }
  .hist li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .doc-actions .btn { height: 40px; padding: 0 12px; font-size: 13.5px; }
}
@media (max-width: 380px) {
  .demo-banner { font-size: 12px; }
  .side-nav a { font-size: 10.5px; }
}
@media (max-width: 980px) {
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}
