/* Sophience portal components (blueprint 06). Class names are the contract;
   templates compose these instead of hard-coding colours. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body.portal {
  background: var(--bg); color: var(--fg); font-family: var(--font-body);
  font-size: var(--t-body); font-weight: 500; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:where(body.portal a) { color: inherit; text-decoration: none; }
body.portal a.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(26,39,85,.3); }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--indigo-500); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(215,168,90,.35); }

.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.012em; line-height: 1.08; }
.h1 { font-family: var(--font-display); font-size: var(--t-h1); font-weight: 600; line-height: 1.06; letter-spacing: -0.012em; margin: 0; }
.h2 { font-family: var(--font-display); font-size: var(--t-h2); font-weight: 600; line-height: 1.15; margin: 0; }
.h3 { font-family: var(--font-display); font-size: var(--t-h3); font-weight: 600; line-height: 1.25; margin: 0; }
.h4 { font-family: var(--font-body); font-size: 15.5px; font-weight: 600; margin: 0; }
.sub { color: var(--fg-muted); font-size: 15px; margin-top: 6px; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.small { font-size: var(--t-body-sm); }
.caption { font-size: var(--t-caption); color: var(--fg-subtle); }
.overline { font-size: var(--t-overline); letter-spacing: .2em; text-transform: uppercase; color: var(--fg-subtle); font-weight: 500; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.count { font-family: var(--font-mono); font-size: 12px; color: var(--candle-800); font-weight: 500; }

/* ── shell ─────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #fff;
  border-right: 1px solid var(--line-soft); padding: 22px 14px 16px; display: flex; flex-direction: column; z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.sidebar .brand-chip { width: 42px; height: 42px; border-radius: 999px; background: var(--cream-100); display: grid; place-items: center; box-shadow: var(--shadow-1); }
.sidebar .brand-chip img { width: 26px; height: 26px; }
.sidebar .brand-name { font-family: var(--font-display); font-size: 25px; font-weight: 500; letter-spacing: .005em; }
.sidebar .brand-tag { font-size: 10.5px; letter-spacing: 2.1px; text-transform: uppercase; color: var(--fg-muted); text-align: right; padding: 8px 6px 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px;
  font-size: 13px; letter-spacing: 2.08px; text-transform: uppercase; color: var(--cream-700); font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast);
}
.nav-item:hover { background: var(--cream-50); color: var(--fg); }
.nav-item.active { background: var(--pill-active); color: var(--fg); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .nav-count { margin-left: auto; font-size: 12px; letter-spacing: .08em; color: var(--fg-subtle); }
.nav-item .nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--candle-600); color: #fff; font-size: 11px; display: grid; place-items: center; letter-spacing: 0; }
.nav-section { font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--fg-subtle); padding: 14px 16px 6px; }
.sidebar-foot { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 8px; }
.sidebar-logout { margin: 0 0 8px; }
.sidebar-logout .nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

/* V21 User profile menu */
.user-profile-section { position: relative; margin: 0 0 12px; }
.user-profile-button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  border-radius: 8px; transition: background var(--dur-fast);
}
.user-profile-button:hover { background: var(--cream-50); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--candle-500) 0%, var(--candle-700) 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 600; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-email {
  font-size: 11px; color: var(--fg-subtle);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-menu-icon { flex-shrink: 0; color: var(--fg-subtle); }
.user-menu {
  position: absolute; bottom: 100%; left: 8px; right: 8px;
  margin-bottom: 8px; background: white; border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
  padding: 4px; z-index: 100; min-width: 240px;
}
.user-menu-header {
  padding: 12px 12px 8px; border-bottom: 1px solid var(--line-soft);
}
.user-menu-name { font-size: 14px; font-weight: 600; color: var(--fg); }
.user-menu-email { font-size: 12px; color: var(--fg-subtle); margin-top: 2px; }
.user-menu-divider { height: 1px; background: var(--line-soft); margin: 4px 0; }
.user-menu-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 0; background: transparent;
  cursor: pointer; font-size: 13px; color: var(--fg);
  border-radius: 8px; text-align: left; transition: background var(--dur-fast);
}
.user-menu-item:hover { background: var(--cream-50); }
.user-menu-item svg { flex-shrink: 0; }
.user-menu-item form { width: 100%; }

