/* Salon dashboard — one family (Figtree), one accent (grooming-table teal). */
:root {
    --mist: #F4F6F5;
    --surface: #FFFFFF;
    --ink: #1D2B30;
    --muted: #5F6E72;
    --line: #DDE3E1;
    --accent: #127A78;
    --accent-soft: #D7ECEA;
    --accent-ink: #0B5654;
    --warn: #B26B00;
    --warn-soft: #FBEFD9;
    --bad: #B3261E;
    --bad-soft: #F8E1DF;
    --good: #2E7D4F;
    --good-soft: #DFF0E5;

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
    --radius: 10px;
    --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--mist);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.rail {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 2px;
    padding: var(--s5) var(--s3);
    background: var(--ink); color: #C9D4D6;
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s5); color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.rail-link {
    display: flex; align-items: center; gap: var(--s3);
    padding: 9px var(--s3); border-radius: 8px;
    color: inherit; text-decoration: none; font-weight: 500;
}
.rail-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail-link.active { background: var(--accent); color: #fff; }
.icon { flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.statusbar {
    display: flex; align-items: center; gap: var(--s5);
    padding: var(--s3) var(--s6);
    font-size: 13px; color: var(--muted);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.statusbar .zone { margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-live { color: var(--accent-ink); }
.live-live .dot { background: var(--accent); box-shadow: 0 0 0 0 rgba(18, 122, 120, .5); animation: pulse 2.4s infinite; }
.live-reconnecting { color: var(--warn); }
.live-reconnecting .dot { background: var(--warn); }
.live-failed { color: var(--bad); }
.live-failed .dot { background: var(--bad); }
.updated { transition: color .6s; }
.updated.flash { color: var(--accent-ink); font-weight: 600; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(18, 122, 120, .45); }
    70% { box-shadow: 0 0 0 7px rgba(18, 122, 120, 0); }
    100% { box-shadow: 0 0 0 0 rgba(18, 122, 120, 0); }
}

.content { padding: var(--s6); max-width: 1320px; width: 100%; display: flex; flex-direction: column; gap: var(--s6); }

.page-head { display: flex; flex-direction: column; gap: var(--s1); }
.lede { margin: 0; color: var(--muted); font-size: 16px; max-width: 70ch; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.section-note { color: var(--muted); font-size: 13px; }
.empty { margin: 0; color: var(--muted); }

/* ---------- main numbers: one band, the first figure leads ---------- */
.figures {
    display: grid; grid-template-columns: 1.5fr repeat(5, 1fr);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.figure { display: flex; flex-direction: column; gap: 2px; padding: var(--s5); border-left: 1px solid var(--line); min-width: 0; }
.figure:first-child { border-left: 0; }
.figure-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.figure-value { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.figure-lead { background: var(--accent); color: #fff; border-radius: var(--radius) 0 0 var(--radius); }
.figure-lead .figure-label, .figure-lead .figure-sub { color: #CFE9E7; }
.figure-lead .figure-value { font-size: 38px; }
.figure-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ---------- today's book: the salon's day, one lane per groomer ---------- */
.book { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); }
.timeline { display: flex; flex-direction: column; gap: var(--s2); }
.tl-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: var(--s4); }
.tl-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lane { position: relative; height: 54px; background: var(--mist); border-radius: 8px; }
.tl-scale .tl-lane { height: 18px; background: none; }
.tl-hour { position: absolute; transform: translateX(-50%); font-size: 12px; color: var(--muted); }
.tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--bad); border-radius: 1px; z-index: 2; }
.tl-block {
    position: absolute; top: 5px; bottom: 5px;
    display: flex; flex-direction: column; justify-content: center;
    padding: 0 var(--s2); overflow: hidden; white-space: nowrap;
    border-radius: 6px; font-size: 12px; line-height: 1.25;
    background: var(--accent-soft); color: var(--accent-ink); border-left: 3px solid var(--accent);
}
.tl-block strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.tl-block span { overflow: hidden; text-overflow: ellipsis; }
.tl-block.tone-good { background: var(--good-soft); color: var(--good); border-left-color: var(--good); }
.tl-block.tone-bad { background: var(--bad-soft); color: var(--bad); border-left-color: var(--bad); }

/* ---------- grids & charts ---------- */
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: var(--s5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }
.chart, .feed, .panel {
    margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s5); min-width: 0;
}
.chart figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s4); }
.chart-note { font-size: 12.5px; color: var(--muted); }
.chart-empty { margin: 0; color: var(--muted); display: flex; flex-direction: column; gap: var(--s2); }
.chart-axis { margin: var(--s3) 0 0; font-size: 12px; color: var(--muted); text-align: right; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.bar-row { display: grid; grid-template-columns: minmax(80px, 38%) 1fr 48px; align-items: center; gap: var(--s3); font-size: 13.5px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--mist); border-radius: 6px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .5s ease; }
.bar-value { text-align: right; font-weight: 600; }
.columns { width: 100%; height: auto; display: block; }
.columns .grid { stroke: var(--line); stroke-width: 1; }
.columns .axis { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.columns .col { fill: var(--accent); }
.columns .col:hover { fill: var(--accent-ink); }

.skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--mist), #E8EDEB, var(--mist)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton.short { width: 60%; }
.skeleton.tall { height: 160px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- live feed ---------- */
.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 44px 1fr; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: 0; padding-top: 0; }
.feed-time { color: var(--muted); font-size: 13px; padding-top: 1px; }
.feed-body { display: flex; flex-direction: column; min-width: 0; }
.feed-text { font-weight: 500; }
.feed-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); display: flex; flex-direction: column; gap: var(--s2); width: min(360px, calc(100vw - 32px)); z-index: 20; }
.toast {
    background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
    border-radius: 8px; padding: var(--s3) var(--s4);
    box-shadow: 0 6px 24px rgba(29, 43, 48, .14);
    animation: toast-in .25s ease-out;
}
.toast.op-delete { border-left-color: var(--bad); }
.toast.op-update { border-left-color: var(--warn); }
.toast-head { display: flex; align-items: center; gap: var(--s2); font-size: 12.5px; color: var(--muted); }
.toast-op { font-weight: 700; color: var(--ink); }
.toast-close { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-flex; }
.toast-close:hover { color: var(--ink); background: var(--mist); }
.toast-text { font-weight: 500; margin-top: 2px; }
.toast-changes { margin: var(--s1) 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- lists ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.list-tools { display: flex; align-items: center; gap: var(--s3); }
.search {
    font: inherit; font-size: 14px; color: var(--ink);
    width: 260px; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--mist);
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 0; background: var(--surface); }
.count { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F8FAF9; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.when { white-space: nowrap; }
.sub { display: block; font-size: 12.5px; color: var(--muted); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--mist); color: var(--muted); white-space: nowrap; }
.pill.tone-good { background: var(--good-soft); color: var(--good); }
.pill.tone-info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.tone-bad { background: var(--bad-soft); color: var(--bad); }
.pill.tone-warn { background: var(--warn-soft); color: var(--warn); }

.problems { background: var(--warn-soft); color: #5C3A00; border-radius: var(--radius); padding: var(--s4) var(--s5); font-size: 14px; }
.problems ul { margin: var(--s2) 0 0; padding-left: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
    .figures { grid-template-columns: repeat(3, 1fr); }
    .figure:nth-child(4) { border-left: 0; }
    .figure:nth-child(n+4) { border-top: 1px solid var(--line); }
    .figure-lead { border-radius: var(--radius) 0 0 0; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 64px 1fr; }
    .rail { padding: var(--s4) var(--s2); align-items: center; }
    .rail-link span, .brand-name { display: none; }
    .brand { padding: 0 0 var(--s4); }
    .content { padding: var(--s5) var(--s4); }
    .statusbar { padding: var(--s3) var(--s4); flex-wrap: wrap; gap: var(--s3); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .tl-row { grid-template-columns: 90px 1fr; }
}
@media (max-width: 600px) {
    .figures { grid-template-columns: 1fr 1fr; }
    .figure { border-left: 0; border-top: 1px solid var(--line); }
    .figure-lead { grid-column: 1 / -1; border-radius: var(--radius) var(--radius) 0 0; border-top: 0; }
    .search { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
