/* Minimal modern theme: white surfaces, near-black text, one blue accent, Heebo. */

@font-face { font-family: "Heebo"; font-weight: 400; font-display: swap;
  src: url("fonts/heebo-hebrew-400-normal.woff2") format("woff2"); unicode-range: 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+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: 700; font-display: swap;
  src: url("fonts/heebo-hebrew-700-normal.woff2") format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Heebo"; font-weight: 700; font-display: swap;
  src: url("fonts/heebo-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #eceef1;
  --line-strong: #d9dce1;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --hover: #f9fafb;
  --accent: #0369a1;
  --accent-soft: #e0f2fe;
  --sky: #38bdf8;
  --sky-hover: #0ea5e9;
  --sky-ink: #0c2d48;
  --danger: #b91c1c;
  --ok: #166534;
  --warn: #92400e;
  --font: "Heebo", "Segoe UI", Arial, sans-serif;
  --radius: 10px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 700; color: var(--ink); margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin-bottom: 1rem; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Top bar ------------------------------------------------------------- */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-inner {
  max-width: 1200px; margin: 0 auto; padding: .75rem 1.5rem;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.monogram { width: 40px; height: 40px; flex: none; display: block; }
.brand-name { font-size: 1rem; font-weight: 700; line-height: 1.15; display: block; }
.brand-sub { font-size: .78rem; color: var(--muted); display: block; }
.mainnav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; margin-inline-start: auto; }
.mainnav a, .mainnav .link {
  color: var(--muted); font-size: .93rem; padding: .45rem .75rem; border-radius: var(--radius-sm);
  background: none; border: 0; text-decoration: none; font-weight: 500;
}
.mainnav a:hover, .mainnav .link:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
.mainnav a.active { color: #075985; font-weight: 700; background: var(--accent-soft); }
.mainnav .sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 .4rem; }

/* --- Page ---------------------------------------------------------------- */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.eyebrow { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .15rem; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.month-nav {
  display: inline-flex; align-items: center; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden;
}
.month-nav a { padding: .45rem .8rem; color: var(--ink-2); font-size: .88rem; }
.month-nav a + a { border-inline-start: 1px solid var(--line); }
.month-nav a:hover { background: var(--hover); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.5rem; margin-bottom: 1.25rem; overflow-x: auto;
}
.card-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2 { margin: 0; flex: 1; }
.card-head a { font-size: .9rem; }
.narrow { max-width: 480px; margin-inline: auto; }
.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.25rem; align-items: end; }

/* --- Figures (KPI tiles) --------------------------------------------------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.figure-label { font-size: .85rem; color: var(--muted); }
.figure-value {
  font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin-top: .3rem;
  font-variant-numeric: tabular-nums; direction: ltr; text-align: right;
}
.figure.accent .figure-value { color: var(--accent); }
.figure-note { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.currency-tag {
  display: inline-block; font-size: .7rem; font-weight: 500; color: var(--ink-2); background: #f3f4f6;
  padding: 0 .4rem; border-radius: 4px; margin-inline-start: .3rem;
}

/* --- Tables --------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: start; font-weight: 500; font-size: .8rem; color: var(--muted);
  padding: .55rem .6rem; border-bottom: 1px solid var(--line);
}
.table td { text-align: start; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table td a { font-weight: 500; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.desc { white-space: pre-wrap; min-width: 220px; }
tr.nonbillable td { color: var(--muted); }
tr.inactive td { opacity: .55; }
.internal { margin-top: .3rem; font-size: .84rem; color: var(--warn); }
.empty { color: var(--muted); text-align: center; padding: 2rem 0 !important; }

.badge {
  display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 500;
  white-space: nowrap; background: #f3f4f6; color: var(--ink-2);
}
.badge-unbilled { background: #fef3c7; color: var(--warn); }
.badge-billed { background: var(--accent-soft); color: #075985; }
.badge-paid { background: #dcfce7; color: var(--ok); }

/* --- Forms ---------------------------------------------------------------- */
label { display: block; margin-bottom: 1rem; font-weight: 500; font-size: .9rem; color: var(--ink-2); }
label small { font-weight: 400; }
label.check { display: flex; align-items: center; gap: .55rem; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month],
select, textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .55rem .75rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; font-weight: 400;
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.25); }
input:disabled { background: #f3f4f6; color: var(--muted); }
input[type=checkbox] { accent-color: var(--accent); width: 1rem; height: 1rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .75rem 0 0; }
.row input, .row select { width: auto; flex: 1 1 150px; margin-top: 0; }
.row label.check { margin: 0; }
.row.divider { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }

button, .button {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  background: var(--sky); color: var(--sky-ink); border: 1px solid var(--sky);
  border-radius: var(--radius-sm); padding: .55rem 1.1rem; font: inherit; font-weight: 700; font-size: .9rem;
  cursor: pointer; text-decoration: none; line-height: 1.3;
}
button:hover, .button:hover { background: var(--sky-hover); border-color: var(--sky-hover); color: var(--sky-ink); text-decoration: none; }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
button.secondary:hover, .button.secondary:hover { background: var(--hover); color: var(--ink); }
button.danger { background: var(--surface); color: var(--danger); border-color: #fecaca; font-weight: 500; }
button.danger:hover { background: #fef2f2; color: var(--danger); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500; }
button.link:hover { background: none; color: var(--accent); text-decoration: underline; }
button.block { width: 100%; }
form.inline { display: inline; }
.actions-cell form + form { margin-inline-start: .9rem; }
.form-footer { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.form-footer .spacer { flex: 1; }

/* --- Flash messages ------------------------------------------------------ */
.flash {
  padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem;
  border: 1px solid #bae6fd; background: var(--accent-soft); color: #075985; font-size: .92rem;
}
.flash-error { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.flash-success { border-color: #bbf7d0; background: #f0fdf4; color: var(--ok); }

/* --- Authentication screens --------------------------------------------- */
body.auth { background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand {
  background: linear-gradient(160deg, #e0f2fe 0%, #bae6fd 100%); color: var(--sky-ink); padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand .monogram { width: 80px; height: 80px; }
.auth-brand h1 { color: var(--sky-ink); font-size: 2rem; margin-top: 1.5rem; }
.auth-brand .rule { display: none; }
.auth-brand p { color: #2f5b78; max-width: 36ch; margin: .75rem 0 0; font-size: 1.02rem; }
.auth-brand .assurances { list-style: none; padding: 0; margin: 0; font-size: .9rem; color: #2f5b78; }
.auth-brand .assurances li { padding: .3rem 0; }
.auth-brand .assurances li::before { content: "✓"; color: #0284c7; margin-inline-end: .6rem; font-weight: 700; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 3rem 1.5rem; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.6rem; margin: 0 0 .35rem; }
.auth-card .lead { color: var(--muted); margin: 0 0 1.75rem; }
.auth-card .flash { margin-bottom: 1.5rem; }
.auth-card details { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.auth-card summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.code-input { font-size: 1.5rem !important; letter-spacing: .45em; text-align: center; direction: ltr; font-variant-numeric: tabular-nums; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 1rem 0 1.25rem; }
.steps li { counter-increment: step; position: relative; padding-inline-start: 2.2rem; margin-bottom: .9rem; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0;
  width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.qr { display: block; width: 200px; height: 200px; margin: .75rem auto 1rem; background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.secret { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: #f3f4f6; padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: .88rem; }
.codes {
  font-family: ui-monospace, Consolas, monospace; columns: 2; list-style: none; padding: 1rem 1.25rem; margin: 1rem 0 1.5rem;
  font-size: 1rem; background: #f9fafb; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
}
.codes li { padding: .2rem 0; }

/* --- Matters and hour banks ---------------------------------------------- */
.matter { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.matter.inactive { opacity: .6; }
.matter-head .badge { margin-inline-start: .4rem; }
.matter-terms { font-size: .88rem; margin-top: .2rem; }
.matter details, .new-matter { margin-top: .6rem; }
.matter summary, .new-matter summary { cursor: pointer; color: var(--accent); font-size: .9rem; font-weight: 500; }
.matter details form, .new-matter form { margin-top: 1rem; }
.new-matter { padding-top: .5rem; }
.badge-mode-hourly { background: #f3f4f6; color: var(--ink-2); }
.badge-mode-fixed_hours { background: #ede9fe; color: #5b21b6; }
.badge-mode-fixed_price { background: #e0f2fe; color: #075985; }

.package { margin-top: 2rem; }
.project + .project { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.package-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.package-head h3 { font-size: 1.1rem; margin: 0; }
.package-head .label { font-size: .8rem; color: var(--muted); }
.bank {
  background: #f9fafb; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 1rem 1.25rem; margin-bottom: 1rem; display: grid; gap: .6rem;
}
.bank-figures { display: flex; flex-wrap: wrap; gap: .5rem 2rem; }
.bank-figures div { display: grid; }
.bank-figures .k { font-size: .8rem; color: var(--muted); }
.bank-figures .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bank-figures .v.over { color: var(--danger); }
.bank progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; background: #e5e7eb; overflow: hidden; }
.bank progress::-webkit-progress-bar { background: #e5e7eb; border-radius: 99px; }
.bank progress::-webkit-progress-value { background: var(--sky); border-radius: 99px; }
.bank progress::-moz-progress-bar { background: var(--sky); border-radius: 99px; }
.bank .note { font-size: .85rem; color: var(--muted); margin: 0; }
.over-tag { display: block; font-size: .8rem; color: var(--danger); }
.section-title { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }

.provisional {
  margin: 0 0 1.25rem; padding: .7rem 1rem; border-radius: var(--radius-sm);
  background: #fffbeb; border: 1px solid #fde68a; color: #78350f; font-size: .9rem;
}

/* --- Report --------------------------------------------------------------- */
.letter { padding: 2.25rem 2.5rem; }
.letterhead {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem;
}
.letterhead .monogram { width: 60px; height: 60px; }
.letter-meta { text-align: end; font-size: .9rem; }
.letter-meta .doc-title { font-size: 1.35rem; font-weight: 700; }
.parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.parties .label { font-size: .8rem; color: var(--muted); }
.parties .value { font-size: 1.05rem; font-weight: 700; }
.totals { margin-top: 1.25rem; margin-inline-start: auto; border-collapse: collapse; min-width: 300px; font-size: .95rem; }
.totals th, .totals td { padding: .35rem .5rem; text-align: start; font-weight: 400; color: var(--ink-2); }
.totals td { text-align: end; }
.totals .grand th, .totals .grand td { border-top: 1px solid var(--line-strong); font-weight: 700; font-size: 1.15rem; color: var(--ink); padding-top: .6rem; }
.disclaimer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }

/* --- Footer --------------------------------------------------------------- */
.site-footer { text-align: center; font-size: .78rem; color: var(--muted); padding: 0 1rem 2rem; }

/* --- Responsive & print --------------------------------------------------- */
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 1.5rem; }
  .auth-brand .assurances, .auth-brand .tagline { display: none; }
  .auth-brand h1 { font-size: 1.35rem; margin-top: .75rem; }
  .masthead-inner { gap: .75rem; }
  .mainnav { margin-inline-start: 0; }
  .letter { padding: 1.25rem; }
}
@media print {
  body { background: #fff; }
  .no-print, .masthead, .site-footer { display: none !important; }
  .container { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; }
  .letter { padding: 0; }
}
