:root {
  --paper: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #f9fbf8;
  --ink: #1b2024;
  --ink-2: #48535b;
  --ink-3: #78838a;
  --line: #dbe2dc;
  --line-2: #e9eee9;
  --pine: #0f6a31;
  --pine-2: #0a5326;
  --pine-soft: #e5f2e8;
  --leaf: #5ba51b;
  --leaf-soft: #eef7e5;
  --amber: #a85f00;
  --amber-soft: #fff3df;
  --red: #b42318;
  --red-soft: #fdecea;
  --blue: #1d5fa8;
  --blue-soft: #e8f0fa;
  --violet: #5b3fb0;
  --violet-soft: #efeafb;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 14px rgba(20, 40, 30, .05);
  --shadow-lg: 0 20px 60px rgba(10, 30, 20, .25);
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Archivo', 'Public Sans', system-ui, sans-serif;
  --doc: 'Times New Roman', Times, Georgia, serif;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--pine); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--pine-2); }
h1, h2, h3, h4 { font-family: var(--display); font-stretch: 108%; margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 10px; }
small, .muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-2); }
:focus-visible { outline: 3px solid rgba(91, 165, 27, .55); outline-offset: 2px; border-radius: 4px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { opacity: .9; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; vertical-align: -4px; stroke: currentColor; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.side .brand { padding: 20px 20px 14px; display: block; }
.side .brand img { width: 176px; height: auto; display: block; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 14.5px; position: relative; }
.nav a svg { width: 19px; height: 19px; flex: none; stroke: currentColor; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--pine-soft); color: var(--pine-2); }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--leaf); }
.nav .badge { margin-left: auto; }
.nav-group { padding: 16px 22px 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.side-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--line-2); }
.me { display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--pine); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.me .who { min-width: 0; }
.me .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12.5px; color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 34px 40px; max-width: 1280px; width: 100%; }
.footer-note { padding: 0 34px 26px; font-size: 12px; color: var(--ink-3); max-width: 1280px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13.5px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--pine); text-decoration: underline; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-b { padding: 16px 18px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2e { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .panel, .grid-2e > .panel, .grid-2 > .stack, .grid-2e > .stack { margin-top: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 18px; }

/* stat strip */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.strip > div { padding: 16px 18px; border-left: 1px solid var(--line-2); }
.strip > div:first-child { border-left: 0; }
.strip .v { font-family: var(--display); font-weight: 750; font-size: 26px; font-stretch: 112%; line-height: 1.1; }
.strip .l { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.strip .v.red { color: var(--red); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.3; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); border-color: #c8d2ca; color: var(--ink); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; flex: none; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn.primary:hover { background: var(--pine-2); border-color: var(--pine-2); color: #fff; }
.btn.leaf { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn.leaf:hover { background: #4d8f15; }
.btn.danger { color: var(--red); border-color: #efc7c2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 11px 18px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ai { background: linear-gradient(180deg, #1c7a3b, #0f6a31); border-color: #0f6a31; color: #fff; }
.btn.ai:hover { background: #0a5326; color: #fff; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--pine); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.green { background: #d7eedd; color: #0a4a22; }
.pill.leaf { background: #dff0cc; color: #2c5a09; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f6faf6; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t .primary-cell b { display: block; }
table.t .primary-cell span { font-size: 13px; color: var(--ink-3); }
.money { font-variant-numeric: tabular-nums; }
.money.due { color: var(--red); font-weight: 650; }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field .help { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 14.5px; padding: 9px 11px; border: 1px solid #cdd6cf; border-radius: var(--radius-sm); background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(91, 165, 27, .18); }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--pine); flex: none; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-prefix input { padding-left: 24px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.err { color: var(--red); font-size: 13.5px; }
.callout { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.callout.warn { background: var(--amber-soft); border-color: #f3d9a8; color: #6b4200; }
.callout.danger { background: var(--red-soft); border-color: #f2c4bf; color: #7a1a12; }
.callout.info { background: var(--blue-soft); border-color: #c9dbf1; color: #173f6c; }
.callout.ok { background: var(--pine-soft); border-color: #c3e0cb; color: #0b4a22; }
.callout b { font-weight: 650; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; color: var(--ink); }
.empty .btn { margin-top: 12px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; font: inherit; font-weight: 600; font-size: 14.5px; color: var(--ink-3); padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--pine-2); border-bottom-color: var(--leaf); }

/* ---------- dashboard ---------- */
.hello { font-family: var(--display); font-weight: 780; font-size: 30px; font-stretch: 112%; }
.today-list { list-style: none; margin: 0; padding: 0; }
.today-list li { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.today-list li:last-child { border-bottom: 0; }
.datechip { text-align: center; border-radius: 8px; padding: 6px 4px; background: var(--surface-2); border: 1px solid var(--line-2); line-height: 1.15; }
.datechip .m { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.datechip .d { font-family: var(--display); font-weight: 780; font-size: 20px; font-stretch: 110%; }
.datechip .w { font-size: 11.5px; color: var(--ink-3); }
.datechip.now { background: var(--leaf-soft); border-color: #cfe8b6; }
.datechip.now .d { color: #3d7110; }
.datechip.court { background: var(--violet-soft); border-color: #dcd2f5; }
.datechip.court .d { color: var(--violet); }
.datechip.none .d { font-size: 15px; padding: 4px 0; color: var(--ink-3); }
.today-list .what b { display: block; font-size: 15px; }
.today-list .what span { color: var(--ink-3); font-size: 13.5px; }
.checklist { list-style: none; padding: 0; margin: 0; counter-reset: c; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.checklist li:last-child { border-bottom: 0; }
.checklist .n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--ink-3); flex: none; }
.checklist li.done .n { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.checklist li.done .t { color: var(--ink-3); text-decoration: line-through; }
.checklist .t { flex: 1; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 18px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed li b { font-weight: 600; }
.feed li .when { color: var(--ink-3); font-size: 12.5px; }

/* ---------- docket (case steps) ---------- */
.docket { list-style: none; margin: 0; padding: 0; position: relative; }
.docket > li { position: relative; padding: 0 0 0 52px; }
.docket > li::before { content: ''; position: absolute; left: 17px; top: 36px; bottom: -4px; width: 2px; background: var(--line); }
.docket > li:last-child::before { display: none; }
.docket > li.done::before { background: var(--leaf); }
.docket .dot { position: absolute; left: 2px; top: 6px; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; font-family: var(--display); font-weight: 750; font-size: 14px; color: var(--ink-3); z-index: 1; }
.docket > li.done .dot { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.docket > li.skipped .dot { background: var(--line-2); color: var(--ink-3); }
.docket > li.active .dot { background: var(--pine); border-color: var(--pine); color: #fff; box-shadow: 0 0 0 5px rgba(15, 106, 49, .14); }
.docket .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 12px 9px 4px; cursor: pointer; border-radius: 8px; }
.docket .row:hover .ttl { color: var(--pine-2); }
.docket .ttl { font-weight: 650; font-size: 15.5px; }
.docket li.pending .ttl { color: var(--ink-2); font-weight: 600; }
.docket li.skipped .ttl { text-decoration: line-through; color: var(--ink-3); }
.docket .meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.docket .right { text-align: right; flex: none; }
.docket .detail { margin: 2px 0 18px 4px; }
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.docket li.active .step-card { border-color: #9fcdae; box-shadow: 0 0 0 1px #9fcdae, var(--shadow); }
.step-when { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 16px 18px; background: linear-gradient(180deg, #f3faf0, #fff); border-bottom: 1px solid var(--line-2); align-items: center; }
.step-when.wait { background: linear-gradient(180deg, #fff8ea, #fff); }
.bigdate { text-align: center; min-width: 86px; border-right: 1px solid var(--line); padding-right: 16px; }
.bigdate .m { font-size: 12.5px; font-weight: 650; color: var(--ink-3); }
.bigdate .d { font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; font-stretch: 115%; color: var(--pine); }
.step-when.wait .bigdate .d { color: var(--amber); }
.bigdate .w { font-size: 12.5px; color: var(--ink-3); }
.step-when .lead { font-size: 15.5px; font-weight: 650; }
.step-when .why { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.step-body { padding: 16px 18px; }
.step-body .desc { color: var(--ink-2); white-space: pre-line; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; margin: 10px 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.step-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); align-items: center; }
.step-actions .spacer { flex: 1; }
.doc-chip { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; background: #fff; }
.doc-chip .ic { width: 30px; height: 36px; border-radius: 4px; background: var(--pine-soft); display: grid; place-items: center; color: var(--pine); flex: none; }
.doc-chip .ic svg { width: 17px; height: 17px; }
.doc-chip .nm { flex: 1; min-width: 0; }
.doc-chip .nm b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-chip .nm span { font-size: 12.5px; color: var(--ink-3); }
.court-box { border: 1px solid #d6cdf0; background: #faf8ff; border-radius: 8px; padding: 12px 14px; margin-top: 12px; }
.court-box h4 { font-family: var(--display); font-size: 14.5px; margin-bottom: 8px; color: var(--violet); }
.court-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.court-opts > div { background: #fff; border: 1px solid #e3dcf6; border-radius: 8px; padding: 11px 12px; font-size: 14px; }
.court-opts b { display: block; margin-bottom: 4px; }

.case-head { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.case-head h1 { font-size: 28px; }
.case-head .addr { color: var(--ink-2); margin-top: 4px; }
.progress { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; min-width: 80px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), var(--pine)); border-radius: 6px; }

/* ---------- document editor ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.doc-toolbar { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: 10px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.doc-toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.fmt { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.fmt button { width: 32px; height: 30px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-weight: 700; color: var(--ink-2); font-family: var(--doc); font-size: 15px; }
.fmt button:hover { background: var(--surface-2); color: var(--ink); }
.sheet-wrap { background: #e9ece8; border-radius: var(--radius); padding: 28px 20px; }
.sheet { background: #fff; max-width: 816px; min-height: 1056px; margin: 0 auto; padding: 72px 76px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12), 0 12px 40px rgba(0, 0, 0, .08); font-family: var(--doc); font-size: 15.5px; line-height: 1.55; color: #111; }
.sheet:focus { outline: none; box-shadow: 0 0 0 3px rgba(91, 165, 27, .35), 0 12px 40px rgba(0, 0, 0, .08); }
.sheet h1, .sheet h2, .sheet h3 { font-family: var(--doc); font-stretch: normal; letter-spacing: 0; color: #111; }
.sheet h1 { font-size: 20px; margin: 4px 0 14px; }
.sheet h2 { font-size: 17px; margin: 18px 0 8px; }
.sheet h3 { font-size: 15.5px; margin: 14px 0 6px; }
.sheet p { margin: 0 0 11px; }
.sheet table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.sheet td, .sheet th { vertical-align: top; padding: 4px 6px; }
.sheet .field-missing { background: #fff1b8; color: #8a2a00; font-weight: 700; padding: 0 2px; border-radius: 2px; }
.sheet .sig-block { margin: 26px 0 16px; }
.sheet .sig-line { border-bottom: 1px solid #222; width: 300px; min-height: 52px; display: flex; align-items: flex-end; }
.sheet .sig-line img { max-height: 54px; max-width: 280px; }
.sheet .sig-block p { margin: 3px 0; }
.sheet hr { border: 0; border-top: 1px solid #888; margin: 16px 0; }
.sheet ul, .sheet ol { padding-left: 26px; }
.sheet[contenteditable=false] { cursor: default; }
.side-card h3 { margin-bottom: 8px; }
.side-card ul { margin: 0; padding-left: 18px; font-size: 14px; }
.side-card li { margin-bottom: 5px; }
.sources a { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- signature pad ---------- */
.sig-pad { border: 1px dashed #aab5ad; border-radius: 8px; background: #fff; position: relative; touch-action: none; }
.sig-pad canvas { display: block; width: 100%; height: 170px; cursor: crosshair; }
.sig-pad .base { position: absolute; left: 24px; right: 24px; bottom: 36px; border-bottom: 1px solid #c5ccc7; pointer-events: none; }
.sig-pad .x { position: absolute; left: 10px; bottom: 38px; color: #aab5ad; font-size: 18px; pointer-events: none; }
.sig-typed { font-family: 'Brush Script MT', 'Segoe Script', 'Lucida Handwriting', cursive; font-size: 40px; text-align: center; padding: 30px 10px; border: 1px dashed #aab5ad; border-radius: 8px; min-height: 120px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; margin-bottom: 10px; }
.seg button { border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chat .msg { max-width: 82%; padding: 11px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.55; }
.chat .msg.user { align-self: flex-end; background: var(--pine); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat .msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat .msg.assistant p:last-child { margin-bottom: 0; }
.chat .msg.assistant ul, .chat .msg.assistant ol { margin: 4px 0 10px; padding-left: 20px; }
.chat .msg .srcs { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; }
.chat .msg .srcs a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat form textarea { min-height: 46px; height: 46px; }
.chat .typing { color: var(--ink-3); font-size: 14px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; justify-content: center; }
.suggestions button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.suggestions button:hover { border-color: var(--leaf); color: var(--pine-2); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 28, 22, .48); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .14s ease-out; }
.modal.wide { max-width: 820px; }
.modal-h { padding: 18px 22px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-h p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.modal-b { padding: 6px 22px 18px; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* AI working overlay */
.working { text-align: center; padding: 26px 10px 10px; }
.working .orb { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; background: conic-gradient(from 0deg, var(--leaf), var(--pine), #a8d978, var(--leaf)); animation: spin 1.2s linear infinite; position: relative; }
.working .orb::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.working .msg { font-weight: 650; font-size: 16px; }
.working .sub { color: var(--ink-3); font-size: 13.5px; margin-top: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .working .orb { animation-duration: 4s; } .modal, .modal-bg { animation: none; } }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0, 0, 0, .15); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }

/* toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .15s ease-out; }
.toast.ok { background: #0f5126; }
.toast.err { background: #8c1d14; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: #0d4f25; color: #eaf5e3; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -120px; bottom: -80px; width: 520px; height: 420px; background: linear-gradient(135deg, rgba(91, 165, 27, .55), rgba(91, 165, 27, 0)); clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%); }
.auth-art h2 { font-size: 38px; font-weight: 800; font-stretch: 115%; line-height: 1.08; color: #fff; max-width: 460px; }
.auth-art .steps { list-style: none; padding: 0; margin: 28px 0 0; position: relative; z-index: 1; }
.auth-art .steps li { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; font-size: 15.5px; color: #d6ebcc; }
.auth-art .steps li b { color: #fff; display: block; }
.auth-art .steps .k { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #8fdc5c; color: #8fdc5c; display: grid; place-items: center; font-weight: 750; flex: none; font-family: var(--display); }
.auth-art small { color: #a9cf98; position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form .logo { width: 250px; margin-bottom: 26px; }
.auth-form h1 { margin-bottom: 6px; }
.auth-form .sub { color: var(--ink-2); margin-bottom: 22px; }

/* ---------- misc ---------- */
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.mt-s { margin-top: 8px; }
.mb { margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=search] { max-width: 280px; }
.chipset { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.chipset button { border: 0; background: none; font: inherit; font-size: 13.5px; padding: 5px 11px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.chipset button.on { background: var(--pine); color: #fff; }
.md p { margin: 0 0 9px; }
.md h3, .md h4 { margin: 10px 0 6px; font-size: 15px; }
.md code { background: var(--line-2); padding: 1px 4px; border-radius: 4px; font-size: 13px; }
dl.facts { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; }
.rules-sec { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.rules-sec:last-child { border-bottom: 0; }
.rules-sec h3 { margin-bottom: 6px; }
.rules-sec p { color: var(--ink-2); font-size: 14.5px; }
.temp-pass { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; user-select: all; }
.agenda-day { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.agenda-day:last-child { border-bottom: 0; }
.agenda-day .dl b { display: block; font-family: var(--display); font-size: 16px; }
.agenda-day .dl span { color: var(--ink-3); font-size: 13px; }
.agenda-day.today { background: #f6fbf2; }
.agenda-item { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.agenda-item a { font-weight: 600; text-decoration: none; color: var(--ink); }
.agenda-item a:hover { color: var(--pine); text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .doc-layout { grid-template-columns: 1fr; }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .strip > div:nth-child(3) { border-left: 0; }
  .strip > div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 50; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
  .topbar img { height: 30px; }
  .topbar button { border: 0; background: none; padding: 6px; cursor: pointer; }
  .content { padding: 18px 16px 30px; }
  .footer-note { padding: 0 16px 20px; }
  .form-grid, .form-grid.three, .grid-2e, .court-opts, .checks { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .today-list li { grid-template-columns: 72px 1fr; }
  .today-list li > :last-child { grid-column: 2; }
  .kv, dl.facts { grid-template-columns: 1fr; }
  .kv dt, dl.facts dt { margin-top: 6px; }
  .sheet { padding: 36px 24px; min-height: 0; }
  .sheet-wrap { padding: 10px; }
  .agenda-day { grid-template-columns: 1fr; gap: 6px; }
  .chat .msg { max-width: 94%; }
  .step-when { grid-template-columns: 1fr; }
  .bigdate { border-right: 0; padding-right: 0; display: flex; gap: 8px; align-items: baseline; text-align: left; }
  .bigdate .d { font-size: 28px; }
  .hello { font-size: 24px; }
}

@media print {
  .side, .topbar, .doc-toolbar, .doc-side, .footer-note, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .sheet-wrap { background: none; padding: 0; }
  .sheet { box-shadow: none; padding: 0; max-width: none; min-height: 0; }
  .sheet .field-missing { background: none; }
}

/* =================== v2: panels, search, ledger, files, guide =================== */
.logo-dark { display: none !important; }
.imp-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 34px; background: #3b2a7a; color: #fff; font-size: 14px; }
.imp-bar .btn { margin-left: auto; }
.side-search { display: flex; align-items: center; gap: 9px; margin: 2px 12px 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink-3); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.side-search:hover { border-color: var(--leaf); color: var(--ink); }
.side-search span { flex: 1; }
.side-search kbd, kbd { font-family: inherit; font-size: 11.5px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface); color: var(--ink-3); }
.tb-search { margin-left: auto; }
.tb-title { font-family: var(--display); font-size: 16px; }
.search-modal { max-width: 620px; }
.search-modal input { font-size: 16px; padding: 12px 14px; }
.search-results { margin-top: 10px; max-height: 60vh; overflow-y: auto; }
.search-results .sr-group { font-size: 12.5px; font-weight: 650; color: var(--ink-3); padding: 10px 4px 4px; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.search-results a span { color: var(--ink-3); font-size: 13.5px; text-align: right; }
.search-results a:hover, .search-results a.sel { background: var(--pine-soft); }
.portal-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: #0f5126; background: #d9f0c5; border-radius: 6px; padding: 3px 8px; }
.portal-tag.big { font-size: 13px; margin-bottom: 18px; }
.cred { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); font-size: 15px; }
.cred .label { margin-bottom: 4px; }
.balance-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.balance-cards > div { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.balance-cards b { display: block; font-family: var(--display); font-size: 20px; font-stretch: 110%; }
.balance-cards span { font-size: 13px; color: var(--ink-3); }
.amt-plus { color: var(--red); }
.amt-minus { color: var(--pine); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line-2); }
.file-row:last-child { border-bottom: 0; }
.file-row .nm { flex: 1; min-width: 0; }
.file-row .nm b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .nm span { font-size: 12.5px; color: var(--ink-3); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--leaf); background: var(--leaf-soft); }
.guide-steps { counter-reset: g; list-style: none; padding: 0; margin: 0; }
.guide-steps > li { position: relative; padding: 0 0 22px 56px; }
.guide-steps > li::before { counter-increment: g; content: counter(g); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--pine); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 17px; }
.guide-steps > li::after { content: ''; position: absolute; left: 18px; top: 42px; bottom: 4px; width: 2px; background: var(--line); }
.guide-steps > li:last-child::after { display: none; }
.guide-steps h3 { font-size: 17px; margin: 6px 0 6px; }
.guide-steps p { color: var(--ink-2); margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--line-2); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq details p { color: var(--ink-2); margin: 8px 0 0; }

/* ---------- Admin Panel: its own look ---------- */
.admin-shell .side { background: #0f2219; border-right-color: #0a1811; }
.admin-shell .side .brand { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.admin-shell .nav a { color: #b8cdbf; }
.admin-shell .nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-shell .nav a.active { background: rgba(143, 220, 92, .14); color: #fff; }
.admin-shell .side-foot { border-top-color: rgba(255, 255, 255, .08); }
.admin-shell .me .who b { color: #fff; }
.admin-shell .me .who span { color: #8fa898; }
.admin-shell .side-foot .btn.ghost { color: #b8cdbf; }
.admin-shell .side-foot .btn.ghost:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-shell .avatar { background: #8fdc5c; color: #0f2219; }
.admin-auth .auth-art { background: #0f2219; }

/* ---------- dark theme ---------- */
:root[data-theme="dark"] {
  --paper: #0e1411; --surface: #151d19; --surface-2: #1a2420; --ink: #e7eee9; --ink-2: #b4c1b9; --ink-3: #85938b;
  --line: #2a3731; --line-2: #212c27; --pine: #2f9a57; --pine-2: #3db466; --pine-soft: #17321f; --leaf: #7ac943; --leaf-soft: #1c3114;
  --amber: #f0b456; --amber-soft: #3a2b12; --red: #ff8a7d; --red-soft: #3a1a17; --blue: #8ab8f2; --blue-soft: #15263b; --violet: #b9a6ff; --violet-soft: #251e3e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1411; --surface: #151d19; --surface-2: #1a2420; --ink: #e7eee9; --ink-2: #b4c1b9; --ink-3: #85938b;
    --line: #2a3731; --line-2: #212c27; --pine: #2f9a57; --pine-2: #3db466; --pine-soft: #17321f; --leaf: #7ac943; --leaf-soft: #1c3114;
    --amber: #f0b456; --amber-soft: #3a2b12; --red: #ff8a7d; --red-soft: #3a1a17; --blue: #8ab8f2; --blue-soft: #15263b; --violet: #b9a6ff; --violet-soft: #251e3e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}

:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
:root[data-theme="dark"] .topbar .logo-dark { display: inline !important; }
:root[data-theme="dark"] a { color: #6fcf8f; }
:root[data-theme="dark"] a:hover { color: #93dfaa; }
:root[data-theme="dark"] input[type=text],:root[data-theme="dark"] input[type=email],:root[data-theme="dark"] input[type=password],:root[data-theme="dark"] input[type=number],:root[data-theme="dark"] input[type=date],:root[data-theme="dark"] input[type=time],:root[data-theme="dark"] input[type=tel],:root[data-theme="dark"] input[type=url],:root[data-theme="dark"] input[type=search],:root[data-theme="dark"] select,:root[data-theme="dark"] textarea { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
:root[data-theme="dark"] .doc-chip,:root[data-theme="dark"] .court-opts > div,:root[data-theme="dark"] .suggestions button,:root[data-theme="dark"] .auth-form { background: var(--surface); }
:root[data-theme="dark"] .court-box { background: #1b1730; border-color: #3a3166; }
:root[data-theme="dark"] .court-opts > div { border-color: #3a3166; }
:root[data-theme="dark"] .step-when { background: linear-gradient(180deg, #17301f, var(--surface)); }
:root[data-theme="dark"] .step-when.wait { background: linear-gradient(180deg, #33270f, var(--surface)); }
:root[data-theme="dark"] .sheet-wrap { background: #0a0f0c; }
:root[data-theme="dark"] table.t tr.click:hover td { background: #1b2a22; }
:root[data-theme="dark"] .agenda-day.today { background: #15261c; }
:root[data-theme="dark"] .seg button.on { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .callout.warn { border-color: #5a4316; color: #f6d9a6; }
:root[data-theme="dark"] .callout.danger { border-color: #5c2621; color: #ffc2bb; }
:root[data-theme="dark"] .callout.info { border-color: #23405f; color: #c4dcf7; }
:root[data-theme="dark"] .callout.ok { border-color: #24502f; color: #bfe8c9; }
:root[data-theme="dark"] .pill { background: var(--line); }
:root[data-theme="dark"] .pill.green { color: #9fe0b3; }
:root[data-theme="dark"] .pill.leaf { color: #b6e690; }
:root[data-theme="dark"] .pill.amber { color: var(--amber); }
:root[data-theme="dark"] .pill.red { color: var(--red); }
:root[data-theme="dark"] .pill.blue { color: var(--blue); }
:root[data-theme="dark"] .pill.violet { color: var(--violet); }
:root[data-theme="dark"] .btn.danger { border-color: #5c2621; }
:root[data-theme="dark"] .portal-tag { background: #24502f; color: #c9f0a9; }
:root[data-theme="dark"] .chat .msg.user { background: #24723f; }
:root[data-theme="dark"] .datechip.now .d { color: #b6e690; }
:root[data-theme="dark"] .docket .dot { background: var(--surface); }
:root[data-theme="dark"] .money.due { color: var(--red); }
:root[data-theme="dark"] .modal-bg { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .sig-pad { background: #fff; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .logo-light { display: none !important; }
:root:not([data-theme="light"]) .logo-dark { display: block !important; }
:root:not([data-theme="light"]) .topbar .logo-dark { display: inline !important; }
:root:not([data-theme="light"]) a { color: #6fcf8f; }
:root:not([data-theme="light"]) a:hover { color: #93dfaa; }
:root:not([data-theme="light"]) input[type=text],:root:not([data-theme="light"]) input[type=email],:root:not([data-theme="light"]) input[type=password],:root:not([data-theme="light"]) input[type=number],:root:not([data-theme="light"]) input[type=date],:root:not([data-theme="light"]) input[type=time],:root:not([data-theme="light"]) input[type=tel],:root:not([data-theme="light"]) input[type=url],:root:not([data-theme="light"]) input[type=search],:root:not([data-theme="light"]) select,:root:not([data-theme="light"]) textarea { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
:root:not([data-theme="light"]) .doc-chip,:root:not([data-theme="light"]) .court-opts > div,:root:not([data-theme="light"]) .suggestions button,:root:not([data-theme="light"]) .auth-form { background: var(--surface); }
:root:not([data-theme="light"]) .court-box { background: #1b1730; border-color: #3a3166; }
:root:not([data-theme="light"]) .court-opts > div { border-color: #3a3166; }
:root:not([data-theme="light"]) .step-when { background: linear-gradient(180deg, #17301f, var(--surface)); }
:root:not([data-theme="light"]) .step-when.wait { background: linear-gradient(180deg, #33270f, var(--surface)); }
:root:not([data-theme="light"]) .sheet-wrap { background: #0a0f0c; }
:root:not([data-theme="light"]) table.t tr.click:hover td { background: #1b2a22; }
:root:not([data-theme="light"]) .agenda-day.today { background: #15261c; }
:root:not([data-theme="light"]) .seg button.on { background: var(--surface); color: var(--ink); }
:root:not([data-theme="light"]) .callout.warn { border-color: #5a4316; color: #f6d9a6; }
:root:not([data-theme="light"]) .callout.danger { border-color: #5c2621; color: #ffc2bb; }
:root:not([data-theme="light"]) .callout.info { border-color: #23405f; color: #c4dcf7; }
:root:not([data-theme="light"]) .callout.ok { border-color: #24502f; color: #bfe8c9; }
:root:not([data-theme="light"]) .pill { background: var(--line); }
:root:not([data-theme="light"]) .pill.green { color: #9fe0b3; }
:root:not([data-theme="light"]) .pill.leaf { color: #b6e690; }
:root:not([data-theme="light"]) .pill.amber { color: var(--amber); }
:root:not([data-theme="light"]) .pill.red { color: var(--red); }
:root:not([data-theme="light"]) .pill.blue { color: var(--blue); }
:root:not([data-theme="light"]) .pill.violet { color: var(--violet); }
:root:not([data-theme="light"]) .btn.danger { border-color: #5c2621; }
:root:not([data-theme="light"]) .portal-tag { background: #24502f; color: #c9f0a9; }
:root:not([data-theme="light"]) .chat .msg.user { background: #24723f; }
:root:not([data-theme="light"]) .datechip.now .d { color: #b6e690; }
:root:not([data-theme="light"]) .docket .dot { background: var(--surface); }
:root:not([data-theme="light"]) .money.due { color: var(--red); }
:root:not([data-theme="light"]) .modal-bg { background: rgba(0, 0, 0, .6); }
:root:not([data-theme="light"]) .sig-pad { background: #fff; }
}
@media (max-width: 860px) {
  .imp-bar { padding: 10px 16px; }
  .balance-cards { grid-template-columns: 1fr; }
  .topbar .tb-search { margin-left: auto; }
  .search-results a { flex-direction: column; gap: 2px; }
  .search-results a span { text-align: left; }
}
/* grid children must be allowed to shrink so wide tables scroll inside their panel on phones */
.grid-2 > *, .grid-2e > *, .stack > *, .case-head > *, .main, .content { min-width: 0; }
.side-foot .row-flex { display: flex; flex-wrap: wrap; gap: 2px; }
.side-foot .row-flex .btn { padding: 5px 8px; }
@media (max-width: 860px) { .case-head > div[style] { min-width: 0 !important; width: 100%; } }

/* ---------- phone layout: tables become stacked cards, nothing scrolls sideways ---------- */
@media (max-width: 860px) {
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  table.t.cards tr:last-child { border-bottom: 0; }
  table.t.cards td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 4px 0; border: 0; text-align: right; }
  table.t.cards td.num { text-align: right; }
  table.t.cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; font-weight: 600; text-align: left; flex: none; max-width: 45%; }
  table.t.cards td[data-label=""]::before, table.t.cards td:not([data-label])::before { content: none; }
  table.t.cards td:first-child { display: block; text-align: left; font-size: 15.5px; padding-bottom: 6px; }
  table.t.cards td:first-child::before { content: none; }
  table.t.cards td.primary-cell, table.t.cards td.primary-cell b, table.t.cards td.primary-cell span { text-align: left; }
  table.t.cards td:not(:first-child).primary-cell { display: flex; }
  table.t.cards td:not(:first-child).primary-cell b, table.t.cards td:not(:first-child).primary-cell span { text-align: right; }
  table.t.cards td.right { justify-content: flex-end; }
  table.t.cards td:empty { display: none; }
  .table-wrap { overflow-x: visible; }
  .tabs { flex-wrap: wrap; gap: 0; border-bottom: 0; }
  .tabs button { padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; margin: 0 6px 6px 0; }
  .tabs button.on { background: var(--pine-soft); border-color: var(--leaf); }
  .doc-toolbar { position: static; }
  .fmt { flex-wrap: wrap; max-width: 100%; }
  #title { max-width: 100% !important; min-width: 0; }
  .doc-toolbar .sep { display: none; }
  .step-actions .btn:not(.ghost) { flex: 1 1 auto; white-space: normal; text-align: center; }
  .page-head .actions .btn, .doc-toolbar .btn { white-space: normal; }
  .agenda-item { flex-wrap: wrap; gap: 4px 8px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .strip .v { font-size: 22px; }
}

/* "Part of the Landlord 360 Network" badge */
.l360 { display: inline-flex; align-items: center; gap: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); text-decoration: none; white-space: nowrap; line-height: 1; }
.l360:hover { color: var(--ink); }
.l360 img.l360-i, .side .brand .l360 img.l360-i { width: 15px; height: 15px; border-radius: 4px; display: block; }
.l360 img.l360-w, .side .brand .l360 img.l360-w { width: auto; height: 8px; display: block; }
.l360-dark { color: #a9bcae; }
.l360-dark:hover { color: #fff; }
.side .brand > a:first-child { display: block; }
.side .brand .l360 { margin-top: 8px; }
.auth-form .box .l360 { margin: -6px 0 18px; }
