/* Components. Ported 1:1 from prototype.html, plus the pieces the real app
   needs (skeletons, sync pill, onboarding, settings, row menus). */

/* ========================================================= device frame */
.stage { min-height: 100dvh; }
.phone { position: relative; width: 100%; height: 100dvh; }
.screen {
  position: relative; height: 100%; overflow: hidden; background: var(--bg);
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
}

@media (min-width: 520px) {
  .stage {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 28px 16px; background: var(--stage);
  }
  .phone {
    width: 392px; height: min(840px, calc(100dvh - 56px)); min-height: 640px;
    padding: 10px; border-radius: 52px;
    background: var(--bezel); border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
  }
  .screen { border-radius: 42px; padding-top: 18px; }
}

#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 24px; scrollbar-width: none; overscroll-behavior: contain; }
.content::-webkit-scrollbar { display: none; }
.enter { animation: fadeUp 0.25s ease both; }
.pad { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ============================================================== headers */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 12px; }
.appbar .right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.wordmark { display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0; flex: 1 1 auto; }
.wordmark > span:last-child { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.logo-tile {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; overflow: hidden;
  background: var(--logo-tile); border: 1px solid var(--logo-tile-border);
  display: grid; place-items: center;
}
.logo-tile img { width: 100%; height: 100%; display: block; }
.wm-title { display: block; font-size: 18px; line-height: 20px; font-weight: 700; color: var(--primary); letter-spacing: -0.2px; }
.wm-title .of { color: var(--green-text); }
.wm-sub {
  display: block; margin-top: 2px; font-size: 9px; line-height: 12px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.date-chip {
  padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
}
.theme-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.theme-btn::after { content: ""; position: absolute; inset: -4px; }
.theme-btn:hover { color: var(--primary); }
.theme-btn.spin svg { animation: spin 0.8s linear infinite; }

.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 12px; }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; flex: 1; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--primary); flex-shrink: 0; }
.icon-btn:hover { background: var(--primary-soft); }
.icon-btn.quiet { color: var(--text-3); }
.screen-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px 14px; }
.screen-title h1 { margin: 0; font-size: 24px; font-weight: 700; }
.screen-title .right { display: flex; align-items: center; gap: 6px; }

.demo-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold);
}

