:root {
  color-scheme: light;
  /* Shared with the public site (../styles.css) */
  --bg: #f7f4ec;
  --surface: #fffdf7;
  --surface-2: #f3efe4;
  --paper-deep: #eee8da;
  --ink: #22281f;
  --ink-2: #4a5444;
  --muted: #5f6858;
  --line: #e4ddcd;
  --forest: #344c3d;
  --forest-deep: #263a2e;
  --forest-soft: #e4ece5;
  --moss: #75866a;
  --clay: #a64f33;
  --clay-bright: #c4664a;
  --gold: #edc66e;
  /* Status (reserved: always paired with icon + label) */
  --good: #2f7a47;   --good-bg: #e3f1e6;
  --warn: #8a5a00;   --warn-bg: #fbefd2;
  --bad: #a3261c;    --bad-bg: #fbe3df;
  --info: #2a5f8f;   --info-bg: #e3edf7;
  /* Chart series */
  --series-1: #344c3d;
  --series-1-hover: #c4664a;
  --chart-grid: #ece6d8;
  --sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(38, 58, 46, .07);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
::selection { background: var(--forest); color: var(--surface); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--forest); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
:focus-visible { outline: 3px solid var(--clay); outline-offset: 2px; border-radius: 6px; }
[data-lucide], svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Demo banner */
.demo-banner { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 7px 16px; background: var(--forest-deep); color: #d5ddd0; font-size: 13px; }
.demo-banner strong { color: #fff; font-weight: 600; }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--forest); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .92rem; }
.demo-banner .link-btn { color: var(--gold); font-size: 13px; font-weight: 600; }

/* Layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - 34px); }
.sidebar { background: var(--forest-deep); color: #e8ede6; display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.03em; line-height: 1.05; padding: 0 8px 22px; }
.side-brand small { display: block; margin-top: 4px; font-weight: 600; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #b9c6b8; }
.side-mark { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 253, 247, .22); flex: none; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #dfe7dc; text-decoration: none; font-weight: 600; }
.side-nav a:hover { background: rgba(255, 255, 255, .07); }
.side-nav a.is-active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-count { margin-left: auto; background: var(--gold); color: var(--ink); font-size: .78rem; padding: 1px 8px; border-radius: 999px; }
.nav-count:empty { display: none; }
.side-foot { margin-top: auto; padding: 12px; }
.side-foot a { display: flex; align-items: center; gap: 8px; color: #b9c6b8; text-decoration: none; font-size: .92rem; }
.side-foot a:hover { color: #fff; }

.main { min-width: 0; padding: 0 28px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 0 20px; }
.topbar h1 { font-family: var(--serif); font-weight: 500; font-size: 2.4rem; letter-spacing: -.03em; line-height: 1.05; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.search { position: relative; display: flex; align-items: center; }
.search [data-lucide], .search svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 260px; min-height: 44px; padding: 10px 16px 10px 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.search input::placeholder { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .2s, border-color .2s, transform .2s var(--ease); }
.btn:hover { border-color: #c9c2b2; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest); color: #fff; border-color: var(--forest); box-shadow: 0 8px 20px rgba(38, 58, 46, .18); }
.btn-primary:hover { background: var(--forest-deep); }
.btn-sm { min-height: 34px; padding: 4px 14px; font-size: .9rem; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }

/* Panels & grid */
.panel { background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; margin: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; letter-spacing: -.02em; }
.wrap-head { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.stack { display: grid; gap: 18px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 0; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.kpi-label svg { color: var(--clay-bright); }
.kpi-value { font-family: var(--serif); font-size: 2.3rem; font-weight: 500; letter-spacing: -.03em; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-family: var(--sans); font-size: 1rem; color: var(--muted); font-weight: 500; }
.kpi-note { font-size: .88rem; color: var(--muted); margin-top: 2px; }
.meter { height: 6px; border-radius: 99px; background: var(--chart-grid); margin-top: 10px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--forest); border-radius: 99px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid #efebe2; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover, .table-click tbody tr:focus-visible { background: var(--surface-2); }
.dog-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.dog-cell strong { display: block; }
.dog-cell span { font-size: .86rem; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 700; font-family: var(--serif); flex: none; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.avatar.lg { width: 72px; height: 72px; font-size: 2rem; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

/* Pills & status */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .84rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.s-good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.s-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.s-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.s-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.s-neutral { background: #eeebe3; color: var(--ink-2); border-color: transparent; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.status-btn { cursor: pointer; border: 1px solid transparent; min-width: 118px; justify-content: center; }
.status-btn:hover { filter: brightness(.96); border-color: currentColor; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--forest); color: #fff; }

/* Lists */
.alert-list, .task-list, .staff-list, .roster { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #efebe2; font-size: .95rem; }
.alert-list li:last-child { border: 0; }
.alert-list .ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; flex: none; }
.alert-list strong { display: block; }
.tel { white-space: nowrap; font-weight: 600; color: var(--forest); text-underline-offset: 3px; }
.task-list li label { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; font-size: .95rem; }
.task-list input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--forest); flex: none; }
.task-list input:checked + span { text-decoration: line-through; color: var(--muted); }
.task-time { font-weight: 700; color: var(--forest); margin-right: 4px; font-variant-numeric: tabular-nums; }
.staff-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.staff-list .avatar { width: 32px; height: 32px; font-size: .9rem; background: var(--forest); }
.staff-list div { flex: 1; }
.staff-list span { display: block; font-size: .86rem; color: var(--muted); }

/* Schedule */
.grid-cal { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.day-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.cap-bar { height: 8px; background: var(--chart-grid); border-radius: 99px; overflow: hidden; margin: -4px 0 14px; }
.cap-bar span { display: block; height: 100%; background: var(--forest); }
.roster li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #efebe2; }
.roster li > div { flex: 1; min-width: 0; }
.roster strong { display: block; }
.roster span.meta { font-size: .86rem; color: var(--muted); }
.roster-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 14px 0 4px; border: 0 !important; }

/* FullCalendar theming */
.fc { --fc-border-color: var(--line); --fc-today-bg-color: #f6efd9; --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-button-bg-color: var(--surface); --fc-button-text-color: var(--ink); --fc-button-border-color: var(--line); --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: #c9c2b2; --fc-button-active-bg-color: var(--forest); --fc-button-active-border-color: var(--forest); --fc-event-border-color: transparent; font-size: .92rem; }
.fc .fc-toolbar-title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.fc .fc-button { font-weight: 600; text-transform: capitalize; box-shadow: none !important; border-radius: 8px; padding: 6px 12px; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.fc .fc-daygrid-day { cursor: pointer; }
.fc .fc-daygrid-day.is-selected { background: var(--forest-soft); }
.fc-event { cursor: pointer; border-radius: 6px !important; padding: 1px 4px; font-weight: 600; }
.ev-daycare { background: var(--forest) !important; color: #fff !important; }
.ev-daycare.ev-busy { background: #7a3a22 !important; }
.ev-meet { background: var(--info-bg) !important; color: var(--info) !important; }
.ev-meet .fc-event-time, .ev-meet .fc-event-title { color: var(--info); }
.ev-groom { background: var(--warn-bg) !important; color: var(--warn) !important; }
.ev-groom .fc-event-time, .ev-groom .fc-event-title { color: var(--warn); }
.fc .fc-list-event:hover td { background: var(--surface-2); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters select, .modal select, .modal input:not([type="checkbox"]) { padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-height: 44px; }

/* Kanban */
.lead-intro { margin: -8px 0 16px; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: var(--paper-deep); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.lane h2 { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; display: flex; justify-content: space-between; padding: 4px 4px 12px; }
.lane h2 span { font-family: var(--sans); color: var(--muted); }
.card { background: var(--surface); border-radius: 12px; padding: 14px; box-shadow: 0 2px 8px rgba(38, 58, 46, .06); margin-bottom: 10px; }
.card strong { display: block; }
.card p { margin: 6px 0 0; font-size: .92rem; color: var(--ink-2); }
.card .meta { font-size: .84rem; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }
.card-actions { display: flex; gap: 6px; margin-top: 10px; }

/* Charts */
.chart-panel { display: flex; flex-direction: column; }
.chart-box { position: relative; height: 260px; }
.chart-table { max-height: 260px; overflow: auto; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(20, 26, 19, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); z-index: 50; transform: translateX(100%); transition: transform .22s ease; overflow-y: auto; padding: 26px 26px 40px; box-shadow: -10px 0 40px rgba(0, 0, 0, .12); }
.drawer.is-open { transform: none; }
.drawer-close { position: absolute; top: 16px; right: 16px; }
.d-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; padding-right: 40px; }
.d-head h2 { font-family: var(--serif); font-size: 2rem; font-weight: 500; letter-spacing: -.03em; }
.d-head p { color: var(--muted); margin: 2px 0 0; }
.d-section { border-top: 1px solid var(--line); padding: 16px 0; }
.d-section h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--clay); margin-bottom: 10px; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.d-grid div { min-width: 0; }
.d-grid dt { font-size: .84rem; color: var(--muted); font-weight: 600; }
.d-grid dd { margin: 0; overflow-wrap: anywhere; }
.d-grid .wide { grid-column: 1 / -1; }
.vax-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.drawer textarea { width: 100%; min-height: 90px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.visits { display: flex; flex-wrap: wrap; gap: 4px; }
.visits span { width: 14px; height: 14px; border-radius: 3px; background: var(--chart-grid); }
.visits span.on { background: var(--forest); }

/* Modal */
.modal { border: 0; border-radius: 20px; padding: 0; background: var(--surface); width: min(460px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(38, 58, 46, .25); }
.modal::backdrop { background: rgba(20, 26, 19, .4); }
.modal form { padding: 24px; display: grid; gap: 14px; }
.modal h2 { font-family: var(--serif); font-weight: 500; font-size: 1.7rem; letter-spacing: -.03em; }
.modal label { display: grid; gap: 5px; font-weight: 600; font-size: .95rem; }
.modal select, .modal input:not([type="checkbox"]) { width: 100%; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks-inline { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks-inline legend { font-weight: 600; font-size: .95rem; margin-bottom: 6px; padding: 0; }
.checks-inline label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.checks-inline input { accent-color: var(--forest); width: 17px; height: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.form-msg { margin: 0; color: var(--bad); font-weight: 600; font-size: .92rem; min-height: 1.2em; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 40px)); visibility: hidden; background: var(--forest-deep); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); transition: transform .22s ease; z-index: 90; max-width: calc(100% - 32px); }
.toast.is-visible { transform: translate(-50%, 0); visibility: visible; }

/* Responsive */
@media (max-width: 1180px) {
  .grid-2, .grid-cal { grid-template-columns: 1fr; }
  .day-panel { position: static; max-height: none; }
  .stack { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; gap: 6px; overflow-x: auto; }
  .side-brand { padding: 0 6px 0 0; }
  .side-brand > span:last-child, .side-foot { display: none; }
  .side-nav { display: flex; gap: 2px; }
  .side-nav a { padding: 9px 10px; white-space: nowrap; font-size: .92rem; gap: 7px; }
  .side-nav a.is-active { box-shadow: inset 0 -3px 0 var(--gold); }
  .main { padding: 0 16px 40px; }
  .grid-2.even { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .top-actions { width: 100%; }
  .search { flex: 1; }
}
@media (max-width: 560px) {
  .side-nav a span { display: none; }
  .side-nav a { padding: 10px 12px; }
  .nav-count { margin-left: 2px; }
  .top-actions .btn span { display: none; }
  .demo-banner { padding: 7px 14px; flex-wrap: wrap; gap: 4px 12px; }
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg button { white-space: nowrap; }
  .kpi-value { font-size: 1.7rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .panel { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .fc .fc-toolbar { flex-direction: column; gap: 8px; }
  .d-grid, .row-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .drawer, .toast { transition: none; } }

.nowrap { white-space: nowrap; }
.roster .link-btn { display: block; }
#invoice-table td:first-child, #invoice-table td:nth-child(3) { white-space: nowrap; }
.clients-stack { display: grid; gap: 18px; }
.dog-cell span { font-weight: 400; }
@media (max-width: 700px) {
  #board thead { display: none; }
  #board, #board tbody { display: block; }
  #board tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; border-bottom: 1px solid #efebe2; }
  #board td { border: 0; padding: 0; }
  #board td:nth-child(1) { grid-column: 1 / -1; }
  #board td:nth-child(2) { grid-row: 2; grid-column: 1; font-weight: 600; }
  #board td:nth-child(3) { grid-row: 3; grid-column: 1; color: var(--ink-2); }
  #board td:nth-child(4) { grid-row: 4; grid-column: 1 / -1; }
  #board td:nth-child(5) { grid-row: 2 / 4; grid-column: 2; align-self: center; }
  #board td.empty { grid-column: 1 / -1; }
  .table-wrap:has(#board) { margin: 0; padding: 0; }
}
@media (max-width: 700px) { .panel-head { flex-wrap: wrap; } }
