@font-face { font-family: 'Heebo'; font-weight: 300; font-display: swap; src: url(/fonts/heebo-hebrew-300-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 300; font-display: swap; src: url(/fonts/heebo-latin-300-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Heebo'; font-weight: 400; font-display: swap; src: url(/fonts/heebo-hebrew-400-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 400; font-display: swap; src: url(/fonts/heebo-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Heebo'; font-weight: 500; font-display: swap; src: url(/fonts/heebo-hebrew-500-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 500; font-display: swap; src: url(/fonts/heebo-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Heebo'; font-weight: 600; font-display: swap; src: url(/fonts/heebo-hebrew-600-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 600; font-display: swap; src: url(/fonts/heebo-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Frank Ruhl Libre'; font-weight: 500; font-display: swap; src: url(/fonts/frank-ruhl-libre-hebrew-500-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Frank Ruhl Libre'; font-weight: 500; font-display: swap; src: url(/fonts/frank-ruhl-libre-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Frank Ruhl Libre'; font-weight: 700; font-display: swap; src: url(/fonts/frank-ruhl-libre-hebrew-700-normal.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Frank Ruhl Libre'; font-weight: 700; font-display: swap; src: url(/fonts/frank-ruhl-libre-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --navy: #1E2F5C;
  --navy-dark: #0F1B3D;
  --navy-soft: #EEF1F8;
  --gold: #B8995F;
  --gold-text: #7A5F2E;
  --gold-soft: #F6F4EE;
  --ink: #1A1F2E;
  --muted: #5B6275;
  --line: #EEEDE8;
  --line-2: #F1F0EC;
  --field: #E6E4DD;
  --bg: #FAFAF8;
  --white: #FFFFFF;
  --danger: #8A3A14;
  --danger-soft: #FBEDE6;
  --ok: #24613A;
  --ok-soft: #E8F3EC;
  --radius: 18px;
  --serif: 'Frank Ruhl Libre', 'David', serif;
  --sans: 'Heebo', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--white); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-dark); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; color: var(--navy); margin: 0; }
h1 { font-size: 40px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* layout */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.side { flex: 1 1 240px; max-width: 270px; padding: 32px 22px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 32px; background: var(--white); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.brand img { width: 130px; height: auto; }
.brand .name { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--navy); }
.brand .rule { width: 40px; height: 1px; background: var(--gold); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-radius: 12px; color: #3A4152; }
.nav a:hover { background: var(--gold-soft); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--navy); color: var(--white); font-weight: 500; }
.nav .soon { font-size: 11px; color: var(--muted); }
.nav span.disabled { padding: 11px 16px; color: #8A8F9C; display: flex; justify-content: space-between; }
.me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: var(--white); display: flex; align-items: center; justify-content: center; font-weight: 500; flex: none; }
.me .who { display: flex; flex-direction: column; min-width: 0; }
.me .who small { color: var(--muted); }
.me .links { display: flex; gap: 12px; font-size: 13px; }
.linkbtn { background: none; border: none; padding: 0; color: var(--navy); cursor: pointer; font-size: 13px; }
.linkbtn:hover { text-decoration: underline; }
.main { flex: 999 1 560px; min-width: 0; padding: 40px 48px 64px; background: var(--bg); display: flex; flex-direction: column; gap: 32px; }

@media (max-width: 820px) {
  .side { max-width: none; flex-basis: 100%; padding: 18px; gap: 16px; border-left: none; border-bottom: 1px solid var(--line); }
  .brand { flex-direction: row; justify-content: flex-start; }
  .brand img { width: 64px; }
  .brand .rule { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a, .nav span.disabled { padding: 8px 12px; }
  .nav span.disabled { display: none; }
  .me { margin-top: 0; }
  .main { padding: 24px 18px 48px; }
  h1 { font-size: 30px; }
}

/* page header */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; }
.head .eyebrow { font-size: 14px; color: var(--gold-text); letter-spacing: 0.04em; }
.head .sub { color: var(--muted); }
.head .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* controls */
.btn { min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--navy); background: var(--white); color: var(--navy); cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--navy-soft); }
.btn.primary { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-dark); }
.btn.ghost { border-color: var(--field); color: var(--ink); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; background: var(--white); border: 1px solid var(--field); border-radius: 999px; min-width: 240px; }
.search input { border: none; outline: none; background: transparent; width: 100%; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--field); color: var(--ink); background: var(--white); font-size: 14px; }
.tabs a:hover { text-decoration: none; border-color: var(--navy); }
.tabs a.active { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card .card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card.dark { background: var(--navy); color: var(--white); border-color: var(--navy); }
.card.dark h2 { color: var(--white); }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.row > .wide { flex: 3 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.row > .narrow { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-family: var(--serif); font-size: 46px; line-height: 1; color: var(--navy); }
.stat .note { font-size: 13px; color: var(--gold-text); }
.stat.alert .value { color: var(--danger); }

.list-item { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.list-item:first-of-type { border-top: none; }
.list-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item .title { font-weight: 500; }
.list-item .meta { font-size: 13px; color: var(--muted); }
.datebox { width: 58px; flex: none; display: flex; flex-direction: column; align-items: center; padding: 7px 0; border-radius: 12px; background: var(--gold-soft); }
.datebox .d { font-family: var(--serif); font-size: 22px; line-height: 1; color: var(--navy); }
.datebox .m { font-size: 12px; color: var(--muted); }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; background: var(--navy-soft); color: var(--navy); white-space: nowrap; }
.pill.gold { background: var(--gold-soft); color: #5E4A22; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.muted { background: var(--line-2); color: var(--muted); }
.empty { color: var(--muted); padding: 10px 0; }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.bar > div { height: 100%; background: var(--navy); border-radius: 3px; }
.bar.gold > div { background: var(--gold); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: right; font-weight: 500; font-size: 13px; color: var(--muted); padding: 10px 8px; }
td { padding: 15px 8px; border-top: 1px solid var(--line-2); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }

.kv { display: flex; flex-direction: column; gap: 10px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; }
.kv .k { color: var(--muted); }
.card.dark .kv .k { color: #C9D1E6; }
.kv .v { text-align: left; overflow-wrap: anywhere; }

/* stepper */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.steps li { display: flex; flex-direction: column; gap: 8px; }
.steps button { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 8px; border-radius: 8px; padding: 4px 2px; }
.steps button:focus-visible { outline: 2px solid var(--gold); }
.steps .line { height: 4px; border-radius: 2px; background: var(--field); }
.steps .done .line { background: var(--navy); }
.steps .now .line { background: var(--gold); }
.steps .label { font-size: 14.5px; color: var(--muted); }
.steps .done .label { color: var(--ink); }
.steps .now .label { color: var(--navy); font-weight: 600; }
.steps .state { font-size: 12.5px; color: var(--muted); }

.task { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.task input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--navy); flex: none; cursor: pointer; }
.task .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task.done .t { color: var(--muted); text-decoration: line-through; }
.task .meta { font-size: 13px; color: var(--muted); }
.task .overdue { color: var(--danger); }
.iconbtn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; min-width: 32px; min-height: 32px; }
.iconbtn:hover { background: var(--line-2); color: var(--ink); }

.note { padding: 12px 0; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; }
.note .meta { font-size: 12.5px; color: var(--gold-text); }
.note .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 10px; align-items: flex-start; }
.inline-form textarea, .inline-form input { flex: 1; border: 1px solid var(--field); border-radius: 12px; padding: 10px 14px; background: var(--white); resize: vertical; min-height: 44px; }

/* forms & dialogs */
dialog { border: none; border-radius: 22px; padding: 0; width: min(620px, calc(100vw - 32px)); box-shadow: 0 24px 80px rgba(15, 27, 61, 0.18); }
dialog::backdrop { background: rgba(15, 27, 61, 0.35); }
.dialog-body { padding: 32px; display: flex; flex-direction: column; gap: 20px; max-height: calc(100vh - 64px); overflow-y: auto; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { border: 1px solid var(--field); border-radius: 12px; padding: 11px 14px; background: var(--white); min-height: 44px; width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--navy); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--white); }
.auth .box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 24px; }
.auth .brand img { width: 200px; }
.auth .box .fields { grid-template-columns: 1fr; }
.auth .hint { color: var(--muted); font-size: 14px; text-align: center; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 12px 22px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 10; }
#toast.show { opacity: 1; }
#toast.error { background: var(--danger); }
.actions-inline { display: inline-flex; gap: 6px; flex: none; }
.approval-banner { background: var(--gold-soft); border-color: #E8DFC9; }
.approval-banner.rejected { background: var(--danger-soft); border-color: #F1D3C4; }
.approval-banner h2 { font-size: 20px; }
.lawyer-filter { min-height: 40px; border: 1px solid var(--field); border-radius: 999px; padding: 0 14px; background: var(--white); }
.perm-yes { color: var(--ok); font-weight: 600; }
.perm-no { color: #B0B4BF; }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; direction: ltr; }