/* Setup defaults field-row layout */
.field-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 12px 0;
}
.field-row label {
  flex: 0 0 auto; min-width: 140px; font-weight: 500; color: var(--fg);
}
.field-row .input, .field-row select {
  flex: 0 0 auto; min-width: 200px;
}
.field-row > div {
  flex: 1; text-align: right; color: var(--fg-subtle);
}
.venue-switch {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 14px;
  padding: 10px 14px; border-radius: 12px; background: var(--cream-50); border: 1px solid var(--cream-300);
  font: 600 15px var(--font-body); color: var(--fg); cursor: pointer; text-align: left;
}
.venue-back { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-muted); padding: 4px 8px 12px; }
.venue-back:hover { color: var(--fg); }

.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; position: relative; }
.main-wash { position: fixed; inset: 0 0 0 var(--sidebar-w); background: url("../background/teravana-illustration-3.png") center/cover no-repeat; z-index: 0; }
.main-wash::after { content: ""; position: absolute; inset: 0; background: rgba(248,244,236,0.6); }
.main-inner { position: relative; z-index: 1; padding: 28px 48px 64px; max-width: 1240px; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 40px; margin-bottom: 18px; }
.topbar .crumbs { margin-right: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--fg-muted); }
.topbar .crumbs a:hover { color: var(--fg); text-decoration: underline; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.7); border: 1px solid var(--line); color: var(--fg-muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: #fff; color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 99px; background: var(--candle-600); border: 2px solid #fff; }
.avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--moss-700); color: var(--cream-50); display: grid; place-items: center; font-size: 13px; font-weight: 600; letter-spacing: .04em; border: 0; cursor: pointer; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ── buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r-pill);
  font: 500 14.5px var(--font-body); padding: 11px 18px; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast); line-height: 1.2;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--bark); color: var(--cream-50); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: #2a190f; }
.btn-secondary { background: var(--sand); color: var(--fg); border-color: rgba(74,52,30,.12); font-size: 13.5px; padding: 8px 14px; }
.btn-secondary:hover { background: #e4d8c8; }
.btn-ghost { background: transparent; color: var(--fg-muted); padding: 8px 12px; font-size: 13.5px; }
.btn-ghost:hover { background: rgba(74,52,30,.06); color: var(--fg); }
.btn-outline { background: #fff; color: var(--fg); border-color: var(--line-strong); font-size: 13.5px; padding: 8px 14px; }
.btn-outline:hover { border-color: var(--cream-500); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #73301f; }
.btn-danger-ghost { background: transparent; color: var(--danger); padding: 8px 12px; font-size: 13.5px; }
.btn-danger-ghost:hover { background: var(--clay-50); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }

/* ── cards ─────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-card); border: 1px solid var(--line-soft); padding: 20px 22px; }
.card-tight { padding: 15px 18px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0; }
.card-sub { color: var(--fg-muted); font-size: 13.5px; }
.card-cream { background: var(--bg-elevated); }
.card-link { display: block; transition: transform var(--dur-fast), box-shadow var(--dur-fast); }
.card-link:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(60,40,20,.08); }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.section-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0; }
.section-head .right { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } .split { grid-template-columns: 1fr; } }

/* stat card */
.stat { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-card); border: 1px solid var(--line-soft); padding: 16px 18px; }
.stat .label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-subtle); }
.stat .value { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.1; margin-top: 6px; }
.stat .delta { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.stat .delta.up { color: var(--success); } .stat .delta.down { color: var(--danger); }

/* needs-you */
.ny-list { display: flex; flex-direction: column; gap: 10px; }
.ny-item { display: flex; align-items: center; gap: 16px; background: #fff; border-radius: var(--r-lg); padding: 15px 18px; box-shadow: var(--shadow-card); border: 1px solid var(--line-soft); }
.ny-dot { width: 8px; height: 8px; border-radius: 99px; flex: none; background: var(--candle-800); }
.ny-dot.danger { background: var(--danger); } .ny-dot.info { background: var(--indigo-500); } .ny-dot.success { background: var(--success); }
.ny-title { font-size: 15.5px; font-weight: 600; color: var(--fg); }
.ny-sub { font-size: 13.5px; color: var(--fg-subtle); margin-top: 2px; }

/* setup progress */
.progress { height: 6px; background: var(--cream-200); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--moss-500); border-radius: 99px; transition: width var(--dur) var(--ease-out); }
.checklist { display: flex; flex-direction: column; }
.check-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line-soft); }
.check-row:last-child { border-bottom: 0; }
.check-ico { width: 24px; height: 24px; border-radius: 99px; display: grid; place-items: center; flex: none; border: 1.5px solid var(--cream-300); color: transparent; }
.check-ico.done { background: var(--moss-500); border-color: var(--moss-500); color: #fff; }
.check-ico.attn { border-color: var(--candle-600); color: var(--candle-600); }
.check-ico svg { width: 14px; height: 14px; }
.setup-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--candle-600); display: inline-block; }

/* badges + chips */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: .85; }
.badge-success { background: var(--moss-100); color: var(--moss-700); }
.badge-warning { background: var(--candle-50); color: var(--candle-800); box-shadow: inset 0 0 0 1px var(--candle-200); }
.badge-danger { background: var(--clay-50); color: var(--danger); }
.badge-info { background: var(--indigo-100); color: var(--indigo-700); }
.badge-neutral { background: var(--cream-100); color: var(--cream-700); }
.badge-muted { background: rgba(74,52,30,.05); color: var(--fg-subtle); }
.badge.plain::before { display: none; }
.venue-pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--moss-100); color: var(--moss-700); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: rgba(255,255,255,.75); border: 1px solid var(--line); font-size: 13px; color: var(--fg-muted); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--cream-400); color: var(--fg); }
.chip.on { background: var(--bark); color: var(--cream-50); border-color: var(--bark); }
.chip .n { font-family: var(--font-mono); font-size: 11px; opacity: .8; }
.role-chip { display: inline-flex; padding: 2px 9px; border-radius: 999px; background: var(--cream-100); color: var(--cream-700); font-size: 12px; font-weight: 600; margin: 1px 2px 1px 0; }

/* tabs */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 0 12px; font-size: 14.5px; color: var(--fg-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: baseline; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--bark); font-weight: 600; }
.tab .count { font-size: 11.5px; }

/* filter bar */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.85); border: 1px solid var(--line); min-width: 260px; }
.search svg { width: 16px; height: 16px; color: var(--fg-subtle); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; flex: 1; color: var(--fg); }

/* tables */
.table-wrap { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-card); border: 1px solid var(--line-soft); overflow: visible; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-subtle); font-weight: 600; padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--bg-elevated); }
.table th:first-child { border-top-left-radius: var(--r-lg); } .table th:last-child { border-top-right-radius: var(--r-lg); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FDFBF6; }
.table .cell-main { font-weight: 600; color: var(--fg); }
.table .cell-sub { font-size: 12.5px; color: var(--fg-subtle); margin-top: 1px; }
.table td.actions { text-align: right; width: 1%; white-space: nowrap; }
.table a.rowlink:hover .cell-main { text-decoration: underline; text-underline-offset: 3px; }

/* menus / dropdowns */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-pop); border: 1px solid var(--line); padding: 6px; z-index: 60; text-align: left; }
.menu.left { left: 0; right: auto; }
.menu.up { bottom: calc(100% + 6px); top: auto; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; font: 500 14px var(--font-body); color: var(--fg); background: none; border: 0; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--cream-50); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 16px; height: 16px; color: var(--fg-subtle); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 5px 4px; }
.menu-label { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-subtle); padding: 8px 12px 4px; }
.menu form { margin: 0; }

