/* ===== VAULT CALENDAR — component styles (token-driven) ===== */

.cal-root {
  height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  background: var(--surface-sunken);
  color: var(--text);
  overflow: hidden;
}

/* ---------- TOPBAR ---------- */
.cal-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-5);
  background: var(--glass);
  backdrop-filter: blur(var(--blur-strong)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(140%);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 50;
}
.cal-brand { display: flex; align-items: center; gap: var(--space-2); min-width: 150px; }
.cal-brand .mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--text-on-accent);
  display: grid; place-items: center; flex-shrink: 0;
}
.cal-brand .wordmark {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 15px;
  letter-spacing: var(--tracking-wide);
  color: var(--text-strong);
}

.cal-nav { display: flex; align-items: center; gap: var(--space-2); }
.cal-nav-title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h2);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
  min-width: 170px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cal-nav-title .yr { color: var(--text-faint); font-weight: var(--fw-medium); margin-left: 6px; }

.icon-btn {
  width: var(--control-sm); height: var(--control-sm);
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast), transform var(--dur-fast);
}
.icon-btn:hover { background: var(--accent-soft); color: var(--text-strong); }
.icon-btn:active { transform: scale(0.9); }

.cal-spacer { flex: 1; }

.cal-actions { display: flex; align-items: center; gap: var(--space-2); }

/* Segmented view switcher */
.seg {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface-inset);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
}
.seg button {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius-xs);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.02em; color: var(--text-muted);
  transition: all var(--dur-fast) var(--ease-smooth);
}
.seg button:hover { color: var(--text-strong); }
.seg button.on {
  background: var(--surface-raised);
  color: var(--text-strong);
  box-shadow: var(--shadow-sm);
}

.today-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; height: var(--control-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--text); background: var(--surface-raised);
  font-family: var(--font-mono);
  transition: all var(--dur-fast) var(--ease-smooth);
}
.today-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 16px; height: var(--control-sm);
  border-radius: var(--radius-sm);
  background: var(--accent); color: var(--text-on-accent);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast) var(--ease-smooth);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(0.97); }

/* Theme toggle */
.theme-toggle {
  width: var(--control-sm); height: var(--control-sm);
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--text-muted); background: var(--surface-raised);
  position: relative; overflow: hidden;
  transition: all var(--dur-base) var(--ease-smooth);
}
.theme-toggle:hover { color: var(--text-strong); border-color: var(--line-strong); }
.theme-toggle svg { transition: transform var(--dur-slow) var(--ease-spring), opacity var(--dur-base); }

/* ---------- BODY GRID ---------- */
.cal-body { display: grid; grid-template-columns: 280px 1fr; overflow: hidden; min-height: 0; }

/* ---------- SIDEBAR ---------- */
.cal-side {
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow-y: auto; padding: var(--space-5) var(--space-4) var(--space-4);
  gap: var(--space-6);
}

.mini { user-select: none; }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.mini-title { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--text-strong); }
.mini-nav { display: flex; gap: 2px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-dow {
  font-family: var(--font-mono); font-size: 9px; font-weight: var(--fw-semibold);
  color: var(--text-faint); text-align: center; padding-bottom: 5px;
  letter-spacing: 0.04em;
}
.mini-cell {
  aspect-ratio: 1; display: grid; place-items: center;
  font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
  border-radius: var(--radius-xs); color: var(--text); cursor: pointer;
  position: relative;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.mini-cell:hover { background: var(--accent-soft); }
.mini-cell.dim { color: var(--text-faint); }
.mini-cell.today { background: var(--accent); color: var(--text-on-accent); font-weight: var(--fw-semibold); }
.mini-cell.sel { box-shadow: inset 0 0 0 1.5px var(--line-strong); font-weight: var(--fw-semibold); }
.mini-cell .dot { position: absolute; bottom: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }
.mini-cell.today .dot { background: var(--text-on-accent); }

/* Groups */
.side-section-label {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-3);
}
.groups { display: flex; flex-direction: column; gap: 2px; }
.group-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--dur-fast);
}
.group-row:hover { background: var(--accent-soft); }
.group-check {
  width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0;
  border: 1.5px solid var(--cc); display: grid; place-items: center;
  transition: all var(--dur-fast) var(--ease-smooth);
}
.group-check.on { background: var(--cc); box-shadow: 0 0 10px color-mix(in srgb, var(--cc) 60%, transparent); }
.group-check svg { opacity: 0; transform: scale(0.5); transition: all var(--dur-fast) var(--ease-spring); }
.group-check.on svg { opacity: 1; transform: scale(1); }
.group-name { flex: 1; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text); }
.group-row.off .group-name { color: var(--text-faint); }
.group-count {
  font-family: var(--font-mono); font-size: var(--fs-micro);
  color: var(--text-faint); background: var(--surface-inset);
  padding: 1px 7px; border-radius: var(--radius-pill);
}
.group-x {
  width: 0; opacity: 0; overflow: hidden; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-faint);
  transition: all var(--dur-fast);
}
.group-row:hover .group-x { width: 18px; opacity: 0.7; }
.group-x:hover { opacity: 1 !important; color: var(--critical); background: var(--critical-soft); }
.add-group {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; margin-top: 4px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-muted); border: 1px dashed var(--line);
  transition: all var(--dur-fast);
}
.add-group:hover { color: var(--text-strong); border-color: var(--line-strong); background: var(--accent-soft); }

/* ---------- MAIN VIEW ---------- */
.cal-main { overflow: hidden; display: flex; flex-direction: column; min-width: 0; position: relative; }
/* Mount-entrance reveals are interaction/focus dependent; essential content
   stays visible at rest (offscreen iframes pause CSS animations). */
.view-anim {}

/* ===== MONTH GRID ===== */
.month { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.month-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.month-dow span {
  padding: 10px 14px; font-family: var(--font-mono);
  font-size: var(--fs-micro); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-faint);
}
.month-dow span.we { color: var(--text-muted); }
.month-grid {
  flex: 1; display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  min-height: 0;
}
.day-cell {
  border-right: 1px solid var(--line-subtle);
  border-bottom: 1px solid var(--line-subtle);
  padding: 6px 7px; display: flex; flex-direction: column; gap: 3px;
  min-height: 0; overflow: hidden; cursor: pointer; position: relative;
  background: var(--surface);
  transition: background var(--dur-fast);
}
.day-cell:nth-child(7n) { border-right: none; }
.day-cell.other { background: var(--surface-subtle); }
.day-cell.other .day-num { color: var(--text-faint); }
.day-cell.we { background: color-mix(in srgb, var(--surface-sunken) 50%, var(--surface)); }
.day-cell:hover { background: var(--accent-soft); }
.day-cell .add-here {
  position: absolute; top: 6px; right: 7px;
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--text-on-accent);
  opacity: 0; transform: scale(0.6); pointer-events: none;
  transition: all var(--dur-fast) var(--ease-spring);
}
.day-cell:hover .add-here { opacity: 1; transform: scale(1); }
.day-top { display: flex; align-items: center; }
.day-num {
  font-family: var(--font-display);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text); font-variant-numeric: tabular-nums;
  width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%;
}
.day-cell.today-cell .day-num {
  background: var(--accent); color: var(--text-on-accent);
  font-weight: var(--fw-bold);
}
.day-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }

.chip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 7px; border-radius: var(--radius-xs);
  font-size: 11.5px; font-weight: var(--fw-medium);
  color: var(--text); cursor: pointer; min-width: 0;
  background: color-mix(in srgb, var(--cc) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--cc) 38%, transparent);
  transition: transform var(--dur-fast) var(--ease-smooth), box-shadow var(--dur-fast), filter var(--dur-fast);
}
.chip:hover { transform: translateX(2px); box-shadow: 0 2px 12px color-mix(in srgb, var(--cc) 25%, transparent); filter: brightness(1.1); }
.chip .cdot { width: 6px; height: 6px; border-radius: 50%; background: var(--cc); box-shadow: 0 0 6px var(--cc); flex-shrink: 0; }
.chip .ctime { font-family: var(--font-mono); font-size: 10px; color: color-mix(in srgb, var(--cc) 70%, var(--text)); flex-shrink: 0; white-space: nowrap; }
.chip .ctitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.allday { background: var(--cc); border-color: transparent; color: #0B0B0D; font-weight: var(--fw-semibold); }
.chip.allday .ctitle { color: #0B0B0D; }
@keyframes chipIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.more-link {
  font-size: 11px; font-weight: var(--fw-semibold); color: var(--text-muted);
  padding: 1px 7px; cursor: pointer; border-radius: var(--radius-xs);
}
.more-link:hover { color: var(--text-strong); background: var(--accent-soft); }

/* ===== AGENDA ===== */
.agenda { overflow-y: auto; flex: 1; padding: var(--space-6) var(--space-8); }
.agenda-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-5); }

/* Next-up hero — the first thing you see */
.next-hero {
  position: relative; cursor: pointer;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--cc) 38%, transparent);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--cc) 20%, transparent) 0%, transparent 55%),
    var(--surface-raised);
  padding: 20px 22px;
  box-shadow: 0 10px 36px color-mix(in srgb, var(--cc) 16%, transparent), var(--shadow-md);
  transition: transform var(--dur-fast) var(--ease-smooth), box-shadow var(--dur-base);
  margin-bottom: var(--space-2);
}
.next-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 48px color-mix(in srgb, var(--cc) 26%, transparent), var(--shadow-lg);
}
.next-hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.next-hero-label {
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: color-mix(in srgb, var(--cc) 80%, var(--text)); white-space: nowrap;
}
.next-hero-group {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted);
  border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px 11px;
  background: var(--surface);
}
.next-hero-group .gdot { width: 8px; height: 8px; border-radius: 50%; background: var(--cc); box-shadow: 0 0 8px var(--cc); }
.next-hero-title {
  font-family: var(--font-display); font-size: 26px; font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight); color: var(--text-strong); line-height: 1.15;
}
.next-hero-meta {
  display: flex; align-items: center; gap: 14px; margin-top: 10px;
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted);
}
.next-hero-meta .when { color: color-mix(in srgb, var(--cc) 85%, var(--text)); font-weight: var(--fw-semibold); white-space: nowrap; }
.next-hero-meta .loc { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.agenda-day { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-5); }
.agenda-date { position: sticky; top: 0; }
.agenda-dow { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-faint); }
.agenda-dow.is-today { color: var(--text-strong); }
.agenda-dnum { font-family: var(--font-display); font-size: 34px; font-weight: var(--fw-bold); color: var(--text-muted); line-height: 1; margin-top: 4px; }
.agenda-dnum.is-today { color: var(--text-strong); }
.agenda-mon { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-faint); margin-top: 4px; white-space: nowrap; }
.agenda-events { display: flex; flex-direction: column; gap: var(--space-2); }
.agenda-card {
  display: flex; align-items: center; gap: var(--space-4);
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface-raised); border: 1px solid var(--line-subtle);
  border-left: 3px solid var(--cc); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-smooth), box-shadow var(--dur-fast), border-color var(--dur-fast);
}
.agenda-card:hover {
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--cc) 40%, var(--line-subtle));
  box-shadow: 0 6px 24px color-mix(in srgb, var(--cc) 14%, transparent), var(--shadow-md);
}
.agenda-time { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); min-width: 118px; white-space: nowrap; }
.agenda-ev-title { font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--text-strong); }
.agenda-ev-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.agenda-empty { text-align: center; color: var(--text-faint); padding: 80px 0; }

/* ===== WEEK ===== */
.week { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.week-head { display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid var(--line); background: var(--surface); }
.week-head .corner { border-right: 1px solid var(--line-subtle); }
.week-hcell { padding: 8px; text-align: center; border-right: 1px solid var(--line-subtle); }
.week-hcell .wd { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.week-hcell .wn { font-family: var(--font-display); font-size: 18px; font-weight: var(--fw-bold); color: var(--text-strong); margin-top: 2px; width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 50%; }
.week-hcell.today-col .wn { background: var(--accent); color: var(--text-on-accent); }
.week-allday { display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid var(--line); background: var(--surface); max-height: 104px; overflow-y: auto; }
.week-allday .wad-label { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); padding: 7px 8px 0 0; text-align: right; border-right: 1px solid var(--line-subtle); }
.wad-col { border-right: 1px solid var(--line-subtle); padding: 5px 4px; display: flex; flex-direction: column; gap: 3px; min-height: 30px; cursor: pointer; }
.wad-col.we { background: color-mix(in srgb, var(--surface-sunken) 50%, var(--surface)); }
.wad-col.today-col { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.wad-chip {
  font-size: 11px; line-height: 1.35; padding: 2px 8px; border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--cc) 22%, var(--surface));
  border-left: 2px solid var(--cc); color: var(--text-strong); font-weight: var(--fw-semibold);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: filter var(--dur-fast);
}
.wad-chip:hover { filter: brightness(1.12); }
.week-scroll { flex: 1; overflow-y: auto; }
.week-grid { display: grid; grid-template-columns: 60px repeat(7, 1fr); position: relative; }
.week-hours { display: flex; flex-direction: column; }
.hour-row { height: 52px; border-bottom: 1px solid var(--line-subtle); position: relative; }
.hour-label { position: absolute; top: -7px; right: 8px; font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); white-space: nowrap; }
.week-col { border-right: 1px solid var(--line-subtle); position: relative; }
.week-col.we { background: color-mix(in srgb, var(--surface-sunken) 50%, var(--surface)); }
.week-ev {
  position: absolute; left: 3px; right: 3px;
  border-radius: var(--radius-xs); padding: 4px 7px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--cc) 24%, var(--surface));
  border-left: 3px solid var(--cc);
  box-shadow: var(--shadow-sm);
  transition: filter var(--dur-fast), box-shadow var(--dur-fast);
}
.week-ev:hover { filter: brightness(1.12); box-shadow: 0 4px 18px color-mix(in srgb, var(--cc) 30%, transparent); z-index: 3; }
.week-ev .we-title { font-size: 11.5px; font-weight: var(--fw-semibold); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-ev .we-time { font-family: var(--font-mono); font-size: 9.5px; color: color-mix(in srgb, var(--cc) 70%, var(--text)); }
.now-line { position: absolute; left: 60px; right: 0; height: 2px; background: var(--critical); z-index: 4; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--critical); }