/* ======================================================= sync / status */
.status-pill {
  align-self: center; display: inline-flex; align-items: center; gap: 6px; margin: 0 auto 12px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.status-pill.offline .dot { background: var(--danger); }
.status-pill.failed { border-color: var(--danger); color: var(--danger); }
.status-pill.failed .dot { background: var(--danger); }
.status-wrap { display: flex; justify-content: center; padding: 0 16px; }
.stale-note { font-size: 11px; color: var(--text-3); text-align: center; margin: -6px 0 10px; }

.ptr {
  height: 0; overflow: hidden; display: grid; place-items: center; color: var(--text-3);
  font-size: 12px; font-weight: 600; transition: height 0.15s;
}
.ptr.on { height: 40px; }
.ptr.go { color: var(--primary); }

/* ================================================================= hero */
.hero { margin: 0 16px; padding: 16px; border-radius: 22px; background: var(--hero-bg); border: 1px solid var(--border); }
.hero-eyebrow {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.2px;
}
.hero h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.hero p { margin: 2px 0 14px; font-size: 13px; color: var(--text-2); }
.clinic {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; min-height: 66px;
  padding: 12px 14px; border-radius: 16px; border: 1.5px solid transparent; transition: transform 0.15s;
}
.clinic:active { transform: scale(0.98); }
.clinic:disabled { cursor: default; }
.clinic .ic { width: 42px; height: 42px; border-radius: 21px; display: grid; place-items: center; flex-shrink: 0; }
.clinic .t1 { display: block; font-size: 16px; font-weight: 700; }
.clinic .t2 { font-size: 12px; }
.clinic .hint { margin-left: auto; font-size: 11px; text-align: right; color: var(--text-3); }
.clinic.idle { background: var(--primary); color: var(--on-primary); }
.clinic.idle .ic { background: rgba(255, 255, 255, 0.18); }
.clinic.idle .t2 { opacity: 0.85; }
.clinic.in { background: var(--primary-soft); border-color: var(--primary); }
.clinic.in .ic { background: var(--gold); color: var(--on-gold); animation: pulse 1.8s infinite; }
.clinic.in .t2 { color: var(--text-2); }
.clinic.done { background: var(--surface-2); border-color: var(--border); }
.clinic.done .ic { background: var(--green-soft); color: var(--green-text); }
.clinic.done .t2 { color: var(--text-2); }
.clinic.leave { background: var(--gold-soft); border-color: var(--gold); }
.clinic.leave .ic { background: var(--gold); color: var(--on-gold); }
.clinic.leave .t2 { color: var(--text-2); }

/* ================================================================ cards */
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 10px; }
.section-title h3 { margin: 0; font-size: 15px; font-weight: 700; }
.section-title span { font-size: 11px; color: var(--text-3); }
.card { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 14px; }
.card.flat { box-shadow: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.label { font-size: 12px; color: var(--text-2); }
.big { font-size: 18px; font-weight: 700; }
.huge { font-size: 26px; line-height: 32px; font-weight: 700; }
.link-card { width: 100%; text-align: left; transition: border-color 0.15s; }
.link-card:hover { border-color: var(--border-strong); }

.visit { display: flex; align-items: center; gap: 12px; padding: 12px; }
.time { width: 52px; flex-shrink: 0; text-align: center; padding: 7px 0; border-radius: 12px; background: var(--surface-2); }
.time b { display: block; font-size: 15px; line-height: 18px; color: var(--primary); }
.time small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); }
.visit .who { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-align: left; min-height: 44px; }
.visit .name { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit .meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.visit .meta b { color: var(--text); flex-shrink: 0; }
.visit .meta svg { flex-shrink: 0; }
.visit .meta .loc { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.visit .meta .note { flex-shrink: 100; }
.visit .end { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.av-teal { background: var(--primary-soft); color: var(--primary); }
.av-gold { background: var(--gold-soft); color: var(--gold-text); }
.av-green { background: var(--green-soft); color: var(--green-text); }
.av-deep { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: transform 0.12s, filter 0.12s; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; transform: none; filter: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-green { background: var(--green); color: var(--on-green); }
.btn-gold { background: var(--gold); color: var(--on-gold); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--border-strong); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-block { width: 100%; height: 50px; font-size: 16px; }
.btn-md { height: 44px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-sm::after { content: ""; position: absolute; inset: -5px -2px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-paid { background: var(--green-soft); color: var(--green-text); }
.b-pending { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--primary-soft); color: var(--primary); }
.b-sync { background: var(--gold-soft); color: var(--gold-text); }

.progress { height: 8px; border-radius: 5px; background: var(--track); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 5px; background: var(--primary); transition: width 0.4s; }
.progress.sm { height: 5px; }

.list { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; min-height: 56px; }
.row + .row { border-top: 1px solid var(--border); }
button.row:hover, .row.tap:hover { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { display: block; font-size: 14px; font-weight: 700; }
.row .t2 { display: block; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .more { margin: -8px -10px -8px -4px; }
.row.pressing, .visit.pressing { background: var(--surface-2); }
.chip-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.session-ic { background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: 12px; border: 1px solid var(--border); }
.empty { padding: 22px 16px; text-align: center; color: var(--text-2); font-size: 13px; }
.empty .btn { margin-top: 12px; }

/* ============================================================= skeletons */
.sk { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 10px; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
.sk-line { height: 12px; margin: 6px 0; }
.sk-card { height: 72px; border-radius: var(--radius); border: 1px solid var(--border); }

/* ================================================================ forms */
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.field-hint { display: block; font-size: 11px; color: var(--text-3); margin-top: 5px; }
.field-error { display: block; font-size: 12px; color: var(--danger); margin-top: 6px; font-weight: 600; }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 16px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { resize: none; min-height: 84px; }
select.input {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px; background-size: 5px 5px; background-repeat: no-repeat;
}
.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 14px; color: var(--text-3); }
.search .input { padding-left: 42px; }
.pass { position: relative; display: block; }
.pass .input { padding-right: 52px; }
.pass .icon-btn { position: absolute; right: 2px; top: 1px; color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  transition: background 0.15s, border-color 0.15s;
}
.chip::after { content: ""; position: absolute; inset: -3px 0; }
.chip .ci { display: flex; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip[aria-pressed="true"] .ci { color: inherit !important; }
.chip.gold[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { height: 40px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.amount { text-align: center; padding: 14px 0; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.amount .v { font-size: 34px; line-height: 42px; font-weight: 700; color: var(--text); }
.amount .v.empty { color: var(--text-3); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  height: 50px; border-radius: 14px; font-size: 22px; font-weight: 600; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: transform 0.1s, background 0.1s;
}
.key:active { transform: scale(0.95); background: var(--surface-2); }
.key.back { color: var(--danger); }

.stepper { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface); }
.stepper .mid { flex: 1; text-align: center; }

.switch-row { display: flex; align-items: center; gap: 12px; min-height: 48px; width: 100%; text-align: left; }
.switch-row .grow { flex: 1; min-width: 0; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--track); border: 1px solid var(--border-strong); position: relative; flex-shrink: 0; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.15s; }
[aria-checked="true"] > .switch { background: var(--primary); border-color: var(--primary); }
[aria-checked="true"] > .switch::after { transform: translateX(18px); }

.form-section { display: flex; flex-direction: column; gap: 12px; }
.form-section + .form-section { border-top: 1px solid var(--border); padding-top: 16px; }
.form-section h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.6px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.kv span:first-child { color: var(--text-2); }

/* ============================================================== tab bar */
.tabbar {
  flex-shrink: 0; display: grid; grid-template-columns: 1fr 1fr 70px 1fr 1fr; align-items: start;
  padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 4px; min-height: 52px; color: var(--text-3); font-size: 11px; font-weight: 600; }
.tab .pill { width: 54px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background 0.2s; }
.tab[aria-current="page"] { color: var(--primary); }
.tab[aria-current="page"] .pill { background: var(--primary-soft); }
.fab {
  justify-self: center; width: 58px; height: 58px; margin-top: -28px; border-radius: 50%;
  background: var(--gold); color: var(--on-gold); border: 4px solid var(--surface); display: grid; place-items: center;
  transition: transform 0.15s;
}
.fab:active { transform: scale(0.92); }

/* =============================================================== sheets */
.layer { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.scrim { position: absolute; inset: 0; background: var(--scrim); }
.sheet {
  position: relative; background: var(--surface); border-radius: 24px 24px 0 0; border-top: 1px solid var(--border);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88%; overflow-y: auto; outline: none;
}
.layer.anim .scrim { animation: fade 0.2s ease both; }
.layer.anim .sheet { animation: slideUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 700; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tiles.four { grid-template-columns: repeat(2, 1fr); }
.tile {
  height: 108px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-size: 13px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); transition: transform 0.12s;
}
.tiles.four .tile { height: 96px; }
.tile:active { transform: scale(0.96); }
.tile .ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; }
.option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); text-align: left; text-decoration: none; }
.option:hover { background: var(--surface-2); }
.option + .option { margin-top: 8px; }
.option.danger { color: var(--danger); }
.chat { padding: 14px; border-radius: 16px; background: var(--chat-bg); }
.bubble { margin-left: auto; max-width: 92%; padding: 10px 12px; border-radius: 14px 14px 4px 14px; background: var(--chat-bubble); color: var(--chat-text); font-size: 13px; line-height: 19px; word-break: break-word; white-space: pre-wrap; }
.bubble .ts { text-align: right; font-size: 10px; color: var(--chat-meta); margin-top: 4px; }

/* ===================================================== toast + splash */
#toast { position: absolute; left: 0; right: 0; bottom: 100px; display: flex; justify-content: center; pointer-events: none; z-index: 50; }
.toast { display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; background: var(--toast-bg); color: var(--toast-text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast 2.6s ease both; max-width: 86%; }
.toast svg { color: var(--green); flex-shrink: 0; }
.toast.err svg { color: var(--danger); }
.toast.wait svg { color: var(--gold); }
#splash { position: absolute; inset: 0; z-index: 60; }
#splash:empty { display: none; }
.splash {
  position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 24px;
  background: radial-gradient(circle at 50% 38%, var(--primary-soft), transparent 60%), var(--bg);
  animation: fade 0.3s ease both;
}
.logo-card {
  width: min(250px, 70%); padding: 14px; border-radius: 28px; background: var(--logo-tile);
  border: 1px solid var(--logo-tile-border); box-shadow: var(--shadow-lg);
  animation: rise 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.logo-card img { width: 100%; height: auto; display: block; }
.splash .tag { font-size: 14px; font-weight: 600; color: var(--primary); animation: fadeUp 0.6s 0.3s ease both; }
.splash .tag i { font-style: normal; color: var(--gold); padding: 0 4px; }
.splash .bar { width: 120px; height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.splash .bar i { display: block; height: 100%; background: var(--primary); animation: load 2.4s linear both; }
.splash .skip { position: absolute; bottom: 28px; font-size: 12px; color: var(--text-3); }

/* =========================================================== onboarding */
.welcome {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 28px 22px calc(24px + env(safe-area-inset-bottom)); text-align: center;
  background: radial-gradient(circle at 50% 22%, var(--primary-soft), transparent 55%), var(--bg);
}
.welcome .logo-card { width: min(220px, 62%); margin-top: 6px; }
.welcome h1 { margin: 4px 0 0; font-size: 22px; font-weight: 700; }
.welcome p { margin: 0; font-size: 14px; color: var(--text-2); line-height: 20px; }
.welcome form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.welcome .or { font-size: 12px; color: var(--text-3); text-align: center; }
.welcome details { font-size: 13px; color: var(--text-2); }
.welcome summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; }

/* ============================================================ insights */
.legend { display: flex; flex-direction: column; gap: 7px; flex: 1 1 140px; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-axis { fill: var(--text-3); }
.chart-grid { stroke: var(--border); }
.chart-income { fill: var(--green); }
.chart-expense { fill: var(--gold); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; max-width: 360px; margin: 0 auto; }
.cal .h { font-size: 11px; color: var(--text-3); font-weight: 600; padding: 2px 0 4px; }
.cal .d {
  height: 38px; min-width: 0; padding: 0; border-radius: 10px;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.cal button.d:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.cal .d.s-clinic { background: var(--green-soft); color: var(--green-text); }
.cal .d.s-leave { background: var(--gold); color: var(--on-gold); }
.cal .d.s-half { background: linear-gradient(135deg, var(--gold) 50%, var(--gold-soft) 50%); color: var(--on-gold); }
.cal .d.s-off { background: var(--surface-2); color: var(--text-3); }
.cal .d.s-future { color: var(--text-3); }
.cal .d.is-today { box-shadow: inset 0 0 0 2px var(--primary); font-weight: 800; }
.legend-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--text-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 5px; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.month-switch { display: flex; align-items: center; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.month-switch .icon-btn { width: 36px; height: 36px; }
.month-switch .icon-btn::after { content: ""; position: absolute; inset: -4px; }
.month-switch .icon-btn:disabled { color: var(--text-3); opacity: 0.5; cursor: default; background: none; }
.month-switch span { min-width: 70px; text-align: center; font-size: 13px; font-weight: 700; }

/* ============================================================ utilities */
[tabindex="-1"]:focus { outline: none; }
@media (max-width: 379px) { .hide-narrow { display: none !important; } }

/* ============================================================ keyframes */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes rise { from { opacity: 0; transform: scale(0.9) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes load { from { width: 0; } to { width: 100%; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.5); } 50% { box-shadow: 0 0 0 7px rgba(245, 166, 35, 0); } }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 8%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }
