/* ---------------------------------------------------------------
   Components
   --------------------------------------------------------------- */

/* ============ Icon tiles (pastel containers) ============ */

.icon-tile {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--tile-violet-bg);
  color: var(--tile-violet-fg);
}

.icon-tile--sm { width: 34px; height: 34px; border-radius: var(--r-sm); }
.icon-tile--lg { width: 56px; height: 56px; border-radius: var(--r-lg); }

.icon-tile--violet { background: var(--tile-violet-bg); color: var(--tile-violet-fg); }
.icon-tile--blue   { background: var(--tile-blue-bg);   color: var(--tile-blue-fg); }
.icon-tile--mint   { background: var(--tile-mint-bg);   color: var(--tile-mint-fg); }
.icon-tile--gold   { background: var(--tile-gold-bg);   color: var(--tile-gold-fg); }
.icon-tile--rose   { background: var(--tile-rose-bg);   color: var(--tile-rose-fg); }
.icon-tile--pink   { background: var(--tile-pink-bg);   color: var(--tile-pink-fg); }
.icon-tile--teal   { background: var(--tile-teal-bg);   color: var(--tile-teal-fg); }
.icon-tile--slate  { background: var(--tile-slate-bg);  color: var(--tile-slate-fg); }

/* ============ Buttons ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text-strong);
  transition: background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.btn--primary {
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-violet);
}
.btn--primary:hover { background: var(--primary-hover); }

.btn--secondary {
  background: var(--primary-soft);
  color: var(--violet-700);
}
.btn--secondary:hover { background: var(--violet-200); }

.btn--outline {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-strong);
  box-shadow: var(--shadow-xs);
}
.btn--outline:hover { border-color: var(--border-strong); background: var(--bg-sunken); }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn--ghost:hover { background: var(--bg-sunken); color: var(--text-strong); }

.btn--danger {
  background: var(--rose-50);
  color: var(--rose-600);
  border-color: var(--rose-100);
}
.btn--danger:hover { background: var(--rose-100); }

.btn--success {
  background: var(--mint-500);
  color: #fff;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.22);
}
.btn--success:hover { background: var(--mint-600); }

.btn--lg { min-height: 52px; padding: 0 var(--s-7); font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn--sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 44px; }
.btn--icon.btn--sm { width: 36px; }

/* ============ Cards ============ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
  /* Flex/grid children default to min-width:auto, which lets wide content (the
     status track, tables) push the whole page sideways. Constrain it here so
     wide content scrolls inside its own container instead. */
  min-width: 0;
  max-width: 100%;
}

.card--flat { box-shadow: none; }
.card--pad-lg { padding: var(--s-6); }
.card--pad-0 { padding: 0; }
.card--lavender { background: var(--bg-lavender-soft); border-color: var(--violet-100); }

.card--link {
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
  text-align: left;
  width: 100%;
  display: block;
}
.card--link:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--violet-200);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--text-strong);
}

.card__body { padding: var(--s-5); }
.card__divider { border-top: 1px solid var(--border-soft); }

/* ============ Badges & status ============ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
  white-space: nowrap;
  background: var(--bg-sunken);
  color: var(--text-muted);
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
  flex: none;
}

.badge--violet { background: var(--violet-50); color: var(--violet-700); }
.badge--blue   { background: var(--blue-50);   color: var(--blue-600); }
.badge--mint   { background: var(--mint-50);   color: var(--mint-600); }
.badge--gold   { background: var(--gold-50);   color: var(--gold-600); }
.badge--rose   { background: var(--rose-50);   color: var(--rose-600); }
.badge--pink   { background: var(--pink-50);   color: var(--pink-500); }
.badge--teal   { background: var(--teal-50);   color: var(--teal-500); }
.badge--slate  { background: var(--bg-sunken); color: var(--text-muted); }

.badge--lg { padding: 6px 14px; font-size: var(--fs-sm); }

/* ============ Avatars ============ */

.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  flex: none;
  background: var(--violet-100);
  color: var(--violet-700);
}

.avatar--sm { width: 34px; height: 34px; font-size: var(--fs-xs); }
.avatar--lg { width: 60px; height: 60px; font-size: var(--fs-lg); }

