/* MiCal Dashboard Styles */

/* Inter Variable — self-hosted from /public/fonts/. font-display: swap so
   text renders immediately in the fallback stack and reflows once Inter
   loads. Single variable file covers every weight 100–900 and italic. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/InterVariable.woff2") format("woff2");
}
@font-face {
  font-family: "Inter Variable";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/InterVariable-Italic.woff2") format("woff2");
}

:root {
  /* Brand. Teal is the single primary accent for actions and active
     states. --ink-blue is reserved for text-only use (link color, etc.);
     the dashboard chrome should not pair it with teal anywhere. */
  --flow-teal: #00c2a8;
  --teal-dark: #009e88;
  --ink-blue: #0f4c81;
  /* Legacy alias — many existing rules still reference --bridge-blue.
     New rules should use --ink-blue (for text) or --flow-teal (for
     accent/action). This alias keeps the file valid while we migrate. */
  --bridge-blue: var(--ink-blue);

  /* Surface scale. Grays read warmer than absolute neutral — closer to
     Linear/Stripe than Material. */
  --white: #ffffff;
  --surface-1: #fafbfc; /* Page background */
  --cloud: #f5f7fa; /* Card hovers, subtle tints */
  --surface-3: #eef0f4; /* Borders that need to read as a panel */

  /* Type colors */
  --charcoal: #1a202c;
  --stone: #718096;

  /* Semantic */
  --danger: #e53e3e;
  --danger-dark: #c53030;
  --warning: #d69e2e;
  --success: #38a169;

  /* Spacing scale — 4px base, no in-between values. Everything else
     in the codebase should snap to a multiple of these. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Border-radius scale */
  --radius-sm: 6px; /* small chips, dense controls */
  --radius-md: 8px; /* buttons, inputs */
  --radius-lg: 12px; /* cards */
  --radius-xl: 16px; /* modals */
  --radius-full: 9999px;

  /* Shadow scale — cool-tinted (slate, not pure black), layered for depth */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04),
    0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 8px -2px rgba(15, 23, 42, 0.06),
    0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-overlay: 0 16px 48px -8px rgba(15, 23, 42, 0.18),
    0 4px 12px -4px rgba(15, 23, 42, 0.08);

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
}

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

/* The HTML hidden attribute is supposed to act like display:none, but any
   later rule with an explicit display value will override it. We rely on
   `el.hidden = true` for menu/dropdown toggling in several places, so make
   the attribute authoritative globally. !important is the recommended
   guard for exactly this pattern. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  /* Explicit light scheme. The semantic tokens above are the seam a
     future dark theme plugs into — when we're ready, add a
     @media (prefers-color-scheme: dark) (or a [data-theme="dark"])
     block that remaps --surface-*/--charcoal/--stone and tokenizes the
     remaining hardcoded rgba borders. Until then this prevents the OS
     dark setting from rendering form controls dark on a light app. */
  color-scheme: light;
}

body {
  font-family:
    "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings:
    "cv11",
    "ss01",
    "cv02";
  font-variant-numeric: tabular-nums;
  color: var(--charcoal);
  line-height: 1.55;
  background: var(--surface-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--white);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-header a {
  font-size: 1.4rem;
  font-weight: 650;
  color: var(--charcoal);
  text-decoration: none;
  letter-spacing: -0.02em;
}

/* Wordmark used to split "Mi" charcoal + "Cal" teal — premium-SaaS
   reference cohort (Linear, Vercel, Stripe) all ship single-color
   wordmarks. The mark itself (logo.svg) carries the brand colors. */
.sidebar-header a span {
  color: inherit;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--stone);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--cloud);
  color: var(--charcoal);
}

.nav-item.active {
  background: rgba(0, 194, 168, 0.1);
  color: var(--charcoal);
  font-weight: 600;
  position: relative;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--flow-teal);
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--flow-teal);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bridge-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-details {
  overflow: hidden;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--stone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  gap: 6px;
}

.btn-primary {
  background: var(--flow-teal);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  background: var(--white);
  color: var(--charcoal);
  border: 1px solid var(--surface-3);
}

.btn-secondary:hover {
  background: var(--cloud);
  border-color: rgba(15, 23, 42, 0.18);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.top-bar {
  background: var(--white);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--charcoal);
  flex: 1;
}

/* Generic dropdown chevron — used by the connect-account menu in the
   Calendars header and any other small caret indicators. */
.dropdown-chevron {
  font-size: 0.7rem;
  color: var(--stone);
}

/* Per-group sidebar entries. Each group renders as a small section with
   the group name as a header and Schedule/Settings sub-items underneath.
   See renderGroupsSection() in app.js. */
.groups-section {
  margin-top: 8px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 12px 4px;
}

.sidebar-group {
  margin-bottom: 8px;
  padding: 4px 0;
  border-radius: 8px;
}

.sidebar-group.active {
  background: rgba(15, 76, 129, 0.04);
}

.sidebar-group-name {
  padding: 4px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--stone);
}

.nav-subitem {
  padding-left: 28px;
  font-size: 0.9rem;
}

.sidebar-create-group {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  margin-top: 4px;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bridge-blue);
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
}

.sidebar-create-group:hover {
  background: var(--cloud);
}

/* Group settings page */
.muted {
  color: var(--stone);
  font-size: 0.85rem;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.12s ease;
}

.member-row:last-child {
  border-bottom: none;
}

.member-row.pending {
  opacity: 0.75;
}

.member-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bridge-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.member-avatar.muted {
  background: var(--stone);
}

.member-text {
  min-width: 0;
}

.member-name {
  font-weight: 600;
  color: var(--charcoal);
  font-size: 0.95rem;
}

.member-email {
  font-size: 0.8rem;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.role-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--stone);
  background: rgba(0, 0, 0, 0.04);
  padding: 3px 8px;
  border-radius: 999px;
}

.role-select {
  font-size: 0.8rem;
  padding: 4px 8px;
  width: auto;
}

.receive-row {
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.receive-row:last-child {
  border-bottom: none;
}

.receive-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.receive-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-left: 48px;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--stone);
  font-weight: 500;
}

.field-inline select,
.field-inline input {
  font-size: 0.85rem;
  padding: 6px 10px;
  width: auto;
  min-width: 140px;
}

.danger-zone {
  border-color: rgba(229, 62, 62, 0.2);
}

.danger-zone .card-title {
  color: var(--danger);
  margin-bottom: 8px;
}

.danger-zone p {
  margin-bottom: 16px;
}

/* Group schedule (merged calendar agenda + ask widget) */
.schedule-ask .ask-form {
  margin-top: 12px;
}

.ask-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.ask-fields .field-inline {
  flex: 1;
  min-width: 160px;
}

.ask-result {
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--stone);
}

.ask-result.ask-ok {
  background: rgba(56, 161, 105, 0.06);
  border-left-color: var(--success);
  color: var(--success);
}

.ask-result.ask-conflict {
  background: rgba(229, 62, 62, 0.06);
  border-left-color: var(--danger);
  color: var(--danger);
}

.ask-result strong {
  display: block;
  margin-bottom: 2px;
}

.ask-result .muted {
  color: var(--stone);
}

.member-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.schedule-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--stone);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.day-bucket {
  margin-bottom: 18px;
}

.day-bucket:last-child {
  margin-bottom: 0;
}

