/* PASHAN practice system: staff area and client portal. Inter throughout. Dark mode in deep oxblood, light mode in Pashan blue. */
:root {
  --bg: #3a1210; --bg-2: #45160f; --bg-footer: #2b0d0b; --panel: rgba(255, 255, 255, 0.04); --panel-2: rgba(255, 255, 255, 0.07);
  --ink: #fbf7ee; --muted: #dcc9c2; --accent: #f8f5e6; --blue: #cbe5fd; --ox: #6f2720; --ox-bright: #a3443a; --cream: #f8f5e6; --heading: #ffffff;
  --hair: rgba(248, 245, 230, 0.16); --hair-strong: rgba(248, 245, 230, 0.36); --ok: #9fd3a6; --warn: #f0c27b; --err: #f3a39a;
  --chart-1: #cbe5fd; --chart-2: #f0c27b; --chart-3: #a3443a; --chart-4: #9fd3a6; --chart-5: #e8a0bf; --chart-6: #b8a7ff; --wg-cross: #f0c27b;
  --btn-primary: #a3443a; --btn-primary-hover: #b8524a;
  --display: Inter, "Helvetica Neue", Arial, sans-serif; --sans: Inter, "Helvetica Neue", Arial, sans-serif; --side: 248px;
}
html[data-mode="light"] {
  --bg: #cbe5fd; --bg-2: #bddcf6; --bg-footer: #b3d4f3; --panel: rgba(255, 255, 255, 0.5); --panel-2: rgba(255, 255, 255, 0.75);
  --ink: #1a1a1a; --muted: #4d5a66; --accent: #6f2720; --blue: #6f2720; --cream: #f8f5e6; --heading: #1a1a1a;
  --hair: rgba(26, 26, 26, 0.14); --hair-strong: rgba(26, 26, 26, 0.32); --ok: #2f7d3b; --warn: #9a6b00; --err: #b00020;
  --chart-1: #6f2720; --chart-2: #9a6b00; --chart-3: #2f5d8a; --chart-4: #2f7d3b; --chart-5: #a5356b; --chart-6: #5b4ea8; --wg-cross: #9a6b00;
  --btn-primary: #6f2720; --btn-primary-hover: #8a3129;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 0.5em; color: var(--heading); }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); }
h2 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.label { font-family: var(--sans); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--blue); margin: 0 0 10px; }
.link { color: var(--blue); font-size: 12.5px; }

/* Scene behind dashboards and sign-in */
.scene-wrap { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.scene-wrap canvas { width: 100%; height: 100%; display: block; opacity: 0.55; }
.scene-wrap::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 70% at 30% 40%, var(--bg), transparent 70%); }
body.has-scene .main { position: relative; z-index: 1; }
body.has-scene .main-inner > *:not(.hero-card):not(.page-head):not(.flash):not(.quote):not(.ai-inline) { background: color-mix(in srgb, var(--bg) 82%, black); }

