/* KlikPet Klinik web.
   Taste follows nihbuatjajan's design system (.cursor/rules/design-system.mdc there):
   one white canvas, thin lines instead of shadowed cards, ink for secondary actions,
   ONE accent fill per screen (Klinik Blue, always with white text),
   status = dot + word, lists = rows, sheets from the bottom on phones. */

:root {
  --ink: #111111;
  --ink-2: #5b5b5f;
  --ink-3: #8a8a90;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --fill: #f4f4f5;
  --fill-2: #ebebed;
  --white: #ffffff;

  /* Accent = Klinik Blue (logo + app `primary`). Fill only: the main button, count badges.
     Orange read as a warning on a plain "Simpan", so it is not used for actions. */
  --accent: #1f5fbf;
  --accent-hover: #1a51a3;
  --on-accent: #ffffff;
  --accent-soft: #e8f0fd;
  --accent-ink: #1a4f9e; /* accent text on --accent-soft only */
  --brand: #1f5fbf;
  /* the one dark card (Beranda queue summary, lead stat tiles): brand navy, as on the homepage.
     Not the button blue, so the main action stays the only bright blue on the screen. */
  --hero: #0f2d5c;
  --hero-hover: #163a72;

  --ok: #15803d;
  --ok-bg: #ecfdf3;
  --danger: #c8261b;
  --danger-bg: #fdf0ef;
  --warn-bg: #fff7e0;
  --warn-ink: #7a5600;

  /* visit flow hues (dot + word) */
  --st-waiting: #a16207;
  --st-calling: #0e5a74;
  --st-inroom: #0e7c72;
  --st-payment: #6d28d9;

  --float-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 16px 40px -12px rgba(0, 0, 0, 0.22);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
p { text-wrap: pretty; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.num, .money { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.meta { font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
@media (max-width: 768px) { .hide-sm { display: none !important; } }
@media (min-width: 769px) { .hide-lg { display: none !important; } }

.icon { flex-shrink: 0; display: block; }

/* Boot ---------------------------------------------------------------------- */
.boot { display: grid; place-items: center; min-height: 100vh; }
.boot .brand-mark { width: 44px; height: 44px; border-radius: 12px; animation: boot-pulse 1.4s ease-in-out infinite; }
@keyframes boot-pulse { 50% { opacity: 0.45; transform: scale(0.96); } }

.brand-mark {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #1f5fbf url("/app/logo.svg") center / cover no-repeat;
  flex-shrink: 0;
}

/* Buttons ------------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), opacity 160ms var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn.small { min-height: 36px; padding: 7px 14px; font-size: 14px; }
.btn.large { min-height: 52px; padding: 14px 24px; font-size: 16px; font-weight: 700; }
.btn.block { display: flex; width: 100%; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.grey { background: var(--fill); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.text { background: transparent; color: var(--ink-2); padding-left: 8px; padding-right: 8px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #2a2a2a; }
  .btn.primary:hover { background: var(--accent-hover); }
  .btn.grey:hover { background: var(--fill-2); }
  .btn.ghost:hover, .btn.text:hover { background: var(--fill); color: var(--ink); }
  .btn.danger:hover { background: #a91f16; }
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.btn .price { font-variant-numeric: tabular-nums; }

/* Busy: text hidden, size kept, spinner centered */
[aria-busy="true"].btn, .icon-btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
[aria-busy="true"].btn > *, .icon-btn[aria-busy="true"] > * { visibility: hidden; }
[aria-busy="true"].btn::after, .icon-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 700ms linear infinite;
}
.btn.grey[aria-busy="true"]::after, .btn.ghost[aria-busy="true"]::after, .btn.text[aria-busy="true"]::after, .icon-btn[aria-busy="true"]::after {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--ink);
  flex-shrink: 0;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.quiet { color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--fill); } }

.link { font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link-quiet { font-size: 14px; font-weight: 600; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { .link-quiet:hover { color: var(--ink); } }

/* Form ---------------------------------------------------------------------- */
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--fill);
  font-size: 16px; /* never < 16px: iOS zoom */
  line-height: 1.4;
  color: var(--ink);
  transition: box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); background: var(--white); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }
textarea.input { resize: none; min-height: 88px; field-sizing: content; }
select.input {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b5b5f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
.input[type="date"] { min-height: 48px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.field .error { font-size: 13px; color: var(--danger); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form { display: flex; flex-direction: column; gap: 18px; }

.input-affix {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--fill);
  transition: box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.input-affix > span { font-weight: 600; color: var(--ink-2); flex-shrink: 0; }
.input-affix input {
  width: 100%;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.input-affix:focus-within { box-shadow: inset 0 0 0 2px var(--ink); background: var(--white); }
.input-affix.big input { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; padding: 10px 0; }
.input-affix.big { min-height: 60px; }

.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 14px; color: var(--ink-3); pointer-events: none; }
.search .input { min-height: 44px; height: 44px; padding: 0 40px 0 42px; }
.search .clear { position: absolute; right: 4px; color: var(--ink-3); }

/* Chips & tabs -------------------------------------------------------------- */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
@media (min-width: 769px) { .chips { flex-wrap: wrap; margin: 0; padding: 0; } }
.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--white);
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), color 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(0.97); }
.chip small { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip .count { padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; line-height: 18px; }
.chip.active, .chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.chip.active small, .chip[aria-pressed="true"] small, .chip[aria-checked="true"] small { color: rgba(255, 255, 255, 0.6); }
@media (hover: hover) and (pointer: fine) { .chip:not(.active):not([aria-pressed="true"]):not([aria-checked="true"]):hover { background: var(--fill); } }

.tabs {
  display: flex;
  gap: 24px;
  margin: 0 -16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 769px) { .tabs { margin: 0; padding: 0; } }
.tab {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-3);
}
.tab small { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tab .count { padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; line-height: 18px; }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--fill); gap: 2px; }
.seg button { min-height: 34px; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--line); }

/* Status: dot + word -------------------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink-3);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.waiting { color: var(--st-waiting); }
.status.calling { color: var(--st-calling); }
.status.calling::before { animation: pulse 1.6s ease-in-out infinite; }
.status.inroom { color: var(--st-inroom); }
.status.inroom::before { animation: pulse 1.6s ease-in-out infinite; }
.status.payment { color: var(--st-payment); }
.status.completed, .status.ok { color: var(--ok); }
.status.danger { color: var(--danger); }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
@media (prefers-reduced-motion: reduce) { .status::before { animation: none !important; } }

/* Layout -------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; }

.nav {
  position: sticky;
  top: 0;
  display: none;
  flex-direction: column;
  gap: 18px;
  flex-shrink: 0;
  width: 248px;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
@media (min-width: 769px) { .nav { display: flex; } }
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.nav-clinic {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  transition: background-color 160ms var(--ease-out);
}
.nav-clinic small { display: block; font-size: 12px; color: var(--ink-3); }
.nav-clinic strong { display: block; font-size: 14px; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .nav-clinic:hover { background: var(--fill); } }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { padding: 6px 12px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.nav-group a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
}
.nav-group a .count { margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; line-height: 18px; font-variant-numeric: tabular-nums; }
.nav-group a.active { background: var(--fill); color: var(--ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .nav-group a:hover { background: var(--fill); color: var(--ink); } }
.nav-new { display: flex; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.nav-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; }
.nav-me .grow strong { display: block; font-size: 14px; font-weight: 600; }
.nav-me .grow small { display: block; font-size: 12px; color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .nav-me:hover { background: var(--fill); } }

.mobile-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 8px 0 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.mobile-head .nav-clinic { box-shadow: none; padding: 6px 8px; margin-left: -8px; width: auto; min-width: 0; }
@media (min-width: 769px) { .mobile-head { display: none; } }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
@media (min-width: 769px) { .tabbar { display: none; } }
.tabbar a, .tabbar button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--ink-3);
  -webkit-tap-highlight-color: transparent;
}
.tabbar small { font-size: 11px; font-weight: 600; }
.tabbar .active { color: var(--ink); }
.tabbar .dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.tabbar .tabbar-new {
  justify-self: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  transition: transform 160ms var(--ease-out);
}
.tabbar .tabbar-new:active { transform: scale(0.94); }

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 16px 120px;
}
@media (min-width: 769px) { .page { padding: 40px 40px 96px; } }
.page.narrow { max-width: 720px; }
.page.wide { max-width: 1200px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; min-height: 44px; }
.page-head h1 { min-width: 0; font-size: 28px; line-height: 1.15; letter-spacing: -0.03em; }
@media (min-width: 769px) { .page-head h1 { font-size: 30px; } }
.page-head p { width: 100%; font-size: 15px; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 8px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-left: -6px; padding: 6px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); align-self: flex-start; }
@media (hover: hover) and (pointer: fine) { .back:hover { background: var(--fill); color: var(--ink); } }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 36px; }
.section-head h2 { font-size: 17px; letter-spacing: -0.01em; }
.section-head h2 small { margin-left: 6px; font-size: 14px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.cols { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1100px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 24px 32px; }
  .cols.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols.side-left { grid-template-columns: 360px minmax(0, 1fr); }
  .cols > .sticky { position: sticky; top: 24px; }
}
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Cards (outline only; the queue hero is the one dark card) ------------------ */
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--line);
  min-width: 0;
}
.card h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card.fill { background: var(--fill); box-shadow: none; }

.hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 20px 20px;
  border-radius: 20px;
  background: var(--hero);
  color: #fff;
}
.hero .eyebrow { font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, 0.6); }
.hero .big { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: 17px; font-weight: 500; letter-spacing: 0; color: rgba(255, 255, 255, 0.55); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.hero-stats a, .hero-stats div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--hero); transition: background-color 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .hero-stats a:hover { background: var(--hero-hover); } }
.hero-stats strong { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hero-stats span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: rgba(255, 255, 255, 0.65); }
.hero-stats span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #fff); }
.hero-progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.hero-progress i { display: block; height: 100%; border-radius: inherit; background: #fff; transition: width 400ms var(--ease-out); }
.hero .meta-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: rgba(255, 255, 255, 0.6); font-variant-numeric: tabular-nums; }

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-weight: 500;
}
.notice > .grow { flex: 1; }
.notice.danger { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.info { background: var(--fill); color: var(--ink); }
a.notice { transition: transform 160ms var(--ease-out); }
a.notice:active { transform: scale(0.99); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  border-radius: 20px;
  background: var(--fill);
  color: var(--ink-2);
  text-align: center;
}
.empty .icon { color: var(--ink-3); }
.empty strong { color: var(--ink); font-size: 16px; }
.empty p { max-width: 40ch; line-height: 1.5; }
.empty .btn { margin-top: 6px; }
.empty.compact { padding: 24px 16px; }

/* Rows ---------------------------------------------------------------------- */
.rows { display: flex; flex-direction: column; }
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.row:last-child { border-bottom: 0; }
.rows.pad .row { padding-left: 12px; padding-right: 12px; margin: 0 -12px; border-radius: 12px; border-bottom: 0; }
.rows.pad .row + .row::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--line); }
.row-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-title { overflow: hidden; font-size: 15px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
a.row-title::before, button.row-title::before { content: ""; position: absolute; inset: 0; }
button.row-title { text-align: left; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 0; }
.row-meta > * { min-width: 0; }
.row-meta .sep::before { content: "·"; margin-right: 10px; }
.row-end { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.row-amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.row-amount small { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.row .chev { color: var(--ink-3); flex-shrink: 0; }
.row.is-selected { background: var(--fill); }
@media (hover: hover) and (pointer: fine) {
  .rows.hover .row:has(> .row-body > .row-top > .row-title:is(a, button)):hover,
  .rows.hover .row:has(.row-title:is(a, button)):hover { background: var(--fill); }
}
.rows.hover .row { margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 12px; border-bottom: 0; }
.rows.hover .row + .row::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--line); }
.rows.hover .row:hover::before, .rows.hover .row:hover + .row::before { opacity: 0; }

.qno {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--fill);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.qno.ink { background: var(--ink); color: #fff; }

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.xl { width: 88px; height: 88px; font-size: 30px; }
.avatar.pet { border-radius: 30%; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar[data-tone="1"] { background: #fff1ea; color: #9a3412; }
.avatar[data-tone="2"] { background: #e8f0fd; color: #1f4f9a; }
.avatar[data-tone="3"] { background: #e6f6f3; color: #0e6b62; }
.avatar[data-tone="4"] { background: #f2ecfd; color: #5b21b6; }
.avatar[data-tone="5"] { background: #fdf6e3; color: #854d0e; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--ink-3); }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

/* Bill lines ---------------------------------------------------------------- */
.bill { display: flex; flex-direction: column; }
.bill-group { padding: 4px 0 8px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); text-transform: uppercase; }
.bill-group:not(:first-child) { padding-top: 14px; }
.bill-line { display: flex; align-items: baseline; gap: 12px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.bill-line .grow small { display: block; font-size: 13px; color: var(--ink-3); }
.bill-line .amt { font-weight: 500; white-space: nowrap; }
.bill-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line-strong); font-variant-numeric: tabular-nums; }
.bill-total span { font-weight: 600; }
.bill-total strong { font-size: 24px; letter-spacing: -0.02em; }

/* Stepper ------------------------------------------------------------------- */
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--fill); }
.stepper button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--ink); transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out); }
.stepper button:active { transform: scale(0.9); }
@media (hover: hover) and (pointer: fine) { .stepper button:hover { background: var(--white); } }
.stepper output { min-width: 26px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Sheet / dialog ------------------------------------------------------------ */
.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.32);
  animation: fade-in 200ms var(--ease-out);
  overscroll-behavior: contain;
}
.sheet-root.closing { animation: fade-out 140ms var(--ease-out) forwards; }
.sheet-root.stack { z-index: 50; background: rgba(0, 0, 0, 0.24); }
.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  max-height: min(86vh, 760px);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--float-shadow);
  animation: pop-in 220ms var(--ease-out);
  overflow: hidden;
}
.sheet.wide { max-width: 560px; }
.sheet:focus { outline: none; }
.sheet-root.closing .sheet { animation: pop-out 140ms var(--ease-out) forwards; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 24px 24px 0; }
.sheet-head h2 { flex: 1; font-size: 21px; line-height: 1.25; }
.sheet-head p { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); font-weight: 400; letter-spacing: 0; }
.sheet-head .icon-btn { margin: -8px -10px 0 0; color: var(--ink-2); }
.sheet-body { display: flex; flex-direction: column; gap: 18px; padding: 20px 24px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; padding: 0 24px 24px; }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn.text, .sheet-foot .btn.fit { flex: 0 0 auto; }
.sheet .handle { display: none; }
.sheet-center { align-items: center; text-align: center; }
.sheet-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--fill); color: var(--ink); margin: 0 auto; }
.sheet-icon.danger { background: var(--danger-bg); color: var(--danger); }
.sheet-icon.ok { background: var(--ok-bg); color: var(--ok); }

