:root {
  --navy: #0f2438;
  --gold: #a9802f;
  --gold-soft: #f5ecd8;
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1e2430;
  --muted: #667085;
  --line: #e3dfd6;
  --ok: #2f7d4f;
  --ok-soft: #e5f3ea;
  --warn: #9a6a00;
  --warn-soft: #fbf1d9;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --radius: 12px;
  --serif: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: Barlow, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #c9a45c;
    --gold: #d4b06a;
    --gold-soft: #2c2719;
    --bg: #12161f;
    --card: #1a202b;
    --ink: #e8e6e1;
    --muted: #9aa3b2;
    --line: #2c3442;
    --ok: #6cc28f; --ok-soft: #173024;
    --warn: #e2b54f; --warn-soft: #302714;
    --bad: #f08a80; --bad-soft: #3a1c1a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden always wins over display: flex/grid below */
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }

.topbar { background: radial-gradient(circle at 0 50%, #173450 0, #0f2438 340px); color: #f6f1e6; border-bottom: 3px solid #d4b06a; }
.topbar .inner { max-width: 1040px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 14px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.topbar img { width: 58px; height: 58px; }
.brand-name { display: block; font: 700 1.9rem var(--serif); letter-spacing: .06em; text-transform: uppercase; color: #d9b56c; line-height: 1.1; }
.topbar .tag { display: block; color: #f6f1e6; font-size: .92rem; letter-spacing: .14em; font-weight: 500; }
.menu { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.menu a { color: #f6f1e6; text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.menu a:hover { background: rgba(255, 255, 255, .08); }
.menu a[aria-current="page"] { background: #d4b06a; color: #0f2438; }
@media (max-width: 640px) {
  .menu { margin-left: 0; width: 100%; }
  .menu a { flex: 1; text-align: center; padding: 8px 6px; font-size: .88rem; background: rgba(255, 255, 255, .06); }
  .brand-name { font-size: 1.6rem; }
  .topbar img { width: 48px; height: 48px; }
}
h2, h3 { letter-spacing: .02em; }

.advocate { display: flex; gap: 14px; align-items: center; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.advocate img { width: 84px; height: 84px; border-radius: 50%; border: 3px solid #d4b06a; flex: none; }
.adv-name { font: 700 1.35rem var(--serif); letter-spacing: .03em; }
.adv-qual { color: var(--gold); font-weight: 600; font-size: .9rem; }
.adv-role { color: var(--muted); font-size: .85rem; }
.topbar .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 60px; }
.hero { margin-bottom: 20px; }
.hero h1 { font-size: 2.1rem; }
.hero p { color: var(--muted); margin: 6px 0 0; }

.grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.grid > * { min-width: 0; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.step:last-of-type { border-bottom: 0; margin-bottom: 0; }
.step h3 { font-size: 1.1rem; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font: 600 .85rem var(--sans); display: inline-grid; place-items: center; }

label { display: block; font-size: .88rem; font-weight: 600; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: 8px 12px; font: inherit; cursor: pointer; text-align: center; min-width: 74px;
}
.chip small { display: block; color: var(--muted); font-size: .75rem; }
.chip:hover:not(:disabled) { border-color: var(--gold); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--card); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .8; }
.chip:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.days { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.slot-group { margin-bottom: 10px; }
.slot-group .lbl { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.slots .chip { min-width: 88px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px;
  padding: 11px 18px; font: 600 1rem var(--sans); cursor: pointer; background: var(--navy); color: var(--card);
}
.btn:disabled { opacity: .5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.topbar .btn.ghost { color: #f6f1e6; border-color: #3a4a68; }
.btn.block { width: 100%; }

.error { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: .92rem; }
.empty { color: var(--muted); font-size: .92rem; }

.side h3 { font-size: 1.05rem; margin-bottom: 10px; }
.side dl { margin: 0; }
.side dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 12px; }
.side dd { margin: 2px 0 0; white-space: pre-line; }
.summary { background: var(--gold-soft); border-radius: 10px; padding: 12px 14px; margin-top: 16px; font-size: .92rem; }

.done { text-align: center; padding: 36px 22px; }
.done .tick { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: inline-grid; place-items: center; font-size: 30px; margin-bottom: 12px; }
.done .ref { font: 600 1.5rem ui-monospace, Menlo, monospace; letter-spacing: .08em; color: var(--gold); margin: 6px 0 14px; }
.done table { margin: 16px auto; text-align: left; border-collapse: collapse; }
.done td { padding: 4px 12px; }
.done td:first-child { color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px; }

/* ---------- admin ---------- */
.login { max-width: 380px; margin: 60px auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 260px; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink); }
.tabs button[aria-pressed="true"] { background: var(--navy); color: var(--card); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font: 600 1.6rem var(--serif); }
.stat span { color: var(--muted); font-size: .82rem; }
.daygroup { margin-bottom: 18px; }
.daygroup h3 { font-size: 1rem; margin: 0 0 8px; color: var(--muted); font-family: var(--sans); font-weight: 600; }
.appt { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 8px; display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; }
@media (max-width: 640px) { .appt { grid-template-columns: 1fr; } }
.appt .time { font: 600 1.05rem var(--serif); }
.appt .name { font-weight: 600; }
.appt .meta { color: var(--muted); font-size: .86rem; }
.appt .notes { font-size: .9rem; margin-top: 6px; white-space: pre-wrap; }
.appt .actions { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.appt .links { display: flex; gap: 6px; }
.appt textarea { min-height: 50px; font-size: .85rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; text-transform: capitalize; margin-left: 6px; vertical-align: middle; background: var(--line); color: var(--ink); }
.st-requested { background: var(--warn-soft); color: var(--warn); }
.st-confirmed { background: var(--ok-soft); color: var(--ok); }
.st-completed { background: var(--line); color: var(--muted); }
.st-cancelled, .st-no-show { background: var(--bad-soft); color: var(--bad); }
.appt.is-cancelled { opacity: .6; }
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
@media (max-width: 820px) { .panels { grid-template-columns: 1fr; } }
.blocked li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.blocked ul { list-style: none; padding: 0; margin: 12px 0 0; }

@media print {
  .topbar .right, footer, .btn { display: none !important; }
  body { background: #fff; }
}

/* ---------- accounts, cases, notifications ---------- */
.side-col { display: grid; gap: 20px; min-width: 0; }
.location { text-align: center; }
.location h3 { margin-bottom: 10px; }
.location img { display: block; margin: 0 auto 8px; border-radius: 8px; background: #fff; padding: 6px; border: 1px solid var(--line); }
.signed-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; background: var(--gold-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; font-size: .92rem; }
.idbox { background: var(--gold-soft); border-radius: 12px; padding: 16px; margin: 18px auto; max-width: 460px; }
.idbox .ref { margin: 2px 0 8px; }
.done-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
a.btn { text-decoration: none; }
.login h1 { font-size: 1.8rem; margin-bottom: 6px; }
.login .hint { margin-bottom: 16px; }

.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.dash-head h1 { font-size: 2rem; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: .86rem; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-weight: 500; }
.notice a { color: inherit; }
.okmsg { background: var(--ok-soft); color: var(--ok); border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: .92rem; }
.block-gap { margin-bottom: 22px; }
.narrow { max-width: 460px; }
.section-title { font-size: 1.3rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
h3.section-title { margin-top: 22px; }
.count { background: var(--gold); color: var(--card); font: 600 .75rem var(--sans); border-radius: 99px; padding: 2px 8px; }
.notes-list { list-style: none; margin: 0; padding: 0; }
.notes-list li { padding: 10px 0 10px 12px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.notes-list li:last-child { border-bottom: 0; }
.notes-list li.unread { border-left-color: var(--gold); background: linear-gradient(90deg, var(--gold-soft), transparent 70%); }
.fee { font-weight: 600; color: var(--gold); margin-top: 6px; font-size: .92rem; }
.appt.simple .actions { min-width: 0; }
details > summary { cursor: pointer; font-weight: 600; }
.case { margin-bottom: 10px; }
.case-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.case-head h2 { font-size: 1.6rem; }
.case .name { font-weight: 600; font-size: 1.05rem; }
.case details { margin-top: 10px; font-size: .92rem; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 8px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.case-update { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.new-case { margin: 10px 0; }
.new-case form { margin-top: 14px; }

.main-tabs { display: inline-flex; margin-bottom: 16px; }
.main-tabs button { font-weight: 600; padding: 8px 16px; }
.clients-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.clients-layout > * { min-width: 0; }
@media (max-width: 820px) { .clients-layout { grid-template-columns: 1fr; } }
.client-list { padding: 12px; }
.client-list ul { list-style: none; margin: 10px 0 0; padding: 0; max-height: 70vh; overflow-y: auto; }
.client-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.client-list button:hover { background: var(--gold-soft); }
.client-list button.active { background: var(--navy); color: var(--card); }
.client-list button.active .meta { color: inherit; opacity: .8; }
.client-list .meta { display: block; }
.appt .actions input { padding: 6px 10px; font-size: .9rem; }

dialog { border: 0; border-radius: var(--radius); padding: 22px; width: min(560px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(10, 20, 35, .55); }
dialog h2 { font-size: 1.5rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.st-hearing-scheduled, .st-filed, .st-evidence, .st-arguments, .st-consultation { background: var(--gold-soft); color: var(--gold); }
.st-adjourned, .st-judgment-reserved { background: var(--warn-soft); color: var(--warn); }
.st-disposed, .st-closed { background: var(--ok-soft); color: var(--ok); }

/* ---------- documents ---------- */
.dropzone { display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px; cursor: pointer; font-weight: 400; font-size: .9rem; color: var(--muted); }
.dropzone:hover { border-color: var(--gold); }
.dropzone input { width: auto; border: 0; padding: 0; font-size: .85rem; max-width: 110px; }
.dropzone b { color: var(--ink); }
.filelist { list-style: none; padding: 0; margin: 8px 0 0; }
.filelist li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.filelist li span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li.error { display: block; border: 0; }
.linkbtn { border: 0; background: none; color: var(--bad); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
.uploads-result { max-width: 460px; margin: 0 auto; }
.docs { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doclist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.doc { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px 4px 4px; text-decoration: none; color: var(--ink); font-size: .85rem; background: var(--card); }
.doc:hover { border-color: var(--gold); }
.doc-ico { font: 700 .62rem var(--sans); background: var(--gold-soft); color: var(--gold); border-radius: 5px; padding: 3px 4px; }
.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach { display: inline-flex; gap: 8px; align-items: center; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; }
.doc-table { padding: 8px 14px; }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 220px) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-row select { padding: 6px 8px; font-size: .85rem; }
@media (max-width: 640px) { .doc-row { grid-template-columns: 1fr; } }
.stats { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 820px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }
