@keyframes toast-drop {
  0% { opacity: 0; transform: translateY(-14px) scale(0.98); }
  70% { opacity: 1; transform: translateY(2px) scale(1); }
  100% { opacity: 1; transform: none; }
}
@keyframes toast-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

:root {
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --nav: #334155;
  --paper: #f8fafc;
  --card: #ffffff;
  --soft: #f8fafc;
  --hover: #f1f5f9;
  --line: #e2e8f0;
  --row: #f1f5f9;
  --sep: #cbd5e1;
  --slot: #cbd5e1;
  --accent: #059669;
  --accent-hover: #10b981;
  --accent-soft: #ecfdf5;
  --accent-border: #a7f3d0;
  --accent-text: #047857;
  --on-accent: #ffffff;
  --danger: #e11d48;
  --danger-soft: #fff1f2;
  --danger-text: #be123c;
  --danger-line: #fecdd3;
  --ok: #047857;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --topbar: rgba(255, 255, 255, 0.9);
  --toast: rgba(255, 255, 255, 0.98);
  --focus: #6ee7b7;
  --plan: #f0f9ff;
  --plan-text: #0369a1;
  --badge: #f1f5f9;
  --auth: #0f172a;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
}
html[data-theme="dark"] {
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --nav: #cbd5e1;
  --paper: #0b1220;
  --card: #111827;
  --soft: #172033;
  --hover: #1e293b;
  --line: #243044;
  --row: #1a2436;
  --sep: #475569;
  --slot: #475569;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --accent-border: rgba(52, 211, 153, 0.45);
  --accent-text: #6ee7b7;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --danger-text: #fda4af;
  --danger-line: rgba(251, 113, 133, 0.4);
  --ok: #6ee7b7;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --topbar: rgba(17, 24, 39, 0.92);
  --toast: rgba(17, 24, 39, 0.98);
  --focus: #34d399;
  --plan: rgba(14, 165, 233, 0.16);
  --plan-text: #7dd3fc;
  --badge: #1e293b;
  --auth: #020617;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-weight: 400; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: grid; grid-template-columns: 16.5rem 1fr; min-height: 100vh; background: var(--paper); }
.side {
  background: var(--card);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
.brand-block { padding: 16px 16px 4px; }
.brand { margin: 0; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.brand span { color: var(--accent); font-weight: 600; }
.aside-note { margin: 2px 0 0; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.nav-scroll { min-height: 0; flex: 1; overflow: auto; padding: 8px 10px 16px; }
.nav-tree { padding: 2px; }
.nav-label {
  margin: 8px 8px 6px;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.side nav { display: grid; gap: 4px; }
.side nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 0.5rem;
  color: var(--nav); background: transparent;
  border: 0; font-weight: 500; font-size: 0.875rem;
}
.side nav a:hover { background: var(--hover); color: var(--ink); }
.side nav a.is-on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 24px; background: var(--topbar);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.crumbs {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-width: 0; padding: 0; border: 0; background: transparent; box-shadow: none;
  color: var(--muted); font-size: 0.875rem; font-weight: 500;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }
.crumb-sep { width: 5px; height: 5px; border-right: 1.5px solid var(--sep); border-top: 1.5px solid var(--sep); transform: rotate(45deg); }
.who {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px 3px 3px;
}
.who strong { display: block; font-size: 0.875rem; font-weight: 600; line-height: 1.2; }
.who > div span { color: var(--muted); font-size: 0.7rem; font-weight: 500; }
.avatar {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 0.72rem; font-weight: 600;
}
button.logout, button.theme {
  background: var(--card); color: var(--nav); border: 1px solid var(--line);
  border-radius: 0.5rem; padding: 6px 10px; box-shadow: var(--shadow); font-weight: 500; font-size: 0.875rem;
}
button.theme { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; }
button.theme .ico-sun { display: none; }
html[data-theme="dark"] button.theme .ico-moon { display: none; }
html[data-theme="dark"] button.theme .ico-sun { display: grid; }
button.logout:hover, button.theme:hover { background: var(--hover); color: var(--ink); }
button.logout:hover { color: var(--danger); border-color: var(--danger-line); }
.gate .theme { position: fixed; top: 16px; right: 16px; z-index: 6; }
main { padding: 20px 24px 48px; min-width: 0; display: grid; gap: 14px; align-content: start; animation: route-in 180ms ease both; }
.intro { margin-bottom: 0; }
.intro h2, h1, h2 { margin: 0; letter-spacing: -0.025em; font-weight: 600; }
.intro h2 { font-size: 1.125rem; }
.eyebrow { margin: 0 0 4px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.intro p, .lead { color: var(--muted); max-width: 68ch; font-weight: 400; font-size: 0.875rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.module, .card {
  background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; box-shadow: var(--shadow);
}
.module { padding: 14px; display: grid; gap: 2px; }
.module span { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.module strong { font-size: 1.5rem; letter-spacing: -0.03em; font-weight: 600; line-height: 1.2; }
.module p { margin: 4px 0 0; color: var(--muted); font-weight: 400; font-size: 0.75rem; }
.gate {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(circle at 12% 18%, rgba(16, 185, 129, 0.18), transparent 26%),
    linear-gradient(165deg, #1e293b 0%, var(--auth) 48%, #020617 100%);
}
.login-shell { width: min(400px, 100%); }
.gate:has(.vet-login) {
  padding: 28px;
  background:
    radial-gradient(circle at 8% 16%, rgba(52, 211, 153, 0.2), transparent 27%),
    radial-gradient(circle at 92% 88%, rgba(56, 189, 248, 0.15), transparent 26%),
    linear-gradient(145deg, #052e2b 0%, #0f3b3a 48%, #102a43 100%);
}
.vet-login {
  width: min(1040px, 100%); min-height: 620px; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr);
  overflow: hidden; border: 1px solid rgba(255, 255, 255, .16); border-radius: 1.65rem;
  background: var(--card); box-shadow: 0 30px 90px rgba(2, 18, 25, .38);
}
.vet-login-story {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; min-width: 0; padding: 42px 48px 30px;
  color: #ecfdf5; background:
    radial-gradient(circle at 82% 15%, rgba(255, 255, 255, .14) 0 3px, transparent 4px),
    radial-gradient(circle at 14% 70%, rgba(255, 255, 255, .1) 0 4px, transparent 5px),
    linear-gradient(145deg, #047857 0%, #059669 54%, #0d9488 100%);
}
.vet-login-story::before, .vet-login-story::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; border: 1px solid rgba(255,255,255,.12);
}
.vet-login-story::before { width: 390px; height: 390px; right: -170px; top: -190px; box-shadow: 0 0 0 55px rgba(255,255,255,.035); }
.vet-login-story::after { width: 260px; height: 260px; left: -155px; bottom: -145px; box-shadow: 0 0 0 42px rgba(255,255,255,.03); }
.vet-login-brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: #fff; font-size: 1.28rem; font-weight: 500; text-decoration: none; letter-spacing: -.03em; }
.vet-login-brand strong { font-weight: 750; }
.vet-brand-mark, .vet-mobile-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); font-size: 1.05rem; }
.vet-login-copy { margin-top: 52px; max-width: 500px; }
.vet-login-copy .vet-kicker { margin: 0 0 12px; color: #a7f3d0; font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.vet-login-copy h1 { margin: 0; color: #fff; font-size: clamp(2rem, 4.2vw, 3.25rem); font-weight: 700; line-height: 1.04; letter-spacing: -.052em; }
.vet-login-copy > p:last-child { max-width: 48ch; margin: 18px 0 0; color: rgba(236,253,245,.84); font-size: .95rem; line-height: 1.65; }
.vet-pets { flex: 1; display: flex; align-items: flex-end; justify-content: center; min-height: 270px; margin: -16px -22px -4px; }
.vet-pets svg { display: block; width: min(100%, 560px); height: auto; filter: drop-shadow(0 20px 25px rgba(4, 47, 46, .18)); }
.pet-heart { transform-origin: 320px 112px; animation: pet-heart 2.8s ease-in-out infinite; }
@keyframes pet-heart { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-7px) scale(1.035); } }
.vet-login-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.vet-login-pills span { padding: 6px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(3, 78, 72, .2); color: rgba(255,255,255,.88); font-size: .7rem; font-weight: 600; }
.vet-login-card { display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 54px 48px; background: var(--card); }
.vet-login-heading { display: grid; gap: 4px; }
.vet-login-heading h2 { margin: 0; color: var(--ink); font-size: 1.72rem; font-weight: 700; letter-spacing: -.04em; }
.vet-login-heading > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.vet-mobile-mark { display: none; margin-bottom: 8px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-border); }
.vet-login-form { gap: 14px; }
.vet-login-form label { gap: 7px; color: var(--ink); font-size: .82rem; font-weight: 650; }
.vet-login-form input { min-height: 46px; padding: 10px 13px; border-radius: .7rem; background: var(--soft); box-shadow: none; }
.vet-login-form input::placeholder { color: var(--faint); }
.vet-login-help { display: flex; justify-content: flex-end; margin-top: -5px; }
.vet-login-help a, .vet-signup a { color: var(--accent-text); font-size: .8rem; font-weight: 650; }
button.vet-login-submit { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; border-radius: .72rem; font-weight: 650; box-shadow: 0 9px 24px rgba(5,150,105,.2); }
button.vet-login-submit span { font-size: 1.15rem; transition: transform 160ms ease; }
button.vet-login-submit:hover span { transform: translateX(3px); }
.vet-signup { margin: 0; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .8rem; }
.vet-login-safe { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -8px 0 0; color: var(--faint); font-size: .7rem; }
.vet-login-safe span { color: var(--accent); font-size: .55rem; }
.vet-login-card .debug-launch { margin-top: -4px; padding-top: 0; border: 0; }
.vet-login-card .debug-launch summary { cursor: pointer; color: var(--faint); font-size: .72rem; text-align: center; }
.vet-login-card .debug-launch[open] { padding-top: 10px; border-top: 1px solid var(--line); }
.vet-register { min-height: 680px; }
.vet-register .vet-login-card { gap: 12px; padding-top: 30px; padding-bottom: 30px; }
.vet-register .vet-login-form { gap: 9px; }
.vet-register .vet-login-form input { min-height: 42px; }
.vet-register .vet-login-form small { color: var(--faint); font-size: .7rem; font-weight: 400; }
.debug-launch { display: grid; gap: 6px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.debug-launch p { margin: 0; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.debug-launch form { display: block; }
.debug-launch button { width: 100%; justify-content: flex-start; }
.gate-card { width: 100%; padding: 24px; border-radius: 1rem; }
.gate .eyebrow { color: var(--faint); }
.gate h1 { font-size: 1.5rem; color: var(--ink); font-weight: 600; }
.gate .lead { color: var(--muted); }
form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 0.875rem; color: var(--nav); font-weight: 500; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 0.5rem; padding: 8px 12px; background: var(--card); color: var(--ink); font-weight: 400;
  width: 100%; min-width: 0; box-shadow: var(--shadow);
}
input[type="checkbox"], input[type="radio"], input[type="hidden"] { width: auto; box-shadow: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.with-ico { display: inline-flex; align-items: center; gap: 6px; }
.profile { display: grid; gap: 12px; align-items: start; }
.profile-card { display: flex; align-items: center; gap: 12px; padding: 16px; }
.profile-card h2, .stack h2 { margin: 0; font-size: 0.95rem; }
.profile-card p { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; }
.avatar-lg { width: 44px; height: 44px; font-size: 0.95rem; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fields .full { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .profile { grid-template-columns: 240px minmax(0, 1fr); }
  .profile-card { grid-row: span 2; align-self: start; }
}
button, .list button {
  background: var(--accent); color: var(--on-accent); border: 1px solid transparent; border-radius: 0.5rem;
  padding: 8px 14px; cursor: pointer; font-weight: 500; font-size: 0.875rem; box-shadow: var(--shadow);
}
button:hover { background: var(--accent-hover); }
.inline { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; padding: 12px; }
.list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; overflow: hidden; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list span { color: var(--muted); font-size: 0.75rem; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.error, .notice { border-radius: 0.5rem; padding: 8px 10px; margin: 0; font-size: 0.875rem; }
.error { color: var(--danger-text); background: var(--danger-soft); border: 1px solid var(--danger-line); }
.notice { background: var(--accent-soft); color: var(--ok); border: 1px solid var(--accent-border); }
.links { display: flex; gap: 14px; }
.links a { color: var(--accent-text); font-weight: 500; font-size: 0.875rem; }
.stack { max-width: 640px; background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; padding: 16px; box-shadow: var(--shadow); }
.form-actions { display: flex; justify-content: flex-start; margin-top: 2px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
.pager-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.pager-nav button { background: var(--card); color: var(--nav); border: 1px solid var(--line); min-width: 32px; padding: 4px 8px; box-shadow: none; font-weight: 500; }
.pager-nav button:hover:not(:disabled) { background: var(--soft); }
.pager-nav button.is-on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-border); }
.pager-nav button:disabled { opacity: 0.4; cursor: default; }
.role-card, .plan-card { padding: 14px; margin: 0; display: grid; gap: 10px; }
.plan-card h3 { margin: 0; font-size: 0.95rem; }
.plan-fields, .system-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; min-width: 0; }
.plan-fields > *, .system-fields > *, .inline > * { min-width: 0; }
.system-fields .wide, .system-fields .full, .plan-fields .full { grid-column: 1 / -1; }
.plan-fields > button, .system-fields > button { width: auto; justify-self: start; }
.system-head { display: flex; gap: 10px; align-items: center; }
.system-head p { margin: 0; color: var(--muted); font-size: 0.875rem; }
.system-mark {
  width: 32px; height: 32px; border-radius: 0.5rem; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 0.9rem; flex: none;
}
.module-pills { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.module-pills li { background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 3px 8px; font-size: 0.75rem; font-weight: 500; }
.plan-card form.plan-edit, .plan-card.plan-create { display: grid; gap: 10px; }
form button.danger { width: auto; justify-self: start; background: var(--card); color: var(--danger); border: 1px solid var(--danger-line); }
form button.danger:hover { background: var(--danger-soft); }
.plan-remove { justify-items: start; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; margin: 2px 0; }
.checks label { font-weight: 500; display: flex; gap: 8px; align-items: center; font-size: 0.875rem; }
.perm-stack { display: grid; gap: 10px; }
.perm-group { border: 1px solid var(--line); border-radius: 0.5rem; padding: 10px 12px; display: grid; gap: 6px; background: var(--card); }
.perm-group h3 { margin: 0; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.perm-mod { font-size: 0.75rem; color: var(--muted); }
.perm-phrase { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; font-weight: 500; font-size: 0.875rem; }
.perm-phrase span { display: grid; }
.perm-phrase small { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.perm-phrase small.code { color: var(--faint); font-size: 0.72rem; }
.perm-note { margin: 0; color: var(--muted); font-size: 0.875rem; }
.perm-title { margin: 4px 0 0; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.datagrid-bar form { display: flex; align-items: center; gap: 8px; margin: 0; text-transform: none; letter-spacing: 0; font-weight: 500; }
.datagrid-bar form label { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--nav); }
.datagrid-bar select { font: inherit; text-transform: none; letter-spacing: 0; padding: 4px 8px; border-radius: 0.45rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.part strong.is-live { color: var(--ink); }
.mod-count { margin-left: 8px; font-size: 0.75rem; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; vertical-align: 1px; }
table.agenda { width: 100%; border-collapse: collapse; min-width: 520px; }
table.agenda th, table.agenda td { border-bottom: 1px solid var(--row); padding: 5px 8px; font-size: 0.75rem; font-weight: 500; }
table.agenda thead th { text-align: left; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: var(--soft); }
table.agenda tbody th { width: 4.2rem; color: var(--muted); text-align: left; background: var(--card); }
td.slot { text-align: center; color: var(--slot); font-weight: 400; }
td.slot.is-busy { color: var(--ink); font-weight: 500; }
.part-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.part { background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; padding: 10px 12px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.part span { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.part strong { font-size: 0.875rem; font-weight: 500; color: var(--faint); }
.list form { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 12px; }
.gate-error { width: min(400px, 100%); }
.chooser { width: min(880px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; padding: 20px; box-shadow: var(--shadow); }
.chooser h1 { letter-spacing: -0.025em; color: var(--ink); font-size: 1.25rem; }
.is-locked { opacity: 0.62; }
.empty { color: var(--muted); }
.page-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 0; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; box-shadow: var(--shadow);
}
.page-head h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.025em; line-height: 1.3; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 68ch; font-size: 0.875rem; font-weight: 400; line-height: 1.45; }
.chip {
  display: inline-flex; margin: 0; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.datagrid, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; box-shadow: var(--shadow); overflow: hidden; }
.datagrid-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 12px; color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; background: var(--soft); border-bottom: 1px solid var(--line); }
.datagrid-scroll { overflow: auto; scrollbar-color: var(--sep) transparent; scrollbar-width: thin; }
.empty-state { padding: 72px 20px; text-align: center; color: var(--muted); }
.empty-state h2 { margin: 0 0 6px; font-size: 0.95rem; color: var(--ink); }
.empty-state p { margin: 0; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th { text-align: left; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
table.data td { padding: 10px 14px; vertical-align: middle; border-bottom: 1px solid var(--row); font-size: 0.875rem; }
table.data:has(td.empty-state) { min-width: 0; }
table.data td.empty-state { padding: 88px 24px; text-align: center; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--soft); }
.cell { display: flex; align-items: center; gap: 8px; }
.cell .system-mark { width: 28px; height: 28px; border-radius: 0.45rem; font-size: 0.85rem; }
.page-actions { margin-top: 0; }
.cell small, table.data small { color: var(--muted); display: block; font-size: 0.72rem; font-weight: 400; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; font-weight: 500; background: var(--badge); color: var(--nav); }
.badge.is-on { background: var(--accent-soft); color: var(--accent-text); }
.badge.is-off { background: var(--danger-soft); color: var(--danger-text); }
.badge.is-plan { background: var(--plan); color: var(--plan-text); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }
button.ghost, a.ghost, .row-actions button { width: auto; background: var(--card); color: var(--nav); border: 1px solid var(--line); font-weight: 500; box-shadow: none; }
button.ghost:hover, a.ghost:hover, .row-actions button:hover { background: var(--soft); color: var(--accent-text); border-color: var(--accent-border); }
a.ghost { display: inline-flex; align-items: center; margin-right: 6px; text-decoration: none; border-radius: 0.5rem; padding: 6px 10px; font-size: 0.875rem; }
.mod-block { display: grid; gap: 10px; }
.mod-block h2 { margin: 0; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mod-block > p { margin: 0; color: var(--muted); font-size: 0.875rem; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
a.mod-card { display: grid; gap: 4px; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 0.75rem; padding: 12px; box-shadow: var(--shadow); }
a.mod-card:hover { border-color: var(--accent-border); }
a.mod-card strong { font-size: 0.875rem; font-weight: 600; }
a.mod-card p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.mod-ico { width: 28px; height: 28px; border-radius: 0.45rem; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty-panel { padding: 88px 24px; text-align: center; }
.empty-panel h2 { margin: 0 0 6px; font-size: 0.95rem; }
.empty-panel p { margin: 0; color: var(--muted); }
.toasts { position: fixed; top: 14px; left: 50%; z-index: 40; display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); transform: translateX(-50%); }
.toast { position: relative; display: flex; align-items: flex-start; gap: 10px; overflow: hidden; border-radius: 0.9rem; padding: 12px 12px 14px; background: var(--toast); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14); font-weight: 500; font-size: 0.875rem; animation: toast-drop 420ms cubic-bezier(0.2, 0.9, 0.24, 1.18) both; }
.toast.is-out { animation: toast-out 200ms ease both; }
.toast p { margin: 2px 0 0; line-height: 1.45; }
.toast-ico { width: 32px; height: 32px; border-radius: 0.65rem; display: grid; place-items: center; flex: none; font-weight: 700; }
.toast.is-ok .toast-ico { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-border); }
.toast.is-bad .toast-ico { background: var(--danger-soft); color: var(--danger-text); box-shadow: inset 0 0 0 1px var(--danger-line); }
.toast::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform-origin: left; background: var(--accent); animation: toast-life 6s linear forwards; }
.toast.is-bad::after { background: #e11d48; }
.toast button { margin-left: auto; background: transparent; color: var(--faint); border: 0; width: 28px; height: 28px; padding: 0; border-radius: 999px; box-shadow: none; }
.toast button:hover { background: var(--hover); color: var(--nav); }
.toast a { color: var(--accent-text); text-decoration: underline; }
dialog.modal { border: 0; padding: 0; background: transparent; width: min(480px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.4); }
.modal-card { background: var(--card); border-radius: 0.75rem; border: 1px solid var(--line); box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16); padding: 16px; display: grid; gap: 12px; max-height: calc(100vh - 48px); overflow: auto; }
.modal-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-card h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.modal-card header button { background: var(--card); color: var(--muted); border: 1px solid var(--line); width: 28px; height: 28px; padding: 0; border-radius: 0.45rem; box-shadow: none; }
.modal-card form { display: grid; gap: 10px; }
.modal-card form button[type="submit"] { width: auto; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; }
.modal-actions button[data-close] { background: var(--card); color: var(--nav); border: 1px solid var(--line); box-shadow: none; }
.modal-actions button[data-close]:hover { background: var(--soft); }
.modal-danger { padding-top: 10px; border-top: 1px solid var(--line); }
.dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(200px, 0.6fr); gap: 12px; align-items: start; }
.chart-card { padding: 14px; display: grid; justify-items: center; gap: 10px; }
.chart-card h2 { margin: 0; justify-self: start; font-size: 0.875rem; }
.donut { width: 128px; height: 128px; border-radius: 50%; -webkit-mask: radial-gradient(circle 42px, transparent 99%, #000 100%); mask: radial-gradient(circle 42px, transparent 99%, #000 100%); }
.legend { list-style: none; padding: 0; margin: 0; width: 100%; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.legend strong { margin-left: auto; color: var(--ink); font-weight: 600; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.legend .c1 { background: #059669; }
.legend .c2 { background: #0ea5e9; }
.legend .c3 { background: var(--nav); }
@media (max-width: 1200px) {
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .inline { grid-template-columns: 1fr 1fr; }
  .inline button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-scroll { overflow: visible; padding: 0 10px 10px; }
  .side nav { display: flex; overflow: auto; }
  .side nav a span { white-space: nowrap; }
  .inline, .plan-fields, .system-fields { grid-template-columns: 1fr; }
  .system-fields .wide, .system-fields .full { grid-column: auto; }
  main, .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: space-between; }
  .dash { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .fields { grid-template-columns: 1fr; }
  .who > div { display: none; }
}
@media (max-width: 760px) {
  .gate:has(.vet-login) { padding: 16px; align-items: flex-start; }
  .vet-login { grid-template-columns: 1fr; min-height: 0; border-radius: 1.25rem; }
  .vet-login-story { display: none; }
  .vet-login-card { min-height: calc(100dvh - 32px); padding: 42px clamp(24px, 8vw, 48px); }
  .vet-mobile-mark { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root), main, .toast, .toast::after, .pet-heart { animation: none; }
}
