:root {
  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #ececf2;
  --text: #15161c;
  --muted: #6b6f7b;
  --border: #e2e2ea;
  --accent: #5b5fef;
  --accent-soft: #e8e9fd;
  --ok: #1a8f5a;
  --ok-soft: #dcf3e8;
  --warn: #b27a00;
  --warn-soft: #fbf0d2;
  --bad: #d93a40;
  --bad-soft: #fde2e3;
  --info: #2f6fe4;
  --info-soft: #dfe9fd;
  --shadow: 0 1px 2px rgb(20 20 40 / 0.04), 0 4px 16px rgb(20 20 40 / 0.05);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1015;
    --surface: #191a21;
    --surface-2: #24252e;
    --text: #f1f1f5;
    --muted: #9a9dab;
    --border: #2b2c36;
    --accent: #8084ff;
    --accent-soft: #272a52;
    --ok: #3ccf8e;
    --ok-soft: #173427;
    --warn: #f5b82e;
    --warn-soft: #3a2f12;
    --bad: #ff6369;
    --bad-soft: #3f1c1e;
    --info: #6aa8ff;
    --info-soft: #1c2a45;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1015;
  --surface: #191a21;
  --surface-2: #24252e;
  --text: #f1f1f5;
  --muted: #9a9dab;
  --border: #2b2c36;
  --accent: #8084ff;
  --accent-soft: #272a52;
  --ok: #3ccf8e;
  --ok-soft: #173427;
  --warn: #f5b82e;
  --warn-soft: #3a2f12;
  --bad: #ff6369;
  --bad-soft: #3f1c1e;
  --info: #6aa8ff;
  --info-soft: #1c2a45;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* No double-tap zoom (taps also fire instantly). */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }

svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(100px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.logo { width: 30px; height: 30px; stroke: none; }

.topbar-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  font-size: 17px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.placeholder { visibility: hidden; }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.1s ease, background-color 0.15s ease;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.big { min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn.soft { background: var(--surface-2); color: var(--text); }
.btn.soft.present { color: var(--ok); }
.btn.soft.skip { color: var(--bad); }
.btn.soft.excused { color: var(--info); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost.danger, .btn.danger { color: var(--bad); }

/* ---------- empty state ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 12px 24px;
  text-align: center;
}
.empty-art .logo { width: 88px; height: 88px; }
.empty h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; max-width: 340px; }
.empty p { color: var(--muted); max-width: 360px; }
.empty .btn { margin-top: 8px; }
.empty-foot { font-size: 13px; }

/* ---------- summary ---------- */

.summary {
  --tone: var(--ok);
  --tone-soft: var(--ok-soft);
  position: relative;
  margin-top: 6px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.summary.level-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.summary.level-zero, .summary.level-over { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.summary-date { color: var(--muted); font-size: 13px; font-weight: 500; }
.summary-headline { margin-top: 2px; color: var(--tone); font-size: 20px; font-weight: 750; letter-spacing: -0.01em; line-height: 1.25; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.tile { display: flex; flex-direction: column; padding: 2px 12px; }
.tile:first-child { padding-left: 0; }
.tile + .tile { border-left: 1px solid var(--border); }
.tile-num { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: 12px; }
/* Colour only when there is something to report. */
.tile.t-skip.has .tile-num { color: var(--bad); }
.tile.t-excused.has .tile-num { color: var(--info); }

/* ---------- subject cards ---------- */

.list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.card {
  position: relative;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-main { display: block; padding: 14px 16px 12px; }
.card-main:active { background: color-mix(in srgb, var(--c) 8%, transparent); }

.card-top { display: flex; align-items: center; gap: 12px; }
.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  background: var(--c);
  color: #fff;
  font-size: 19px;
  font-weight: 750;
}
.card-title { flex: 1; min-width: 0; }
.card-title h2 {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.count { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.count-num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.count-label { margin-top: 2px; color: var(--muted); font-size: 12px; }

.level-ok .count-num { color: var(--ok); }
.level-warn .count-num { color: var(--warn); }
.level-zero .count-num, .level-over .count-num { color: var(--bad); }
.level-none .count-num { color: var(--muted); }

/* meters: one row for skips, one for excused */
.meters { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.meters:empty { display: none; }
.meter-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; }
.meter-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.meter-value { min-width: 34px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.meter-row.kind-skip { --fill: var(--c, var(--accent)); }
.meter-row.kind-excused { --fill: var(--info); }
.meter-row.lvl-warn { --fill: var(--warn); }
.meter-row.lvl-zero, .meter-row.lvl-over { --fill: var(--bad); }
.meter-row.lvl-zero .meter-value, .meter-row.lvl-over .meter-value { color: var(--bad); }

.pips { display: flex; gap: 4px; }
.pip {
  flex: 1;
  height: 9px;
  max-width: 44px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
.pip.used { background: var(--fill, var(--accent)); }
.pip.over { background: var(--bad); opacity: 0.55; }

.bar { height: 9px; border-radius: 5px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 5px; background: var(--fill, var(--accent)); }

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 12px 12px;
}
.card-actions .btn { min-height: 40px; padding: 0 6px; gap: 4px; font-size: 13.5px; }
.card-actions .btn svg { width: 16px; height: 16px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.chip.status-present { background: var(--ok-soft); color: var(--ok); }
.chip.status-absent { background: var(--bad-soft); color: var(--bad); }
.chip.status-excused { background: var(--info-soft); color: var(--info); }

.add-more { width: 100%; margin-top: 8px; }

/* ---------- subject detail ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
  padding: 24px 20px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.hero-counts { display: flex; justify-content: center; gap: 12px; width: 100%; }
.hero-counts.two .hero-count { flex: 1; padding: 12px 8px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.hero-count { display: flex; flex-direction: column; align-items: center; }
.hero-num { font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.hero-counts.two .hero-num { font-size: 56px; }
.hero-label { margin-top: 4px; color: var(--muted); font-size: 14px; font-weight: 550; }
.hero-count.lvl-ok .hero-num { color: var(--ok); }
.hero-count.kind-excused.lvl-ok .hero-num, .hero-count.kind-excused.lvl-warn .hero-num { color: var(--info); }
.hero-count.lvl-warn .hero-num { color: var(--warn); }
.hero-count.lvl-zero .hero-num, .hero-count.lvl-over .hero-num { color: var(--bad); }
.hero-count.lvl-none .hero-num { color: var(--muted); }
.hero .meters { width: 100%; margin-top: 18px; }
.hero-advice { margin-top: 14px; color: var(--muted); font-size: 14px; max-width: 320px; }

.badge {
  margin-top: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}
.badge.level-ok { background: var(--ok-soft); color: var(--ok); }
.badge.level-warn { background: var(--warn-soft); color: var(--warn); }
.badge.level-zero, .badge.level-over { background: var(--bad-soft); color: var(--bad); }
.badge.level-none { background: var(--surface-2); color: var(--muted); }

/* One card, 3×2 cells split by hairlines. */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stat { display: flex; flex-direction: column; padding: 12px 14px; }
.stat:not(:nth-child(3n + 1)) { border-left: 1px solid var(--border); }
.stat:nth-child(n + 4) { border-top: 1px solid var(--border); }
.stat-num { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat.s-skip.has .stat-num { color: var(--bad); }
.stat.s-excused.has .stat-num { color: var(--info); }

.limit-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.limit-line svg { width: 16px; height: 16px; }

.section-title {
  margin: 26px 2px 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.log-today { display: flex; flex-direction: column; }
.log-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.log-buttons .btn { padding: 0 8px; }
.log-today > .btn.ghost { align-self: center; margin-top: 6px; }


.history {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.history li + li { border-top: 1px solid var(--border); }
.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  text-align: left;
}
.history-row:active { background: var(--surface-2); }
.history-date { flex: none; font-weight: 550; }
.history-mark { flex: none; width: 4px; height: 22px; border-radius: 2px; }
.history-mark.status-present { background: var(--ok); }
.history-mark.status-absent { background: var(--bad); }
.history-mark.status-excused { background: var(--info); }
.history-note {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-empty { padding: 18px 16px; color: var(--muted); text-align: center; }

/* ---------- settings ---------- */

.panel {
  margin-top: 12px;
  padding: 4px 16px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel .section-title { margin-top: 14px; }
.panel-text { color: var(--muted); font-size: 14px; }
.panel-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.panel-buttons .btn { flex: 1 1 140px; }
.steps { margin: 0 0 10px; padding-left: 20px; }
.steps li { margin: 4px 0; }
.about { margin-top: 24px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- segmented control ---------- */

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}
.segmented.three { grid-template-columns: 1fr 1fr 1fr; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 6px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- dialogs (bottom sheets) ---------- */

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}
.sheet[open] { animation: sheet-in 0.22s ease-out; }
.sheet::backdrop { background: rgb(0 0 0 / 0.4); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 22px; }
}

.sheet form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; }
.sheet-head h2 { font-size: 20px; font-weight: 700; }
.sheet-head .icon-btn { background: var(--surface-2); box-shadow: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { padding: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.field-label em { font-style: normal; font-weight: 500; opacity: 0.75; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field input:not([type="radio"]), .field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 16px; /* 16px stops iOS from zooming in on focus */
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; max-width: 380px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch.custom span {
  background:
    radial-gradient(circle, var(--c) 0 42%, transparent 44%),
    conic-gradient(#ff4d4d, #ffb020, #d4f542, #36d399, #22b8f0, #6b6bff, #d946ef, #ff4d4d);
}
/* The native picker sits invisibly on top of the rainbow swatch. */
.swatch.custom input[type="color"] {
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  pointer-events: auto;
  cursor: pointer;
}
.swatch span {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); transform: scale(0.92); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }

.hint { color: var(--muted); font-size: 14px; min-height: 1.4em; }
.error { color: var(--bad); font-size: 14px; font-weight: 600; }

.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.sheet-actions .btn.primary { flex: 1; margin-left: auto; max-width: 220px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 12px 12px 12px 16px;
  border-radius: 14px;
  background: #1d1e26;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  /* Sits above the tab bar, so hide it by fading out rather than sliding off-screen. */
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: transform 0.25s ease, opacity 0.2s ease, visibility 0s linear 0.25s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: transform 0.25s ease, opacity 0.2s ease, visibility 0s;
  pointer-events: auto;
}
.toast button {
  flex: none;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.14);
  color: #b9bbff;
  font-weight: 700;
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.tabbar a {
  display: flex;
  flex: 1;
  max-width: 140px;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--accent); }
.tabbar a { position: relative; z-index: 1; }
/* Soft pill behind the active tab, positioned by moveTabIndicator() in motion.js. */
.tab-indicator {
  position: absolute;
  top: 6px;
  left: 0;
  width: 0;
  height: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  opacity: 0;
  pointer-events: none;
}

.btn.slim { min-height: 36px; padding: 0 12px; }
.link-btn { padding: 4px 6px; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; }

.avatar.sm { font-size: 14px; letter-spacing: -0.02em; }
.avatar.xs { font-size: 12px; letter-spacing: -0.03em; }

.section-title + .list { margin-top: 0; }

/* ---------- today widget ---------- */

.today {
  margin-top: 12px;
  padding: 14px 14px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.today-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 6px; }
.today-head h2 { font-size: 18px; font-weight: 750; }
.today-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.today-free { padding: 8px 2px 2px; font-size: 16px; font-weight: 650; }
.today-next { padding: 2px 2px 8px; color: var(--muted); font-size: 14px; }
.today-next b { color: var(--text); }
.today-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px -4px 0;
  padding: 10px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13.5px;
  font-weight: 650;
}
.today-pending svg { width: 16px; height: 16px; }
.today-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
}
.today-empty h2 { font-size: 16px; font-weight: 700; }
.today-empty p { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.today-empty .btn { flex: none; }

/* one class row (today widget + calendar day list) */
.entries { margin: 0; padding: 0; list-style: none; }
.entries.boxed {
  padding: 4px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.entry {
  position: relative;
  padding: 10px 2px 10px 12px;
}
.entry-row { display: flex; align-items: center; gap: 12px; }
.entry + .entry { border-top: 1px solid var(--border); }
.entry::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 2px;
  background: var(--c);
}
.entry-time { display: flex; flex-direction: column; width: 44px; flex: none; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.entry-time small { color: var(--muted); font-size: 12px; font-weight: 500; }
.entry-body { flex: 1; min-width: 0; }
.entry-title { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 650; }
.entry-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-marker {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.entry.is-next .entry-marker { background: var(--accent-soft); color: var(--accent); }
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 5px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}
.entry-meta svg { width: 13px; height: 13px; margin-right: 1px; }
.entry-meta .sep { opacity: 0.5; }
.entry-left { font-weight: 650; }
.entry-left.lvl-ok { color: var(--ok); }
.entry-left.lvl-warn { color: var(--warn); }
.entry-left.lvl-zero, .entry-left.lvl-over { color: var(--bad); }
.entry-upcoming { color: var(--muted); font-size: 12px; font-weight: 600; }
.entry.is-now { margin: 0 -8px; padding-left: 20px; padding-right: 10px; border-radius: 14px; background: var(--accent-soft); }
.entry.is-now::before { left: 8px; }
.entry.is-now + .entry { border-top-color: transparent; }
.entry .chip { border: 0; cursor: pointer; }
.chip.exam { background: var(--accent-soft); color: var(--accent); }

.mini-group { display: flex; gap: 4px; flex: none; }
.mini {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
}
.mini svg { width: 17px; height: 17px; }
.mini:active { transform: scale(0.92); }
.mini.present { background: var(--ok-soft); color: var(--ok); }
.mini.absent { background: var(--bad-soft); color: var(--bad); }
.mini.excused { background: var(--info-soft); color: var(--info); }

/* ---------- schedule block on subject page ---------- */

.sched {
  margin: 0;
  padding: 4px 14px;
  list-style: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.sched li { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 14px; }
.sched li + li { border-top: 1px solid var(--border); }
.sched-icon { display: grid; color: var(--muted); }
.sched-icon svg { width: 17px; height: 17px; }
.sched-label { width: 58px; flex: none; color: var(--muted); }
.sched-value { font-weight: 600; }
.sched-cal { margin-top: 6px; width: 100%; }

/* ---------- calendar ---------- */

.filters {
  display: flex;
  gap: 6px;
  margin: 2px -16px 10px;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.filter-chip.active { border-color: var(--c); background: var(--c); color: #fff; }

.cal {
  padding: 12px 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; }
.cal-head h2 { font-size: 17px; font-weight: 700; }
.cal-head .icon-btn { background: var(--surface-2); box-shadow: none; width: 36px; height: 36px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-weekdays span { padding-bottom: 4px; color: var(--muted); font-size: 11.5px; font-weight: 650; text-align: center; }
/* Every cell has the same fixed height; state is shown on the number circle only. */
.cal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  height: 52px;
  padding: 4px 0 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.cal-cell.pad { pointer-events: none; }
.cal-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.cal-cell.is-future .cal-num { color: var(--muted); }
.cal-cell.is-today .cal-num { color: var(--accent); font-weight: 800; box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.is-selected .cal-num { background: var(--accent); color: #fff; font-weight: 750; box-shadow: none; }
.cal-cell:active .cal-num { background: var(--surface-2); }
.cal-cell.is-selected:active .cal-num { background: var(--accent); }
.dots { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 3px; height: 6px; }
.d { flex: none; width: 6px; height: 6px; border-radius: 50%; }
.d.status-present { background: var(--ok); }
.d.status-absent { background: var(--bad); }
.d.status-excused { background: var(--info); }
.d.planned { background: color-mix(in srgb, var(--text) 22%, transparent); }
.d.missing { box-shadow: inset 0 0 0 1.5px var(--warn); }
.d.exam { background: var(--accent); border-radius: 1px; transform: rotate(45deg) scale(0.9); }
.d.more { background: var(--muted); width: 4px; height: 4px; }

.cal-summary { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; padding: 10px 4px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.cal-stat { display: inline-flex; gap: 4px; }
.cal-stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.cal-stat.has.status-absent b { color: var(--bad); }
.cal-stat.has.status-excused b { color: var(--info); }
.cal-stat.missing { background: var(--warn-soft); color: var(--warn); }

.day-empty { padding: 18px; border-radius: var(--radius); background: var(--surface); color: var(--muted); text-align: center; box-shadow: var(--shadow); }
.day-add { width: 100%; margin-top: 6px; }

/* ---------- import dialog ---------- */

.import-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: -6px; }
.import-groups {
  display: flex;
  flex-direction: column;
  max-height: 42dvh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.import-group { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.import-group + .import-group { border-top: 1px solid var(--border); }
.import-group input { position: absolute; opacity: 0; pointer-events: none; }
.import-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 2px solid var(--border);
  border-radius: 7px;
}
.import-group input:checked + .import-check { border-color: var(--accent); background: var(--accent); }
.import-group input:checked + .import-check::after { content: ""; width: 10px; height: 6px; margin-top: -3px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.import-group input:focus-visible + .import-check { outline: 2px solid var(--accent); outline-offset: 2px; }
.import-body { display: flex; flex-direction: column; min-width: 0; }
.import-name { font-size: 15px; font-weight: 650; }
.import-name em { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-style: normal; }
.import-meta { color: var(--muted); font-size: 12.5px; }

/* ---------- week strip, skip advice, semester, exams ---------- */

.today-head .link-btn { padding: 0; }
.wk { display: flex; align-items: center; gap: 2px; margin: 2px -6px 8px; }
.wk-nav { display: grid; place-items: center; width: 26px; height: 52px; flex: none; padding: 0; border: 0; background: none; color: var(--muted); }
.wk-nav svg { width: 18px; height: 18px; }
.wk-days { display: grid; flex: 1; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.wk-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 58px;
  padding: 5px 0 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.wk-label { color: var(--muted); font-size: 11px; font-weight: 650; }
.wk-num { display: grid; place-items: center; width: 28px; height: 24px; border-radius: 8px; font-size: 15px; font-weight: 650; }
.wk-day.is-empty .wk-num { color: var(--muted); font-weight: 500; }
.wk-day.is-today .wk-num { color: var(--accent); font-weight: 800; }
.wk-day.is-selected .wk-num { background: var(--accent); color: #fff; }
.wk-day .dots { gap: 2px; }
.wk-day .d { width: 5px; height: 5px; }

.advice { font-weight: 650; }
.advice.ok { color: var(--ok); }
.advice.warn { color: var(--warn); }
.advice.bad { color: var(--bad); }

.term { margin-top: 14px; }
.term-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.term-top span:first-child { color: var(--text); }
.term-bar { height: 6px; margin-top: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.term-bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.exam-list { margin: 0; padding: 2px 14px; list-style: none; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.exam-item { display: flex; align-items: center; gap: 14px; padding: 11px 0; }
.exam-item + .exam-item { border-top: 1px solid var(--border); }
.exam-when { display: flex; flex-direction: column; width: 92px; flex: none; }
.exam-when b { color: var(--accent); font-size: 15px; }
.exam-when small { color: var(--muted); font-size: 12px; }
.exam-body { display: flex; flex-direction: column; min-width: 0; }
.exam-title { font-weight: 650; }
.exam-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; color: var(--muted); font-size: 12.5px; }
.exam-meta svg { width: 13px; height: 13px; }
.exam-meta .sep { opacity: 0.5; }

/* ---------- attended by default / not-checked subjects ---------- */

.card-actions.two { grid-template-columns: repeat(2, 1fr); }
.log-buttons.n-1 { grid-template-columns: 1fr; }
.log-buttons.n-2 { grid-template-columns: 1fr 1fr; }
.log-tip, .today-tip { margin-top: 6px; color: var(--muted); font-size: 12.5px; text-align: center; }
.today-tip { margin: 4px 0 2px; }

.entry-auto { display: inline-flex; align-items: center; gap: 2px; color: var(--ok); font-weight: 650; }
.entry-auto svg { width: 13px; height: 13px; stroke-width: 2.6; }
.entry-free { font-style: italic; }
.entry.is-free .entry-title, .entry.is-free .entry-time { color: var(--muted); }
.entry.is-free::before { opacity: 0.45; }
.d.auto { opacity: 0.5; }

.title-note { text-transform: none; letter-spacing: 0; font-weight: 500; }
.free-list {
  margin: 0;
  padding: 2px 12px;
  list-style: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.free-list li + li { border-top: 1px solid var(--border); }
.free-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.free-row > svg { width: 16px; height: 16px; color: var(--muted); }
.free-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-count { color: var(--muted); font-size: 13px; }
.avatar.small { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; box-shadow: none; opacity: 0.85; }
.avatar.small.sm, .avatar.small.xs { font-size: 11px; }

.import-name em.free { background: var(--surface-2); color: var(--muted); }

/* iOS-style switch */
.toggle-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg); cursor: pointer; }
.toggle-title { display: block; font-weight: 600; }
.toggle-sub { display: block; color: var(--muted); font-size: 12.5px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { position: relative; width: 50px; height: 30px; flex: none; border-radius: 15px; background: color-mix(in srgb, var(--text) 18%, transparent); transition: background-color 0.2s ease; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.2s ease; }
.toggle-row input:checked + .toggle { background: var(--ok); }
.toggle-row input:checked + .toggle::after { transform: translateX(20px); }
.toggle-row input:focus-visible + .toggle { outline: 2px solid var(--accent); outline-offset: 2px; }
.limit-fields { display: flex; flex-direction: column; gap: 14px; }

/* ---------- update banner ---------- */

#update-banner {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  transform: translateX(-50%);
}
#update-banner button {
  flex: none;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.2);
  color: #fff;
  font: inherit;
  font-weight: 700;
}

/* ---------- tasks ---------- */

.section-with-action { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-with-action .link-btn { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; }
.section-with-action .link-btn svg { width: 16px; height: 16px; }

.mini.task { background: var(--surface-2); color: var(--muted); }
.mini-group .chip { align-self: center; }

.entry-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
}

.task-lines { margin: 6px 0 0 56px; padding: 0; list-style: none; }
.task-card {
  margin: 0;
  padding: 4px 12px;
  list-style: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.task-card .task-line + .task-line { border-top: 1px solid var(--border); }
.task-card .task-line { padding: 8px 0; }

.task-line { display: flex; align-items: flex-start; gap: 10px; padding: 3px 0; }
.task-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  margin-top: 1px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.task-check svg { width: 14px; height: 14px; stroke-width: 3; }
.task-line.is-done .task-check { border-color: var(--ok); background: var(--ok); }
.task-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 14.5px;
  text-align: left;
  overflow-wrap: anywhere;
}
.task-line.is-done .task-text > span:first-child { color: var(--muted); text-decoration: line-through; }
.task-optional {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}
.task-meta { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; }
.task-meta .dot { width: 7px; height: 7px; }
.task-meta .sep { opacity: 0.5; }
.task-meta .late { color: var(--bad); font-weight: 600; }
.task-line.just-logged .task-check { animation: pop 0.28s ease-out; }

.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  resize: vertical;
}
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ---------- course rules ---------- */

.course-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.course-empty svg { width: 24px; height: 24px; color: var(--accent); }
.course-empty b { display: block; color: var(--text); font-size: 15px; }
.course-empty small { display: block; font-size: 13px; }

.course {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.course-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.course-total { flex: none; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.course-total b { color: var(--text); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.course-state { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; font-weight: 650; text-align: right; }
.course-state small { color: var(--muted); font-size: 12px; font-weight: 500; }
.course-head.is-ok .course-state { color: var(--ok); }
.course-head.is-bad .course-state { color: var(--bad); }
.course-bar { position: relative; margin-top: 10px; overflow: visible; }
.course-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); opacity: 0.5; }

.course-items { margin: 12px 0 0; padding: 0; list-style: none; }
.course-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.course-item + .course-item { border-top: 1px solid var(--border); }
.course-items:first-child .course-item:first-child { padding-top: 0; }
.course-item-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.course-item-title { font-weight: 650; }
.course-item-meta { display: flex; flex-wrap: wrap; gap: 2px 5px; color: var(--muted); font-size: 12.5px; }
.course-item-meta .sep { opacity: 0.5; }
.course-item-note { margin-top: 2px; color: var(--muted); font-size: 12.5px; font-style: italic; }
.score { display: flex; align-items: center; gap: 4px; flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.score input {
  width: 58px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}
.score input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.score.is-low input { border-color: var(--bad); color: var(--bad); }

.course-scale-toggle { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; }
.course-scale-toggle svg { width: 16px; height: 16px; }
.course-scale { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.course-scale td { padding: 6px 0; border-top: 1px solid var(--border); }
.course-scale td:last-child { font-weight: 700; text-align: right; }
.course-scale tr.is-now td { color: var(--accent); }
.course-notes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text); font-size: 14px; white-space: pre-wrap; }
.course > .course-notes:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* rule editor rows */
.rows { display: flex; flex-direction: column; gap: 10px; }
.rule-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 40px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.rule-row input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}
.rule-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.rule-row .rule-title { font-weight: 650; }
.rule-nums { display: grid; grid-template-columns: repeat(3, 1fr) 1.6fr; gap: 6px; }
.rule-row label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rule-row label span { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.rule-row.scale { flex-direction: row; }
.rule-row.scale label { flex: 1; }
.rule-remove {
  position: absolute;
  top: 8px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
}
.rule-remove svg { width: 16px; height: 16px; }
.row-add { align-self: flex-start; min-height: 36px; margin-top: 6px; padding: 0 4px; font-size: 14px; }

.exam-list .exam-item { width: 100%; }
.exam-list li + li .exam-item { border-top: 1px solid var(--border); }
.exam-list a.exam-item:active { opacity: 0.7; }

/* ---------- motion ---------- */
/* Short and small: a few pixels of travel, ~200ms, no bounce on whole screens. */

@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes view-in-r { from { opacity: 0.4; transform: translateX(22px); } }
@keyframes view-in-l { from { opacity: 0.4; transform: translateX(-22px); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } }
@keyframes pop { 0% { transform: scale(0.8); opacity: 0.3; } 70% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes bump { 40% { transform: scale(1.1); } }

#app.enter { animation: view-in 0.2s ease-out; }
#app.enter-r { animation: view-in-r 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
#app.enter-l { animation: view-in-l 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-in { animation: fade-in 0.18s ease-out; }
.entry.just-logged .chip { animation: pop 0.28s ease-out; }
.count-num.bump, .hero-num.bump { display: inline-block; animation: bump 0.3s ease-out; }
.sheet::backdrop { animation: fade-in 0.2s ease-out; }
.tabbar a svg { transition: transform 0.15s ease; }
.tabbar a:active svg { transform: scale(0.9); }
.card-main, .history-row, .free-row, .filter-chip, .mini { transition: background-color 0.15s ease, transform 0.1s ease; }
.mini:active, .filter-chip:active { transform: scale(0.94); }

/* Sheets: close by sliding down; swipe-down drag is driven from motion.js. */
@keyframes sheet-out { to { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-out-center { to { transform: translateY(8px) scale(0.98); opacity: 0; } }
@keyframes backdrop-out { to { opacity: 0; } }
.sheet { overscroll-behavior-y: none; } /* no rubber-band at the top, so a pull-down drags the sheet */
.sheet-head { touch-action: none; }
.sheet.closing { animation: sheet-out 0.2s ease-in forwards; }
.sheet.closing::backdrop, .sheet.dismissing::backdrop { animation: backdrop-out 0.2s ease-in forwards; }
@media (min-width: 600px) {
  .sheet.closing { animation-name: sheet-out-center; }
}

/* Calendar month change */
@keyframes slide-in-r { from { opacity: 0; transform: translateX(14px); } }
@keyframes slide-in-l { from { opacity: 0; transform: translateX(-14px); } }
.slide-in-r { animation: slide-in-r 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.slide-in-l { animation: slide-in-l 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Tab bar pill */
.tab-indicator { transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