.day-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.schedule-event {
  display: grid;
  grid-template-columns: 110px 4px 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 10px 4px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.schedule-event:hover {
  background: rgba(15, 76, 129, 0.03);
}

.event-time {
  font-size: 0.85rem;
  color: var(--stone);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.event-bar {
  background: var(--member-color, var(--bridge-blue));
  border-radius: 2px;
  width: 4px;
}

.event-body {
  min-width: 0;
}

.event-title {
  font-weight: 600;
  color: var(--charcoal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-title.muted {
  color: var(--stone);
  font-weight: 500;
  font-style: italic;
}

.event-meta {
  font-size: 0.8rem;
  color: var(--stone);
  margin-top: 2px;
}

.event-member {
  color: var(--member-color, var(--stone));
  font-weight: 600;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--charcoal);
  padding: 4px;
}

.page-content {
  padding: 28px;
  max-width: 1200px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--charcoal);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 20px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--stone);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-pill-row {
  margin-top: 10px;
}

/* Health pills (status indicators on stat cards) */
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.health-healthy {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success);
}

.health-stale {
  background: rgba(214, 158, 46, 0.1);
  color: var(--warning);
}

.health-warning {
  background: rgba(214, 158, 46, 0.14);
  color: var(--warning);
}

.health-error {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger);
}

.health-muted {
  background: rgba(0, 0, 0, 0.04);
  color: var(--stone);
}

/* First-run hero (zero-calendar empty state) */
.empty-hero {
  text-align: center;
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-hero .illust {
  margin-bottom: 16px;
}

.empty-hero .empty-state-icon {
  color: var(--bridge-blue);
  margin-bottom: 16px;
}

.empty-hero h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-hero p {
  color: var(--stone);
  max-width: 420px;
  margin: 0 auto 24px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Secondary recovery line under the empty-state actions: "already connected? */
.empty-hero-alt {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--stone);
}

.btn-link-inline {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--bridge-blue);
  text-decoration: underline;
  cursor: pointer;
}

.btn-link-inline:hover {
  opacity: 0.8;
}

/* Recent activity feed */
.activity-list,
.attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.9rem;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-ok {
  background: var(--success);
}

.activity-err {
  background: var(--danger);
}

.activity-info {
  background: var(--bridge-blue);
}

.activity-when {
  color: var(--stone);
  font-size: 0.8rem;
  min-width: 84px;
  flex-shrink: 0;
}

.activity-text {
  color: var(--charcoal);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Needs attention */
.attention-card {
  border-left: 3px solid var(--warning);
}

.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.attention-item:last-child {
  border-bottom: none;
}

.attention-item:hover {
  background: rgba(15, 76, 129, 0.03);
}

.attention-icon {
  flex-shrink: 0;
  color: var(--warning);
  display: inline-flex;
  align-items: center;
}

.attention-item.severity-error .attention-icon {
  color: var(--danger);
}

.attention-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.attention-detail {
  color: var(--stone);
  font-size: 0.82rem;
}

/* Quick actions row */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Calendars-by-account layout */
.account-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* Connect-another-account dropdown */
.connect-wrap {
  position: relative;
}

.connect-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 280px;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  padding: 6px;
  z-index: 110;
  display: flex;
  flex-direction: column;
}

.connect-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--charcoal);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  font-family: inherit;
}

.connect-item:hover {
  background: var(--cloud);
}

.connect-item .muted {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--stone);
}

.connect-sep {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 4px 0;
}

/* Sync Flow rule sections — replaced the NL textarea + advanced toggles
   round-trip with a clear two-section toggle layout: when (filter) and
   what (transform). Buffer/work-hours numeric details stay in Advanced. */
.rule-section {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--cloud);
}

.rule-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin-bottom: 10px;
}

.rule-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--charcoal);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row:hover {
  color: var(--charcoal);
}

/* "Why 25/50?" rationale on the Event Types empty state. Collapsed by
   default — curious users open it; everyone else sees a clean CTA. */
.rationale {
  margin-top: 16px;
  text-align: left;
  max-width: 560px;
  width: 100%;
}

.rationale summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--bridge-blue);
  padding: 8px 12px;
  border-radius: 6px;
  display: inline-block;
}

.rationale summary::-webkit-details-marker {
  display: none;
}

.rationale summary::before {
  content: "▸ ";
  font-size: 0.75rem;
}

.rationale[open] summary::before {
  content: "▾ ";
}

.rationale summary:hover {
  background: var(--cloud);
}

.rationale-body {
  padding: 8px 12px 4px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--charcoal);
}

.rationale-body p {
  margin-bottom: 10px;
}

.rationale-body p:last-child {
  margin-bottom: 0;
}

.rationale-body a {
  color: var(--bridge-blue);
}

.account-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 16px;
  overflow: hidden;
}

.account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--cloud);
}

.account-provider {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.account-email {
  font-weight: 600;
  color: var(--charcoal);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta {
  font-size: 0.8rem;
  color: var(--stone);
  flex-shrink: 0;
}

.calendar-rows {
  display: flex;
  flex-direction: column;
}

.calendar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.12s ease;
}

.calendar-row:last-child {
  border-bottom: none;
}

.calendar-row:hover {
  background: rgba(15, 76, 129, 0.03);
}

.calendar-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.calendar-label {
  font-weight: 500;
  color: var(--charcoal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-role {
  font-size: 0.75rem;
  color: var(--stone);
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 8px;
  border-radius: 999px;
}

.calendar-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ics-add-row {
  margin: 16px 0;
}

.ics-form-card .icon-btn {
  font-size: 1.2rem;
  line-height: 1;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 12px;
  font-weight: 600;
  color: var(--stone);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(15, 76, 129, 0.03);
}

tbody tr:last-child td {
  border-bottom: none;
}

.preview-item:not(.disabled) {
  cursor: pointer;
}

.preview-item:not(.disabled):hover {
  background: rgba(15, 76, 129, 0.03);
}

.stat-card {
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.stat-card.clickable {
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out-expo),
    box-shadow var(--duration-fast) var(--ease-out-expo);
}

/* Unified clickable-surface lift. Anything the user can click that's
   card-shaped gets the same -1px rise + soft shadow on hover — one
   consistent affordance instead of five different background tints.
   The expo-out curve makes it feel like the card is responding, not
   just changing state. */
.stat-card.clickable:hover,
.account-card.clickable:hover,
.whats-next-item.clickable:hover,
.attention-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.account-card,
.whats-next-item,
.attention-item {
  transition:
    transform var(--duration-fast) var(--ease-out-expo),
    box-shadow var(--duration-fast) var(--ease-out-expo);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.weekday-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Advanced-options progressive disclosure */
.advanced-toggle {
  margin: 16px 0 8px;
  background: none;
  border: none;
  color: var(--bridge-blue);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.advanced-toggle:hover {
  text-decoration: underline;
}

.advanced-chevron {
  font-size: 0.7rem;
  display: inline-block;
  width: 12px;
}

.advanced-fields {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 16px;
  margin-top: 8px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--stone);
  margin-top: 4px;
}

.form-suffix {
  font-size: 0.85rem;
  color: var(--stone);
  margin-left: 6px;
}

.weekday-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--stone);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
  margin: 0;
}

.weekday-check input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.weekday-check:hover {
  border-color: var(--flow-teal);
}

.weekday-check:has(input:checked) {
  background: rgba(0, 194, 168, 0.08);
  border-color: var(--flow-teal);
  color: var(--bridge-blue);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  color: var(--charcoal);
  transition: border-color 0.15s;
}

input:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--flow-teal);
  box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.12);
}

/* Inline field validation. .input-invalid is toggled by validateField();
   the message lives in a sibling .field-error slot wired via
   aria-describedby. Replaces submit-only toast feedback — the single
   biggest "this is a CRUD form" tell per the design review. */
.input-invalid,
.input-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--danger);
}

.field-error::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: no-repeat center / contain
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e53e3e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 8v4M12 16h.01'/></svg>");
}

/* Inline "saved" affordance — a quiet confirmation that beats a toast
   for in-place edits (rename, settings tweaks). */
.saved-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--success);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out-expo);
}

.saved-hint.show {
  opacity: 1;
}

input::placeholder,
textarea::placeholder {
  color: var(--stone);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background-color: var(--flow-teal);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(214, 158, 46, 0.1);
  color: var(--warning);
}

.badge-danger {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger);
}

.badge-info {
  background: rgba(15, 76, 129, 0.08);
  color: var(--bridge-blue);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--stone);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.empty-state .illust {
  margin-bottom: 12px;
}

/* Legacy fallback for inline icon-based empty states still in use. */
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.empty-state p {
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 380px;
  margin: 0 auto;
}

.empty-state-cta {
  margin-top: 16px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--stone);
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--flow-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton loaders — used in place of spinners for content whose shape
   is known ahead of time (stats grid, calendars list, bookings table).
   A skeleton that mimics the final layout reads as faster than a
   spinner even when the wall-clock time is identical. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--cloud) 25%,
    rgba(15, 23, 42, 0.06) 37%,
    var(--cloud) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  from {
    background-position: 100% 50%;
  }
  to {
    background-position: 0 50%;
  }
}

.skeleton-stat {
  height: 96px;
  border-radius: var(--radius-lg);
}

.skeleton-row {
  height: 56px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
}

.skeleton-line {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-line.short {
  width: 40%;
}
.skeleton-line.med {
  width: 65%;
}

/* Error */
.error-banner {
  background: rgba(229, 62, 62, 0.08);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error-banner button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
}

/* Toasts (top-right stack, auto-dismiss) */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-left: 3px solid var(--stone);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.9rem;
  color: var(--charcoal);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.toast-in {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-out {
  opacity: 0;
  transform: translateY(-6px);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-info {
  border-left-color: var(--bridge-blue);
}

.toast-msg {
  flex: 1;
  line-height: 1.45;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--stone);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0 0 4px;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--charcoal);
}

@media (max-width: 480px) {
  .toast-stack {
    top: 8px;
    right: 8px;
    left: 8px;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
}

/* Provider Icons */
.provider-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Provider marks — real SVG glyphs instead of letter-in-colored-box.
   Inline data: URIs keep them deploy-portable; cost is ~600 bytes per
   icon vs ~30 bytes for a letter. Worth it — the letter-box pattern
   is the single most "I followed the Calendly tutorial" tell. */
.provider-google::before,
.provider-microsoft::before,
.provider-ics::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}

.provider-google::before {
  /* Four-color Google G */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><path fill='%23FFC107' d='M43.6 20.1H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 1 1 0-24c3 0 5.8 1.2 8 3l5.7-5.7A20 20 0 1 0 24 44a20 20 0 0 0 19.6-23.9z'/><path fill='%23FF3D00' d='M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 8 3l5.7-5.7A20 20 0 0 0 6.3 14.7z'/><path fill='%234CAF50' d='M24 44a20 20 0 0 0 13.4-5.2l-6.2-5.2A12 12 0 0 1 12.7 28.6l-6.5 5A20 20 0 0 0 24 44z'/><path fill='%231976D2' d='M43.6 20.1H42V20H24v8h11.3a12 12 0 0 1-4.1 5.6l6.2 5.2C37 39.2 44 34 44 24c0-1.3-.1-2.7-.4-3.9z'/></svg>");
}

.provider-microsoft::before {
  /* Four-square Microsoft mark */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 23 23'><path fill='%23F25022' d='M1 1h10v10H1z'/><path fill='%237FBA00' d='M12 1h10v10H12z'/><path fill='%2300A4EF' d='M1 12h10v10H1z'/><path fill='%23FFB900' d='M12 12h10v10H12z'/></svg>");
}

.provider-ics::before {
  /* Generic calendar glyph — matches the icon() set used elsewhere
     in the dashboard rather than the 📅 emoji that rendered as
     OS-specific pixel-art in the tab strip. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4.5' width='18' height='16' rx='2'/><path d='M3 9h18M8 2.5v4M16 2.5v4'/></svg>");
}

/* Actions */
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--stone);
  font-size: 1rem;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--cloud);
  color: var(--charcoal);
}

.icon-btn.danger {
  color: var(--danger);
}

.icon-btn.danger:hover {
  background: rgba(229, 62, 62, 0.08);
  color: var(--danger-dark);
}

/* Section spacing */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--charcoal);
}

/* Modal overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 199;
}

/* Calendar Preview Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: overlay-in var(--duration-base) var(--ease-out-expo);
}

.modal-dialog {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-overlay);
  /* Dialog rises + settles slightly faster than the backdrop fades —
     classic "content arrives" feel rather than a flat appear. */
  animation: modal-in var(--duration-base) var(--ease-out-expo);
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tab cross-fade. showTab() adds .tab-enter when a page becomes visible;
   the class is removed on animationend. 100ms is deliberately short —
   navigation should feel instant but not jarring. */
.tab-page.tab-enter {
  animation: tab-in 140ms var(--ease-out-expo);
}

@keyframes tab-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect the OS "reduce motion" setting. Premium products do this;
   it's also an accessibility requirement (vestibular disorders). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Billing tab */
.usage-grid {
  display: grid;
  gap: var(--space-2);
}

.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--cloud);
  border-radius: var(--radius-md);
}

.usage-label {
  font-size: 0.9rem;
  color: var(--charcoal);
}

.usage-count {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--charcoal);
}

.usage-count.at-limit {
  color: var(--danger);
}

.usage-of {
  color: var(--stone);
  font-weight: 400;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.plan-card {
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.plan-card.is-current {
  border-color: var(--flow-teal);
  box-shadow: 0 0 0 1px var(--flow-teal);
}

.plan-card-name {
  font-weight: 650;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.plan-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--stone);
  flex: 1;
}

.plan-card-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.plan-card-list li::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: no-repeat center / contain
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300c2a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>");
}

/* Poll create slot picker — one row per day, day header on the left and
   inline time-slot chips on the right. Slots that conflict with the
   organizer's calendar are visually crossed out but still clickable
   (the picker only suggests; the organizer can override). */
#cp-slot-grid {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.slot-row {
  display: flex;
  gap: 12px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  align-items: flex-start;
}

.slot-row:last-child {
  border-bottom: none;
}

.slot-row-header {
  flex: 0 0 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
  padding-top: 4px;
}

.slot-row-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.poll-pick-slot {
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--charcoal);
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.poll-pick-slot:hover {
  border-color: var(--flow-teal);
}

.poll-pick-slot.is-picked {
  background: var(--flow-teal);
  border-color: var(--teal-dark);
  color: var(--white);
  font-weight: 600;
}

.poll-pick-slot.is-busy {
  text-decoration: line-through;
  color: var(--stone);
  background: var(--cloud);
}

.poll-pick-slot.is-busy.is-picked {
  /* Even if the organizer overrides a busy slot, keep the strikethrough
     visible so they remember it conflicts with their existing calendar. */
  text-decoration: line-through;
  color: var(--white);
  background: var(--flow-teal);
}

/* Contact-picker chip input + suggestions popup. Used in the poll-create
   "Send invitations to" field; designed to be reusable for group invites
   and other multi-recipient surfaces later. */
.contact-picker {
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 6px 8px 2px;
  background: var(--white);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 40px;
}

.contact-picker:focus-within {
  border-color: var(--flow-teal);
}

.contact-picker-chips {
  display: contents;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 194, 168, 0.12);
  color: var(--charcoal);
  border-radius: 999px;
  padding: 2px 8px 2px 12px;
  font-size: 0.85rem;
  max-width: 100%;
}

.contact-chip-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.contact-chip-email {
  color: var(--stone);
  font-size: 0.75rem;
  white-space: nowrap;
}

.contact-chip-remove {
  background: none;
  border: none;
  color: var(--stone);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}

.contact-chip-remove:hover {
  color: var(--danger);
}

.contact-picker-input {
  border: none;
  outline: none;
  padding: 4px 4px;
  font: inherit;
  flex: 1;
  min-width: 160px;
  background: transparent;
}

.contact-picker-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
}

.contact-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--charcoal);
}

.contact-suggestion:hover {
  background: var(--cloud);
}

.contact-suggestion-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-suggestion-email {
  color: var(--stone);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.contact-suggestion-source {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--stone);
  background: var(--cloud);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.contact-suggestion-loading {
  padding: 12px;
  text-align: center;
  color: var(--stone);
  font-size: 0.85rem;
}

/* Type picker (Create Group, future tile-style choices) */
.type-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.type-option {
  cursor: pointer;
  margin: 0;
  display: block;
}

.type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-card {
  padding: 14px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition:
    border-color 0.12s ease,
    background 0.12s ease;
}

.type-card strong {
  color: var(--charcoal);
  font-size: 0.95rem;
}

.type-card .muted {
  font-size: 0.82rem;
  color: var(--stone);
}

.type-option input:checked + .type-card {
  border-color: var(--flow-teal);
  background: rgba(0, 194, 168, 0.06);
}

.type-option:hover .type-card {
  border-color: rgba(0, 0, 0, 0.16);
}

.create-group-dialog {
  max-width: 460px;
}

.invite-dialog {
  max-width: 480px;
}

.invite-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.invite-link-row input {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  background: var(--cloud);
}

.booking-url-cell {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  color: var(--bridge-blue);
  text-decoration: none;
  background: var(--cloud);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 220px;
  vertical-align: middle;
}

.booking-url-cell:hover {
  text-decoration: underline;
}

.booking-url-dialog {
  max-width: 540px;
}

/* Welcome modal — first-run onboarding */
.welcome-dialog {
  max-width: 520px;
  padding: 40px 36px 32px;
  text-align: center;
  align-items: center;
}

.welcome-illust {
  margin-bottom: 8px;
}

.welcome-title {
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--charcoal);
}

.welcome-lead {
  color: var(--stone);
  margin-bottom: 24px;
  font-size: 0.98rem;
}

.welcome-steps {
  list-style: none;
  counter-reset: welcome;
  padding: 0;
  margin: 0 0 28px;
  text-align: left;
  max-width: 420px;
  width: 100%;
}

.welcome-steps li {
  counter-increment: welcome;
  position: relative;
  padding: 10px 0 10px 40px;
  font-size: 0.95rem;
  color: var(--charcoal);
}

.welcome-steps li::before {
  content: counter(welcome);
  position: absolute;
  left: 0;
  top: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 194, 168, 0.1);
  color: var(--bridge-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.welcome-steps li strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.welcome-steps li .muted {
  font-size: 0.85rem;
  color: var(--stone);
}

.welcome-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* "What's next" guidance card on Overview */
.whats-next-card {
  border-left: 3px solid var(--flow-teal);
}

.whats-next-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.whats-next-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: 10px;
  background: var(--cloud);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.whats-next-illust {
  margin-bottom: 4px;
}

.whats-next-item h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--charcoal);
  margin: 0;
  letter-spacing: -0.01em;
}

.whats-next-item p {
  font-size: 0.88rem;
  color: var(--stone);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.whats-next-item .btn {
  margin-top: 4px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--charcoal);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--stone);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--charcoal);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.preview-account {
  margin-bottom: 20px;
}

.preview-account-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 8px;
  background: var(--cloud);
}

.preview-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--flow-teal);
  flex-shrink: 0;
}

.preview-item label {
  flex: 1;
  margin-bottom: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-item .already-imported {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
}

.preview-item.disabled {
  opacity: 0.5;
}

.preview-item.disabled input {
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content {
    padding: 16px;
  }

  .top-bar {
    padding: 12px 16px;
  }

  .card {
    padding: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
