@font-face {
  font-family: Jost;
  src: url("../fonts/jost-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Jost;
  src: url("../fonts/jost-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Jost;
  src: url("../fonts/jost-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Jost;
  src: url("../fonts/jost-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #121316;
  --muted: #5c6570;
  --paper: #f3f4f6;
  --card: #ffffff;
  --line: #e4e6eb;
  --sidebar: #070707;
  --sidebar-text: #f7f7f5;
  --sidebar-dim: #a1a1aa;
  --accent: #f5c518;
  --accent-ink: #111111;
  --good: #067647;
  --good-bg: #e7f6ee;
  --warn: #92400e;
  --warn-bg: #fff6d8;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --info: #1f2937;
  --info-bg: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 18, 22, 0.04), 0 12px 32px rgba(16, 18, 22, 0.06);
  --sans: Jost, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(245, 197, 24, 0.16), transparent 55%),
    var(--paper);
  line-height: 1.5;
  font-size: 15px;
}
a { color: #111; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: white; padding: 8px 12px; z-index: 6; border-radius: 8px; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 268px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  border-right: 1px solid #1c1c1c;
}
.brand { display: block; padding: 18px 16px 8px; }
.brand img { display: block; width: 100%; border-radius: 12px; background: #000; }
.nav { display: flex; flex-direction: column; gap: 10px; padding: 8px 10px 12px; overflow: auto; flex: 1; min-height: 0; }
.sidebar footer { flex-shrink: 0; }
.nav-group { padding: 8px; border-radius: 14px; background: #121212; border: 1px solid #2a2a2a; }
.nav-label {
  margin: 2px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav-group.g-today { border-color: #5c4a08; }
.nav-group.g-today .nav-label { color: #f5c518; }
.nav-group.g-book { border-color: #3a3a3a; }
.nav-group.g-book .nav-label { color: #f4f4f5; }
.nav-group.g-money { border-color: #14532d; }
.nav-group.g-money .nav-label { color: #86efac; }
.nav-group.g-work { border-color: #1e3a8a; }
.nav-group.g-work .nav-label { color: #93c5fd; }
.nav-group.g-control { border-color: #3f3f46; }
.nav-group.g-control .nav-label { color: #d4d4d8; }
.feature-band.g-today h3 { color: #8a6a00; }
.feature-band.g-book h3 { color: #111; }
.feature-band.g-money h3 { color: #067647; }
.feature-band.g-work h3 { color: #1d4ed8; }
.feature-band.g-control h3 { color: #3f3f46; }
.nav a {
  color: var(--sidebar-text);
  text-decoration: none;
  display: block;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.sidebar footer { margin-top: auto; padding: 14px 16px 18px; color: var(--sidebar-dim); font-size: 13px; border-top: 1px solid #222; }
.sidebar footer strong { display: block; color: white; font-weight: 600; margin-bottom: 8px; }
.sidebar .btn.secondary { color: white; border-color: #3a3a3a; width: 100%; }
.sidebar .btn.secondary:hover { background: #1a1a1a; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 22px 32px 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(243, 244, 246, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar h1 { font-weight: 600; font-size: 30px; letter-spacing: -0.03em; margin: 0; }
.topbar p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.content { padding: 20px 32px 56px; }
.menu-toggle { display: none; background: var(--ink); color: white; border: 0; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards-2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.grid > * { min-width: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.kpi.lead { background: #111; color: white; border-color: #111; }
.kpi.lead .label, .kpi.lead .note { color: #d4d4d8; }
.kpi.owe { background: #fff8d6; border-color: #f0d56a; }
.kpi .value, .stat .value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.kpi .label, .stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.panel { margin-top: 28px; }
.panel:first-of-type { margin-top: 0; }
.section-head { display: flex; gap: 12px; align-items: center; margin: 0 0 14px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.03em; text-transform: none; color: var(--ink); font-weight: 650; }
.section-head p { margin: 2px 0 0; }
.mark { width: 8px; height: 36px; border-radius: 99px; background: var(--accent); flex: none; }
.mark.money { background: #067647; }
.mark.work { background: #1d4ed8; }
.mark.book { background: #111; }
.page-tabs { display: grid; gap: 16px; align-content: start; }
.grid + .page-tabs, .steps + .page-tabs { margin-top: 16px; }
.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 5px;
  position: sticky;
  top: 92px;
  z-index: 3;
  box-shadow: var(--shadow);
}
.tabbar button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink);
}
.tabbar button[aria-selected="true"] { background: #111; color: var(--accent); }
.page-tabs > .tab-panel { display: none; }
.page-tabs:not(.is-ready) > .tab-panel:first-of-type { display: block; }
.page-tabs.is-ready > .tab-panel.is-on { display: block; }
.segment { display: flex; flex-wrap: wrap; gap: 4px; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.segment a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; padding: 7px 11px; border-radius: 10px; }
.segment a.on { background: #111; color: var(--accent); }
.split { margin: 0; }
.split div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.split dt { color: var(--muted); }
.split dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat .value { font-size: 32px; }
.appt { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.appt a { text-decoration: none; }
.feature-band { margin-top: 12px; padding: 14px; border-radius: 18px; background: white; border: 1px solid var(--line); }
.feature-band h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.feature { display: grid; gap: 4px; text-decoration: none; border-radius: 14px; padding: 14px; background: #f6f7f9; border: 1px solid transparent; min-height: 86px; }
.feature strong { font-size: 16px; letter-spacing: -0.02em; }
.feature span { color: var(--muted); font-size: 13px; }
.feature:hover { background: #fffbeb; border-color: #111; }
.g-today.feature-band { box-shadow: inset 4px 0 0 #f5c518; }
.g-book.feature-band { box-shadow: inset 4px 0 0 #111; }
.g-money.feature-band { box-shadow: inset 4px 0 0 #067647; }
.g-work.feature-band { box-shadow: inset 4px 0 0 #1d4ed8; }
.g-control.feature-band { box-shadow: inset 4px 0 0 #6b7280; }
.note { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
tbody tr:hover td { background: #fafafa; }
.table-wrap { overflow: auto; }

.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.good { color: var(--good); background: var(--good-bg); }
.warn { color: var(--warn); background: var(--warn-bg); }
.bad { color: var(--bad); background: var(--bad-bg); }
.info { color: var(--info); background: var(--info-bg); }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid #e2b400;
  border-radius: 12px;
  padding: 10px 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.btn:hover { background: #ffd84a; }
.btn.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: #f7f7f8; }
.btn.danger { background: var(--bad); color: white; border-color: var(--bad); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(245, 197, 24, 0.85);
  outline-offset: 2px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

form.stack, .stack { display: grid; gap: 14px; justify-items: start; }
form.stack > label, form.stack > .row, form.stack > .row-3, form.stack > h2, form.stack > p, form.stack > .service-toolbar, form.stack > .service-group, form.stack > .sticky-actions, form.stack > .check { width: 100%; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
label span { color: var(--muted); font-weight: 500; }
input, select, textarea {
  background: #fff;
  border: 1px solid #d9dce2;
  border-radius: 12px;
  padding: 11px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: #111; }
textarea { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: #111; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 500; }
.alert.good { background: var(--good-bg); color: var(--good); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filters a, .filters button { border-radius: 999px; border: 1px solid var(--line); background: white; padding: 7px 12px; text-decoration: none; color: var(--ink); font-weight: 500; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { min-height: 120px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.day strong { display: block; font-size: 12px; color: var(--muted); }
.slot { display: block; font-size: 12px; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: #fff8d8; color: var(--ink); text-decoration: none; font-weight: 500; }
.slot.cancelled { opacity: 0.55; text-decoration: line-through; background: #f3f4f6; }

.decision { border-radius: 20px; padding: 24px; }
.decision h2 { font-size: 34px; font-weight: 650; margin: 0 0 8px; letter-spacing: -0.03em; text-transform: none; color: inherit; }
.decision.good { background: var(--good-bg); color: var(--good); }
.decision.warn { background: var(--warn-bg); color: var(--warn); }
.decision.bad { background: var(--bad-bg); color: var(--bad); }

.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { padding: 8px 12px; border-radius: 999px; background: white; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.steps .on { background: var(--ink); color: var(--accent); border-color: var(--ink); }
.client-hit { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.client-hit:last-child { border-bottom: 0; }
.client-hit span { display: block; color: var(--muted); font-size: 13px; }
.service-toolbar { position: sticky; top: 78px; z-index: 1; background: white; padding-bottom: 8px; }
.service-group { margin-top: 8px; }
.service-group h2 { margin-top: 8px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; background: #fff; }
.choice:has(input:checked) { border-color: #111; box-shadow: inset 0 0 0 1px #111; background: #fffbeb; }
.choice label { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; cursor: pointer; }
.choice-name { font-weight: 600; }
.choice-price { grid-column: 2; color: var(--muted); font-size: 13px; font-weight: 500; }
.choice .qty { width: 88px; }
.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.auth-body { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.auth-panel { background: #000; color: white; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-panel img { width: min(520px, 100%); border-radius: 16px; }
.auth-panel p { color: #d4d4d8; max-width: 42ch; }
.auth-form { display: grid; align-content: center; padding: 48px; background: var(--paper); }
.auth-form form { max-width: 420px; }
.auth-form h2 { font-weight: 600; font-size: 36px; letter-spacing: -0.04em; margin: 0; }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.chart-box { height: 260px; max-width: 100%; overflow: hidden; }
.chart-box canvas { max-width: 100%; }
.split dd { text-align: right; }
.logo-lockup { width: min(280px, 70%); display: block; margin: 0 auto 12px; border-radius: 12px; }

.receipt { width: 72mm; margin: 0 auto; color: black; font-family: Jost, "Segoe UI", sans-serif; font-size: 12px; }
.receipt h1 { font-size: 16px; text-align: center; letter-spacing: 0.08em; margin: 8px 0 0; }
.receipt .center { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #222; }
.receipt .logo-lockup { width: 100%; border-radius: 0; }
.a4 { max-width: 800px; margin: 0 auto; background: white; padding: 28px; color: black; }
.reprint { border: 2px solid #b42318; color: #b42318; display: inline-block; padding: 2px 8px; font-weight: 700; letter-spacing: 0.12em; }

.mail-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 16px; align-items: start; }
.mail-body { min-height: 220px; }
.token-row { display: flex; flex-wrap: wrap; gap: 6px; }
.token { background: #fff8d6; border: 1px solid #f0d56a; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.mail-stage { background: #e7e8eb; border-radius: 18px; padding: 14px; position: sticky; top: 156px; }
.mail-stage-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 10px; }
.mail-stage-top strong { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.mail-stage-top span { color: var(--muted); font-size: 13px; }
.mail-envelope { background: white; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.mail-envelope p { margin: 0; display: flex; gap: 8px; font-size: 13px; }
.mail-envelope span { width: 58px; color: var(--muted); flex: none; }
.mail-sheet { background: white; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.mail-sheet-head { background: #070707; padding: 18px 18px 14px; text-align: center; border-bottom: 4px solid #f5c518; }
.mail-sheet-head img { width: 180px; border-radius: 8px; }
.mail-sheet-main { padding: 18px 18px 6px; }
.mail-kicker { margin: 0; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a6a00; font-weight: 700; }
.mail-sheet-main h3 { margin: 6px 0 12px; font-size: 22px; letter-spacing: -0.03em; font-weight: 650; line-height: 1.25; }
.mail-sheet-main p { margin: 0 0 12px; }
.mail-sheet-foot { background: #111; color: #d4d4d8; padding: 16px 18px; }
.mail-sheet-foot strong { color: white; display: block; }
.mail-sheet-foot p { margin: 4px 0 0; font-size: 13px; }
.mail-mark { color: #f5c518 !important; letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px !important; font-weight: 700; margin-top: 12px !important; }

@media (max-width: 980px) {
  .kpis, .cards-2, .row, .row-3, .auth-body, .stat-grid, .mail-work { grid-template-columns: 1fr; }
  .mail-stage { position: static; }
  .sidebar { position: fixed; z-index: 4; transform: translateX(-105%); transition: transform 0.2s ease; }
  .sidebar.open { transform: none; box-shadow: 24px 0 48px rgba(0, 0, 0, 0.28); }
  .menu-toggle { display: inline-flex; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .auth-panel { min-height: 280px; padding: 24px; }
  .service-toolbar { top: 0; }
  .client-hit { align-items: flex-start; flex-direction: column; }
}

@media print {
  .sidebar, .topbar, .no-print, .sticky-actions, .tabbar { display: none !important; }
  .page-tabs > .tab-panel, .page-tabs.is-ready > .tab-panel { display: block !important; }
  body { background: white; }
  .content { padding: 0; }
}
