:root {
  --bg: #f5f7f6; --surface: #ffffff; --ink: #1d2b29; --muted: #64736f; --line: #e2e8e5;
  --accent: #1f7a6d; --accent-soft: #e3f1ee; --warn: #9a6a12; --warn-soft: #fbf3df;
  --radius: 12px; --nav: 232px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 13px; }

.shell { display: grid; grid-template-columns: var(--nav) 1fr; min-height: 100vh; }
.nav { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 4px 10px 18px; }
.brand-mark { font-size: 24px; }
.brand-text { font-weight: 650; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-weight: 400; color: var(--muted); font-size: 12px; }
.nav a:not(.brand) { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:not(.brand):hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.main { min-width: 0; position: relative; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 22px 32px 6px; }
.top h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }
.top-right { display: flex; align-items: center; gap: 14px; }
.updated { color: var(--muted); font-size: 13px; transition: color .6s; }
.updated.fresh { color: var(--accent); }
.bell { position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px; cursor: pointer; color: var(--muted); }
.bell:hover { color: var(--ink); }
.dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.content { padding: 14px 32px 48px; max-width: 1180px; }

.feed { position: absolute; right: 32px; top: 64px; width: 380px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 12px 32px rgba(29,43,41,.12); z-index: 20; }
.feed h2 { font-size: 14px; margin-bottom: 10px; }
.feed ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feed li { font-size: 13px; border-left: 3px solid var(--accent-soft); padding-left: 10px; }
.feed time { color: var(--muted); margin-right: 4px; font-variant-numeric: tabular-nums; }

.toasts { position: fixed; right: 24px; bottom: 24px; display: grid; gap: 10px; z-index: 30; width: min(380px, calc(100vw - 48px)); }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; font-size: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.2); animation: rise .25s ease-out; }
.toast small { display: block; color: #aebdb9; margin-bottom: 2px; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card.flush { padding: 0; overflow: hidden; } .pad { padding: 16px 18px; }
.section { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; }
.btn:hover { border-color: #c9d4d0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }
.btn.primary:hover { background: #196a5e; }
.btn.ghost { border-color: transparent; color: var(--accent); }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }

.datebar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.datebar-day { display: flex; gap: 10px; align-items: center; min-width: 260px; justify-content: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 500; }

.clinic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.card-head h3 { font-size: 16px; }
.count { background: var(--bg); border-radius: 999px; min-width: 30px; text-align: center; padding: 2px 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.appts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.appts li { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.when { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.what { display: grid; gap: 1px; }
.status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.status.s-booked { background: #e8eef9; color: #34559a; }
.status.s-completed { background: var(--accent-soft); color: var(--accent); }
.status.s-cancelled { background: #f4e6e6; color: #9a3a3a; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 18px; background: #fafcfb; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.table tfoot td { font-weight: 650; border-bottom: 0; background: #fafcfb; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.searchbar { margin-bottom: 20px; display: grid; gap: 6px; max-width: 720px; }
.searchbar label { font-weight: 600; font-size: 14px; }
.searchrow { display: flex; gap: 10px; }
.searchrow input { flex: 1; padding: 11px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.searchrow input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.notice { padding: 12px 14px; border-radius: 10px; } .notice.warn { background: var(--warn-soft); color: var(--warn); }

.nearest { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; max-width: 760px; }
.nearest li { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: center; }
.rank { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 650; }
.nearest h3 { font-size: 16px; }
.km { text-align: right; } .km strong { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; } .km span { color: var(--muted); margin-left: 4px; }

.hits { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; max-width: 760px; }
.hits li { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; }
.badge { font-size: 12px; font-weight: 650; text-align: center; padding: 3px 0; border-radius: 8px; }
.badge.owner { background: #e8eef9; color: #34559a; } .badge.pet { background: #f6ece0; color: #8a5a1c; }
.hits h3 { font-size: 16px; }

.map-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.map { height: 560px; border-radius: var(--radius); border: 1px solid var(--line); background: #e9eeec; }
.map-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.map-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; cursor: pointer; }
.map-list li:hover { border-color: var(--accent); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 14px; }
.chart h3 { font-size: 15px; margin-bottom: 10px; }
.canvas-wrap { position: relative; height: 260px; }
.empty { text-align: center; padding: 48px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { width: 100%; padding-bottom: 6px; }
  .nav a span:not(.brand-mark):not(.brand-text) { font-size: 13px; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .map-wrap { grid-template-columns: 1fr; } .feed { right: 16px; width: calc(100vw - 32px); }
}