.avatar--v0 { background: #ede9fe; color: #6d28d9; }
.avatar--v1 { background: #dbeafe; color: #1d4ed8; }
.avatar--v2 { background: #d1fae5; color: #047857; }
.avatar--v3 { background: #fef3c7; color: #b45309; }
.avatar--v4 { background: #fce7f3; color: #be185d; }
.avatar--v5 { background: #ccfbf1; color: #0f766e; }
.avatar--v6 { background: #ffe4e6; color: #be123c; }
.avatar--v7 { background: #e0e7ff; color: #4338ca; }

/* ============ Form controls ============ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
}

.field__hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}

.field__error {
  font-size: var(--fs-sm);
  color: var(--rose-600);
  font-weight: var(--fw-medium);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-strong);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-subtle); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--violet-400);
  box-shadow: 0 0 0 3px var(--violet-100);
}

.textarea {
  min-height: 110px;
  resize: vertical;
  line-height: var(--lh-normal);
  padding-top: var(--s-3);
}

.textarea--tall { min-height: 200px; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group__icon {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
}

.input-group .input { padding-left: 42px; }

/* Search box in topbar */
.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 420px;
}
.search .input {
  min-height: 44px;
  background: var(--bg-sunken);
  border-color: transparent;
  padding-left: 42px;
}
.search .input:focus { background: var(--bg-surface); }
.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

/* ---- Toggle switch ---- */

.toggle {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.toggle:hover { border-color: var(--border-strong); }
.toggle[aria-checked="true"] { border-color: var(--violet-200); background: var(--bg-lavender-soft); }

.toggle__track {
  width: 44px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--border-strong);
  position: relative;
  flex: none;
  transition: background var(--dur) var(--ease);
}
.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}
.toggle[aria-checked="true"] .toggle__track { background: var(--primary); }
.toggle[aria-checked="true"] .toggle__thumb { transform: translateX(18px); }

/* ---- Choice chips (segmented options) ---- */

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  transition: all var(--dur-fast) var(--ease);
}
.choice:hover { border-color: var(--border-strong); }
.choice[aria-pressed="true"] {
  border-color: var(--violet-400);
  background: var(--violet-50);
  color: var(--violet-700);
  font-weight: var(--fw-semibold);
  box-shadow: 0 0 0 3px var(--violet-100);
}

.choice--tile {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: var(--s-4);
  min-height: 74px;
  text-align: left;
  width: 100%;
}

/* ---- Checkbox ---- */

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.check__box {
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  border: 2px solid var(--border-strong);
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
  color: transparent;
  transition: all var(--dur-fast) var(--ease);
}

.check[aria-checked="true"] .check__box {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.check--mint[aria-checked="true"] .check__box {
  background: var(--mint-500);
  border-color: var(--mint-500);
}

/* ---- Stepper (- 1 +) ---- */

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.stepper__btn {
  width: 44px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.stepper__btn:hover { background: var(--violet-50); color: var(--violet-700); }
.stepper__btn[disabled] { opacity: 0.35; pointer-events: none; }

.stepper__value {
  min-width: 52px;
  text-align: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  height: 46px;
  line-height: 46px;
}

.stepper--lg .stepper__btn { width: 56px; height: 60px; }
.stepper--lg .stepper__value { min-width: 76px; height: 60px; line-height: 60px; font-size: var(--fs-2xl); }

/* ============ Progress ============ */

.progress {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--grad-violet);
  transition: width var(--dur-slow) var(--ease-out);
}

.progress--mint .progress__bar { background: linear-gradient(135deg, #34d399, #059669); }
.progress--gold .progress__bar { background: linear-gradient(135deg, #fbbf24, #d97706); }
.progress--thin { height: 6px; }

/* ============ Sidebar ============ */

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: var(--z-nav);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
}

.sidebar__brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--violet-100);
  color: var(--violet-600);
  flex: none;
}

.sidebar__brand-name {
  font-weight: var(--fw-bold);
  color: var(--text-strong);
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
}

.sidebar__nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s-2) var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section-label {
  padding: var(--s-4) var(--s-3) var(--s-2);
}

.navlink {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
  min-height: 44px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  text-decoration: none;
}
.navlink:hover { background: var(--bg-sunken); color: var(--text-strong); text-decoration: none; }

.navlink[aria-current="page"] {
  background: var(--violet-50);
  color: var(--violet-700);
  font-weight: var(--fw-semibold);
}

.navlink__count {
  margin-left: auto;
  background: var(--violet-100);
  color: var(--violet-700);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  padding: 2px 8px;
  min-width: 22px;
  text-align: center;
}

.sidebar__foot {
  border-top: 1px solid var(--border-soft);
  padding: var(--s-4);
}

.studio-chip {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border-radius: var(--r-md);
  width: 100%;
  transition: background var(--dur-fast) var(--ease);
}
.studio-chip:hover { background: var(--bg-sunken); }

/* ============ Topbar ============ */

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 0 var(--s-8);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  position: relative;
  transition: all var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text-strong); }

.icon-btn__dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--rose-500);
  border: 2px solid var(--bg-surface);
}

/* Role switcher */
.role-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  gap: 2px;
}

.role-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  min-height: 36px;
  transition: all var(--dur-fast) var(--ease);
}
.role-switch__btn[aria-pressed="true"] {
  background: var(--bg-surface);
  color: var(--violet-700);
  box-shadow: var(--shadow-sm);
}

/* ============ Mobile bottom nav ============ */

.bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-soft);
  z-index: var(--z-nav);
  align-items: stretch;
}

.bottomnav__item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  min-height: 44px;
}
.bottomnav__item[aria-current="page"] { color: var(--violet-600); }
.bottomnav__item:hover { text-decoration: none; }

.bottomnav__fab {
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--grad-violet);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-violet);
  margin-top: -18px;
}

/* ============ Greeting hero ============ */

.hero {
  position: relative;
  border-radius: var(--r-2xl);
  padding: var(--s-7);
  background: var(--grad-lavender);
  border: 1px solid var(--violet-100);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-mist);
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

.hero__title {
  font-size: var(--fs-4xl);
  letter-spacing: -0.03em;
}

.hero__sub {
  color: var(--text-muted);
  font-size: var(--fs-md);
  margin-top: var(--s-2);
}

/* ============ KPI card ============ */

.kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  text-align: left;
  width: 100%;
}

.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi__label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

.kpi__value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-strong);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.kpi__delta {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

/* ============ Kanban pipeline ============ */

.kanban {
  display: flex;
  gap: var(--s-4);
  overflow-x: auto;
  padding-bottom: var(--s-3);
  scroll-snap-type: x proximity;
}

.kanban__col {
  flex: 0 0 268px;
  background: var(--bg-sunken);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  scroll-snap-align: start;
}

.kanban__col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-2);
}

.kanban__col-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-strong);
}

.kanban__col-rule {
  height: 3px;
  border-radius: var(--r-full);
  background: var(--violet-300);
  margin: 0 var(--s-2);
}

.kanban__card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  width: 100%;
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.kanban__card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* ============ Calendar ============ */

.cal {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.cal__head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-soft);
}

.cal__weekday {
  padding: var(--s-3) var(--s-2);
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal__day {
  min-height: 112px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  text-align: left;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-surface);
  transition: background var(--dur-fast) var(--ease);
  overflow: hidden;
}

.cal__grid > .cal__day:nth-child(7n) { border-right: none; }
.cal__day:hover { background: var(--bg-lavender-soft); }

.cal__day--outside { background: var(--bg-sunken); }
.cal__day--outside .cal__daynum { color: var(--text-subtle); }
.cal__day--outside:hover { background: var(--bg-sunken); }

.cal__daynum {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  flex: none;
}

.cal__day--today .cal__daynum {
  background: var(--primary);
  color: #fff;
}

.cal__day--selected {
  background: var(--bg-lavender);
  box-shadow: inset 0 0 0 2px var(--violet-400);
}

.cal__events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cal__chip {
  font-size: 11px;
  line-height: 1.35;
  font-weight: var(--fw-medium);
  color: var(--text-strong);
  background: var(--bg-sunken);
  border-left: 3px solid var(--violet-500);
  border-radius: 4px;
  padding: 3px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal__more {
  font-size: 10px;
  color: var(--text-subtle);
  font-weight: var(--fw-semibold);
  padding-left: 5px;
}

.cal__dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: auto;
}

.cal__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  display: block;
}

@media (max-width: 720px) {
  .cal__day {
    min-height: 62px;
    padding: 4px;
    align-items: center;
    gap: 3px;
  }
  .cal__daynum { width: 24px; height: 24px; font-size: var(--fs-xs); }
  .cal__weekday { padding: var(--s-2) 0; }
}

/* ============ Tabs ============ */

.tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  min-height: 46px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text-strong); }
.tab[aria-selected="true"] { color: var(--violet-700); border-bottom-color: var(--violet-600); }

.tab__count {
  margin-left: 6px;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  font-weight: var(--fw-bold);
}

/* ============ Drawer / modal ============ */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  opacity: 0;
  animation: fadeIn var(--dur) var(--ease) forwards;
  backdrop-filter: blur(2px);
}

@keyframes fadeIn { to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(960px, 96vw);
  background: var(--bg-surface);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  animation: slideIn var(--dur-slow) var(--ease-out) forwards;
}

.drawer--narrow { width: min(560px, 96vw); }

@keyframes slideIn { to { transform: translateX(0); } }

.drawer__head {
  flex: none;
  padding: var(--s-6);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s-6);
}

.drawer__body--split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--s-6);
  align-items: start;
}

.drawer__foot {
  flex: none;
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--border-soft);
  display: flex;
  gap: var(--s-3);
  background: var(--bg-surface);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.97);
  width: min(560px, 94vw);
  max-height: 88vh;
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: popIn var(--dur) var(--ease-out) forwards;
}

@keyframes popIn {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal__head { padding: var(--s-6) var(--s-6) var(--s-4); }
.modal__body { padding: 0 var(--s-6); overflow-y: auto; flex: 1 1 auto; }
.modal__foot { padding: var(--s-5) var(--s-6) var(--s-6); display: flex; gap: var(--s-3); }

/* ============ Toast ============ */

.toast-host {
  position: fixed;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 92vw;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-full);
  background: var(--text-strong);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  animation: toastIn var(--dur) var(--ease-out);
}

.toast--success { background: var(--mint-600); }
.toast--warn { background: var(--gold-600); }
.toast--error { background: var(--rose-600); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Timeline / status track ============ */

.track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: var(--s-2);
}

.track__step {
  flex: 1 1 0;
  min-width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  text-align: center;
  position: relative;
}

.track__step::before,
.track__step::after {
  content: "";
  position: absolute;
  top: 15px;
  height: 2px;
  background: var(--border);
  width: 50%;
}
.track__step::before { left: 0; }
.track__step::after { right: 0; }
.track__step:first-child::before,
.track__step:last-child::after { display: none; }

.track__step--done::before,
.track__step--done::after,
.track__step--current::before { background: var(--violet-400); }

.track__dot {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-subtle);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  position: relative;
  z-index: 1;
}

.track__step--done .track__dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.track__step--current .track__dot {
  border-color: var(--primary);
  color: var(--violet-700);
  box-shadow: 0 0 0 4px var(--violet-100);
}

.track__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  line-height: var(--lh-snug);
  padding: 0 4px;
}
.track__step--current .track__label { color: var(--violet-700); }
.track__step--done .track__label { color: var(--text-strong); }

/* Vertical checklist */
.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.checklist__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  text-align: left;
  width: 100%;
  transition: all var(--dur-fast) var(--ease);
}
.checklist__item:hover { border-color: var(--border-strong); }
.checklist__item--done { background: var(--bg-lavender-soft); border-color: var(--violet-100); }
.checklist__item--current { border-color: var(--violet-400); box-shadow: 0 0 0 3px var(--violet-100); }

.checklist__num {
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  flex: none;
}
.checklist__item--done .checklist__num { background: var(--primary); color: #fff; }
.checklist__item--current .checklist__num { background: var(--violet-100); color: var(--violet-700); }

/* ============ Lists / rows ============ */

.list {
  display: flex;
  flex-direction: column;
}

.list__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  width: 100%;
}
.list__row:last-child { border-bottom: none; }

.list__row--link { transition: background var(--dur-fast) var(--ease); border-radius: var(--r-sm); }
.list__row--link:hover { background: var(--bg-sunken); }

/* Data table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.table th {
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: var(--fw-semibold);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--bg-lavender-soft); }

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
}

/* ============ Empty state ============ */

.empty {
  text-align: center;
  padding: var(--s-12) var(--s-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
}

.empty__icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-xl);
  display: grid;
  place-items: center;
  background: var(--violet-50);
  color: var(--violet-400);
  margin-bottom: var(--s-1);
}

/* ============ Callouts ============ */

.callout {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--bg-lavender-soft);
  border: 1px solid var(--violet-100);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--text);
}

.callout--mint { background: var(--mint-50); border-color: var(--mint-100); }
.callout--gold { background: var(--gold-50); border-color: var(--gold-100); }
.callout--rose { background: var(--rose-50); border-color: var(--rose-100); }
.callout--blue { background: var(--blue-50); border-color: var(--blue-100); }

.callout__icon { flex: none; margin-top: 1px; }

/* ============ Quote summary panel ============ */

.quote-panel {
  background: var(--bg-lavender-soft);
  border: 1px solid var(--violet-100);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: sticky;
  top: var(--s-4);
}

.quote-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  font-size: var(--fs-base);
}

.quote-line__label { color: var(--text); }
.quote-line__sub { font-size: var(--fs-xs); color: var(--text-muted); }
.quote-line__amount {
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quote-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-4);
  margin-top: var(--s-2);
  border-top: 1px solid var(--violet-200);
}

.quote-total__value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--violet-700);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ============ File upload box ============ */

.upload {
  border: 2px dashed var(--violet-200);
  border-radius: var(--r-lg);
  background: var(--bg-lavender-soft);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  text-align: center;
  width: 100%;
  transition: all var(--dur-fast) var(--ease);
  cursor: pointer;
}
.upload:hover,
.upload.is-drag {
  border-color: var(--violet-400);
  background: var(--violet-50);
}

.file-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
}

/* ============ Folder tree ============ */

.tree {
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 2;
}

.tree__node {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 2px 0;
}

.tree__indent { padding-left: var(--s-6); }

/* ============ Misc ============ */

.divider {
  height: 1px;
  background: var(--border-soft);
  margin: var(--s-5) 0;
}

.dot-sep {
  width: 3px;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--text-subtle);
  flex: none;
}

.pill-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

.link-btn {
  color: var(--text-link);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.link-btn:hover { text-decoration: underline; }

.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 40px;
}

.spark__bar {
  flex: 1 1 0;
  border-radius: 2px 2px 0 0;
  background: var(--violet-200);
  min-height: 4px;
}
.spark__bar--hi { background: var(--violet-500); }

/* Phase 2: Suzanne-friendly guide cards */
.client-guide {
  overflow: hidden;
}

.mini-step {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
}

.mini-step__num {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--violet-500), var(--blue-500));
  box-shadow: var(--shadow-soft);
}

/* Phase 4: make the selected year unmistakable. */
.year-filter .choice[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px var(--violet-100);
}

/* Phase 6 secure sign-in */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 56px);
  background:
    radial-gradient(circle at 15% 15%, rgba(196, 181, 253, 0.32), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(186, 230, 253, 0.28), transparent 34%),
    #f8fafc;
}

.auth-card {
  width: min(100%, 470px);
  display: grid;
  gap: var(--s-6);
  padding: clamp(24px, 5vw, 42px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 24px 70px rgba(30, 41, 59, 0.12);
}

.auth-card--wide { width: min(100%, 760px); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 750; color: var(--text-strong); }
.auth-brand__mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--violet-100); color: var(--violet-600); }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-subtle); font-size: var(--fs-xs); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============ Password visibility controls ============ */
.password-control {
  position: relative;
  width: 100%;
}

.password-control .input {
  padding-right: 92px;
}

.password-control__toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

.password-control__toggle:hover {
  background: var(--violet-50);
  color: var(--violet-700);
}

.password-control__toggle:focus-visible {
  outline: 2px solid var(--violet-400);
  outline-offset: 1px;
}