/* drawer + dialog */
.overlay { position: fixed; inset: 0; background: rgba(31,42,34,.28); z-index: 80; backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg-elevated); z-index: 90; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.drawer.lg { width: min(760px, 100vw); }
.drawer-head { padding: 22px 26px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.drawer-body { padding: 20px 26px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 26px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; background: #fff; }
.dialog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); background: #fff; border-radius: 20px; z-index: 95; box-shadow: var(--shadow-pop); padding: 24px 26px; }
.dialog .h3 { margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.field .help { font-size: 12.5px; color: var(--fg-subtle); margin-top: 5px; }
.field .error, .errorlist { font-size: 12.5px; color: var(--danger); margin-top: 5px; list-style: none; padding: 0; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=tel],
.field input[type=url], .field input[type=date], .field input[type=time], .field input[type=datetime-local], .field select, .field textarea, select.input, textarea.input {
  width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff;
  font: 500 14.5px var(--font-body); color: var(--fg); outline: none; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.field textarea, textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--indigo-500); box-shadow: 0 0 0 3px rgba(69,83,147,.12); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field input[type=checkbox], .check input { width: 18px; height: 18px; accent-color: var(--moss-700); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.toggle { position: relative; width: 40px; height: 22px; flex: none; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: var(--cream-300); border-radius: 99px; transition: background var(--dur-fast); cursor: pointer; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 99px; transition: transform var(--dur-fast) var(--ease-out); box-shadow: var(--shadow-1); }
.toggle input:checked + span { background: var(--moss-500); }
.toggle input:checked + span::after { transform: translateX(18px); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.radio-card { border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px 16px; cursor: pointer; background: #fff; display: block; }
.radio-card:has(input:checked) { border-color: var(--bark); box-shadow: 0 0 0 1px var(--bark); background: var(--bg-elevated); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .t { font-weight: 600; } .radio-card .d { font-size: 13px; color: var(--fg-muted); margin-top: 3px; }
.money { position: relative; } .money span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-subtle); font-size: 14px; } .money input { padding-left: 28px !important; }

/* wizard */
.wizard { max-width: 860px; }
.wizard-steps { display: flex; gap: 6px; margin: 10px 0 26px; flex-wrap: wrap; }
.wizard-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-subtle); padding: 6px 12px 6px 6px; border-radius: 999px; }
.wizard-step .n { width: 24px; height: 24px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--line-strong); background: #fff; font-weight: 600; }
.wizard-step.done .n { background: var(--moss-500); color: #fff; border-color: var(--moss-500); }
.wizard-step.current { background: #fff; color: var(--fg); font-weight: 600; box-shadow: var(--shadow-card); }
.wizard-step.current .n { background: var(--bark); color: #fff; border-color: var(--bark); }
.wizard-step .opt { font-size: 11px; color: var(--fg-subtle); font-weight: 500; }
.wizard-foot { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* empty state */
.empty { text-align: center; padding: 48px 24px; }
.empty img { width: 150px; opacity: .85; margin: 0 auto 14px; display: block; }
.empty .h3 { margin-bottom: 6px; }
.empty p { color: var(--fg-muted); max-width: 420px; margin: 0 auto 16px; }

/* toasts */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 44px)); }
.toast { background: var(--moss-900); color: var(--cream-50); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-pop); font-size: 14px; display: flex; gap: 12px; align-items: flex-start; }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--candle-800); }
.toast button, .toast a { background: none; border: 0; color: var(--candle-200); font: 600 13.5px var(--font-body); cursor: pointer; padding: 0; text-decoration: underline; }
.toast .x { color: rgba(251,247,238,.7); text-decoration: none; margin-left: auto; font-size: 16px; }

/* callouts */
.callout { border-radius: 14px; padding: 14px 16px; background: var(--candle-50); border: 1px solid var(--candle-200); color: var(--candle-800); font-size: 14px; display: flex; gap: 12px; align-items: flex-start; }
.callout.info { background: var(--indigo-100); border-color: #CBD0E6; color: var(--indigo-700); }
.callout.success { background: var(--moss-50); border-color: var(--moss-100); color: var(--moss-700); }
.callout.danger { background: var(--clay-50); border-color: #E7C9C0; color: var(--danger); }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* definition list */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 18px; font-size: 14px; margin: 0; }
.dl dt { color: var(--fg-subtle); } .dl dd { margin: 0; color: var(--fg); }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 99px; background: var(--cream-400); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12.5px; color: var(--fg-subtle); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-subtle); text-align: center; padding-bottom: 4px; }
.cal .day { min-height: 64px; background: #fff; border-radius: 10px; border: 1px solid var(--line-soft); padding: 6px 8px; font-size: 12.5px; }
.cal .day.out { opacity: .35; }
.cal .day .d { font-weight: 600; }
.cal .day.booked { background: var(--moss-50); border-color: var(--moss-100); }
.cal .day.held { background: var(--candle-50); border-color: var(--candle-200); }
.cal .day.blocked { background: repeating-linear-gradient(-45deg, #f6f1e7, #f6f1e7 6px, #efe7d8 6px, #efe7d8 12px); }
.cal .day.external { background: var(--indigo-100); }
.cal .day.today { box-shadow: 0 0 0 2px var(--bark); }

/* room board / schedule */
.board { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.board-col { background: rgba(255,255,255,.7); border: 1px dashed var(--cream-300); border-radius: 16px; padding: 12px; min-height: 120px; }
.board-card { background: #fff; border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); box-shadow: var(--shadow-1); font-size: 13.5px; margin-bottom: 8px; }
.room-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.day-col { background: rgba(255,255,255,.7); border-radius: 16px; padding: 12px; border: 1px solid var(--line-soft); }
.slot { background: #fff; border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); margin-top: 8px; font-size: 13.5px; }
.slot .t { font-family: var(--font-mono); font-size: 11.5px; color: var(--candle-800); }

/* perm grid */
.perm td, .perm th { text-align: center; }
.perm td:first-child, .perm th:first-child { text-align: left; }
.perm select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-strong); font: 600 13px var(--font-mono); background: #fff; }
.lvl { display: inline-grid; place-items: center; width: 28px; height: 24px; border-radius: 7px; font: 600 12px var(--font-mono); }
.lvl-C { background: var(--moss-100); color: var(--moss-700); } .lvl-O { background: var(--candle-50); color: var(--candle-800); }
.lvl-V { background: var(--indigo-100); color: var(--indigo-700); } .lvl-- { background: rgba(74,52,30,.05); color: var(--fg-subtle); }

/* experience cards */
.exp-card { background: #fff; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card); border: 1px solid var(--line-soft); display: flex; flex-direction: column; }
.exp-card .cover { height: 140px; background: var(--cream-200) center/cover no-repeat; position: relative; }
.exp-card .cover .badge { position: absolute; left: 12px; top: 12px; }
.exp-card .body { padding: 14px 16px 16px; }
.exp-card .title { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.15; }
.fill { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--fg-muted); margin-top: 10px; }
.fill .progress { flex: 1; }

/* countdown */
.countdown { font-family: var(--font-mono); font-size: 12.5px; color: var(--candle-800); }
.countdown.warn { color: var(--candle-600); } .countdown.danger { color: var(--danger); font-weight: 600; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, 1fr); }
.auth-art { position: relative; background: url("../background/teravana-illustration-10.png") center/cover no-repeat; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(31,42,34,.05), rgba(31,42,34,.45)); }
.auth-art .quote { position: absolute; left: 48px; bottom: 48px; right: 48px; color: var(--cream-50); z-index: 1; }
.auth-art .quote .display { font-size: 44px; color: var(--cream-50); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(28px, 6vw, 88px); background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.auth-brand img { width: 38px; height: 38px; }
.auth-brand span { font-family: var(--font-display); font-size: 26px; font-weight: 500; }
.auth .h1 { font-size: 40px; }
.code-boxes { display: flex; gap: 8px; }
.code-boxes input { width: 52px; height: 60px; text-align: center; font: 600 24px var(--font-mono); border-radius: 12px; border: 1px solid var(--line-strong); background: #fff; }
.code-boxes input:focus { border-color: var(--indigo-500); outline: none; box-shadow: 0 0 0 3px rgba(69,83,147,.12); }
.hints { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; color: var(--fg-subtle); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.hints li::before { content: "○ "; } .hints li.ok { color: var(--success); } .hints li.ok::before { content: "● "; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* sophie panel */
.sophie-fab { position: fixed; right: 22px; bottom: 22px; z-index: 70; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 999px; background: var(--moss-900); color: var(--cream-50); border: 0; cursor: pointer; box-shadow: var(--shadow-pop); font: 600 14px var(--font-body); }
.sophie-fab .orb { width: 28px; height: 28px; border-radius: 99px; background: radial-gradient(circle at 35% 35%, var(--candle-200), var(--candle-600)); }
.sophie { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100vw); background: var(--bg-elevated); z-index: 100; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.sophie-thread { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--bark); color: var(--cream-50); border-bottom-right-radius: 6px; }
.bubble.her { align-self: flex-start; background: #fff; border: 1px solid var(--line-soft); border-bottom-left-radius: 6px; }
.sophie-input { padding: 12px 16px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; background: #fff; }
.bubble.her .tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; white-space: normal; }
.bubble.her .tbl td, .bubble.her .tbl th { padding: 4px 6px; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.bubble.her .tbl th { color: var(--fg-subtle); font-weight: 600; border-top: 0; }
.bubble .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; white-space: normal; }
.bubble textarea { width: 100%; min-height: 160px; margin-top: 8px; font: 13px/1.5 var(--font-body); border: 1px solid var(--line); border-radius: 10px; padding: 8px; white-space: pre-wrap; }
.sophie-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 10px; }
.sophie-sugg button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.sophie-sugg button:hover { border-color: var(--moss-500); }

/* mobile bottom bar */
.bottombar { display: none; }
@media (max-width: 960px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .main-wash { left: 0; }
  .main-inner { padding: 20px 18px 40px; }
  .h1 { font-size: 34px; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: #fff; border-top: 1px solid var(--line); z-index: 50; justify-content: space-around; align-items: center; }
  .bottombar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-muted); }
  .bottombar a.active { color: var(--fg); font-weight: 600; }
  .bottombar svg { width: 20px; height: 20px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .sophie-fab { bottom: 80px; }
}

/* legacy bridge: old templates rendered inside the new shell */
.legacy-frame { position: relative; }
.legacy-frame .glass-card, .legacy-frame .glass-panel { background: #fff; border: 1px solid var(--line-soft); box-shadow: var(--shadow-card); }

/* admin: permission grid, segmented control */
.perm-cell { display: inline-block; min-width: 72px; padding: 5px 10px; border-radius: 8px; border: 0; font: 600 12.5px var(--font-body); cursor: default; }
button.perm-cell { cursor: pointer; transition: transform var(--dur-fast); }
button.perm-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.seg { display: inline-flex; background: rgba(74,52,30,.06); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font: 500 13px var(--font-body); color: var(--fg-muted); cursor: pointer; }
.seg-btn.on { background: #fff; color: var(--fg); box-shadow: var(--shadow-1); }
.center { text-align: center; }
.table tr.selected td { background: var(--moss-50); }

/* partner calendar (PDF 4 p7 colours) */
.cal .day.pcal-open { background: var(--cream-100, #FBF6EC); }
.cal .day.pcal-blocked { background: repeating-linear-gradient(-45deg, #f6f1e7, #f6f1e7 6px, #e6dccb 6px, #e6dccb 12px); }
.cal .day.pcal-block_held { background: var(--candle-50); border-color: var(--candle-200); }
.cal .day.pcal-booked { background: #5A3E2B; color: #fff; border-color: #5A3E2B; }
.cal .day.pcal-external_block { background: var(--indigo-100); }
.cal form.day { padding: 0; }
.pcal-btn { width: 100%; height: 100%; min-height: 62px; border: 0; background: transparent; text-align: left; padding: 6px 8px; cursor: pointer; font: inherit; border-radius: 10px; }
.pcal-btn:hover { box-shadow: inset 0 0 0 2px var(--moss-300); }
.pcal-key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; border: 1px solid var(--line-soft); }
.pcal-key.pcal-open { background: #FBF6EC; } .pcal-key.pcal-blocked { background: repeating-linear-gradient(-45deg, #f6f1e7, #f6f1e7 3px, #e6dccb 3px, #e6dccb 6px); }
.pcal-key.pcal-block_held { background: var(--candle-50); } .pcal-key.pcal-booked { background: #5A3E2B; } .pcal-key.pcal-external_block { background: var(--indigo-100); }
.pill-check { cursor: pointer; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; font-size: 13px; }
.pill-check input:checked + span { background: var(--moss-500); border-color: var(--moss-500); color: #fff; }
.pill-check input:focus-visible + span { outline: 2px solid var(--moss-300); outline-offset: 2px; }

/* Channel health filters */
.channel-filter, .channel-filter-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.channel-filter {
  background: #fff;
  color: var(--fg);
  border: 1px solid rgba(74, 52, 30, 0.2);
}

.channel-filter:hover {
  background: rgba(74, 52, 30, 0.04);
}

.channel-filter-active {
  background: #2B1B12;
  color: var(--cream-50);
  border: 1px solid #2B1B12;
}

/* Channel health table */
.channel-health-table {
  border-radius: 22px;
  background: #FFFFFF;
  border: 1px solid rgba(74, 52, 30, 0.06);
  box-shadow: 0 2px 14px rgba(60, 40, 20, 0.05);
}

.channel-health-header {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) 118px 128px 92px 70px minmax(0, 0.9fr) 28px;
  gap: 10px;
  padding: 12px 18px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  border-bottom: 1px solid var(--line);
}

.channel-health-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) 118px 128px 92px 70px minmax(0, 0.9fr) 28px;
  gap: 10px;
  align-items: center;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.channel-health-row:first-of-type {
  border-top: none;
}

.channel-health-row:hover {
  background: var(--bg-wash);
}

.notif-row:hover {
  background: #FBF7EE !important;
}

/* Read-only field row with right-aligned value + chevron */
.field-row-readonly {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.field-row-readonly:hover {
  background: var(--bg-wash);
}

.field-row-readonly label {
  color: var(--fg-base);
  font-weight: 500;
}

.field-row-readonly .field-value {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-soft);
  text-align: right;
}