/* Layout */
.side { position: fixed; top: 0; left: 0; bottom: 0; width: var(--side); background: var(--bg-footer); border-right: 1px solid var(--hair); display: flex; flex-direction: column; padding: 24px 0; z-index: 30; }
.side-brand { padding: 4px 24px 24px; display: block; }
.side-brand img { height: 34px; width: auto; max-width: none; }
.side-nav { display: flex; flex-direction: column; padding: 0 12px; gap: 2px; overflow: auto; }
.side-nav a { padding: 10px 12px; border-radius: 6px; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; }
.side-nav a:hover { background: var(--panel); color: var(--heading); text-decoration: none; }
.side-nav a.active { background: var(--panel-2); color: var(--heading); box-shadow: inset 3px 0 0 var(--blue); }
.side-user { margin-top: auto; padding: 20px 24px 0; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 2px; }
.side-name { color: var(--heading); font-size: 13.5px; }
.side-role { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.side-out { margin-top: 10px; font-size: 12.5px; }
.side-toggle { display: none; position: fixed; top: 14px; right: 14px; z-index: 40; width: 44px; height: 44px; background: var(--bg-footer); border: 1px solid var(--hair); border-radius: 8px; cursor: pointer; }
.side-toggle span, .side-toggle span::before, .side-toggle span::after { content: ""; display: block; width: 20px; height: 1.5px; background: var(--heading); position: absolute; left: 11px; }
.side-toggle span { top: 21px; } .side-toggle span::before { top: 0; left: 0; transform: translateY(-6px); } .side-toggle span::after { top: 0; left: 0; transform: translateY(6px); }
.main { margin-left: var(--side); min-height: 100vh; }
.main-inner { max-width: 1240px; padding: 36px 40px 80px; display: flex; flex-direction: column; gap: 24px; }

/* Page head, flashes */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-sub { color: var(--muted); margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flash { padding: 12px 16px; border-left: 3px solid var(--blue); background: var(--panel); border-radius: 0 6px 6px 0; }
.flash-ok { border-color: var(--ok); } .flash-error { border-color: var(--err); }
.form-error { color: var(--err); font-size: 13px; }

/* Hero card, quote, stats */
.hero-card { padding: 8px 0 8px; position: relative; }
.hero-card h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); font-weight: 600; letter-spacing: -0.02em; }
.hero-card .lede { color: var(--muted); font-size: 1.05rem; max-width: 640px; }
.quote { margin: 20px 0 0; padding: 0 0 0 20px; border-left: 2px solid var(--blue); max-width: 760px; }
.quote p { font-family: var(--display); font-size: 1.15rem; font-style: italic; font-weight: 400; color: var(--heading); margin: 0 0 6px; line-height: 1.45; }
.quote footer { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: 8px; overflow: hidden; }
.stat { background: var(--bg); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--display); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; color: var(--heading); line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* Cards, tables, grid */
.card { background: var(--panel); border: 1px solid var(--hair); border-radius: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--hair); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1.1rem; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--hair-strong); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--hair-strong); border-radius: 4px; color: var(--muted); white-space: nowrap; }
.badge-ok, .badge-paid, .badge-done, .badge-closed, .badge-completed, .badge-approved, .badge-clear, .badge-signed { border-color: var(--ok); color: var(--ok); }
.badge-warn, .badge-partially_paid, .badge-in_progress, .badge-on_hold, .badge-awaiting_client, .badge-awaiting_authority, .badge-in_review, .badge-submitted, .badge-final, .badge-high, .badge-hearing, .badge-filing { background: var(--cream); border-color: var(--cream); color: var(--ox); }
.badge-issued, .badge-open, .badge-planned, .badge-draft { border-color: var(--blue); color: var(--blue); }
.badge-void, .badge-cancelled, .badge-rejected, .badge-hits, .badge-error { border-color: var(--err); color: var(--err); }
.progress { display: inline-block; width: 120px; height: 4px; background: var(--hair); border-radius: 2px; vertical-align: middle; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue); }
.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager a { padding: 6px 10px; border: 1px solid var(--hair); border-radius: 6px; font-size: 12.5px; }
.pager a.active { background: var(--blue); color: var(--bg); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hair-strong); flex-wrap: wrap; }
.tabs a { padding: 10px 14px; color: var(--muted); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--heading); text-decoration: none; }
.tabs a.active { color: var(--heading); border-bottom-color: var(--blue); }
.quick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 30px 24px; border: 1px solid var(--hair); border-radius: 8px; background: var(--panel); }
.quick .label { margin: 0 8px 0 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 6px; border: 1px solid var(--cream); color: var(--ox); font-family: var(--sans); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; background: var(--cream); cursor: pointer; line-height: 1; transition: background .2s, border-color .2s, color .2s; }
.btn:hover { background: #ffffff; border-color: #ffffff; color: var(--ox); text-decoration: none; }
.btn-primary { background: var(--btn-primary); color: var(--cream); border-color: var(--btn-primary); }
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); color: #ffffff; }
.btn-ghost { background: transparent; border-color: var(--hair-strong); color: var(--muted); }
.btn-ghost:hover { background: transparent; border-color: var(--heading); color: var(--heading); }
.btn-sm { padding: 6px 10px; font-size: 10.5px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.inline { display: inline; }
.chip { font-size: 11px; padding: 5px 9px; border: 1px solid var(--hair-strong); border-radius: 6px; background: transparent; color: var(--blue); cursor: pointer; font-family: monospace; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; align-items: start; }
.form-grid .span-2 { grid-column: 1 / -1; }
.row-3 { display: grid; grid-template-columns: 1fr 2fr 2fr 2fr; gap: 14px 20px; }
.form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.form-row .field { flex: 1; min-width: 160px; margin: 0; }
.form-row-sm { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.form-row-sm input, .form-row-sm select { padding: 6px 8px; font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--muted); font-size: 11.5px; }
input, select, textarea { width: 100%; background: var(--panel); border: 1px solid var(--hair-strong); border-radius: 6px; color: var(--heading); padding: 10px 12px; font: inherit; font-size: 14px; outline: none; transition: border-color .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[readonly] { color: var(--muted); }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23cbe5fd' stroke-width='1.5'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
html[data-mode="light"] select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%236f2720' stroke-width='1.5'/></svg>"); }
select option { background: var(--bg-footer); color: var(--heading); }
input[type="file"] { padding: 8px; font-size: 12.5px; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; min-height: 60px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: #cbe5fd; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding-top: 24px; }
.big-checks { padding: 12px 0 0; gap: 28px; }
.big-checks .check { font-family: var(--display); font-size: 1.1rem; color: var(--heading); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; border-top: 1px solid var(--hair); z-index: 5; }
.search { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search input[type="search"], .search select { max-width: 320px; }
.gen { margin-top: 6px; align-self: flex-start; }
.notify-block { border: 1px solid var(--hair); border-radius: 8px; padding: 16px; }
.notify-block .checks { padding-top: 0; margin-bottom: 10px; }
.lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.line-row { display: grid; grid-template-columns: 3fr 1fr 1fr; gap: 8px; }
.app-form { display: flex; flex-direction: column; gap: 24px; }
.persons-list { display: flex; flex-direction: column; gap: 18px; }
.hv-line { display: grid; grid-template-columns: minmax(0, 1fr) 120px 72px; gap: 8px; margin-bottom: 6px; }
.side-search { padding: 4px 14px 10px; }
.side-search input { font-size: 13px; padding: 8px 10px; }
.batch-rows { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre; }
.pending-box { border: 1px solid var(--warn); border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; }
.person-block { border: 1px solid var(--hair-strong); border-radius: 8px; padding: 18px 20px 8px; background: var(--panel); }
.person-block h3 { margin: 0 0 14px; font-size: 1rem; color: var(--heading); }
.photo-row { display: flex; gap: 22px; align-items: flex-start; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.photo-thumb { flex: 0 0 auto; }
.photo-fields { flex: 1; min-width: 0; }
.photo-fields .form-grid { margin: 0; }
.ocr-line { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-wrap { display: flex; flex-direction: column; gap: 14px; }
.ai-page { display: flex; flex-direction: column; height: calc(100vh - 116px); max-width: 940px; width: 100%; margin: 0 auto; gap: 0; }
.ai-page .ai-top { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; border-bottom: 1px solid var(--hair); }
.ai-page .ai-thread { flex: 1; overflow: auto; max-height: none; min-height: 0; padding: 18px 6px 16px; gap: 20px; }
.ai-page .ai-msg { font-size: 15px; line-height: 1.6; }
.ai-page .ai-question { max-width: 78%; border-radius: 18px 18px 4px 18px; padding: 12px 18px; }
.ai-page .ai-answer { background: transparent; border: 0; padding: 2px 2px 6px; max-width: 100%; }
.ai-page .ai-answer .ai-body .table { font-size: 13.5px; }
.ai-page .ai-empty { margin: auto; text-align: center; max-width: 640px; }
.ai-page .ai-empty h2 { font-size: 32px; font-weight: 500; margin: 0 0 8px; color: var(--heading); }
.ai-page .ai-chips { justify-content: center; margin-top: 18px; }
.ai-composer { flex: 0 0 auto; padding: 10px 0 2px; }
.ai-composer .ai-ask { border: 1px solid var(--hair-strong); border-radius: 26px; padding: 6px 6px 6px 18px; background: var(--panel-2); align-items: center; border-top: 1px solid var(--hair-strong); }
.ai-composer .ai-ask:focus-within { border-color: var(--heading); }
.ai-composer textarea { background: transparent; border: 0; box-shadow: none; padding: 9px 0; min-height: 24px; max-height: 180px; resize: none; font-size: 15px; }
.ai-composer textarea:focus { outline: none; box-shadow: none; }
.ai-composer .ai-ask-actions { flex-direction: row; }
.ai-composer .btn { border-radius: 999px; padding: 11px 18px; }
.ai-composer .ai-hint { text-align: center; font-size: 11px; color: var(--muted); margin-top: 8px; }
.ai-inline { margin: 22px 0 4px; max-width: 980px; gap: 10px; }
.ai-inline .ai-head { display: flex; justify-content: space-between; align-items: center; }
.ai-inline .ai-ask { border-top: 0; padding-top: 0; }
.ai-inline .ai-ask textarea { min-height: 46px; }
.ai-inline .ai-thread { max-height: none; min-height: 0; overflow: visible; padding: 0; }
.ai-inline .ai-thread:empty { display: none; }
.ai-thread { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 340px); min-height: 220px; overflow: auto; padding: 4px 2px; }
.ai-msg { max-width: 880px; border-radius: 12px; padding: 12px 16px; line-height: 1.5; font-size: 14px; }
.ai-question { align-self: flex-end; background: var(--btn-primary); color: var(--cream); max-width: 70%; }
.ai-answer { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--hair); }
.ai-answer .ai-body p { margin: 0 0 8px; } .ai-answer .ai-body p:last-child { margin-bottom: 0; }
.ai-answer .ai-body h3, .ai-answer .ai-body h4, .ai-answer .ai-body h5 { margin: 10px 0 6px; font-size: 14px; }
.ai-answer .ai-body ul, .ai-answer .ai-body ol { margin: 6px 0 8px 20px; }
.ai-answer .ai-body .table-wrap { margin: 8px 0; } .ai-answer .ai-body .table { font-size: 13px; } .ai-answer .ai-body td.num { text-align: right; white-space: nowrap; }
.ai-meta { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.ai-thinking .ai-body { color: var(--muted); font-style: italic; }
.ai-error { border-color: var(--err); }
.ai-empty { color: var(--muted); max-width: 760px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-chip { border: 1px solid var(--hair-strong); background: transparent; color: var(--ink); border-radius: 999px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; font-family: var(--sans); text-align: left; }
.ai-chip:hover { border-color: var(--heading); }
.ai-ask { display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--hair); padding-top: 12px; }
.ai-ask textarea { flex: 1; resize: vertical; min-height: 56px; }
.ai-ask-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.login-keep { display: flex !important; align-items: center; gap: 8px; flex-direction: row !important; text-transform: none !important; letter-spacing: 0 !important; font-size: 13px !important; margin: 4px 0 12px; }
.login-keep input { width: auto !important; margin: 0; }
.rules-table th, .rules-table td { white-space: nowrap; font-size: 12px; }
.rules-table td:first-child { white-space: normal; min-width: 220px; }
.rule-select { padding: 4px 26px 4px 6px; font-size: 12px; min-width: 196px; }
.rules-card h3 { margin: 18px 0 6px; }
.result-person { margin-top: 16px; }
.result-person .card-head h2 { display: flex; align-items: center; gap: 12px; }
.result-face { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid var(--hair); }
.result-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.result-thumb { display: flex; flex-direction: column; gap: 4px; width: 160px; text-decoration: none; color: var(--muted); font-size: 12px; }
.result-thumb img { width: 160px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--hair); }
.result-thumb span { height: 110px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--hair); border-radius: 6px; padding: 6px; text-align: center; color: var(--heading); }
.ai-link { display: inline-block; margin: 4px 0; padding: 6px 12px; border-radius: 6px; background: var(--cream); color: var(--ox) !important; text-decoration: none; font-weight: 600; }
.fx-bal { font-size: 12px; color: var(--muted); font-weight: 600; }
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: color-mix(in srgb, var(--blue) 25%, transparent); z-index: 1000; overflow: hidden; }
.busy-bar div { position: absolute; top: 0; bottom: 0; width: 35%; background: var(--blue); border-radius: 2px; animation: busy-slide 1.4s ease-in-out infinite; }
@keyframes busy-slide { 0% { left: -35%; } 100% { left: 100%; } }
.busy-note { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--bg); color: var(--heading); border: 1px solid var(--hair-strong); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); font-size: 14px; z-index: 1000; max-width: calc(100vw - 32px); }
.busy-note small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; vertical-align: -2px; margin-right: 8px; animation: spin 0.8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
button.is-busy, input.is-busy { opacity: 0.6; cursor: wait; }
.busy-inline { display: inline-flex; align-items: center; gap: 10px; margin: 0 12px; font-size: 13px; color: var(--heading); vertical-align: middle; flex-wrap: wrap; }
.busy-track { position: relative; width: 140px; height: 6px; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--blue) 25%, transparent); flex: 0 0 auto; }
.busy-track i { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 3px; background: var(--blue); animation: busy-slide-in 1.2s ease-in-out infinite; }
@keyframes busy-slide-in { 0% { left: -40%; } 100% { left: 100%; } }
.busy-wait { color: var(--muted); font-size: 12px; }
form.inline .busy-inline, td .busy-inline { margin: 6px 0 0; display: flex; }
form.inline .busy-track, td .busy-track { width: 90px; }
details.batch-box > summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--heading); }
details.batch-box[open] > summary { border-bottom: 1px solid var(--hair); }
a.step { text-decoration: none; display: block; }
a.step:hover { border-color: var(--heading); color: var(--heading); }
.stage-hint { margin: -8px 0 18px; font-size: 13px; color: var(--muted); }
.stage-hint strong { color: var(--heading); }
@media (max-width: 640px) { .busy-note small { display: none; } }
.wizard { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.wizard-step { flex: 1; min-width: 150px; border: 1px solid var(--hair-strong); background: transparent; color: var(--muted); border-radius: 8px; padding: 10px 12px; text-align: left; font-family: var(--sans); font-size: 13px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.wizard-step.on { border-color: var(--heading); color: var(--heading); background: var(--panel-2); }
.wizard-step.done { color: var(--ok); border-color: var(--ok); }
.wizard-num { width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: 0 0 auto; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 16px; }
.vet-box { border-radius: 10px; padding: 16px 20px; margin-bottom: 18px; border: 2px solid; }
.vet-box .vet-verdict { font-size: 20px; font-weight: 700; letter-spacing: 0.02em; margin-bottom: 4px; }
.vet-box .vet-crime { font-size: 14px; margin-bottom: 6px; }
.vet-box ul { margin: 6px 0 8px 18px; } .vet-box p { margin: 0; font-size: 13px; }
.vet-fail { border-color: var(--err); background: rgba(243, 163, 154, 0.16); color: var(--heading); }
.vet-fail .vet-verdict { color: var(--err); }
.vet-pass { border-color: var(--ok); background: rgba(159, 211, 166, 0.14); color: var(--heading); }
.vet-pass .vet-verdict { color: var(--ok); }
.vet-warn { border-color: var(--warn); background: rgba(240, 194, 123, 0.14); }
.crop-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 6, 5, 0.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.crop-dialog { background: var(--bg-2); color: var(--ink); border: 1px solid var(--hair-strong); border-radius: 10px; padding: 18px 20px 16px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.crop-dialog h3 { margin: 0 0 4px; font-size: 16px; }
.crop-dialog > p { margin: 0 0 12px; max-width: 600px; }
.crop-stage { position: relative; margin: 0 auto; max-width: 100%; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; background: #1a0806; border-radius: 6px; overflow: hidden; }
.crop-stage.dragging { cursor: grabbing; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.crop-controls input[type=range] { flex: 1; min-width: 120px; accent-color: var(--ox-bright); }
.crop-dialog .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.span-all { grid-column: 1 / -1; }
.conflict-box { border: 1px solid var(--err); border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; } .conflict-box ul { margin: 8px 0 0 18px; }
.app-photo { width: 120px; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--hair-strong); background: var(--panel); }
.app-photo-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.photo-fields > .form-grid { grid-template-columns: 1fr 1fr; gap: 14px 20px; }

/* Editor */
.editor-bar { display: flex; gap: 4px; flex-wrap: wrap; margin: 14px 0 0; padding: 8px; background: var(--panel-2); border: 1px solid var(--hair); border-bottom: 0; border-radius: 8px 8px 0 0; }
.editor-bar button { background: transparent; border: 1px solid transparent; color: var(--heading); padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 12.5px; }
.editor-bar button:hover { border-color: var(--hair-strong); }
.editor { min-height: 520px; background: #fff; color: #1a1a1a; padding: 40px 48px; border-radius: 0 0 8px 8px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.6; outline: none; }
.editor h1 { color: #6f2720; font-size: 1.6rem; } .editor h2 { color: #6f2720; font-size: 1.15rem; margin-top: 1.4em; } .editor h3 { color: #1a1a1a; font-size: 1rem; }
.editor table { width: 100%; } .editor .line { border-top: 1px solid #1a1a1a; padding-top: 6px; width: 70%; }
.editor-form .actions { margin-top: 14px; }

/* Messages */
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 10px; max-width: 80%; background: var(--panel-2); }
.msg-staff { margin-left: auto; background: rgba(203, 229, 253, 0.12); }
.msg-meta { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* Portal matters */
.section-title { margin: 8px 0 -8px; font-size: 1.4rem; }
.matters { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.matter { display: block; padding: 22px 24px; background: var(--panel); border: 1px solid var(--hair); border-radius: 10px; color: var(--ink); transition: border-color .2s, background .2s; }
.matter:hover { border-color: var(--blue); background: var(--panel-2); text-decoration: none; }
.matter-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.matter-head .label { margin: 0; }
.matter h2 { font-size: 1.25rem; margin-bottom: 10px; }
.matter .progress { width: 100%; margin-bottom: 8px; }
.matter-foot { display: flex; justify-content: space-between; margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.matter-foot span { color: var(--blue); letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; }
.svc-list { list-style: none; margin: 8px 0 0; padding: 0; }
.svc { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--hair); font-size: 13px; }
.svc span { display: flex; flex-direction: column; } .svc small { color: var(--muted); }
.svc em { font-style: normal; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.svc-done em { color: var(--ok); } .svc-in_progress em { color: var(--warn); }

/* Sign-in */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.login-card { background: color-mix(in srgb, var(--bg) 78%, var(--heading-inverse, black)); backdrop-filter: blur(16px); border: 1px solid var(--hair-strong); border-radius: 12px; padding: 40px 36px; display: flex; flex-direction: column; gap: 14px; }
.login-emblem { height: 64px; width: auto; align-self: center; }
.login-brand { font-family: var(--display); font-size: 1.5rem; letter-spacing: 0.26em; text-align: center; margin: 0; color: var(--heading); }
.login-sub { text-align: center; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin: -8px 0 10px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.login-card input { font-size: 15px; }
.login-card .btn { justify-content: center; margin-top: 6px; padding: 13px; }
.login-foot { display: flex; justify-content: space-between; margin: 8px 0 0; font-size: 12.5px; }
.login-quote { text-align: center; color: var(--muted); font-family: var(--display); font-style: italic; font-size: 1rem; line-height: 1.5; padding: 0 12px; }
.login-quote span { display: block; font-family: var(--sans); font-style: normal; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 6px; }

@media (max-width: 1000px) {
  .side { transform: translateX(-100%); transition: transform .25s; }
  body.side-open .side { transform: none; }
  .side-toggle { display: block; }
  .main { margin-left: 0; }
  .main-inner { padding: 72px 20px 60px; }
  .grid-2, .form-grid, .form-grid-3, .row-3, .photo-fields > .form-grid { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: 1fr; }
  .photo-row { flex-direction: column; }
  .editor { padding: 24px 20px; }
}


/* ---- light and dark logos, mode toggle ---- */
.logo-light { display: none; }
html[data-mode="light"] .logo-dark { display: none; }
html[data-mode="light"] .logo-light { display: block; }
html[data-mode="light"] .login-card { background: rgba(255, 255, 255, 0.72); }
html[data-mode="light"] body.has-scene .main-inner > *:not(.hero-card):not(.page-head):not(.flash):not(.quote):not(.ai-inline) { background: rgba(255, 255, 255, 0.55); }
html[data-mode="light"] .scene-wrap canvas { opacity: 0.45; }
html[data-mode="light"] .side-nav a.active { background: rgba(255, 255, 255, 0.7); }
.side-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.mode-toggle { background: none; border: 1px solid var(--hair-strong); color: var(--muted); border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.mode-toggle:hover { color: var(--heading); border-color: var(--heading); }
.mode-light { display: none; }
html[data-mode="light"] .mode-dark { display: none; }
html[data-mode="light"] .mode-light { display: inline; }
.login-mode { text-align: center; }

/* ---- due dates and priorities ---- */
.due-over { color: var(--err); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.due-soon { color: var(--blue); }
.badge-urgent { border-color: var(--err); color: var(--err); }
.badge-deadline, .badge-court { border-color: var(--err); color: var(--err); }
.badge-meeting { border-color: var(--ok); color: var(--ok); }
.badge-task { border-color: var(--blue); color: var(--blue); }

/* ---- charts ---- */
.chart { width: 100%; height: 200px; display: block; }
.chart-grid { stroke: var(--hair); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.donut { width: 160px; height: 160px; flex: none; }
.donut-total { fill: var(--heading); font-size: 22px; font-weight: 600; font-family: var(--sans); }
.donut-sub { fill: var(--muted); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--sans); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 2px; }
.donut-legend b { margin-left: auto; padding-left: 16px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 80px; gap: 12px; align-items: center; font-size: 13px; }
.hbar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 8px; background: var(--hair); border-radius: 4px; overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: 4px; }
.hbar-value { text-align: right; }

/* ---- calendar ---- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar h2 { margin: 0 12px 0 0; font-size: 1.4rem; }
.cal-toolbar .spacer { flex: 1; }
.cal { border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; background: var(--panel); }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--hair-strong); }
.cal-head span { padding: 10px 12px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.cal-head span:nth-child(n+6) { color: var(--warn); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day { position: relative; min-width: 0; min-height: 118px; padding: 8px 8px 10px; border-top: 1px solid var(--hair); border-right: 1px solid var(--hair); display: flex; flex-direction: column; gap: 4px; transition: background .2s; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:nth-child(7n), .cal-day:nth-child(7n-1) { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.cal-day:hover { background: var(--panel-2); }
.cal-day.other { opacity: 0.4; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-date { font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: none; display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.cal-day.today .cal-date { color: var(--heading); }
.cal-date::after { content: "+"; font-weight: 400; opacity: 0; color: var(--blue); transition: opacity .2s; }
.cal-day:hover .cal-date::after { opacity: 1; }
.cal-date:hover { color: var(--heading); }
.cal-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.3; padding: 4px 7px; border-radius: 5px; background: var(--panel-2); color: var(--heading); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; }
.cal-item::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--blue); }
.cal-item b { font-weight: 600; color: var(--muted); }
.cal-item small { color: var(--muted); margin-left: auto; flex: none; font-size: 9px; letter-spacing: 0.04em; width: 20px; height: 16px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--hair); }
.cal-item.done { opacity: 0.45; text-decoration: line-through; }
.cal-item:hover { border-color: var(--hair-strong); text-decoration: none; }
.cal-item.kind-deadline::before, .cal-item.kind-court::before { background: var(--err); }
.cal-item.kind-hearing::before, .cal-item.kind-filing::before { background: var(--warn); }
.cal-item.kind-meeting::before { background: var(--ok); }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.cal-legend .kind-deadline, .cal-legend .kind-court { background: var(--err); } .cal-legend .kind-hearing, .cal-legend .kind-filing { background: var(--warn); } .cal-legend .kind-meeting { background: var(--ok); }
.cal-side { display: flex; flex-direction: column; gap: 16px; }
.cal-side .stats { grid-template-columns: 1fr 1fr; }
.cal-side .card-body { padding: 16px; }
.cal-side .hbar { grid-template-columns: 96px 1fr 32px; }
.cal-side .donut-wrap { gap: 18px; }
.cal-month-summary { margin-bottom: 18px; }
.cal-month-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.cal-month-nums b { color: var(--heading); font-size: 15px; margin-right: 3px; }
.cal-under { margin-top: 24px; }
.cal-scope select { min-width: 150px; }
.cal-legend { margin: 10px 2px 0; }
.cal-legend .spacer { flex: 1; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 7px; text-decoration: none; }
.cal-item span { overflow: hidden; text-overflow: ellipsis; }
.cal-toolbar .btn-sm { padding: 7px 12px; font-size: 12.5px; }
.cal-next { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cal-next li { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--hair); font-size: 13px; }
.cal-next li:first-child { border-top: 0; padding-top: 0; }
.cal-next .when { font-weight: 600; font-size: 12px; line-height: 1.3; }
.cal-next .when small { display: block; font-weight: 400; color: var(--muted); }
.cal-next .what a { color: var(--heading); text-decoration: none; }
.cal-next .what small { display: block; color: var(--muted); }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } .cal-day { min-height: 96px; } }

/* ---- sidebar groups ---- */
.side-group { margin-bottom: 6px; }
.side-group-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 12px 6px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; text-align: left; cursor: default; }
.side-group.collapsible .side-group-head { cursor: pointer; }
.side-group.collapsible .side-group-head:hover { color: var(--heading); }
.side-group-head i { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
.side-group.open .side-group-head i { transform: rotate(45deg); }
.side-group-items { display: none; flex-direction: column; gap: 2px; }
.side-group.open .side-group-items { display: flex; }
.side-group-items a { padding-left: 20px; }

/* ---- rates ---- */
.rate-rows { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.rate-row { display: grid; grid-template-columns: 60px 180px 1fr; gap: 12px; align-items: center; }
.rate-row strong { font-size: 13px; letter-spacing: 0.08em; }
.rate-new { grid-template-columns: 120px 180px 1fr; margin-top: 4px; }
@media (max-width: 700px) { .rate-row, .rate-new { grid-template-columns: 1fr; } }

/* ---- work graph ---- */
.wg-controls { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.wg { position: relative; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 72px; align-items: start; }
.wg-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.wg-line { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 8 7; animation: wg-flow 1.4s linear infinite; opacity: 0.85; transition: opacity .25s; }
.wg-line.cross { stroke-dasharray: 2 6; stroke-width: 1.8; animation-duration: 1.1s; }
.wg-line.general { stroke-dasharray: 8 7; opacity: 0.45; }
.wg-dot { opacity: 0.9; transition: opacity .25s; }
.wg.focus .wg-line:not(.on), .wg.focus .wg-dot:not(.on) { opacity: 0.06; }
@keyframes wg-flow { to { stroke-dashoffset: -15; } }
.wg-lawyers { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 24px; }
.wg-lawyer { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--panel); border: 1px solid var(--hair); border-radius: 8px; cursor: default; transition: border-color .2s; }
.wg-lawyer:hover { border-color: var(--lc); }
.wg-swatch { width: 10px; height: 44px; border-radius: 3px; background: var(--lc); flex: none; }
.wg-load { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.wg-board { display: flex; flex-direction: column; gap: 18px; position: relative; z-index: 1; }
.wg-client { background: var(--panel); border: 1px solid var(--hair); border-radius: 8px; }
.wg-client > header { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.wg-client > header .label { margin: 0; }
.wg-client > header .link { margin-left: auto; }
.wg-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 12px; }
.wg-case { background: var(--bg); border: 1px solid var(--hair); border-left: 4px solid var(--lc); border-radius: 6px; padding: 12px 14px; transition: border-color .2s; }
.wg-case:hover { border-color: var(--lc); }
.wg-case-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wg-case-title { font-size: 13px; margin: 4px 0 6px; color: var(--heading); }
.wg-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.wg-tasks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wg-general .wg-tasks { padding: 12px; }
.wg-task { padding: 7px 10px; background: var(--panel-2); border-radius: 5px; font-size: 12.5px; border-left: 3px solid transparent; }
.wg-task.cross { border-left-color: var(--wg-cross); }
.wg-task a { color: var(--heading); text-decoration: none; }
.wg-task-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 3px; }
.wg-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--wg-cross); }
.wg-note b { color: var(--heading); font-weight: 600; }
@media (max-width: 1000px) {
  .wg { grid-template-columns: 1fr; gap: 20px; }
  .wg-lawyers { position: static; flex-direction: row; flex-wrap: wrap; }
  .wg-lines { display: none; }
}

/* ---- avatars, discussion and messages ---- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex: none; color: #fff; font-weight: 600; letter-spacing: 0.02em; background: var(--ox-bright); vertical-align: middle; }
img.avatar { background: var(--panel-2); }
.with-avatar { display: inline-flex; align-items: center; gap: 10px; }
.profile-photo { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.chat-card .chat { padding: 20px 20px 10px; }
.chat { display: flex; flex-direction: column; gap: 14px; max-height: 560px; overflow-y: auto; }
.chat-empty { margin: 0; }
.chat-day { display: flex; justify-content: center; margin: 4px 0; }
.chat-day span { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 3px 10px; border: 1px solid var(--hair); border-radius: 4px; }
.chat-msg { display: flex; gap: 12px; align-items: flex-end; max-width: 78%; }
.chat-msg.mine { margin-left: auto; flex-direction: row-reverse; }
.chat-bubble { background: var(--panel-2); border: 1px solid var(--hair); border-radius: 12px 12px 12px 4px; padding: 10px 14px; min-width: 0; }
.chat-msg.mine .chat-bubble { border-radius: 12px 12px 4px 12px; background: color-mix(in srgb, var(--blue) 16%, var(--panel-2)); }
.chat-meta { display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.chat-meta strong { color: var(--heading); font-weight: 600; }
.chat-meta time { margin-left: auto; padding-left: 10px; font-size: 11px; white-space: nowrap; }
.chat-text { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-compose { display: flex; gap: 12px; align-items: flex-end; padding: 14px 20px 20px; border-top: 1px solid var(--hair); }
.chat-compose textarea { flex: 1; resize: vertical; min-height: 44px; }
.chat-people { gap: 0; }
.chat-people .avatar { margin-right: -8px; border: 2px solid var(--bg); }
.chat-people .muted { margin-left: 18px; }

/* ---- notifications ---- */
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--btn-primary); color: #fff; font-size: 10.5px; font-weight: 600; margin-left: 8px; line-height: 1; vertical-align: 1px; }
.side-nav a .count { float: right; margin-top: 1px; }
.bell { position: absolute; top: 10px; right: 0; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 6px; background: var(--cream); color: var(--ox); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; }
.bell:hover { background: #fff; text-decoration: none; }
.bell svg { width: 16px; height: 16px; }
.bell .count { margin-left: 2px; }
.notif-list { display: flex; flex-direction: column; border: 1px solid var(--hair); border-radius: 8px; overflow: hidden; background: var(--panel); }
.notif { display: grid; grid-template-columns: 40px 1fr 12px; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--hair); color: var(--ink); text-decoration: none; transition: background .2s; }
.notif:first-child { border-top: 0; }
.notif:hover { background: var(--panel-2); text-decoration: none; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { color: var(--heading); font-weight: 600; font-size: 14px; }
.notif-text { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-meta { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.notif.read { opacity: 0.68; }
.notif.read .notif-title { font-weight: 400; color: var(--ink); }
.notif.read .notif-dot { background: transparent; }
.side-me { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.side-me:hover { text-decoration: none; }
.side-me > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-me .side-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .chat-msg { max-width: 94%; } .bell { position: static; margin-bottom: 12px; } }

/* ---- filters on stat tiles ---- */
a.stat-link { text-decoration: none; color: inherit; transition: background .2s; position: relative; }
a.stat-link:hover { background: var(--panel-2); text-decoration: none; }
a.stat-link.active { background: var(--panel-2); box-shadow: inset 0 -3px 0 var(--blue); }
a.stat-link.active .stat-label { color: var(--heading); }
.due-ok { color: var(--ok); }

/* ---- work graph: pinning and search ---- */
.wg-controls { align-items: center; }
.wg-search { min-width: 260px; }
.wg-lawyer, .wg-case, [data-client-head] { cursor: pointer; }
.wg-pinned { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.wg.searching .wg-dim { opacity: 0.28; }
.wg.searching .wg-hit { opacity: 1; }
.wg.searching .wg-case.wg-hit { outline: 1px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* ---- team chat ---- */
.chat-app { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.chat-side { border: 1px solid var(--hair); border-radius: 8px; background: var(--panel); overflow: hidden; max-height: calc(100vh - 220px); overflow-y: auto; }
.chat-side-head { padding: 12px 14px 6px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.chat-thread { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--hair); }
.chat-thread:hover { background: var(--panel-2); text-decoration: none; }
.chat-thread.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--blue); }
.chat-thread-text { display: flex; flex-direction: column; min-width: 0; }
.chat-thread-text strong { font-size: 13.5px; color: var(--heading); display: flex; align-items: center; gap: 6px; }
.chat-thread-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-person { opacity: 0.85; }
.chat-group-ico { background: var(--ox-bright); }
.chat-main { border: 1px solid var(--hair); border-radius: 8px; background: var(--panel); display: flex; flex-direction: column; min-height: 520px; }
.chat-main-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.chat-main-head strong { display: block; color: var(--heading); }
.chat-main .chat-log { padding: 18px 18px 10px; max-height: calc(100vh - 380px); min-height: 320px; }
.chat-compose-main { padding: 12px 14px 14px; display: block; }
.chat-compose-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose-row textarea { flex: 1; min-height: 42px; max-height: 160px; resize: none; }
.chat-tool { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 42px; border: 1px solid var(--hair-strong); border-radius: 6px; background: transparent; cursor: pointer; font-size: 18px; color: var(--heading); flex: none; }
.chat-tool:hover { border-color: var(--heading); }
.chat-emojis { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chat-emojis button { background: transparent; border: 1px solid var(--hair); border-radius: 6px; font-size: 20px; padding: 4px 6px; cursor: pointer; line-height: 1; }
.chat-emojis button:hover { border-color: var(--heading); background: var(--panel-2); }
.chat-attach-list { margin-top: 6px; }
.chat-img { display: block; margin-top: 8px; max-width: 320px; }
.chat-img img { width: 100%; height: auto; border-radius: 8px; display: block; }
.chat-video { display: block; margin-top: 8px; max-width: 420px; width: 100%; border-radius: 8px; background: #000; }
.chat-audio { display: block; margin-top: 8px; width: 280px; max-width: 100%; }
.chat-file { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--hair-strong); border-radius: 6px; text-decoration: none; color: var(--heading); font-size: 13px; }
.chat-file:hover { border-color: var(--heading); text-decoration: none; }
.chat-file-icon { font-size: 10px; letter-spacing: 0.1em; padding: 4px 6px; border-radius: 4px; background: var(--cream); color: var(--ox); font-weight: 700; }
.chat-file small { display: block; color: var(--muted); }
@media (max-width: 900px) { .chat-app { grid-template-columns: 1fr; } .chat-side { max-height: 260px; } }

/* ---- journal entry lines ---- */
.journal-lines { margin: 8px 0 16px; }
.journal-head, .journal-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) 130px 130px; gap: 8px; align-items: center; }
.journal-head { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.journal-row { margin-bottom: 8px; }
.journal-totals { margin-top: 10px; display: flex; gap: 16px; align-items: center; font-size: 13px; color: var(--muted); }
.journal-totals b { color: var(--heading); }
@media (max-width: 760px) { .journal-head { display: none; } .journal-row { grid-template-columns: 1fr 1fr; } }
.indent { padding-left: 18px; }

/* ---- right-to-left editing for Kurdish and Arabic ---- */
.editor.rtl, [dir="rtl"].editor { direction: rtl; text-align: right; font-family: "Noto Naskh Arabic", "Noto Sans Arabic", Inter, sans-serif; font-size: 17px; line-height: 1.9; }

/* ---- portal applications and client threads ---- */
.locked-fields { opacity: 0.86; }
.locked-fields input, .locked-fields select, .locked-fields textarea { cursor: not-allowed; }
.chat-msg.from-client .chat-bubble { border-color: var(--hair-strong); }
.quote-box { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; padding: 18px 20px; border: 1px solid var(--hair-strong); border-radius: 8px; background: var(--panel-2); }
.quote-box .fee { font-size: 1.9rem; font-weight: 700; color: var(--heading); }
.quote-box .actions { margin: 0; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; counter-reset: step; margin-bottom: 18px; }
.step { position: relative; padding: 14px 14px 14px 46px; border: 1px solid var(--hair); border-radius: 8px; font-size: 13px; color: var(--muted); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 14px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); color: var(--ox); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.step.on { border-color: var(--blue); color: var(--heading); }
.step.done { opacity: 0.7; }

/* ---- work graph: pictures and pinned isolation ---- */
.wg-avatar { display: inline-flex; padding: 2px; border: 2px solid var(--lc); border-radius: 50%; flex: none; }
.wg-swatch { display: none; }
.wg.pinned .wg-line:not(.on), .wg.pinned .wg-dot:not(.on) { opacity: 0 !important; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { min-width: 200px; }

/* Letterhead editor: A4 pages after the firm's design */
.lh-toolbar-wrap { position: sticky; top: 0; z-index: 20; padding-top: 6px; background: var(--bg); }
.lh-bar { border-radius: 8px; border-bottom: 1px solid var(--hair); margin: 0; }
.lh-sep { width: 1px; background: var(--hair-strong); margin: 4px 6px; align-self: stretch; }
.lh-pages { display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 22px 0 30px; overflow-x: auto; }
.lh-page { position: relative; width: 210mm; height: 297mm; flex: 0 0 auto; background: #fff; color: #1a1a1a; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); font-family: Avenir, "Avenir Next", "Nunito Sans", "Helvetica Neue", sans-serif; overflow: hidden; }
.lh-page[hidden] { display: none; }
.lh-p1-logo { position: absolute; left: 20mm; top: 20mm; width: 80mm; }
.lh-p1-rule { position: absolute; left: 137mm; top: 20mm; height: 28mm; width: 1.3mm; }
.lh-p1-contact { position: absolute; left: 143mm; top: 15.5mm; width: 49mm; color: #5B1B18; font-size: 8.5pt; line-height: 1.45; }
.lh-p1-contact > div { margin-bottom: 2.2mm; } .lh-p1-contact .lh-c-address { font-size: 7pt; line-height: 1.5; }
.lh-p1-line { position: absolute; left: 20mm; right: 18mm; top: 63mm; border-top: 0.6pt solid #5B1B18; }
.lh-p1-ref { position: absolute; left: 20mm; top: 67.5mm; color: #5B1B18; font-size: 10pt; }
.lh-p1-ref > div { display: flex; align-items: flex-end; margin-bottom: 2.6mm; } .lh-p1-ref .k { width: 12mm; } .lh-p1-ref .v { min-width: 48mm; border-bottom: 0.5pt solid #5B1B18; color: #1a1a1a; padding: 0 0 0.6mm 1mm; }
.lh-band-top { position: absolute; left: 0; right: 0; top: 0; height: 15mm; background: #5B1B18; }
.lh-rest-logo { position: absolute; left: 20mm; top: 4mm; width: 24mm; }
.lh-rest-right { position: absolute; right: 18mm; top: 5.6mm; color: #fff; font-size: 8.5pt; } .lh-rest-right span { margin: 0 2mm; opacity: 0.8; }
.lh-band-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 15mm; background: #5B1B18; color: #fff; font-size: 7pt; line-height: 1.45; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 26mm; }
.lh-body { position: absolute; left: 20mm; right: 18mm; top: 90mm; bottom: 26mm; font-size: 10.5pt; line-height: 1.55; }
.lh-page.rest .lh-body { top: 28mm; }
.lh-body[dir="rtl"] { line-height: 1.85; font-family: Vazirmatn, Tahoma, sans-serif; }
.lh-to { margin-bottom: 6mm; } .lh-to:empty { display: none; }
.lh-subject { font-weight: 700; margin-bottom: 5mm; } .lh-subject:empty { display: none; }
.lh-editor { outline: none; min-height: 30mm; border-radius: 2px; }
.lh-editor:focus { box-shadow: 0 0 0 1px rgba(91, 27, 24, 0.25); }
.lh-editor p { margin: 0 0 3mm; } .lh-editor h3 { color: #5B1B18; font-size: 11pt; margin: 4mm 0 2mm; }
.lh-editor table { border-collapse: collapse; width: 100%; margin: 2mm 0 4mm; } .lh-editor td, .lh-editor th { border: 0.5pt solid #9a9a9a; padding: 1.4mm 2mm; vertical-align: top; min-width: 12mm; } .lh-editor th { background: #f4eeed; color: #5B1B18; }
.lh-sig { margin-top: 10mm; line-height: 1.6; }
.lh-limit { position: absolute; left: 14mm; right: 12mm; bottom: 26mm; border-top: 1px dashed rgba(91, 27, 24, 0.18); pointer-events: none; }
.lh-page.overflow .lh-limit { border-top: 2px dashed #c0392b; }
.lh-full { position: absolute; left: 20mm; right: 18mm; bottom: 17mm; background: #c0392b; color: #fff; font-size: 8pt; padding: 1.5mm 3mm; border-radius: 3px; font-family: "Nunito Sans", sans-serif; z-index: 2; }
.lh-page.overflow .lh-body { overflow: visible; }
.lh-form .form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 900px) { .lh-pages { align-items: flex-start; } }

/* Work graph: lawyers across the top, the clients they lead stacked under them */
.wgx { position: relative; overflow-x: auto; padding: 6px 2px 30px; scrollbar-width: none; }
.wgx::-webkit-scrollbar { display: none; }
/* the work graph's horizontal scroll bar stays at the bottom of the screen */
.wgx-hscroll { position: sticky; bottom: 0; z-index: 20; overflow-x: auto; overflow-y: hidden; height: 18px; background: var(--panel); border-top: 1px solid var(--hair); }
.wgx-hscroll > div { height: 1px; }
.wgx-hscroll { scrollbar-width: auto; scrollbar-color: var(--muted) var(--panel-2); }
.wgx-hscroll::-webkit-scrollbar { height: 14px; }
.wgx-hscroll::-webkit-scrollbar-track { background: var(--panel-2); }
.wgx-hscroll::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 7px; border: 3px solid var(--panel-2); }
.wgx-hscroll::-webkit-scrollbar-thumb:hover { background: var(--heading); }
.wgx-hscroll[hidden] { display: none; }
.wgx-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 3; }
.wgx-line { fill: none; stroke-width: 2; stroke-dasharray: 6 6; animation: wg-flow 1.2s linear infinite; opacity: 0.95; }
.wgx-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 22px; align-items: start; min-width: min-content; }
.wgx-lawyer { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--hair-strong); border-top: 3px solid var(--lc); border-radius: 10px; background: var(--panel); position: relative; z-index: 1; transition: box-shadow .2s, transform .2s; }
.wgx-lawyer.involved { box-shadow: 0 0 0 3px var(--lc), 0 10px 26px rgba(0, 0, 0, .3); transform: translateY(-2px); }
.wgx-stats { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wgx-stats span { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--hair); }
.wgx-stats b { color: var(--heading); margin-right: 3px; }
.wgx-stack { position: relative; padding: 14px 0 0 22px; display: flex; flex-direction: column; gap: 10px; }
.wgx-stack::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 22px; width: 2px; background: repeating-linear-gradient(to bottom, var(--lc) 0 7px, transparent 7px 13px); background-size: 2px 13px; animation: wgx-spine 1s linear infinite; opacity: .9; }
@keyframes wgx-spine { from { background-position: 0 0; } to { background-position: 0 13px; } }
.wgx-client { position: relative; border: 1px solid var(--hair); border-left: 3px solid var(--lc); border-radius: 8px; background: var(--panel); padding: 9px 11px; cursor: pointer; outline: none; transition: border-color .2s, box-shadow .2s; }
.wgx-client::before { content: ""; position: absolute; left: -13px; top: 18px; width: 12px; height: 2px; background: var(--lc); }
.wgx-client:hover, .wgx-client:focus, .wgx-client.open { border-color: var(--lc); box-shadow: 0 8px 22px rgba(0, 0, 0, .22); }
.wgx-client-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 13.5px; }
.wgx-client-head a { color: var(--heading); text-decoration: none; }
.wgx-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.wgx-client-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.wgx-client-sub a { color: var(--muted); margin-right: 6px; }
.wgx-tasks { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.wgx-client:hover .wgx-tasks, .wgx-client:focus-within .wgx-tasks, .wgx-client.open .wgx-tasks { max-height: 900px; }
.wgx-tasks ul { list-style: none; margin: 8px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wgx-task { padding: 7px 9px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--hair); font-size: 12.5px; }
.wgx-task.cross { border-style: dashed; border-color: var(--warn); }
.wgx-task:hover { border-color: var(--heading); }
.wgx-task a { color: var(--heading); text-decoration: none; display: block; }
.wgx-task-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 3px; }
.wgx-who { font-weight: 600; }
.wgx-empty { padding: 6px 0 0 4px; }
.wgx-unassigned .wgx-lawyer { border-top-color: var(--hair-strong); }

/* group chats */
.chat-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-pick { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; border: 1px solid var(--hair); border-radius: 999px; cursor: pointer; font-size: 13px; background: var(--panel); }
.chat-pick:has(input:checked) { border-color: var(--heading); background: var(--panel-2); }
.chat-pick input { margin: 0; }
.chat-team-ico { background: var(--blue, #e6f1fc); color: #5B1B18; }

/* tag fields: meeting attendees */
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 5px 8px; border: 1px solid var(--hair-strong); border-radius: 6px; background: var(--panel); cursor: text; }
.tags input { flex: 1; min-width: 160px; border: 0 !important; outline: none; background: transparent; padding: 4px 2px !important; box-shadow: none !important; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--hair); }
.tag button { border: 0; background: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; color: var(--muted); }
.tag-user { border-color: var(--blue, #9cc3ea); }
.tag-client { border-color: #5B1B18; }
.tags-static { border: 0; padding: 0; min-height: 0; background: none; cursor: default; }
.tags-static .tag { padding-right: 10px; }

/* Meeting attendance */
.attend-list { display: grid; gap: 0; margin: 4px 0 10px; }
.attend-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.attend-row form { margin-top: 8px; }
.attend-row details { margin-top: 6px; }
.attend-mine { padding: 14px 16px; margin-bottom: 14px; background: var(--panel-2); border-radius: 10px; }
.attend-mine details { margin-top: 10px; }
.attend-mine summary, .attend-row summary { cursor: pointer; }
.meeting-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 18px; }
.meeting-actions details { flex: 1 1 280px; }
.meeting-actions summary { cursor: pointer; padding: 9px 0; }

/* Applicants: add another person, remove the last one */
.persons-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--hair); }

/* WhatsApp agreement on client and user records */
.wa-consent { padding: 12px 14px; border: 1px solid var(--hair); border-radius: 10px; }
.wa-consent .muted { margin: 4px 0 0; }
.wa-consent [data-consent-detail] { margin-top: 10px; }
