:root {
    --brand: #4e5b4b;
    --brand-dark: #333b31;
    --brand-mid: #717c6f;
    --sage: #9da986;
    --mint: #b8cdba;
    --sage-light: #ebeee7;
    --paper: #f7f8f5;
    --white: #fff;
    --ink: #222720;
    --muted: #687066;
    --line: #dfe4dc;
    --danger: #9c3f3f;
    --danger-bg: #fff1f0;
    --shadow: 0 10px 28px rgba(51, 59, 49, .08);
    --radius: 18px;
    --sidebar: 280px;
    --header: 76px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "DM Sans", Arial, sans-serif; line-height: 1.55; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: "Lora", Georgia, serif; color: var(--brand-dark); }
h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 3vw, 2.45rem); line-height: 1.18; }
h2 { margin-bottom: 8px; font-size: 1.15rem; line-height: 1.35; }
.muted, .page-heading p { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--brand-mid); font-size: .72rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow--light { color: #d8ddcf; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 10px 17px; font-weight: 700; text-decoration: none; cursor: pointer; transition: .2s ease; }
.button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid rgba(157, 169, 134, .6); outline-offset: 2px; }
.button--primary { background: var(--brand); color: var(--white); }
.button--primary:hover { background: var(--brand-dark); }
.button--secondary { border-color: #cad3c7; background: var(--white); color: var(--brand-dark); }
.button--secondary:hover { border-color: var(--brand); background: var(--sage-light); }
.button--ghost { background: transparent; color: var(--brand); }
.button--ghost:hover { background: var(--sage-light); }
.button--block { width: 100%; }
.button--compact { min-height: 38px; padding: 7px 12px; font-size: .82rem; }

/* Authentication */
.auth-page { min-height: 100vh; background: var(--white); }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.05fr) minmax(430px, .95fr); }
.auth-brand { position: relative; display: grid; overflow: hidden; place-items: center; min-height: 100vh; padding: 64px; background: var(--brand); color: var(--white); }
.auth-brand__content { position: relative; z-index: 2; max-width: 610px; }
.auth-brand__logo { width: 250px; margin-bottom: 90px; filter: brightness(0) invert(1); }
.auth-brand h1 { max-width: 570px; margin-bottom: 20px; color: var(--white); font-size: clamp(2.5rem, 5vw, 4.6rem); }
.auth-brand p:not(.eyebrow) { max-width: 530px; color: #ebeee7; font-size: 1.15rem; }
.auth-trust { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 34px; color: #f7f8f5; font-size: .88rem; font-weight: 600; }
.auth-brand__pattern { position: absolute; right: -180px; bottom: -240px; width: 630px; height: 630px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.auth-brand__pattern::before, .auth-brand__pattern::after { position: absolute; content: ""; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; inset: 60px; }
.auth-brand__pattern::after { inset: 130px; }
.auth-form-wrap { display: grid; place-items: center; padding: 44px; background: var(--paper); }
.auth-form-card { width: min(100%, 430px); }
.auth-form-logo { display: none; width: 210px; margin-bottom: 44px; }
.auth-form-card h2 { margin-bottom: 8px; font-size: 2rem; }
.auth-form { display: grid; gap: 20px; margin-top: 28px; }
.access-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 4px; }
.access-switch label { cursor: pointer; }
.access-switch input { position: absolute; opacity: 0; pointer-events: none; }
.access-switch span { display: grid; min-height: 40px; place-items: center; border-radius: 8px; color: var(--muted); font-size: .75rem; font-weight: 700; text-align: center; }
.access-switch input:checked + span { background: var(--white); color: var(--brand); box-shadow: 0 2px 8px rgba(50,60,48,.09); }
.field { display: grid; gap: 7px; color: var(--brand-dark); font-size: .86rem; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; border: 1px solid #cfd6cc; border-radius: 11px; background: var(--white); padding: 0 14px; color: var(--ink); transition: .2s ease; }
.field textarea { padding-top: 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(157,169,134,.16); outline: 0; }
.password-field { position: relative; }
.password-field input { padding-right: 62px; }
.password-toggle { position: absolute; top: 6px; right: 6px; min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--brand); font-size: .8rem; font-weight: 700; cursor: pointer; }
.link-button { display: block; margin: 20px auto; border: 0; background: transparent; color: var(--brand); font-weight: 700; cursor: pointer; }
.demo-access { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 28px; border: 1px dashed var(--sage); border-radius: 12px; padding: 13px; background: var(--sage-light); font-size: .75rem; }
.demo-access span { grid-column: 1 / -1; color: var(--brand-mid); font-weight: 700; }
.demo-access > div { display: grid; min-width: 0; gap: 4px; }
.demo-access small { color: var(--muted); font-size: .62rem; font-weight: 700; }
.demo-access code { overflow: hidden; border-radius: 6px; background: var(--white); padding: 7px 8px; color: var(--brand-dark); text-overflow: ellipsis; white-space: nowrap; }
.auth-help { margin-top: 24px; color: var(--muted); font-size: .78rem; text-align: center; }
.alert { display: grid; gap: 2px; margin-top: 20px; border-radius: 10px; padding: 12px 14px; font-size: .82rem; }
.alert--danger { border: 1px solid #efc4c0; background: var(--danger-bg); color: var(--danger); }
.dialog { width: min(92vw, 480px); border: 0; border-radius: 18px; padding: 0; outline: 0; box-shadow: 0 28px 70px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(34,39,32,.68); backdrop-filter: blur(4px); }
.dialog__card { position: relative; display: grid; gap: 17px; padding: 34px; }
.dialog__close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--paper); color: var(--brand); font-size: 1.5rem; cursor: pointer; }
.admin-dialog { width: min(92vw, 660px); max-height: 90vh; }
.admin-dialog--wide { width: min(92vw, 780px); }
.admin-dialog .dialog__card { grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 0; max-height: 90vh; overflow: hidden; padding: 0; }
.admin-dialog .dialog__close { z-index: 2; top: 18px; right: 20px; }
.admin-dialog .dialog__card > .eyebrow { margin: 0; padding: 25px 72px 5px 28px; }
.admin-dialog .dialog__card > h2 { margin: 0; border-bottom: 1px solid var(--line); padding: 0 72px 20px 28px; font-size: 1.35rem; }
.admin-dialog .dialog__card > .form-grid { overflow-y: auto; padding: 22px 28px 24px; scrollbar-color: var(--sage) transparent; scrollbar-width: thin; }
.admin-dialog .field { align-content: start; }
.admin-dialog .field input, .admin-dialog .field select { min-height: 46px; }
.admin-dialog .preference-row { margin-top: 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); padding: 13px 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 0; border-top: 1px solid var(--line); background: var(--white); padding: 16px 28px; }