/* ===== MODAL ===== */
.scrim {
  position: fixed; inset: 0; z-index: 200;
  background: var(--scrim); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn var(--dur-base) ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 460px; max-width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalIn var(--dur-slow) var(--ease-spring);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: var(--fs-h3); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: var(--space-4); }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); }
.input, .select {
  width: 100%; height: var(--control-md); padding: 0 12px;
  background: var(--surface-inset); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-body);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input.title-input { height: var(--control-lg); font-size: var(--fs-h3); font-weight: var(--fw-semibold); font-family: var(--font-display); }
.input:focus, .select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--accent-ring); }
.textarea { min-height: 70px; padding: 10px 12px; resize: vertical; line-height: var(--lh-normal); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* Quick-move day chips in the event editor */
.quick-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.qd {
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: var(--fw-semibold);
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 11px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); color: var(--text-muted);
  background: var(--surface-inset);
  transition: all var(--dur-fast) var(--ease-smooth);
}
.qd:hover { color: var(--text-strong); border-color: var(--line-strong); transform: translateY(-1px); }
.qd.on { background: var(--accent); color: var(--text-on-accent); border-color: transparent; }

.group-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.gp {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-muted); transition: all var(--dur-fast) var(--ease-smooth);
}
.gp .gp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cc); }
.gp:hover { border-color: var(--cc); color: var(--text-strong); }
.gp.on { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, var(--surface)); color: var(--text-strong); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch-track { width: 38px; height: 22px; border-radius: var(--radius-pill); background: var(--surface-inset); border: 1px solid var(--line); position: relative; transition: background var(--dur-base); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-faint); transition: transform var(--dur-base) var(--ease-spring), background var(--dur-base); }
.switch.on .switch-track { background: var(--accent); }
.switch.on .switch-knob { transform: translateX(16px); background: var(--text-on-accent); }
.switch-label { font-size: var(--fs-sm); color: var(--text); }
.switch-hint { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-faint); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; height: var(--control-md); border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted);
  transition: all var(--dur-fast);
}
.btn-ghost:hover { color: var(--text-strong); background: var(--accent-soft); }
.btn-ghost.danger:hover { color: var(--critical); background: var(--critical-soft); }
.btn-solid {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 18px; height: var(--control-md); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--text-on-accent);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm); transition: all var(--dur-fast) var(--ease-smooth);
}
.btn-solid:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-solid:active { transform: scale(0.98); }

/* Day peek popover */
.daypeek-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.daypeek-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-subtle); border-left: 3px solid var(--cc); cursor: pointer; transition: background var(--dur-fast); }
.daypeek-row:hover { background: var(--accent-soft); }
.daypeek-time { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); min-width: 64px; }
.daypeek-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text); }

/* search */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 10px; color: var(--text-faint); pointer-events: none; }
.search-input {
  width: 180px; height: var(--control-sm); padding: 0 12px 0 32px;
  background: var(--surface-inset); border: 1px solid var(--line-subtle);
  border-radius: var(--radius-pill); font-size: var(--fs-sm); color: var(--text);
  transition: all var(--dur-base) var(--ease-smooth);
}
.search-input:focus { width: 220px; border-color: var(--line); box-shadow: 0 0 0 3px var(--accent-ring); }
.search-input::placeholder { color: var(--text-faint); }

@media (max-width: 1480px) {
  .seg .seg-label { display: none; }
  .seg button { padding: 5px 10px; }
  .search-input { width: 140px; }
  .search-input:focus { width: 180px; }
  .cal-nav-title { font-size: 19px; min-width: 150px; }
}

@media (max-width: 1180px) {
  .search-wrap { display: none; }
  .np-label { display: none; }
  .btn-primary { padding: 0 10px; }
  .today-btn { padding: 0 10px; }
}

@media (max-width: 920px) {
  .cal-body { grid-template-columns: 1fr; }
  .cal-side { display: none; }
  .cal-nav-title { min-width: auto; }
  .search-wrap { display: none; }
}