@media (max-width: 560px) {
  .sheet-root { align-items: flex-end; padding: 0; }
  .sheet {
    max-width: none;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    animation: sheet-up 320ms var(--ease-drawer);
    padding-bottom: env(safe-area-inset-bottom);
    touch-action: pan-y;
  }
  .sheet-root.closing .sheet { animation: sheet-down 200ms var(--ease-out) forwards; }
  .sheet .handle { display: block; position: absolute; top: 8px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 999px; background: var(--fill-2); }
  .sheet-head { padding: 26px 20px 0; }
  .sheet-body { padding: 18px 20px; }
  .sheet-foot { padding: 0 20px 20px; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(4px) scale(0.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-root.closing .sheet { animation: fade-in 160ms ease !important; }
  .sheet-root.closing .sheet { animation: fade-out 120ms ease forwards !important; }
}

/* Action list inside sheets */
.actions-list { display: flex; flex-direction: column; margin: -6px 0; }
.actions-list button, .actions-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 10px 4px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  border-radius: 12px;
}
/* Separators are straight inset lines, not borders on the rounded rows (those curve at the ends) */
.actions-list > * { position: relative; }
.actions-list > * + *::before { content: ""; position: absolute; left: 4px; right: 4px; top: 0; border-top: 1px solid var(--line); transition: opacity 120ms ease; }
@media (hover: hover) and (pointer: fine) {
  .actions-list > *:hover::before, .actions-list > *:hover + *::before { opacity: 0; }
}
.actions-list .icon { color: var(--ink-2); }
.actions-list .danger, .actions-list .danger .icon { color: var(--danger); }
.actions-list small { display: block; font-size: 13px; color: var(--ink-3); font-weight: 400; }
@media (hover: hover) and (pointer: fine) { .actions-list button:not(:disabled):hover, .actions-list a:hover { background: var(--fill); } }

/* Toast --------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 769px) { .toasts { bottom: 28px; } }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: var(--float-shadow);
  pointer-events: auto;
  animation: toast-in 240ms var(--ease-out);
}
.toast.error { background: var(--danger); }
.toast button { margin-left: 6px; font-weight: 700; color: #fff; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* Editor app bar (full-screen tasks like the exam) -------------------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.appbar .title { flex: 1; min-width: 0; }
.appbar .title strong { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .title small { display: block; font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .saved { font-size: 13px; color: var(--ink-3); white-space: nowrap; transition: opacity 300ms ease; }
@media (min-width: 769px) { .appbar { padding: 10px 24px; } }

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.bottom-bar .total { flex: 1; min-width: 0; }
.bottom-bar .total small { display: block; font-size: 12.5px; color: var(--ink-3); }
.bottom-bar .total strong { font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* Exam ---------------------------------------------------------------------- */
.exam { display: grid; gap: 28px; max-width: 1200px; margin: 0 auto; padding: 20px 16px 140px; }
@media (min-width: 1100px) { .exam { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 40px; padding: 32px 32px 120px; } .exam > aside { position: sticky; top: 92px; } }
.exam-section { display: flex; flex-direction: column; gap: 12px; }
.exam-section + .exam-section { padding-top: 24px; border-top: 1px solid var(--line); }
.exam-section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.exam-section > header h2 { font-size: 17px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.exam-section > header h2 .req { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.line-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .grow strong { display: block; font-size: 15px; font-weight: 600; }
.line-item .grow small { display: block; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.line-item .note { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.line-item .note .input { flex: 1; }
.line-item .note .input { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.add-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px dashed var(--line-strong);
  color: var(--ink-2);
  font-weight: 600;
  text-align: left;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .add-line:hover { background: var(--fill); color: var(--ink); } }
.pet-head { display: flex; align-items: center; gap: 14px; }
.pet-head h1 { font-size: 24px; letter-spacing: -0.03em; }
@media (min-width: 769px) { .pet-head h1 { font-size: 28px; } }
.ready { display: flex; flex-direction: column; gap: 6px; }
.ready button { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-align: left; }
.ready button .icon { color: var(--ink-3); }
.ready button.done { color: var(--ok); }
.ready button.done .icon { color: var(--ok); }

/* Picker list in sheets */
.pick-list { display: flex; flex-direction: column; margin: 0 -8px; }
.pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 8px;
  border-radius: 12px;
  text-align: left;
  width: 100%;
}
.pick-item { position: relative; }
.pick-list > .pick-item + .pick-item::before { content: ""; position: absolute; left: 8px; right: 8px; top: 0; border-top: 1px solid var(--line); transition: opacity 120ms ease; }
.pick-list > .pick-item.active::before, .pick-list > .pick-item.active + .pick-item::before { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .pick-list > .pick-item:hover::before, .pick-list > .pick-item:hover + .pick-item::before { opacity: 0; }
}
/* Stand-alone option cards (check-in type): outlined, spaced, no separators */
.pick-list.cards { gap: 8px; margin: 0; }
.pick-list.cards > .pick-item { box-shadow: inset 0 0 0 1px var(--line); }
.pick-list.cards > .pick-item::before { display: none; }
.pick-item .grow strong { display: block; font-weight: 500; }
.pick-item .grow small { display: block; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pick-item .check { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: transparent; transition: background-color 160ms var(--ease-out); }
.pick-item[aria-checked="true"] .check { background: var(--ink); box-shadow: none; color: #fff; }
.pick-item.active, .pick-item:focus-visible { background: var(--fill); outline: none; }
@media (hover: hover) and (pointer: fine) { .pick-item:hover { background: var(--fill); } }

/* Stat tiles & bars --------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 769px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 16px; box-shadow: 0 0 0 1px var(--line); min-width: 0; }
.stat span { font-size: 13.5px; color: var(--ink-2); }
.stat strong { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (min-width: 769px) { .stat strong { font-size: 24px; } }
.stat.lead { background: var(--hero); color: #fff; box-shadow: none; }
.stat.lead span { color: rgba(255, 255, 255, 0.6); }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bars-plot { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 24px; }
.bars-plot .col { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; min-width: 0; }
.bars-plot .stack-bar { display: flex; flex-direction: column-reverse; border-radius: 6px 6px 2px 2px; overflow: hidden; min-height: 2px; transition: height 400ms var(--ease-out); }
.bars-plot .stack-bar i { display: block; }
.bars-plot .col .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 120ms ease; font-variant-numeric: tabular-nums; z-index: 2; }
.bars-plot .col:hover .tip, .bars-plot .col:focus-within .tip, .bars-plot .col.on .tip { opacity: 1; }
.bars-plot .col.on .stack-bar, .bars-plot .col:hover .stack-bar { filter: brightness(0.88); }
.bars-axis { display: flex; gap: 6px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bars-axis span { flex: 1; min-width: 0; text-align: center; overflow: visible; white-space: nowrap; display: flex; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.split { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; }
.split i { display: block; height: 100%; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.hbar strong { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Calendar ------------------------------------------------------------------ */
.cal { display: flex; flex-direction: column; gap: 10px; }
.cal-head { display: flex; align-items: center; gap: 8px; }
.cal-head strong { flex: 1; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid .dow { padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; }
.cal-grid button {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-height: 52px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: background-color 160ms var(--ease-out);
}
.cal-grid button.out { color: var(--ink-3); opacity: 0.45; }
.cal-grid button.today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-grid button.has::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-grid button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.cal-grid button[aria-pressed="true"]::after { background: #fff; }
@media (hover: hover) and (pointer: fine) { .cal-grid button:not([aria-pressed="true"]):hover { background: var(--fill); } }

/* Auth ---------------------------------------------------------------------- */
.auth { display: grid; min-height: 100vh; }
@media (min-width: 1024px) { .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.auth-side { display: none; }
@media (min-width: 1024px) {
  .auth-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    background: var(--fill);
  }
  .auth-side h2 { font-size: 40px; line-height: 1.1; letter-spacing: -0.04em; max-width: 14ch; }
  .auth-side p { margin-top: 14px; font-size: 17px; color: var(--ink-2); max-width: 36ch; }
  .auth-flow { display: flex; flex-direction: column; gap: 0; margin-top: 36px; max-width: 380px; }
  .auth-flow li { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 500; }
  .auth-flow li:last-child { border-bottom: 0; }
  .auth-flow .icon-wrap { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--white); box-shadow: 0 0 0 1px var(--line); }
}
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 20px; }
.auth-card { display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 28px; letter-spacing: -0.03em; }
.auth-card .lead { margin-top: 6px; color: var(--ink-2); }
.auth-card .switch { font-size: 14.5px; color: var(--ink-2); text-align: center; }
.otp { display: flex; gap: 10px; justify-content: center; }
.otp input { width: 56px; height: 64px; text-align: center; font-size: 26px; font-weight: 700; border-radius: 14px; padding: 0; font-variant-numeric: tabular-nums; }

/* Skeleton ------------------------------------------------------------------ */
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--fill) 0%, var(--fill-2) 50%, var(--fill) 100%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.sk-row + .sk-row { border-top: 1px solid var(--line); }

/* Ticket (queue receipt / payment done) ------------------------------------- */
.ticket { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 20px; border-radius: 20px; background: var(--fill); text-align: center; }
.ticket .no { font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.ticket .lbl { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; }

.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 999px; background: var(--fill-2); transition: background-color 240ms var(--ease-out); }
.steps i.on { background: var(--ink); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--fill); font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }

details.fold > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .icon { transition: transform 200ms var(--ease-out); }
details.fold[open] > summary .icon { transform: rotate(180deg); }

.record { padding: 16px 0; border-bottom: 1px solid var(--line); }
.record:last-child { border-bottom: 0; }
.record-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.record-head strong { font-size: 15px; }
.record dl { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; margin-top: 10px; font-size: 14px; }
.record dt { color: var(--ink-3); }
.record dd { min-width: 0; }

.list-footer { display: flex; justify-content: center; padding-top: 8px; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 11.5px; font-weight: 600; color: var(--ink-3); font-family: var(--font); }

/* Print: receipt only ------------------------------------------------------- */
@media print {
  body * { visibility: hidden !important; }
  .printable, .printable * { visibility: visible !important; }
  .printable { position: absolute; inset: 0 auto auto 0; width: 80mm; padding: 4mm; font-size: 12px; box-shadow: none !important; }
  .no-print { display: none !important; }
}
.receipt { display: flex; flex-direction: column; gap: 14px; }
.receipt-head { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.receipt-head strong { font-size: 17px; }

/* Section headers that stick under the phone top bar, or the page top on desktop */
.sticky-head { position: sticky; top: 56px; z-index: 2; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
@media (min-width: 769px) { .sticky-head { top: 0; } }
fieldset { min-width: 0; }
.nav-clinic:disabled { cursor: default; }
.actions-list button:disabled { cursor: default; color: inherit; }
@media (min-width: 1100px) { .hide-xl { display: none !important; } }
@media (max-width: 1099px) { .only-xl { display: none !important; } }

/* Cage picker (check-in, move) */
.cage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  text-align: left;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.cage strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.cage small { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cage:active { transform: scale(0.97); }
.cage[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.cage[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.65); }
.cage:disabled { background: var(--fill); box-shadow: none; color: var(--ink-3); cursor: not-allowed; }
.cage[aria-busy="true"] { opacity: 0.5; }
@media (hover: hover) and (pointer: fine) { .cage:not(:disabled):not([aria-pressed="true"]):hover { background: var(--fill); } }
.stat > span + strong + span { font-size: 12.5px; }

/* Printing */
.spinner-lg { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--fill-2); border-top-color: var(--ink); animation: spin 800ms linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner-lg { animation-duration: 1600ms; } }
.switch-row { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; }
.switch-row strong { display: block; font-size: 15px; font-weight: 600; }
.switch-row small { display: block; font-size: 13px; color: var(--ink-3); }
.switch-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--fill-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  cursor: pointer;
  transition: background-color 160ms var(--ease-out);
}
.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 200ms var(--ease-out);
}
.switch-row input[type="checkbox"]:checked { background: var(--ink); box-shadow: none; }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.switch-row input[type="checkbox"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Quantity field (forms): matches .input height and fill */
.qty-field {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  height: 48px;
  padding: 2px;
  border-radius: 12px;
  background: var(--fill);
  transition: box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.qty-field:focus-within { box-shadow: inset 0 0 0 2px var(--ink); background: var(--white); }
.qty-field button {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 10px;
  color: var(--ink);
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.qty-field button:active { transform: scale(0.92); }
.qty-field button:disabled { color: var(--ink-3); opacity: 0.45; cursor: default; }
@media (hover: hover) and (pointer: fine) { .qty-field button:not(:disabled):hover { background: var(--fill-2); } }
.qty-field:focus-within button:not(:disabled):hover { background: var(--fill); }
.qty-field input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
}

/* Lists inside a card run edge to edge (grouped list): the hover fill reaches both sides of the card,
   the first/last row follow the card's corners, and separators start at the text, after the icon. */
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush > .actions-list { margin: 0; }
.card.flush > .actions-list > * { min-height: 56px; padding: 12px 20px; border-radius: 0; }
.card.flush > .actions-list > * + *::before { left: 54px; right: 0; }
.card.flush > .actions-list > *:focus-visible { outline-offset: -2px; }

.card:has(.rows.hover) { overflow: hidden; }
.card .rows.hover .row { margin: 0 -20px; padding-left: 20px; padding-right: 20px; border-radius: 0; }
.card .rows.hover .row + .row::before { left: 20px; right: 20px; }
.card .rows.hover .row-title:focus-visible { outline-offset: -2px; }
/* a list that ends the card meets the card's bottom edge instead of floating above it */
.card > .rows.hover:last-child,
.card > .section:last-child > .rows.hover:last-child { margin-bottom: -20px; }

/* Fee dokter: input + explanation with a live worked example */
.fee-help { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--fill); font-size: 14px; color: var(--ink-2); }
.fee-help p { margin: 0; line-height: 1.45; }
.fee-help strong { color: var(--ink); font-weight: 600; }
.fee-example { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--white); box-shadow: 0 0 0 1px var(--line); color: var(--ink); font-variant-numeric: tabular-nums; }
.fee-example-head, .fee-example-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fee-example-head { font-size: 13px; color: var(--ink-3); }
.fee-example-row span { display: inline-flex; align-items: center; gap: 8px; }
.fee-example-row strong { font-weight: 600; }
.fee-example .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--fill-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.fee-example .dot.ink { background: var(--ink); box-shadow: none; }
.fee-split { height: 8px; border-radius: 999px; background: var(--fill-2); overflow: hidden; }
.fee-split i { display: block; height: 100%; background: var(--ink); border-radius: inherit; transition: width 240ms var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .fee-split i { transition: none; } }

/* Hero stat labels stay on one line on narrow phones */
.hero-stats span { white-space: nowrap; }
@media (max-width: 400px) {
  .hero-stats a, .hero-stats div { padding: 12px 10px; }
  .hero-stats span { font-size: 12.5px; gap: 5px; }
}

/* Kasir hari ini: two money figures side by side, each opens its Kasir tab */
.cash-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cash-split a { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px; border-radius: 12px; background: var(--fill); transition: background-color 160ms var(--ease-out); }
.cash-split span { font-size: 13px; color: var(--ink-2); }
.cash-split strong { font-size: 18px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.cash-split small { font-size: 12.5px; color: var(--ink-3); }
.cash-split a.owed span::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--st-payment); vertical-align: 1px; }
@media (hover: hover) and (pointer: fine) { .cash-split a:hover { background: var(--fill-2); } }

/* Sidebar "Daftarkan pasien": ink (always visible, so it never competes with the page's blue action) */
.nav-new { justify-content: flex-start; padding-left: 16px; padding-right: 10px; }
.nav-kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.16); font-family: var(--font); font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.nav-new.grey .nav-kbd { background: var(--white); color: var(--ink-3); box-shadow: 0 0 0 1px var(--line); }
@media (pointer: coarse) { .nav-kbd { display: none; } }