/* Portal shell */
.portal-shell { min-height: 100vh; }
.portal-header { position: fixed; z-index: 30; top: 0; right: 0; left: 0; display: flex; height: var(--header); align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); padding: 0 26px; backdrop-filter: blur(12px); }
.portal-brand img { width: 225px; min-width: 140px; }
.portal-header__actions { display: flex; align-items: center; gap: 12px; }
[hidden] { display: none !important; }
.notification-center { position: relative; }
.notification-menu { position: absolute; top: 52px; right: 0; width: min(360px, calc(100vw - 24px)); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 18px 48px rgba(35,50,38,.16); }
.notification-menu__header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 15px 17px; }
.notification-menu__header strong { font-family: "Lora", Georgia, serif; color: var(--brand-dark); }
.notification-menu__header span { color: var(--brand); font-size: .68rem; font-weight: 700; }
.notification-menu > a { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; border-bottom: 1px solid #edf0eb; padding: 13px 17px; color: var(--ink); text-decoration: none; }
.notification-menu > a:last-child { border-bottom: 0; }
.notification-menu > a:hover { background: var(--paper); }
.notification-menu > a > span:last-child { display: grid; gap: 3px; }
.notification-menu > a strong { font-size: .78rem; }
.notification-menu > a small { color: var(--muted); font-size: .68rem; }
.notification-menu__dot { width: 9px; height: 9px; margin: auto; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 5px var(--sage-light); }
.notification-menu__calendar { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 7px; background: var(--sage-light); color: var(--brand); font-size: .67rem; font-weight: 800; }
.icon-button { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--white); color: var(--brand); cursor: pointer; }
.notification-dot { position: absolute; top: -5px; right: -5px; display: grid; width: 20px; height: 20px; place-items: center; border: 2px solid var(--white); border-radius: 50%; background: var(--brand); color: var(--white); font-size: .61rem; font-weight: 700; }
.profile-chip { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 4px 8px; color: inherit; text-decoration: none; }
.profile-chip:hover { background: var(--paper); }
.profile-chip__avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--sage-light); color: var(--brand); font-size: .78rem; font-weight: 700; }
.profile-chip__text { display: grid; line-height: 1.25; }
.profile-chip__text strong { font-size: .82rem; }
.profile-chip__text small { color: var(--muted); font-size: .68rem; }
.portal-sidebar { position: fixed; z-index: 20; top: var(--header); bottom: 0; left: 0; display: flex; width: var(--sidebar); flex-direction: column; overflow-y: auto; border-right: 1px solid rgba(255,255,255,.1); background: var(--brand); color: var(--white); padding: 25px 18px; }
.case-identity { display: grid; gap: 7px; margin: 0 6px 25px; border-bottom: 1px solid rgba(255,255,255,.16); padding-bottom: 24px; }
.case-identity__label { color: #c4cbb6; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.case-identity strong { overflow-wrap: anywhere; font-size: .82rem; }
.portal-nav { display: grid; gap: 5px; }
.portal-nav__item { display: flex; min-height: 48px; align-items: center; gap: 12px; border-radius: 10px; padding: 0 13px; color: #ebeee7; font-size: .86rem; font-weight: 600; text-decoration: none; }
.portal-nav__item:hover { background: rgba(255,255,255,.08); }
.portal-nav__item.is-active { background: var(--white); color: var(--brand-dark); }
.portal-nav__item .nav-count { display: grid; width: 21px; height: 21px; margin-left: auto; place-items: center; border-radius: 50%; background: var(--sage); color: var(--brand-dark); font-size: .65rem; }
.sidebar-help { display: grid; gap: 7px; margin-top: auto; border-radius: 14px; background: rgba(255,255,255,.09); padding: 17px; }
.sidebar-help strong { font-family: "Lora", Georgia, serif; }
.sidebar-help p { margin: 0; color: #d8ddcf; font-size: .73rem; }
.sidebar-help a { color: var(--white); font-size: .75rem; font-weight: 700; }
.portal-main { min-height: 100vh; margin-left: var(--sidebar); padding: calc(var(--header) + 38px) 38px 58px; }
.portal-main > * { max-width: 1320px; margin-right: auto; margin-left: auto; }
.mobile-case-bar, .mobile-nav { display: none; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 28px; }
.page-heading p { margin-bottom: 0; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 24px; box-shadow: 0 1px 0 rgba(51,59,49,.02); }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.current-card, .next-card { display: grid; min-height: 196px; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.current-card { border-top: 4px solid var(--brand); }
.next-card { border-top: 4px solid var(--sage); background: linear-gradient(135deg, var(--white), #f8faf6); }
.current-card p:last-child, .next-card p:last-child { margin-bottom: 0; color: var(--muted); }
.card-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 13px; }
.card-icon--brand { background: var(--brand); color: var(--white); }
.card-icon--sage { background: var(--sage-light); color: var(--brand); }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 18px; }
.metric-card { display: grid; gap: 6px; min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); padding: 17px; }
.metric-card__label { color: var(--brand-mid); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.metric-card strong { color: var(--brand-dark); font-size: .85rem; overflow-wrap: anywhere; }
.metric-card small { color: var(--muted); font-size: .7rem; }
.content-grid { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(420px, 1.22fr); gap: 18px; margin-bottom: 18px; }
.section-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title-row h2 { margin-bottom: 0; }
.section-title-row a { font-size: .78rem; font-weight: 700; }
.days-pill, .info-pill { border-radius: 999px; background: var(--sage-light); padding: 6px 10px; color: var(--brand); font-size: .68rem; font-weight: 700; white-space: nowrap; }
.hearing-date { display: flex; align-items: center; gap: 14px; margin: 24px 0; }
.hearing-date__day { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 15px; background: var(--brand); color: var(--white); font-family: "Lora", Georgia, serif; font-size: 1.8rem; font-weight: 600; }
.hearing-date > span:last-child { display: grid; }
.hearing-date small { color: var(--muted); }
.details-list { display: grid; gap: 10px; margin: 0 0 22px; }
.details-list div { display: grid; grid-template-columns: 118px 1fr; gap: 12px; border-bottom: 1px solid #edf0eb; padding-bottom: 9px; }
.details-list dt { color: var(--muted); font-size: .72rem; }
.details-list dd { margin: 0; color: var(--brand-dark); font-size: .75rem; font-weight: 700; }
.mini-timeline { display: grid; }
.mini-timeline__item { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding-bottom: 17px; }
.mini-timeline__item:not(:last-child)::before { position: absolute; top: 13px; bottom: -3px; left: 5px; width: 1px; background: var(--line); content: ""; }
.mini-timeline__dot { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 4px; border: 3px solid var(--white); border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--sage); }
.mini-timeline__item div { display: grid; gap: 3px; }
.mini-timeline small { color: var(--brand-mid); font-size: .65rem; font-weight: 700; }
.mini-timeline strong { color: var(--brand-dark); font-size: .82rem; }
.mini-timeline p { margin: 0; color: var(--muted); font-size: .73rem; }
.parties-card { margin-bottom: 18px; }
.party-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.party { display: flex; min-width: 0; align-items: center; gap: 11px; border-radius: 12px; background: var(--paper); padding: 13px; }
.party__initials { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 50%; background: var(--sage-light); color: var(--brand); font-weight: 700; }
.party div { display: grid; min-width: 0; }
.party div span { color: var(--brand-mid); font-size: .64rem; font-weight: 700; text-transform: uppercase; }
.party div strong { overflow: hidden; color: var(--brand-dark); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.party div small { color: var(--muted); font-size: .68rem; }

.status-badge, .stage-badge, .current-label, .future-label, .new-badge { display: inline-flex; width: fit-content; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: .66rem; font-weight: 700; }
.status-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.case-identity .status-badge { background: rgba(255,255,255,.13); color: var(--white); }
.status-badge--active { background: #e7f2e8; color: #35613d; }
.status-badge--neutral { background: #edf0eb; color: #5d655b; }
.stage-badge { background: var(--sage-light); color: var(--brand); }
.current-label { background: var(--brand); color: var(--white); }
.future-label { border: 1px solid var(--sage); background: var(--white); color: var(--brand); }
.new-badge { margin-left: 7px; background: var(--brand); color: var(--white); padding: 3px 7px; }

/* Timeline */
.filter-bar { display: flex; overflow-x: auto; gap: 8px; margin-bottom: 25px; padding-bottom: 4px; scrollbar-width: thin; }
.filter-chip { min-height: 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); padding: 7px 14px; color: var(--brand-mid); font-size: .76rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.filter-chip.is-active { border-color: var(--brand); background: var(--brand); color: var(--white); }
.timeline { position: relative; display: grid; }
.timeline-event { display: grid; grid-template-columns: 30px 110px minmax(0, 1fr); align-items: start; gap: 12px; }
.timeline-event__rail { position: relative; height: 100%; }
.timeline-event__rail::before { position: absolute; top: 20px; bottom: -20px; left: 14px; width: 2px; background: var(--line); content: ""; }
.timeline-event:last-child .timeline-event__rail::before { display: none; }
.timeline-event__rail span { position: relative; z-index: 1; display: block; width: 18px; height: 18px; margin: 18px auto; border: 4px solid var(--paper); border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 2px var(--sage); }
.timeline-event--current .timeline-event__rail span { background: var(--brand); box-shadow: 0 0 0 3px var(--brand); }
.timeline-event--future .timeline-event__rail span { border-color: var(--paper); background: var(--white); box-shadow: 0 0 0 2px var(--sage); }
.timeline-event__date { padding-top: 18px; color: var(--brand-mid); font-size: .72rem; font-weight: 700; }
.timeline-event__content { margin-bottom: 15px; }
.timeline-event--current .timeline-event__content { border-left: 4px solid var(--brand); box-shadow: var(--shadow); }
.timeline-event--future .timeline-event__content { border-style: dashed; background: rgba(255,255,255,.64); }
.timeline-event__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.timeline-event__content p { margin: 0; color: var(--muted); font-size: .86rem; }
.document-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; border: 0; border-radius: 8px; background: var(--sage-light); padding: 8px 10px; color: var(--brand); font-size: .72rem; font-weight: 700; cursor: pointer; }

/* Processes, documents and hearings */
.process-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.process-card { display: flex; flex-direction: column; }
.process-card--primary { border-top: 4px solid var(--brand); box-shadow: var(--shadow); }
.process-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 22px; }
.process-type { color: var(--brand-mid); font-size: .67rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.process-card h2 { min-height: 48px; overflow-wrap: anywhere; font-size: .95rem; }
.process-card .details-list { flex: 1; margin-top: 15px; }
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; }
.search-field { position: relative; flex: 1; }
.search-field .icon { position: absolute; top: 14px; left: 14px; }
.search-field input, .toolbar select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); color: var(--ink); }
.search-field input { padding: 0 15px 0 42px; }
.toolbar select { width: 210px; padding: 0 12px; }
.document-list { display: grid; gap: 10px; }
.document-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 18px; }
.document-row__icon { display: grid; width: 46px; height: 52px; place-items: center; border-radius: 8px; background: var(--sage-light); color: var(--brand); font-size: .63rem; font-weight: 800; }
.document-row__main { display: grid; min-width: 0; gap: 3px; }
.document-row__main > div { display: flex; align-items: center; }
.document-row__main strong { overflow: hidden; color: var(--brand-dark); font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.document-row__main > span { color: var(--muted); font-size: .7rem; }
.document-row__actions { display: flex; gap: 7px; }
.empty-state { border: 1px dashed var(--sage); border-radius: 14px; padding: 38px; color: var(--muted); text-align: center; }
.upcoming-hearing { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 24px; margin-bottom: 18px; border-left: 5px solid var(--brand); }
.upcoming-hearing__date { display: grid; width: 86px; height: 98px; place-items: center; align-content: center; border-radius: 15px; background: var(--brand); color: var(--white); line-height: 1.1; }
.upcoming-hearing__date span { font-family: "Lora", Georgia, serif; font-size: 2rem; }
.upcoming-hearing__date strong { font-size: .75rem; }
.upcoming-hearing__date small { opacity: .75; font-size: .63rem; }
.upcoming-hearing__main h2 { margin: 9px 0 4px; font-size: 1.35rem; }
.upcoming-hearing__main > p { color: var(--muted); }
.upcoming-hearing__main .details-list { max-width: 570px; grid-template-columns: 1fr 1fr; margin-bottom: 0; }
.upcoming-hearing__main .details-list div { grid-template-columns: auto 1fr; }
.hearing-list { display: grid; }
.hearing-list__row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding: 14px 0; }
.hearing-list__row:last-child { border-bottom: 0; }
.hearing-list__row > div { display: grid; }
.hearing-list__row > div strong { font-size: .84rem; }
.hearing-list__row > div span { color: var(--muted); font-size: .72rem; }
.calendar-tile { display: grid; width: 47px; height: 51px; place-items: center; align-content: center; border-radius: 10px; background: var(--sage-light); color: var(--brand); line-height: 1.1; }
.calendar-tile strong { font-size: 1rem; }
.calendar-tile small { font-size: .56rem; font-weight: 800; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(380px, calc(100vw - 44px)); transform: translateY(30px); border-radius: 12px; background: var(--brand-dark); padding: 13px 16px; color: var(--white); font-size: .8rem; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }

/* Account */
.account-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
.account-card { display: grid; gap: 20px; }
.account-card--wide { grid-column: 1 / -1; }
.profile-chip__avatar--large { width: 48px; height: 48px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid--single { grid-template-columns: 1fr; }
.field--wide { grid-column: 1 / -1; }
.field input:disabled { background: var(--paper); color: var(--muted); }
.field small, .form-note { margin: 0; color: var(--muted); font-size: .68rem; font-weight: 400; }
.account-card .button { width: fit-content; }
.preference-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 15px; }
.preference-row > span { display: grid; gap: 4px; }
.preference-row strong { color: var(--brand-dark); font-size: .82rem; }
.preference-row small { color: var(--muted); font-size: .7rem; }
.preference-row input { width: 18px; height: 18px; accent-color: var(--brand); }
.icon-account { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-5 0-9 2.5-9 6v2h18v-2c0-3.5-4-6-9-6Z'/%3E%3C/svg%3E"); }
.icon-settings { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m19 13.5 2 1.5-2 3.5-2.5-1a8 8 0 0 1-2 1.2L14 22h-4l-.5-3.3a8 8 0 0 1-2-1.2l-2.5 1L3 15l2-1.5a8 8 0 0 1 0-3L3 9l2-3.5 2.5 1a8 8 0 0 1 2-1.2L10 2h4l.5 3.3a8 8 0 0 1 2 1.2l2.5-1L21 9l-2 1.5a8 8 0 0 1 0 3ZM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z'/%3E%3C/svg%3E"); }

/* Administration */
.admin-shell { min-height: 100vh; background: #f5f6f3; }
.admin-header { position: fixed; z-index: 50; top: 0; right: 0; left: 0; display: flex; height: var(--header); align-items: center; gap: 22px; border-bottom: 1px solid var(--line); background: var(--white); padding: 0 25px; }
.admin-header .portal-brand img { width: 205px; }
.admin-header__context { display: grid; margin-left: 8px; border-left: 1px solid var(--line); padding-left: 20px; }
.admin-header__context span { color: var(--brand-dark); font-size: .78rem; font-weight: 700; }
.admin-header__context small { color: var(--muted); font-size: .65rem; }
.admin-header .portal-header__actions { margin-left: auto; }
.admin-menu-toggle { display: none; }
.admin-hamburger, .admin-hamburger::before, .admin-hamburger::after { width: 18px; height: 2px; background: currentColor; content: ""; }
.admin-hamburger { position: relative; }
.admin-hamburger::before { position: absolute; top: -6px; left: 0; }
.admin-hamburger::after { position: absolute; top: 6px; left: 0; }
.admin-sidebar { position: fixed; z-index: 30; top: var(--header); bottom: 0; left: 0; display: flex; width: var(--sidebar); flex-direction: column; background: var(--brand); padding: 26px 18px; color: var(--white); }
.admin-sidebar__label { margin: 0 13px 17px; color: #cbd2c2; font-size: .65rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.admin-nav-button { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; }
.admin-session { display: grid; gap: 4px; margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding: 18px 10px 0; }
.admin-session span { color: #cbd2c2; font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.admin-session strong { font-size: .76rem; }
.admin-session small { color: #d9ded4; font-size: .66rem; }
.admin-main { min-height: 100vh; margin-left: var(--sidebar); padding: calc(var(--header) + 36px) 36px 55px; }
.admin-main > * { max-width: 1450px; margin-right: auto; margin-left: auto; }
.admin-page-heading { align-items: center; }
.admin-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.admin-metrics--compact { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.admin-stat { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); padding: 18px; }
.admin-stat > div { display: grid; gap: 2px; }
.admin-stat small { color: var(--muted); font-size: .67rem; font-weight: 700; }
.admin-stat strong { color: var(--brand-dark); font-family: "Lora", Georgia, serif; font-size: 1.65rem; line-height: 1; }
.admin-stat div span { color: var(--brand-mid); font-size: .63rem; }
.card-icon--warning { background: #f4ead8; color: #926922; }
.card-icon--soft { background: #e8eeec; color: #48655b; }
.admin-dashboard-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(290px,.5fr); gap: 18px; }
.admin-table-card { overflow: hidden; }
.responsive-table { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.admin-table th { border-bottom: 1px solid var(--line); padding: 10px 12px; color: var(--muted); font-size: .63rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.admin-table td { border-bottom: 1px solid #edf0eb; padding: 13px 12px; color: var(--ink); font-size: .72rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td strong { color: var(--brand-dark); font-size: .74rem; }
.admin-table td small { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.row-action { border: 0; background: transparent; color: var(--brand); font-size: .7rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.table-count { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; background: var(--sage-light); color: var(--brand); font-weight: 700; }
.priority-badge { display: inline-flex; border-radius: 999px; background: var(--sage-light); padding: 5px 9px; color: var(--brand); font-size: .64rem; font-weight: 700; }
.priority-badge--alta { background: #f4ead8; color: #835e20; }
.priority-badge--urgente { background: var(--danger-bg); color: var(--danger); }
.admin-pending { display: grid; align-content: start; }
.pending-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); padding: 15px 0; }
.pending-item:last-child { border-bottom: 0; }
.pending-item > div { display: grid; gap: 3px; }
.pending-item strong { color: var(--brand-dark); font-size: .75rem; }
.pending-item small { color: var(--muted); font-size: .64rem; }
.pending-item > span:last-child { color: var(--muted); font-size: .62rem; font-weight: 700; }
.priority-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sage); }
.priority-dot--high { background: #c28a2a; }
.priority-dot--urgent { background: var(--danger); }
.master-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.master-card { display: flex; min-height: 260px; flex-direction: column; }
.master-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.master-card h2 { margin-bottom: 8px; font-size: 1.05rem; }
.master-card p { color: var(--muted); font-size: .78rem; }
.master-card > small { flex: 1; color: var(--brand-mid); font-size: .68rem; }
.master-card .button { margin-top: 20px; }

/* Simple CSS icons */
.icon { display: inline-block; width: 19px; height: 19px; background: currentColor; mask: var(--mask) center / contain no-repeat; -webkit-mask: var(--mask) center / contain no-repeat; }
.icon-home { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 3 9 8h-3v9h-5v-6h-2v6H6v-9H3z'/%3E%3C/svg%3E"); }
.icon-timeline { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h2v5H6V2Zm0 8h2v5H6v-5Zm0 8h2v4H6v-4Zm1-9a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm4-11h10v2H11V6Zm0 8h8v2h-8v-2Zm0 7h10v2H11v-2Z'/%3E%3C/svg%3E"); }
.icon-cases { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 4h6l2 3h4v13H3V7h4l2-3Zm1 2-.7 1h5.4L14 6h-4Z'/%3E%3C/svg%3E"); }
.icon-document { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 2h10l4 4v16H5V2Zm9 2v4h4M8 12h8v2H8v-2Zm0 4h8v2H8v-2Z'/%3E%3C/svg%3E"); }
.icon-calendar { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h2v3h8V2h2v3h3v17H3V5h3V2Zm13 8H5v10h14V10Z'/%3E%3C/svg%3E"); }
.icon-bell { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a6 6 0 0 1 6 6v5l2 3v2H4v-2l2-3V8a6 6 0 0 1 6-6Zm-2 18h4a2 2 0 0 1-4 0Z'/%3E%3C/svg%3E"); }
.icon-search { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 3a7 7 0 1 1-4.9 12l-3.6 3.5 1.5 1.5 3.5-3.6A7 7 0 0 1 10 3Zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10Z'/%3E%3C/svg%3E"); }
.icon-help { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M11 18h2v2h-2v-2Zm1-16a9 9 0 1 1 0 18v-2a7 7 0 1 0-7-7H3a9 9 0 0 1 9-9Zm0 4a4 4 0 0 1 2 7.5c-1 .6-1 1-1 2.5h-2c0-2.3.3-3.2 2-4.2A2 2 0 1 0 10 10H8a4 4 0 0 1 4-4Z'/%3E%3C/svg%3E"); }
.icon-shield { --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 8 3v6c0 5-3.4 9-8 11-4.6-2-8-6-8-11V5l8-3Zm-1 13 6-6-1.4-1.4-4.6 4.6-2.6-2.6L7 11l4 4Z'/%3E%3C/svg%3E"); }
.icon-clock, .icon-compass, .icon-next { border: 2px solid currentColor; border-radius: 50%; background: transparent; mask: none; -webkit-mask: none; }
.icon-clock::after, .icon-compass::after, .icon-next::after { display: block; width: 6px; height: 6px; margin: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ""; }

@media (max-width: 1080px) {
    :root { --sidebar: 238px; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .party-grid, .process-grid { grid-template-columns: 1fr 1fr; }
    .portal-main { padding-right: 24px; padding-left: 24px; }
    .admin-metrics { grid-template-columns: repeat(2, 1fr); }
    .admin-dashboard-grid { grid-template-columns: 1fr; }
    .master-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
    :root { --header: 68px; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-form-wrap { min-height: 100vh; padding: 34px 22px; }
    .auth-form-logo { display: block; }
    .portal-header { padding: 0 16px; }
    .portal-brand img { width: 185px; }
    .profile-chip__text, .portal-header .button--ghost { display: none; }
    .portal-sidebar { display: none; }
    .portal-main { margin-left: 0; padding: calc(var(--header) + 22px) 18px 94px; }
    .mobile-case-bar { display: grid; gap: 2px; margin-bottom: 21px; border-radius: 12px; background: var(--brand); padding: 12px 15px; color: var(--white); }
    .mobile-case-bar span { color: #d8ddcf; font-size: .62rem; font-weight: 700; text-transform: uppercase; }
    .mobile-case-bar strong { overflow-wrap: anywhere; font-size: .76rem; }
    .mobile-nav { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: grid; height: 72px; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); padding: 7px 6px env(safe-area-inset-bottom); backdrop-filter: blur(12px); }
    .mobile-nav a { display: grid; place-items: center; align-content: center; gap: 3px; border-radius: 9px; color: var(--muted); text-decoration: none; }
    .mobile-nav a.is-active { background: var(--sage-light); color: var(--brand); }
    .mobile-nav .icon { width: 18px; height: 18px; }
    .mobile-nav small { font-size: .57rem; font-weight: 700; }
    .summary-grid, .content-grid { grid-template-columns: 1fr; }
    .page-heading { align-items: flex-start; }
    .party-grid, .process-grid { grid-template-columns: 1fr; }
    .current-card, .next-card { min-height: auto; }
    .upcoming-hearing { grid-template-columns: auto minmax(0,1fr); }
    .upcoming-hearing > .button { grid-column: 1 / -1; }
    .account-grid { grid-template-columns: 1fr; }
    .account-card--wide { grid-column: auto; }
    .admin-header { gap: 12px; padding: 0 14px; }
    .admin-menu-toggle { display: grid; }
    .admin-header .portal-brand img { width: 165px; }
    .admin-header__context { display: none; }
    .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .admin-sidebar.is-open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,.2); }
    .admin-main { margin-left: 0; padding: calc(var(--header) + 24px) 18px 45px; }
}

@media (max-width: 560px) {
    .portal-brand img { width: 155px; }
    .profile-chip { display: flex; padding: 2px; }
    .page-heading { display: grid; }
    .summary-grid { gap: 12px; }
    .current-card, .next-card { grid-template-columns: 1fr; gap: 12px; padding: 19px; }
    .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric-card { padding: 13px; }
    .card { border-radius: 15px; padding: 18px; }
    .party-grid { gap: 8px; }
    .timeline-event { grid-template-columns: 25px minmax(0, 1fr); gap: 8px; }
    .timeline-event__date { grid-column: 2; padding-top: 0; }
    .timeline-event__content { grid-column: 2; }
    .timeline-event__rail { grid-row: 1 / span 2; }
    .timeline-event__rail::before { bottom: -85px; }
    .toolbar { display: grid; }
    .toolbar select { width: 100%; }
    .document-row { grid-template-columns: auto minmax(0,1fr); }
    .document-row__actions { grid-column: 1 / -1; }
    .document-row__actions .button { flex: 1; }
    .upcoming-hearing { grid-template-columns: 1fr; text-align: left; }
    .upcoming-hearing__main .details-list { grid-template-columns: 1fr; }
    .hearing-list__row { grid-template-columns: auto minmax(0,1fr); }
    .hearing-list__row > .status-badge { grid-column: 2; }
    .demo-access { grid-template-columns: 1fr; }
    .demo-access span { grid-column: auto; }
    .form-grid { grid-template-columns: 1fr; }
    .field--wide { grid-column: auto; }
    .admin-header .portal-brand img { width: 135px; }
    .admin-header .profile-chip { display: none; }
    .admin-metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
    .admin-stat { align-items: flex-start; padding: 13px; }
    .admin-stat .card-icon { display: none; }
    .admin-page-heading .button { width: 100%; }
    .admin-metrics--compact, .master-grid { grid-template-columns: 1fr; }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
