/* ==========================================================================
   Water Solution design system
   Tokens first; every component below reads from them.
   ========================================================================== */

:root {
  /* Brand */
  --primary-50: #f3f3f7;
  --primary-100: #e6e5ee;
  --primary-500: #2b2a44;
  --primary-600: #1f1e31;
  --primary-700: #18172a;
  --primary-gradient: linear-gradient(180deg, #2b2a44 0%, #1f1e31 100%);
  --hero-gradient: linear-gradient(120deg, #121120 0%, #2b2a44 52%, #1f1e31 78%, #18172a 100%);

  /* Neutrals */
  --bg-app: #ffffff;
  --bg-content: #f7f7f7;
  --bg-muted: #fafafa;
  --bg-tile: #f6f6f6;
  --bg-hover: #f3f3f3;
  --surface: #ffffff;
  --border: #ebebeb;
  --border-strong: #e1e1e1;
  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --ink: #1f1e31;
  --ink-gradient: linear-gradient(180deg, #2b2a44 0%, #1f1e31 55%, #18172a 100%);

  /* Status */
  --success: #1f9d4c;
  --success-soft: #d8efe2;
  --success-text: #1f7a55;
  --danger: #e5484d;
  --warning: #e8a008;

  /* Accent tiles */
  --lavender: #f2f0fd;
  --blue-soft: #e8f0fe;
  --amber-soft: #fdf3e2;
  --violet-soft: #f1ecfd;

  /* Type */
  /* System UI stack, as in the Triply admin: crisp, and nothing to download */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Spacing (4px scale) */
  --space-1: 4px;
  --space-2: 7px;
  --space-3: 11px;
  --space-4: 14px;
  --space-5: 18px;
  --space-6: 22px;
  --space-7: 25px;
  --space-8: 29px;

  /* Shape & depth */
  --radius-sm: 5px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 7px;
  --radius-xl: 8px;
  --radius-full: 999px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-pop: 0 11px 29px rgba(15, 15, 15, 0.18);
  --focus-ring: 0 0 0 3px rgba(31, 30, 49, 0.3);

  --sidebar-width: 245px;
  --topbar-height: 68px;
  --transition: 150ms ease;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: normal;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.icon {
  flex-shrink: 0;
  stroke-width: 1.6;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #fff;
  background: var(--primary-gradient);
  border-color: var(--primary-700);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-xs);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #24233a 0%, #121120 100%);
}

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

.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-sm {
  height: 31px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  height: 40px;
  padding: 0 var(--space-5);
}

.btn-pill {
  border-radius: var(--radius-full);
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: background var(--transition);
}

.icon-btn:hover {
  background: var(--bg-hover);
}

.icon-btn-sm {
  width: 31px;
  height: 31px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.icon-btn-lg {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
}

.icon-btn-xs {
  width: 25px;
  height: 25px;
  border-radius: var(--radius-sm);
}

.icon-btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-muted);
}

.icon-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
}

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ---------- Inputs ---------- */

.input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus-within {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.input input:focus-visible,
.sidebar-search input:focus-visible {
  box-shadow: none;
}

.input input::placeholder,
.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.input-search {
  width: 252px;
}

input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary-600);
  cursor: pointer;
}

/* ---------- App shell ---------- */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: var(--space-4) var(--space-4) var(--space-4);
  overflow-y: auto;
  background: var(--bg-app);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  margin: 0 0 var(--space-5);
  padding-left: 2px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: linear-gradient(145deg, #4a4868 0%, #2b2a44 45%, #18172a 100%);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 5px rgba(31, 30, 49, 0.25);
}

.brand-mark .icon {
  stroke-width: 2;
}

.brand-name {
  font-size: 1.2375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  margin-bottom: var(--space-5);
  padding: 0 var(--space-2) 0 var(--space-3);
  color: var(--text-muted);
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: text;
}

.sidebar-search:focus-within {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.sidebar-search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
}

.kbd-group {
  display: flex;
  gap: 4px;
}

.brand,
.sidebar-search,
.promo {
  flex-shrink: 0;
}

.nav {
  flex: 1 0 auto;
}

.nav-section + .nav-section {
  margin-top: var(--space-6);
}

.nav-title {
  margin: 0 0 var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.nav ul {
  display: grid;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  padding: 0 var(--space-3) 0 13px;
  font-size: var(--text-base);
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.nav-link .icon {
  color: var(--text-secondary);
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-link.is-active {
  color: #fff;
  background: var(--ink-gradient);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 9px rgba(0, 0, 0, 0.16);
}

.nav-link.is-active .icon {
  color: #fff;
}

.nav-label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-badge {
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding: 0 5px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text);
  background: var(--bg-content);
  border-radius: var(--radius-full);
}

.nav-link.is-active .nav-badge {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.promo {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--bg-content)
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.9) 0, transparent 60%);
  border-radius: var(--radius-lg);
}

.promo-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-md);
  font-weight: 500;
}

.promo-crown {
  color: var(--warning);
  fill: #f6c343;
}

.promo-text {
  margin: var(--space-1) 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.promo-actions {
  display: flex;
  gap: var(--space-2);
}

.promo-actions .btn {
  flex: 1;
}

.app-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-7) 0 var(--space-6);
  background: var(--bg-app);
}

.sidebar-toggle {
  display: none;
}

.history {
  display: flex;
  gap: var(--space-2);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.breadcrumb .icon {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb [aria-current] {
  color: var(--text);
  font-weight: 500;
}

/* Long crumbs (e.g. organization names) truncate instead of stretching */
.breadcrumb > a,
.breadcrumb > span {
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.breadcrumb > .icon {
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.account-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 var(--space-2);
  padding: 2px;
  color: var(--text-muted);
  border-radius: var(--radius-full);
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: #fff;
  background: linear-gradient(145deg, #4a4868, #18172a);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border);
}

.content {
  flex: 1;
  padding: var(--space-7);
  background: var(--bg-content);
  border-top-left-radius: var(--radius-xl);
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin-top: 2px;
  color: var(--text-secondary);
}

.page-actions {
  display: flex;
  gap: var(--space-3);
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-padded {
  padding: var(--space-5) var(--space-5) var(--space-5);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin-top: var(--space-1);
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.card-label {
  color: var(--text-secondary);
}

.card-figure {
  margin-top: var(--space-1);
  font-size: var(--text-3xl);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

/* Summary cards */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.summary-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.summary-body {
  padding: var(--space-4) var(--space-4) var(--space-5);
}

.summary-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  color: var(--text);
  background: var(--lavender);
  border: 1px solid #e8e5fb;
  border-radius: var(--radius-md);
}

.summary-heading {
  flex: 1;
  min-width: 0;
}

.summary-heading h2 {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.summary-heading p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.summary-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.summary-value strong {
  font-size: var(--text-2xl);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--success-text);
  background: var(--success-soft);
  border: 1px solid #c5e5d4;
  border-radius: var(--radius-full);
}

.trend .icon {
  stroke-width: 2.2;
}

.summary-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 45px;
  margin-top: auto;
  padding: 0 var(--space-4);
  font-size: var(--text-base);
  color: var(--text-secondary);
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
  transition: color var(--transition), background var(--transition);
}

.summary-footer:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.summary-footer .icon {
  color: var(--text);
  transition: transform var(--transition);
}

.summary-footer:hover .icon {
  transform: translateX(3px);
}

.summary-card.is-featured .summary-body {
  color: #fff;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 20px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 20px),
    var(--hero-gradient);
}

.summary-card.is-featured .icon-tile {
  color: var(--primary-600);
  background: #fff;
  border-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.summary-card.is-featured .summary-heading p {
  color: rgba(255, 255, 255, 0.82);
}

.summary-card.is-featured .icon-btn-ghost {
  color: rgba(255, 255, 255, 0.85);
}

.summary-card.is-featured .icon-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.summary-card.is-featured .trend {
  color: var(--primary-600);
  background: #fff;
  border-color: #fff;
}

/* Split row */

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

/* Station tiles */

.stations .card-header {
  margin-bottom: var(--space-6);
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.tile {
  padding: var(--space-3) var(--space-3) var(--space-4) var(--space-4);
  background: var(--bg-tile);
  border-radius: var(--radius-lg);
}

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

.tile-name {
  flex: 1;
  font-weight: 500;
}

.station-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.station-dot-blue {
  background: radial-gradient(circle at 35% 35%, #7db4ff, #2b2a44);
}

.station-dot-amber {
  background: radial-gradient(circle at 35% 35%, #ffd66b, #e8a008);
}

.station-dot-green {
  background: radial-gradient(circle at 35% 35%, #5fd394, #2b2a44);
}

.station-dot-red {
  background: radial-gradient(circle at 35% 35%, #ff8c8f, #d9363b);
}

.tile-value {
  margin-top: var(--space-4);
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.tile-meta {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.status-text {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
}

.status-text.is-success {
  color: var(--success);
}

.status-text.is-danger {
  color: var(--danger);
}

/* Segmented control */

.segmented {
  display: flex;
  gap: var(--space-2);
  /* Too many tabs for a narrow screen: swipe instead of widening the page */
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented .segment {
  flex-shrink: 0;
}

.segment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 var(--space-4);
  font-size: var(--text-base);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  transition: background var(--transition), color var(--transition);
}

.segment:hover {
  background: var(--bg-hover);
}

.segment.is-active {
  color: #fff;
  background: var(--primary-gradient);
  border-color: var(--primary-700);
}

.segment.is-active::before {
  content: '';
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

/* Sales chart */

.sales {
  background:
    radial-gradient(ellipse at 45% 0%, rgba(233, 246, 239, 0.7), transparent 55%),
    var(--surface);
}

.chart {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  height: 270px;
  margin-top: var(--space-6);
}

.chart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 25px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: right;
}

.chart-axis span {
  line-height: 1;
  transform: translateY(-50%);
}

.chart-axis span:last-child {
  transform: none;
}

.chart-plot {
  position: relative;
  min-width: 0;
}

.chart-plot::before {
  content: '';
  position: absolute;
  inset: 0 0 25px;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 43px 43px;
  background-position: center bottom;
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 20%, #000 10%, transparent 70%);
  pointer-events: none;
}

.chart-bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.chart-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  min-width: 0;
}

.chart-bar {
  position: relative;
  height: calc((100% - 25px) * var(--h) / 100);
  background: linear-gradient(180deg, #e6e5ee 0%, rgba(233, 244, 238, 0.55) 70%, rgba(247, 247, 247, 0) 100%);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  outline: none;
  transition: background var(--transition);
}

.chart-bar:hover,
.chart-bar:focus-visible {
  background: linear-gradient(180deg, #cfcedc 0%, rgba(214, 239, 226, 0.6) 70%, rgba(247, 247, 247, 0) 100%);
  box-shadow: none;
}

.chart-bar.is-active {
  background: linear-gradient(180deg, #18172a 0%, #24233a 35%, rgba(14, 129, 80, 0.35) 75%, rgba(234, 243, 240, 0.2) 100%);
}

.chart-bar.is-active::after {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 18%;
  left: 50%;
  width: 1.5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  transform: translateX(-50%);
}

.chart-marker {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 18px;
  height: 18px;
  background: var(--primary-600);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(3, 104, 62, 0.4);
  transform: translateX(-50%);
}

.chart-label {
  height: 25px;
  padding-top: 7px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
}

.chart-tooltip {
  position: absolute;
  top: -40px;
  left: calc(50% + 36px);
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 171px;
  padding: var(--space-3) var(--space-3);
  white-space: nowrap;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, #2a2a2a 0%, var(--ink) 60%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}

.chart-tooltip p {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  line-height: 1.35;
}

.chart-tooltip strong {
  font-weight: 500;
  color: #fff;
}

.tooltip-date {
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.72);
}

/* Activities */

.activities .card-header {
  align-items: center;
  margin-bottom: var(--space-5);
}

.toolbar {
  display: flex;
  gap: var(--space-3);
}

.table-wrap {
  /* Contains absolutely positioned bits (switch inputs) so they scroll too */
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  white-space: nowrap;
}

.table th {
  height: 47px;
  padding: 0 var(--space-4);
  font-weight: 400;
  color: var(--text-secondary);
  text-align: left;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  height: 54px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: var(--bg-muted);
}

.col-check {
  width: 47px;
}

.col-actions {
  width: 50px;
  text-align: right;
}

.activity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.activity-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
}

.tone-blue {
  color: #2b2a44;
  background: var(--blue-soft);
}

.tone-amber {
  color: #c27803;
  background: var(--amber-soft);
}

.tone-green {
  color: var(--primary-600);
  background: var(--primary-50);
}

.tone-violet {
  color: #7c3aed;
  background: var(--violet-soft);
}

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

.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-subtle);
}

.status-Completed::before {
  background: var(--success);
}

.status-Pending::before {
  background: var(--warning);
}

.status-Failed::before {
  background: var(--danger);
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Links & small controls ---------- */

.link {
  color: var(--primary-600);
  font-weight: 500;
  text-underline-offset: 3px;
}

.link:hover {
  text-decoration: underline;
}

.link-sm {
  font-size: var(--text-sm);
}

.link-muted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.link-button {
  padding: 0;
  font-weight: 500;
  color: var(--primary-600);
  background: none;
  border: 0;
  text-underline-offset: 3px;
}

.link-button:hover:not(:disabled) {
  text-decoration: underline;
}

.link-button:disabled {
  color: var(--text-subtle);
  cursor: default;
}

.btn-block {
  width: 100%;
}

.btn:disabled,
.btn[aria-busy='true'] {
  opacity: 0.75;
  cursor: progress;
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--success-text);
  background: var(--success-soft);
  border-radius: var(--radius-full);
}

/* ---------- Alerts & toasts ---------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid;
  border-radius: var(--radius);
}

.alert .icon {
  margin-top: 1px;
}

.alert-error {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}

.alert-success {
  color: var(--success-text);
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.alert-info {
  color: #1f1e31;
  background: #f3f3f7;
  border-color: #cfe0fd;
}

.alert-warning {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}

.alert-title {
  display: block;
  font-weight: 500;
}

.alert-text {
  display: block;
  margin-top: 4px;
}

.missing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
}

.missing-list .input-type {
  color: inherit;
}

.toast {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 380px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  color: #fff;
  background: linear-gradient(180deg, #2a2a2a 0%, var(--ink) 60%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  animation: toast-in 220ms ease-out;
}

.toast p {
  flex: 1;
  font-size: var(--text-sm);
}

.toast-success .icon:first-child {
  color: #5fd394;
}

.toast-error .icon:first-child {
  color: #ff8c8f;
}

.toast .icon-btn-ghost {
  color: rgba(255, 255, 255, 0.7);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Auth pages ---------- */

.auth {
  background: var(--bg-app);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  padding: var(--space-4);
  gap: var(--space-4);
}

.auth-main {
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-7) var(--space-4);
}

.auth-main .brand {
  margin: 0;
}

.auth-content {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-header {
  margin-bottom: var(--space-6);
  text-align: center;
}

.auth-badge {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  color: var(--primary-600);
  background: var(--primary-50);
  border: 1px solid #c5e5d4;
  border-radius: var(--radius-md);
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.auth-subtitle {
  margin-top: var(--space-2);
  color: var(--text-muted);
}

.auth-subtitle strong {
  font-weight: 500;
  color: var(--text);
}

.auth-form {
  display: grid;
  gap: var(--space-4);
}

.auth-form .btn-primary {
  margin-top: var(--space-1);
}

.auth-switch {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

.auth-resend {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.auth-footer nav {
  display: flex;
  gap: var(--space-4);
}

.auth-footer a:hover {
  color: var(--text);
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-social {
  color: var(--text);
  gap: var(--space-3);
}

/* Fields */

.field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.field-optional {
  font-weight: 400;
  color: var(--text-subtle);
}

.field-control {
  position: relative;
  display: flex;
  align-items: center;
}

.field-control input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: 0;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field-control input::placeholder {
  color: var(--text-subtle);
}

.field-control input:hover {
  border-color: #cfcfcf;
}

.field-control input:focus {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.field-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-subtle);
  pointer-events: none;
}

.field-icon ~ input {
  padding-left: 36px;
}

[data-password-field] input {
  padding-right: 42px;
}

.field-action {
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.field-action:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.field.has-error .field-control input,
.field.has-error .otp input {
  border-color: var(--danger);
}

.field.has-error .field-control input:focus,
.field.has-error .otp input:focus {
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.2);
}

.field-error {
  font-size: var(--text-sm);
  color: #d92d20;
}

.field-hint,
.field-caps {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.field-caps {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #b54708;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-row .checkbox {
  margin-top: 1px;
  flex-shrink: 0;
}

/* Password strength */

.strength {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  width: 96px;
  flex-shrink: 0;
}

.strength-bars span {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--transition);
}

.strength-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.strength[data-score='1'] .strength-bars span:nth-child(-n + 1) {
  background: var(--danger);
}

.strength[data-score='2'] .strength-bars span:nth-child(-n + 2) {
  background: var(--warning);
}

.strength[data-score='3'] .strength-bars span:nth-child(-n + 3) {
  background: #7cc49b;
}

.strength[data-score='4'] .strength-bars span {
  background: var(--primary-500);
}

/* One-time code */

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

.otp input {
  width: 100%;
  min-width: 0;
  height: 52px;
  font-size: 1.35rem;
  font-weight: 500;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: 0;
  box-shadow: var(--shadow-xs);
  caret-color: var(--primary-500);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.otp input:focus {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.otp-sep {
  flex: 0 0 8px;
  height: 2px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

/* Account picker */

.account-list {
  display: grid;
  gap: var(--space-3);
}

.account-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.account-option:hover {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.1);
}

.account-option.is-current {
  background: var(--bg-muted);
}

.account-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius);
}

.level-Admin {
  color: #fff;
  background: var(--ink-gradient);
}

.level-Company {
  color: #2b2a44;
  background: var(--blue-soft);
}

.level-Organization {
  color: var(--primary-600);
  background: var(--primary-50);
}

.level-Member {
  color: #7c3aed;
  background: var(--violet-soft);
}

.account-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.account-name {
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.account-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.account-chevron {
  color: var(--text-subtle);
}

.empty-state {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  background: var(--bg-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-title {
  font-weight: 500;
}

.empty-text {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Brand panel */

.auth-panel {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.1) 0 18%, transparent 18.2%),
    radial-gradient(circle at 105% 70%, rgba(255, 255, 255, 0.07) 0 28%, transparent 28.2%),
    radial-gradient(circle at 30% 115%, rgba(255, 255, 255, 0.06) 0 22%, transparent 22.2%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 28px),
    var(--hero-gradient);
  border-radius: var(--radius-xl);
}

.auth-panel-inner {
  width: 100%;
  padding: var(--space-8) clamp(28px, 6%, 72px);
}

.auth-panel-title {
  max-width: 520px;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.auth-panel-text {
  max-width: 480px;
  margin-top: var(--space-3);
  color: rgba(255, 255, 255, 0.82);
}

.auth-preview {
  position: relative;
  margin-top: var(--space-8);
  margin-right: -12%;
}

.auth-preview img {
  display: block;
  width: 100%;
  height: auto;
  border: 6px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.auth-preview-card {
  position: absolute;
  bottom: -18px;
  left: -18px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
}

.auth-preview-card .icon-tile {
  width: 38px;
  height: 38px;
  color: var(--primary-600);
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.auth-preview-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.auth-preview-value {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
}

.auth-panel-points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-8);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.85);
}

.auth-panel-points li {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Sidebar sign-out form reuses the nav link look */
.nav form {
  margin: 0;
}

button.nav-link {
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
}

/* ---------- Onboarding ---------- */

.onboarding {
  background: var(--bg-app);
}

.ob-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 68px;
  padding: 0 var(--space-7);
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
}

.ob-header .brand {
  margin: 0;
}

.ob-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.ob-user form {
  margin: 0;
}

.ob-user-name {
  font-weight: 500;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
  box-shadow: none;
}

.ob-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: calc(100vh - 68px);
}

.ob-main {
  padding: var(--space-8) var(--space-7) 64px;
  background: var(--bg-content);
}

.ob-content {
  max-width: 760px;
  margin: 0 auto;
}

.ob-aside {
  position: sticky;
  top: 68px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  height: calc(100vh - 68px);
  padding: 56px var(--space-7) var(--space-7);
  overflow-y: auto;
  background: var(--bg-app);
  border-left: 1px solid var(--border);
}

.ob-progress {
  display: none;
}

/* Vertical stepper */

.stepper {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: flex;
  gap: var(--space-4);
  padding-bottom: var(--space-7);
}

.step:last-child {
  padding-bottom: 0;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 32px;
  bottom: 4px;
  left: 13px;
  width: 2px;
  background: var(--border);
  border-radius: var(--radius-full);
}

.step.is-done:not(:last-child)::after {
  background: var(--primary-500);
}

.step-marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-subtle);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}

.step.is-done .step-marker {
  color: #fff;
  background: var(--primary-gradient);
  border-color: var(--primary-600);
}

.step.is-done .step-marker .icon {
  stroke-width: 3;
}

.step.is-current .step-marker {
  color: var(--primary-600);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(31, 30, 49, 0.12);
}

.step-title {
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}

.step.is-done .step-title,
.step.is-current .step-title {
  color: var(--text);
}

.step.is-current .step-title {
  font-weight: 500;
}

.step-text {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.step.is-done .step-text,
.step.is-current .step-text {
  color: var(--text-muted);
}

.ob-help {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
}

.ob-help-icon {
  color: var(--text-muted);
}

.ob-help-title {
  font-weight: 500;
}

.ob-help-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Hero & shared bits */

.ob-hero {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-7);
  text-align: center;
}

.ob-hero-left {
  justify-items: start;
  text-align: left;
}

.ob-celebrate {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-2);
  color: var(--primary-600);
  background: var(--primary-50);
  border: 1px solid #c5e5d4;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(31, 30, 49, 0.06);
}

.ob-title {
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.ob-subtitle {
  max-width: 560px;
  color: var(--text-muted);
}

.ob-perks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.ob-perks li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ob-next {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-7);
}

.ob-footnote {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

.chip-soon {
  color: #b54708;
  background: var(--amber-soft);
}

/* Choice cards */

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.choice-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.choice-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.1), var(--shadow-sm);
  transform: translateY(-1px);
}

.choice-card.is-primary {
  border-color: #c5e5d4;
  background: linear-gradient(180deg, var(--primary-50) 0%, var(--surface) 60%);
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-2);
  color: var(--primary-600);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.choice-badge {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--primary-600);
  background: var(--surface);
  border: 1px solid #c5e5d4;
  border-radius: var(--radius-full);
}

.choice-title {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.choice-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.choice-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--primary-600);
}

/* Organization search */

.ob-search {
  margin-bottom: var(--space-4);
}

.input-lg {
  height: 48px;
  padding: 0 var(--space-4);
  box-shadow: var(--shadow-sm);
}

.input-lg .spinner {
  width: 16px;
  height: 16px;
  color: var(--primary-500);
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.ob-results {
  transition: opacity var(--transition);
}

.ob-results.is-loading {
  opacity: 0.55;
}

.ob-results-meta {
  min-height: 20px;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.org-grid {
  display: grid;
  gap: var(--space-3);
}

.org-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.org-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.1);
}

.org-logo {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
}

.org-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.org-logo-lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-md);
}

.org-info {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.org-name {
  font-weight: 500;
}

.org-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.org-description {
  overflow: hidden;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.org-join {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 var(--space-3);
  height: 32px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.org-card:hover .org-join {
  color: #fff;
  background: var(--primary-600);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
}

.pager-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Join / KYC form */

.org-summary {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.org-summary-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.org-summary-name {
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.kyc-form {
  overflow: hidden;
}

.kyc-section {
  padding: var(--space-6);
}

.kyc-section-head {
  margin-bottom: var(--space-5);
}

.kyc-fields {
  display: grid;
  gap: var(--space-5);
}

.kyc-optional {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-strong);
}

.kyc-optional summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
  color: var(--primary-600);
  cursor: pointer;
  list-style: none;
}

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

.kyc-optional[open] summary {
  margin-bottom: var(--space-4);
}

.kyc-footer {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
}

.kyc-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.field-rejected {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-3);
  font-size: var(--text-sm);
  color: #b42318;
  background: #fef3f2;
  border-radius: var(--radius-sm);
}

/* File dropzone */

.dropzone {
  position: relative;
  display: block;
  padding: var(--space-5);
  text-align: center;
  background: var(--bg-muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.dropzone:hover,
.dropzone.is-dragging {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

.dropzone:focus-within {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.dropzone-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.dropzone-text strong {
  font-weight: 500;
  color: var(--primary-600);
}

.dropzone-hint {
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.dropzone-file {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-align: left;
}

.dropzone-thumb {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  overflow: hidden;
  color: var(--primary-600);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dropzone-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dropzone-meta {
  display: grid;
  flex: 1;
  min-width: 0;
}

.dropzone-name {
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dropzone-size {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.dropzone-change {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--primary-600);
}

.field.has-error .dropzone {
  border-color: var(--danger);
  background: #fffbfa;
}

/* Application status */

.application-list {
  display: grid;
  gap: var(--space-4);
}

.application {
  padding: var(--space-5);
}

.application.is-highlight {
  border-color: #c5e5d4;
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.08);
}

.application-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.application-title {
  flex: 1;
  min-width: 0;
}

.application .alert {
  margin: var(--space-4) 0 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  height: 26px;
  padding: 0 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
}

.status-pill-Pending {
  color: #b54708;
  background: var(--amber-soft);
}

.status-pill-Accepted {
  color: var(--success-text);
  background: var(--success-soft);
}

.status-pill-Rejected {
  color: #b42318;
  background: #fef3f2;
}

.detail-list {
  display: grid;
  margin-top: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.detail {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

.detail + .detail {
  border-top: 1px solid var(--border);
}

.detail-status {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.detail-status .icon {
  stroke-width: 2.6;
}

.detail-Pending {
  color: #b54708;
  background: var(--amber-soft);
}

.detail-Accepted {
  color: #fff;
  background: var(--primary-500);
}

.detail-Rejected {
  color: #fff;
  background: var(--danger);
}

.detail-name {
  font-weight: 500;
}

.detail-value {
  overflow: hidden;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.detail-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.detail-Skipped {
  color: var(--text-subtle);
  background: var(--bg-hover);
}

.detail-label-Skipped {
  color: var(--text-subtle);
}

.detail-label-Accepted {
  color: var(--success-text);
}

.detail-label-Rejected {
  color: #b42318;
}

.detail-comment {
  grid-column: 2 / -1;
  font-size: var(--text-xs);
  color: #b42318;
}

.application-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.application-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Coming-soon preview */

.preview-steps {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-steps li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.preview-steps li > span {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: 50%;
}

/* ---------- Sidebar groups ---------- */

.nav-parent {
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
}

.nav-parent.has-active {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-parent.has-active .icon {
  color: var(--text);
}

.nav-chevron {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-group.is-open .nav-chevron {
  transform: rotate(-180deg);
}

/* Height animates by transitioning the grid row from 0fr to 1fr */
.nav-sub {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 280ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 200ms ease;
}

.nav-group.is-open .nav-sub {
  grid-template-rows: 1fr;
  opacity: 1;
}

.nav-sub-list {
  position: relative;
  min-height: 0;
  overflow: hidden;
  margin-left: 22px;
  padding-left: 14px;
}

/* Tree connector: a vertical rail with a curved branch into each item */
.nav-sub-list::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 20px;
  left: 0;
  width: 1.5px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.nav-sub-list li {
  position: relative;
  padding-top: 2px;
}

.nav-sub-list li::before {
  content: '';
  position: absolute;
  top: 6px;
  left: -14px;
  width: 10px;
  height: 12px;
  border-bottom: 1.5px solid var(--border-strong);
  border-left: 1.5px solid var(--border-strong);
  border-bottom-left-radius: 8px;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transform: translateX(-4px);
  opacity: 0;
  transition: background var(--transition), color var(--transition), transform 260ms ease, opacity 260ms ease;
}

.nav-group.is-open .nav-sub-link {
  transform: none;
  opacity: 1;
}

.nav-group.is-open .nav-sub-list li:nth-child(2) .nav-sub-link {
  transition-delay: 0ms, 0ms, 40ms, 40ms;
}

.nav-group.is-open .nav-sub-list li:nth-child(3) .nav-sub-link {
  transition-delay: 0ms, 0ms, 80ms, 80ms;
}

.nav-sub-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-sub-link.is-active {
  font-weight: 500;
  color: var(--text);
  background: var(--bg-content);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ---------- Data tables ---------- */

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.data-table {
  position: relative;
  min-height: 120px;
}

.data-table.is-loading > * {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.data-table.is-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  width: 40%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  animation: loading-bar 900ms ease-in-out infinite;
}

@keyframes loading-bar {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

.data-table .table tbody tr {
  animation: row-in 280ms ease both;
}

.data-table .table tbody tr:nth-child(2) { animation-delay: 20ms; }
.data-table .table tbody tr:nth-child(3) { animation-delay: 40ms; }
.data-table .table tbody tr:nth-child(4) { animation-delay: 60ms; }
.data-table .table tbody tr:nth-child(5) { animation-delay: 80ms; }
.data-table .table tbody tr:nth-child(n + 6) { animation-delay: 100ms; }

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

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.table-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

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

.icon-btn.is-disabled {
  opacity: 0.4;
  cursor: default;
}

.row-actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0.55;
  transition: opacity var(--transition);
}

.table tbody tr:hover .row-actions,
.row-actions:focus-within {
  opacity: 1;
}

.icon-btn-danger:hover {
  color: var(--danger);
  background: #fef3f2;
}

.entity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.entity-sm {
  gap: var(--space-2);
}

.entity-name {
  font-weight: 500;
}

.entity-logo {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  font-size: var(--text-xs);
  font-weight: 600;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--border);
}

.flag {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.flag-sm {
  width: 20px;
  height: 14px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-sm);
}

.muted {
  color: var(--text-subtle);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #ea5a5f 0%, #d9363b 100%);
  border-color: #c42b30;
}

.btn-danger:hover {
  background: linear-gradient(180deg, #e0474c 0%, #c42b30 100%);
}

/* ---------- Switch ---------- */

.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  transition: background 200ms ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 220ms cubic-bezier(0.3, 1.4, 0.5, 1);
}

.switch input:checked + .switch-track {
  background: var(--primary-500);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--focus-ring);
}

.switch input:disabled + .switch-track {
  opacity: 0.6;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.switch-row > span:first-child {
  display: grid;
  gap: 2px;
}

/* ---------- Select ---------- */

.select {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.select > .icon:first-child {
  position: absolute;
  left: var(--space-3);
  pointer-events: none;
}

.select select {
  width: 100%;
  height: 42px;
  padding: 0 36px;
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  appearance: none;
  cursor: pointer;
  outline: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.select select:focus {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.select-sm select {
  height: 36px;
  min-width: 190px;
}

.select-chevron {
  position: absolute;
  right: var(--space-3);
  pointer-events: none;
}

.field.has-error .select select {
  border-color: var(--danger);
}

/* Enhanced selects (public/js/select.js) */
.select.is-enhanced > select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.select.is-enhanced > .select-chevron,
.select.is-enhanced.has-media > .icon:first-child {
  display: none;
}

.combo-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 42px;
  padding: 0 var(--space-3) 0 36px;
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.select.has-media .combo-trigger {
  padding-left: var(--space-3);
}

.select-sm .combo-trigger {
  min-height: 36px;
  min-width: 190px;
}

.combo-trigger:focus-visible,
.select.is-open .combo-trigger {
  border-color: var(--primary-500);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.field.has-error .combo-trigger,
.select.is-invalid .combo-trigger {
  border-color: var(--danger);
}

.combo-trigger > .icon {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-muted);
}

.combo-value,
.combo-chips {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.combo-chips {
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 0;
}

.combo-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.combo-placeholder {
  color: var(--text-muted);
}

.combo-media {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.combo-initials {
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 500;
  color: var(--primary-600);
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.combo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 6px 0 4px;
  font-size: var(--text-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.combo-chip .combo-media {
  width: 20px;
  height: 20px;
}

.combo-chip-x {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  border-radius: var(--radius-full);
}

.combo-chip-x:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.combo-panel {
  position: fixed;
  z-index: 80;
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  animation: fade-in 120ms ease;
}

.combo-panel[hidden] {
  display: none;
}

.combo-search {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.combo-search input:focus,
.combo-search input:focus-visible {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.combo-search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: none;
  border: 0;
  outline: 0;
}

.combo-list {
  flex: 1;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.combo-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 38px;
  padding: 6px var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.combo-option.is-active {
  background: var(--primary-50);
}

.combo-option.is-selected {
  color: var(--primary-600);
}

.combo-option.is-placeholder {
  color: var(--text-muted);
}

.combo-option[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.5;
}

.combo-labels {
  display: grid;
  flex: 1;
  min-width: 0;
}

.combo-label,
.combo-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.combo-label strong {
  font-weight: 500;
}

.combo-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.combo-check {
  display: grid;
  flex-shrink: 0;
  color: var(--primary-600);
}

.combo-box {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 18px;
  height: 18px;
  color: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

.combo-option.is-selected .combo-box {
  color: #fff;
  background: var(--primary-600);
  border-color: var(--primary-600);
}

.combo-empty {
  padding: var(--space-4);
  font-size: var(--text-sm);
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Drawer ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  visibility: hidden;
}

.drawer.is-open {
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 15, 0.32);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 250ms ease;
}

.drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100vw - 24px));
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  transform: translateX(calc(100% + 24px));
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none;
}

.drawer.is-open .drawer-panel {
  transform: none;
}

.drawer-body {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.drawer-body.is-loading {
  padding: var(--space-6);
}

.drawer-form {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  animation: fade-in 200ms ease;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  font-size: var(--text-lg);
  font-weight: 500;
}

.drawer-subtitle {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.drawer-content {
  display: grid;
  align-content: start;
  flex: 1;
  gap: var(--space-4);
  padding: var(--space-5);
  overflow-y: auto;
}

.drawer-content .alert {
  margin: 0;
}

.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
}

.skeleton {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-hover) 25%, #ececec 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.2s linear infinite;
}

.skeleton + .skeleton {
  margin-top: var(--space-3);
}

.skeleton-lg {
  height: 40px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.flag-preview {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.flag-preview img {
  width: 48px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  animation: fade-in 200ms ease;
}

.flag-placeholder {
  display: grid;
  place-items: center;
  width: 48px;
  height: 34px;
  color: var(--text-subtle);
  background: var(--surface);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.flag-caption {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ---------- Confirm dialog ---------- */

.confirm {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}

.confirm[open] {
  animation: pop-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.confirm::backdrop {
  background: rgba(15, 15, 15, 0.35);
  backdrop-filter: blur(2px);
  animation: fade-in 200ms ease;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

.confirm-inner {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-6);
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-2);
  color: #d92d20;
  background: #fef3f2;
  border-radius: 50%;
  box-shadow: 0 0 0 6px #fffbfa;
}

.confirm-title {
  font-size: var(--text-lg);
  font-weight: 500;
}

.confirm-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ---------- Toast stack ---------- */

.toast-stack {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 80;
  display: grid;
  gap: var(--space-2);
  justify-items: end;
}

.toast-stack .toast {
  position: static;
}

/* Toasts are notices only: never block clicks on what's underneath */
.toast-stack,
.toast-stack .toast {
  pointer-events: none;
}

.toast-stack {
  transition: right 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Keep toasts beside an open drawer instead of over its buttons */
.drawer.is-open ~ .toast-stack {
  right: calc(min(460px, 100vw - 24px) + var(--space-6) + var(--space-3));
}

@media (max-width: 640px) {
  .drawer.is-open ~ .toast-stack {
    top: var(--space-4);
    right: var(--space-4);
    bottom: auto;
    left: var(--space-4);
  }
}

/* ---------- Image upload field ---------- */

.image-field {
  display: grid;
  gap: var(--space-2);
}

.image-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3);
  background: var(--bg-muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.image-drop:hover,
.image-drop.is-dragging {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

.image-drop:focus-within {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.image-drop input[type='file'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-thumb {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  overflow: hidden;
  color: var(--text-subtle);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--border);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: fade-in 200ms ease;
}

.image-meta {
  display: grid;
  min-width: 0;
}

.image-meta .dropzone-empty {
  justify-items: start;
  text-align: left;
}

.image-cta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.image-cta strong {
  font-weight: 500;
  color: var(--primary-600);
}

.image-meta .dropzone-file {
  display: grid;
}

.image-remove {
  padding-left: 2px;
}

.field.has-error .image-drop {
  border-color: var(--danger);
  background: #fffbfa;
}

/* ---------- Roles & permissions ---------- */

.roles-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 560px;
  overflow: hidden;
}

.roles-aside {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.roles-aside-head {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.roles-list {
  flex: 1;
  padding: var(--space-2);
  overflow-y: auto;
}

.role-items {
  display: grid;
  gap: 2px;
}

.role-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition);
  animation: row-in 240ms ease both;
}

.role-item:hover {
  background: var(--bg-hover);
}

.role-item.is-selected {
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.role-tile {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.role-item.is-selected .role-tile {
  color: #fff;
  background: var(--primary-gradient);
}

.role-tile-lg {
  width: 48px;
  height: 48px;
  font-size: var(--text-sm);
  color: #fff;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
}

.role-item-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.role-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 500;
}

.role-name-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.role-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  background: var(--border-strong);
  border-radius: 50%;
}

.status-dot.is-on {
  background: var(--success);
}

.badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 22px;
  padding: 0 7px;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-secondary);
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.badge-brand {
  color: var(--success-text);
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.badge-amber {
  color: #b54708;
  background: var(--amber-soft);
  border-color: #f5dcae;
}

.roles-no-match {
  padding: var(--space-6) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

.role-detail {
  min-width: 0;
  padding: var(--space-6) var(--space-7);
  overflow-y: auto;
  background: var(--bg-muted);
}

.role-detail-inner {
  max-width: 820px;
  animation: fade-in 220ms ease;
}

.role-empty {
  max-width: 420px;
  margin: 80px auto 0;
  background: transparent;
  border: 0;
}

.role-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.role-heading {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
}

.role-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.role-title {
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.role-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.role-meta b {
  font-weight: 500;
  color: var(--text);
}

.dot-sep {
  color: var(--border-strong);
}

.role-description {
  margin-top: var(--space-2);
  max-width: 560px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

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

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
}

.switch-inline:hover {
  background: var(--bg-hover);
}

.role-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.role-lock {
  margin-bottom: var(--space-4);
}

.perm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.perm-card-body {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5);
}

.perm-group-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.perm-group-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.perm-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.perm-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  animation: row-in 220ms ease both;
}

.perm-row + .perm-row {
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.perm-row:hover {
  background: var(--bg-muted);
}

.perm-check {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: var(--radius-sm);
}

.perm-check .icon {
  stroke-width: 2.4;
}

.perm-name {
  flex: 1;
  font-size: var(--text-base);
  color: var(--text);
}

.perm-remove {
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}

.perm-row:hover .perm-remove,
.perm-remove:focus-visible {
  opacity: 1;
}

.perm-row.is-leaving {
  opacity: 0.4;
  transform: translateX(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.perm-empty {
  background: transparent;
  border: 0;
}

.perm-empty .btn {
  margin-top: var(--space-4);
}

.textarea {
  width: 100%;
  padding: var(--space-3);
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  outline: 0;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.textarea:focus {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.eyebrow {
  margin-bottom: 2px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--primary-600);
}

.drawer-search {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.drawer-footer-split {
  align-items: center;
  justify-content: space-between;
}

.drawer-footer-actions {
  display: flex;
  gap: var(--space-3);
}

.pick-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.pick-group + .pick-group {
  margin-top: var(--space-2);
}

.pick-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pick-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 6px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.pick-row:hover {
  background: var(--bg-muted);
}

.pick-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pick-box {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: transparent;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.pick-box .icon {
  stroke-width: 3;
}

.pick-row:has(input:checked) {
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.pick-row input:checked + .pick-box {
  color: #fff;
  background: var(--primary-500);
  border-color: var(--primary-500);
  transform: scale(1.05);
}

.pick-row input:focus-visible + .pick-box {
  box-shadow: var(--focus-ring);
}

.pick-name {
  flex: 1;
  font-size: var(--text-base);
}

.error-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-6);
  background: var(--bg-content);
}

.error-card {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  max-width: 460px;
  padding: var(--space-8);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ---------- Staff ---------- */

.row-link {
  cursor: pointer;
}

.entity-stack {
  display: grid;
  min-width: 0;
}

.entity-stack .entity-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entity-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.chip-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.segment-count {
  font-size: var(--text-xs);
  opacity: 0.7;
}

.drawer-person {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
}

.drawer-person .drawer-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-rows {
  display: grid;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.detail-rows > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
}

.detail-rows > div + div {
  border-top: 1px solid var(--border);
}

.detail-rows dt {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.detail-rows dd {
  margin: 0;
}

.role-picks {
  display: grid;
}

.role-picks .pick-row:first-child {
  margin-top: 0;
}

.pick-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pick-row.is-locked {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ---------- Workspace (organization in admin) ---------- */

/* Main navigation collapses to an icon rail */
@media (min-width: 1025px) {
  .is-workspace .sidebar {
    width: 76px;
    z-index: 40;
    padding-inline: var(--space-3);
    overflow: visible;
    transition: width 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .is-workspace .brand-name,
  .is-workspace .sidebar-search,
  .is-workspace .nav-title,
  .is-workspace .nav-label,
  .is-workspace .nav-badge,
  .is-workspace .nav-chevron,
  .is-workspace .promo {
    display: none;
  }

  .is-workspace .brand {
    justify-content: center;
    padding: 0;
  }

  .is-workspace .nav-section + .nav-section {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
  }

  .is-workspace .nav-link {
    position: relative;
    justify-content: center;
    padding: 0;
  }

  /* Hover labels */
  .is-workspace .nav-link::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 50;
    padding: 5px 9px;
    font-size: var(--text-sm);
    color: #fff;
    white-space: nowrap;
    background: var(--ink);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    pointer-events: none;
    transform: translate(-4px, -50%);
    transition: opacity 150ms ease, transform 150ms ease;
  }

  .is-workspace .nav-link:hover::after,
  .is-workspace .nav-link:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
  }

  /* Groups open as a flyout beside the rail */
  .is-workspace .nav-group {
    position: relative;
  }

  .is-workspace .nav-group .nav-sub {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    z-index: 50;
    display: block;
    min-width: 170px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
  }

  .is-workspace .nav-group:hover .nav-sub,
  .is-workspace .nav-group:focus-within .nav-sub {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .is-workspace .nav-group:hover .nav-parent::after {
    opacity: 0;
  }

  .is-workspace .nav-sub-list {
    margin: 0;
    padding: 0;
  }

  .is-workspace .nav-sub-list::before,
  .is-workspace .nav-sub-list li::before {
    display: none;
  }

  .is-workspace .nav-sub-link {
    opacity: 1;
    transform: none;
  }
}

.workspace {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  animation: fade-in 220ms ease;
}

.ws-nav {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-4));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  min-width: 0;
}

.ws-back {
  font-size: var(--text-sm);
}

.ws-org {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.ws-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  font-size: var(--text-sm);
}

.ws-org-text {
  flex: 1;
  min-width: 0;
}

/* Long names wrap to two lines, then ellipsis (full name in the title) */
.ws-org-name {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.ws-org-meta > * {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-org-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.ws-links {
  display: grid;
  gap: 2px;
}

.ws-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 38px;
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.ws-link:hover {
  color: var(--text);
  background: var(--surface);
}

.ws-link.is-active {
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-xs);
}

.ws-link.is-active .icon {
  color: var(--primary-600);
}

.ws-badge {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  padding: 0 6px;
  font-size: var(--text-xs);
  color: #b54708;
  background: var(--amber-soft);
  border-radius: var(--radius-full);
}

.ws-main {
  min-width: 0;
}

.ws-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.ws-columns-wide {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: start;
}

.ws-description {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.stat-card {
  display: grid;
  gap: 2px;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  border-color: #c5e5d4;
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.08);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: var(--space-2);
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: var(--radius);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.text-warning {
  color: #b54708;
  font-weight: 500;
}

.attention-list {
  display: grid;
  gap: 2px;
  margin-top: var(--space-2);
}

.attention-list a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.attention-list a:hover {
  background: var(--bg-muted);
}

.attention-list a > .icon:first-child {
  color: #b54708;
}

.attention-chevron {
  margin-left: auto;
  color: var(--text-subtle);
}

.all-good {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--success-text);
}

.people-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.people-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Pills & progress */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  font-size: var(--text-sm);
  white-space: nowrap;
  border-radius: var(--radius-full);
}

.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.pill-sm {
  height: 20px;
  padding: 0 8px;
  font-size: var(--text-xs);
}

.pill-success {
  color: var(--success-text);
  background: var(--success-soft);
}

.pill-warning {
  color: #b54708;
  background: var(--amber-soft);
}

.pill-danger {
  color: #b42318;
  background: #fef3f2;
}

.pill-muted {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.code-chip-sm {
  height: 18px;
  padding: 0 5px;
}

.kyc-progress {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.progress-bar {
  display: block;
  width: 72px;
  height: 6px;
  overflow: hidden;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f1b44c, #e8a008);
  border-radius: var(--radius-full);
  transition: width 400ms ease;
}

.progress-bar.is-complete > span {
  background: var(--primary-gradient);
}

.progress-bar-lg {
  width: 100%;
  height: 8px;
}

.kyc-progress-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.kyc-summary {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.kyc-summary-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.kyc-counts {
  display: grid;
  gap: var(--space-2);
}

.kyc-counts li {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.kyc-counts b {
  font-weight: 500;
}

.status-Inactive::before {
  background: var(--border-strong);
}

.kyc-banner {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Table / cards layout switch */
.view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.view-toggle-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.view-toggle-btn:hover {
  color: var(--text);
}

.view-toggle-btn.is-active {
  color: var(--primary-600);
  background: var(--surface);
  border-color: var(--border);
}

.view-cards {
  display: none;
}

[data-view='cards'] .view-table {
  display: none;
}

[data-view='cards'] .view-cards {
  display: grid;
}

.entity-cards {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-4);
}

.entity-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: var(--space-4);
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  animation: row-in 280ms ease both;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

a.entity-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.08), var(--shadow-sm);
  transform: translateY(-1px);
}

.entity-card.is-muted .entity-card-title,
.entity-card.is-muted .entity-logo {
  opacity: 0.6;
}

.entity-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.entity-card-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.entity-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.entity-card-meta .icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.entity-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.entity-card-stats strong {
  font-weight: 500;
  color: var(--text);
}

.entity-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.entity-card-foot .link-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Station page */
.station-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--space-3);
}

.station-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

.station-media {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.station-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.station-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.station-cover:hover img {
  transform: scale(1.02);
}

.station-cover.is-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-2);
  cursor: default;
}

.station-cover-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: var(--text-xs);
  color: #fff;
  background: rgba(16, 24, 40, 0.6);
  border-radius: var(--radius-full);
}

.station-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: var(--space-2);
}

.station-thumb,
.photo-open {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.station-thumb img,
.photo-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.station-thumb:hover {
  border-color: var(--primary-500);
}

.station-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2) var(--space-2) var(--space-2) 0;
}

.station-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.station-title-row .page-title {
  overflow-wrap: anywhere;
}

.station-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.station-meta .icon {
  color: var(--text-muted);
}

.station-description {
  margin-top: var(--space-1);
  font-size: var(--text-base);
  color: var(--text-secondary);
  white-space: pre-line;
}

.station-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
}

.stat-value-sm {
  font-size: var(--text-lg);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.photo-tile {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.photo-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--text-xs);
  color: #fff;
  background: rgba(31, 30, 49, 0.9);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.photo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.photo-title {
  min-width: 0;
  overflow: hidden;
  font-size: var(--text-sm);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.photo-actions {
  display: inline-flex;
  flex-shrink: 0;
}

.photo-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.card-note-flush {
  padding: var(--space-3) 0 0;
}

.readings-card {
  margin-bottom: var(--space-5);
}

.reading-sold {
  font-weight: 500;
  color: var(--primary-600);
}

.evidence-thumbs {
  display: inline-flex;
  gap: 4px;
}

.evidence-thumb {
  width: 30px;
  height: 30px;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.evidence-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bill-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bill-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.bill-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.bill-head .entity-stack {
  flex: 1;
  min-width: 0;
}

.bill-items {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
}

.bill-items th,
.bill-items td {
  padding: 8px var(--space-4);
  text-align: left;
  border-top: 1px solid var(--border);
}

.bill-items th {
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-content);
}

.bill-items th:last-child,
.bill-items td:last-child {
  text-align: right;
}

/* Numbers stay on one line; the description takes the remaining width */
.bill-items td:not(:first-child),
.bill-items th:not(:first-child) {
  white-space: nowrap;
}

.bill-items td:first-child {
  width: 100%;
}

.bill-items tfoot td {
  font-weight: 500;
}

.bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.bill-meta > span,
.bill-settle-label,
.bill-settle-sub > span,
.bill-settle-none,
.bill-grand > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bill-meta .icon,
.bill-settle-label .icon,
.bill-settle-sub .icon,
.bill-grand .icon {
  color: var(--text-muted);
}

.bill-settle {
  display: grid;
  gap: 8px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-content);
  border-top: 1px solid var(--border);
}

.bill-settle-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bill-settle-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}

.bill-settle-none {
  font-size: var(--text-sm);
  color: #b54708;
}

.bill-grand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  font-size: var(--text-base);
}

.bill-grand strong {
  font-weight: 500;
}

.collect-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.collect-history {
  display: grid;
  gap: 6px;
}

.collect-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: 8px var(--space-3);
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.collect-history-row:hover {
  border-color: var(--border-strong);
}

.collect-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  border-radius: var(--radius-lg);
}

.collect-state.is-waiting {
  background: #fffaeb;
}

.collect-state.is-success {
  background: var(--primary-50);
}

.collect-state.is-failed {
  background: #fef3f2;
}

.collect-state-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: var(--space-2);
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
}

.is-waiting .collect-state-icon {
  color: #b54708;
}

.is-success .collect-state-icon {
  color: var(--primary-600);
}

.is-failed .collect-state-icon {
  color: #d92d20;
}

.collect-amount {
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.collect-text {
  max-width: 34ch;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.collect-dots {
  display: inline-flex;
  gap: 5px;
  margin-top: var(--space-2);
}

.collect-dots i {
  width: 7px;
  height: 7px;
  background: #f5a524;
  border-radius: 50%;
  animation: collect-dot 1.2s ease-in-out infinite;
}

.collect-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.collect-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes collect-dot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.collect-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.collect-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}

.collect-chip.is-paid {
  cursor: pointer;
  color: var(--success-text, #1f1e31);
  background: var(--primary-50);
  border-color: #c5e5d4;
}

.collect-chip.is-waiting {
  cursor: pointer;
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}

.collect-chip.is-waiting .icon {
  animation: spin 1.2s linear infinite;
}

.fee-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Transactions */
.settle-plan {
  display: grid;
  gap: 8px;
}

.settle-plan li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.settle-plan .entity-stack {
  flex: 1;
  min-width: 0;
}

.tx-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.tx-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.tx-card-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
}

.tx-card-icon.is-success { color: var(--primary-600); background: var(--primary-50); }
.tx-card-icon.is-waiting { color: #b54708; background: #fffaeb; }
.tx-card-icon.is-failed { color: #d92d20; background: #fef3f2; }

.tx-card-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.tx-card-value {
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tx-dir {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.tx-dir.is-in { color: var(--primary-600); background: var(--primary-50); }
.tx-dir.is-out { color: #c4320a; background: #fff4ed; }

.tx-logo {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
}

.tx-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tx-logo-badge.is-out {
  background: #e8590c;
}

.tx-logo-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #fff;
  background: var(--primary-600);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.tx-amount {
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tx-amount.is-in {
  color: var(--primary-600);
}

.tx-drawer-logo {
  width: 42px;
  height: 42px;
}

.tx-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
}

.tx-status.is-success { color: var(--primary-600); background: var(--primary-50); }
.tx-status.is-warning { color: #b54708; background: #fffaeb; }
.tx-status.is-danger { color: #b42318; background: #fef3f2; }
.tx-status.is-muted { color: var(--text-secondary); background: var(--bg-hover); }

.tx-status .entity-sub {
  color: inherit;
  opacity: 0.85;
}

.detail-rows dt .icon {
  vertical-align: -2px;
  margin-right: 4px;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .tx-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Station card cover */
.entity-card-cover {
  display: block;
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-2);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-content);
}

.entity-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

a.entity-card-title {
  color: inherit;
}

.entity-card-switch {
  margin-left: auto;
}

a.entity-card-title:hover,
.table a.entity-name:hover {
  color: var(--primary-600);
}

/* Multi-photo upload */
.multi-drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  background: var(--bg-content);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background var(--transition);
}

.multi-drop:hover,
.multi-drop:focus-within {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.multi-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.multi-drop-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.multi-drop-empty .icon {
  color: var(--primary-600);
}

.multi-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: var(--space-2);
}

.multi-previews:empty {
  display: none;
}

.multi-previews li {
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.multi-previews li.is-too-big {
  border-color: var(--danger);
  outline: 2px solid rgba(229, 72, 77, 0.25);
}

.multi-previews img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  padding: var(--space-6) var(--space-4);
  background: rgba(10, 14, 20, 0.88);
  animation: fade-in 160ms ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  min-width: 0;
  margin: 0;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: var(--radius-md);
}

.lightbox-figure figcaption {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
}

.lightbox .icon-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
}

.lightbox .icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

.lightbox-nav {
  justify-self: center;
}

.lightbox.is-single .lightbox-nav {
  visibility: hidden;
}

@media (max-width: 900px) {
  .station-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .station-info {
    padding: 0;
  }

  .lightbox {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: var(--space-4) var(--space-2);
  }
}

/* Settlements */
.settle-dest {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.settle-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: var(--radius-sm);
}

.settle-logo {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.settle-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.settle-type .icon {
  color: var(--text-muted);
}

.settle-stations {
  border-top: 1px solid var(--border);
}

.settle-station + .settle-station {
  border-top: 1px solid var(--border);
}

.settle-station-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
}

.settle-station .table-wrap {
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.dest-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.dest-option {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: var(--space-3) var(--space-2);
  font-size: var(--text-sm);
  text-align: center;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

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

.dest-option:hover {
  border-color: var(--border-strong);
}

.dest-option:has(input:checked) {
  color: var(--primary-600);
  background: var(--primary-50);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.1);
}

.dest-option:has(input:focus-visible) {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Fields and labels that only apply to one destination type */
.settle-form [data-for],
.settle-form .field:has(#accountNumber) {
  display: none;
}

.settle-form:has(input[name='settleTo'][value='Mobile']:checked) [data-for='Mobile'],
.settle-form:has(input[name='settleTo'][value='Bank']:checked) [data-for='Bank'],
.settle-form:has(input[name='settleTo'][value='Paybill']:checked) [data-for='Paybill'],
.settle-form:has(input[name='settleTo'][value='Till']:checked) [data-for='Till'] {
  display: revert;
}

.settle-form:has(input[name='settleTo'][value='Bank']:checked) .field[data-for='Bank'],
.settle-form:has(input[name='settleTo'][value='Paybill']:checked) .field:has(#accountNumber) {
  display: grid;
}

@media (max-width: 520px) {
  .dest-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Analytics (layout after the "Transaction Insights" reference) */
:root {
  --an-s1: #1f1e31;
  --an-s2: #eb6834;
  --an-s3: #2a78d6;
  --an-s4: #f5a524;
  --an-s5: #8391b0;
  --an-s6: #0ea5e9;
  --an-good: #1f9d55;
  --an-warning: #f5a524;
  --an-critical: #d03b3b;
  --an-serious: #ec835a;
  --an-processing: #8391b0;
  --an-grid: #eceff3;
  --an-muted: #8a94a3;
  --an-surface-2: #f1f3f6;
  --an-heat-1: #e6e5ee;
  --an-heat-2: #a5a3ba;
  --an-heat-3: #7a7896;
  --an-heat-4: #4a4868;
  --an-heat-5: #1f1e31;
  --an-heat-6: #121120;
  --an-shadow: 0 1px 2px rgba(14, 22, 36, 0.04), 0 2px 8px rgba(14, 22, 36, 0.05);
  --an-radius: 8px;
}

.an-top {
  margin-bottom: var(--space-4);
}

.an-eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--an-muted);
  text-transform: uppercase;
}

.an-filters {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-2));
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: var(--space-4);
  padding: 10px 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--an-radius);
  box-shadow: var(--an-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.an-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-field > span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--an-muted);
}

.an-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--an-surface-2);
  border-radius: 7px;
}

.an-seg a {
  padding: 5px 11px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
}

.an-seg a[aria-current='page'] {
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.an-spacer {
  flex: 1;
}

.an-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.an-scope .icon {
  color: var(--an-muted);
}

.an-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: var(--space-4);
}

.an-kpi {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  overflow: hidden;
  gap: 6px;
  min-width: 0;
  padding: 16px 16px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--an-radius);
  box-shadow: var(--an-shadow);
}

.an-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--an-muted);
}

.an-value {
  overflow: hidden;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.an-value.is-negative {
  color: var(--an-critical);
}

.an-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--an-muted);
}

.an-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.an-delta.is-up {
  color: #0b7a0b;
  background: #e5f5e5;
}

.an-delta.is-up::before {
  content: '▲';
  font-size: 9px;
}

.an-delta.is-down {
  color: #b22f2f;
  background: #fbe9e9;
}

.an-delta.is-down::before {
  content: '▼';
  font-size: 9px;
}

.an-delta.is-flat {
  color: var(--text-secondary);
  background: var(--an-surface-2);
}

.an-spark {
  min-width: 0;
  min-height: 34px;
  overflow: hidden;
}

[data-chart='heatmap'] {
  overflow-x: auto;
}

.an-spark.is-flat {
  height: 34px;
  background: linear-gradient(var(--an-grid), var(--an-grid)) center / 100% 1px no-repeat;
}

.an-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.an-span-2 {
  grid-column: span 2;
}

.an-span-3 {
  grid-column: span 3;
}

.an-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--an-radius);
  box-shadow: var(--an-shadow);
}

.an-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.an-card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.an-card-head p {
  max-width: 60ch;
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.an-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.an-legend:empty {
  display: none;
}

.an-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.an-sw {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.an-chart {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: var(--h, 120px);
}

.an-chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.an-ax {
  font-size: 12px;
  fill: var(--an-muted);
  font-variant-numeric: tabular-nums;
}

.an-ax-name {
  fill: var(--text-secondary);
  font-size: 12px;
}

.an-cell {
  cursor: pointer;
}

.an-cell:hover {
  stroke: var(--text);
  stroke-width: 1.5;
}

.an-empty {
  display: grid;
  place-items: center;
  min-height: var(--h, 120px);
  padding: 24px 12px;
  font-size: 13px;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: 7px;
}

/* Donut + list */
.an-donut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.an-donut svg {
  flex: none;
  width: 170px;
}

.an-arc {
  cursor: pointer;
  stroke: var(--surface);
  stroke-width: 2;
  stroke-linejoin: round;
  transition: opacity 0.15s;
}

.an-donut svg:hover .an-arc {
  opacity: 0.45;
}

.an-donut svg .an-arc:hover {
  opacity: 1;
}

.an-center-n {
  font-size: 18px;
  font-weight: 500;
  fill: var(--text);
  font-variant-numeric: tabular-nums;
}

.an-center-l {
  font-size: 12px;
  fill: var(--an-muted);
}

.an-list {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 180px;
}

.an-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 8px;
}

.an-row:hover {
  background: var(--an-surface-2);
}

.an-c {
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.an-p {
  width: 48px;
  font-size: 12px;
  text-align: right;
  color: var(--an-muted);
  font-variant-numeric: tabular-nums;
}

/* Stacked status bars */
.an-stacks {
  display: grid;
  gap: 16px;
}

.an-stack {
  display: grid;
  gap: 7px;
}

.an-stack-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.an-stack-top b {
  font-size: 14px;
  font-weight: 500;
}

.an-stack-top span {
  font-size: 12px;
  color: var(--an-muted);
  font-variant-numeric: tabular-nums;
}

.an-stackbar {
  display: flex;
  gap: 2px;
  height: 12px;
}

.an-stackbar.is-empty {
  background: var(--an-surface-2);
  border-radius: 4px;
}

.an-stackbar i {
  display: block;
  min-width: 2px;
  height: 100%;
  cursor: pointer;
  transition: opacity 0.15s;
}

.an-stackbar i:first-child {
  border-radius: 4px 0 0 4px;
}

.an-stackbar i:last-child {
  border-radius: 0 4px 4px 0;
}

.an-stackbar i:only-child {
  border-radius: 4px;
}

.an-stackbar:hover i {
  opacity: 0.5;
}

.an-stackbar i:hover {
  opacity: 1;
}

/* Ranked bars */
.an-ranks {
  display: grid;
  gap: 10px;
}

.an-rank {
  display: grid;
  grid-template-columns: minmax(0, 130px) 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.an-rank-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.an-track {
  height: 10px;
  overflow: hidden;
  background: var(--an-surface-2);
  border-radius: 4px;
}

.an-track i {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.an-rank:hover .an-track i {
  filter: brightness(1.08);
}

.an-rank-v {
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.an-rank-v small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--an-muted);
}

/* Heatmap legend */
.an-heat-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--an-muted);
}

.an-heat-legend i {
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.an-heat-legend .an-hatch-sw {
  margin-left: 10px;
  background: repeating-linear-gradient(45deg, var(--an-surface-2) 0 3px, #c4c9d2 3px 4px);
}

/* Tooltip */
.an-tip {
  position: fixed;
  z-index: 20;
  display: grid;
  gap: 5px;
  min-width: 170px;
  max-width: 280px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}

.an-tip.is-apex {
  position: static;
  box-shadow: none;
  border: 0;
}

.an-tip-t {
  margin-bottom: 2px;
  font-size: 12.5px;
  font-weight: 500;
}

.an-tip-r {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
}

.an-tip-r .an-sw {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.an-tip-r span:last-child {
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.an-tip-r.is-total {
  margin-top: 2px;
  padding-top: 5px;
  font-weight: 500;
  border-top: 1px solid var(--border);
}

.an-card .apexcharts-tooltip.apexcharts-theme-light {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}

.an-card .apexcharts-xaxis-label,
.an-card .apexcharts-yaxis-label {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .an-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .an-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .an-span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .an-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .an-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .an-span-2,
  .an-span-3 {
    grid-column: auto;
  }

  .an-filters {
    position: static;
  }

  .an-spacer {
    display: none;
  }
}

/* Pricing */
.price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}

.price-stat {
  display: grid;
  gap: 2px;
  padding: var(--space-4) var(--space-5);
}

.price-stat + .price-stat {
  border-left: 1px solid var(--border);
}

.price-label,
.price-unit {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.price-value {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text);
}

.price-value.is-negative,
.text-danger {
  color: #d92d20;
}

.form-section-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.form-section .field-hint {
  font-weight: 400;
}

.charges-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

.charges-row .entity-stack {
  flex: 1;
  min-width: 0;
}

@media (max-width: 720px) {
  .price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .price-stat:nth-child(3) {
    border-left: 0;
  }

  .price-stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}

/* Member requirements */
.ws-main > .card + .card {
  margin-top: var(--space-5);
}

.card-header-padded {
  padding: var(--space-5) var(--space-5) var(--space-4);
}

.card-header-padded + .data-table,
.card-header-padded + .table-wrap {
  border-top: 1px solid var(--border);
}

.card-note {
  padding: 0 var(--space-5) var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.input-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.input-type .icon {
  color: var(--text-muted);
}

.type-options {
  display: grid;
  gap: var(--space-2);
}

.type-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.type-option:hover {
  border-color: var(--border-strong, #d0d5dd);
}

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

.type-option-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.type-option-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.type-option-label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.type-option:has(input:checked) {
  background: var(--primary-50);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(31, 30, 49, 0.1);
}

.type-option:has(input:checked) .type-option-icon {
  color: var(--primary-600);
  background: var(--surface);
  border-color: #c5e5d4;
}

.type-option:has(input:focus-visible) {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.textarea.is-invalid {
  border-color: var(--danger);
}

.table-wrap-flush {
  border: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kyc-table td {
  height: auto;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  vertical-align: top;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.card-footer-flush {
  justify-content: flex-end;
  margin: var(--space-5) calc(var(--space-5) * -1) calc(var(--space-5) * -1);
}

.form-section {
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.drawer-content > .form-section:first-child,
.drawer-content > .alert + .form-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.settings-fields {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.status-help {
  margin: var(--space-2) 0 var(--space-4);
}

.status-actions {
  display: grid;
  gap: var(--space-3);
}

.status-actions li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.btn-danger-outline {
  color: #b42318;
  border-color: #fecdca;
}

.btn-danger-outline:hover {
  background: #fef3f2;
}

/* User picker */

.picker-selected {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--primary-50);
  border: 1px solid #c5e5d4;
  border-radius: var(--radius);
  animation: fade-in 180ms ease;
}

.picker-selected .entity-stack {
  flex: 1;
}

.picker-results {
  margin-top: var(--space-2);
  transition: opacity var(--transition);
}

.picker-results.is-loading {
  opacity: 0.5;
}

.picker-options {
  display: grid;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.picker-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2);
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.picker-option:hover,
.picker-option:focus-visible {
  background: var(--bg-muted);
}

.picker-hint {
  padding: var(--space-2) 2px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.avatar-xs {
  width: 24px;
  height: 24px;
  font-size: 0.6rem;
  box-shadow: none;
}

/* Review */

.review-list {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.review-item {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

.review-item + .review-item {
  border-top: 1px solid var(--border);
}

.review-item.is-empty {
  opacity: 0.7;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.review-name {
  font-weight: 500;
}

.review-text {
  font-size: var(--text-base);
}

.review-choice {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

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

.choice-accept:has(input:checked) {
  color: #fff;
  background: var(--primary-500);
}

.choice-reject:has(input:checked) {
  color: #fff;
  background: var(--danger);
}

.choice:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.review-comment {
  margin-top: 6px;
}

.input-plain {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: 0;
}

.input-plain:focus {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.file-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.file-link:hover {
  border-color: var(--primary-500);
}

.file-link img,
.file-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: cover;
  color: var(--primary-600);
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.file-link-sm {
  display: inline-flex;
  padding: 4px 10px 4px 4px;
}

.file-link-sm img,
.file-link-sm .file-icon {
  width: 32px;
  height: 32px;
}

/* Structure tree */

.org-tree {
  display: grid;
  gap: var(--space-5);
}

.tree-root {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-self: start;
  padding: var(--space-3) var(--space-5) var(--space-3) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tree-branch {
  position: relative;
  margin-left: 22px;
  padding-left: var(--space-6);
  border-left: 1.5px solid var(--border-strong);
}

.tree-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.tree-label::before {
  content: '';
  position: absolute;
  left: calc(var(--space-6) * -1);
  top: 50%;
  width: calc(var(--space-6) - 6px);
  border-top: 1.5px solid var(--border-strong);
}

.tree-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.tree-node {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: row-in 240ms ease both;
}

.tree-node.is-inactive {
  opacity: 0.65;
}

.tree-node-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.tree-people {
  display: grid;
  gap: 6px;
}

.tree-people li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.tree-people li.is-inactive {
  opacity: 0.6;
}

.tree-empty {
  font-size: var(--text-sm);
}

/* Attendants */

.attendant-list {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.attendant {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.attendant + .attendant {
  border-top: 1px solid var(--border);
}

.attendant .entity-stack {
  flex: 1;
}

.attendant.is-inactive .entity-stack {
  opacity: 0.6;
}

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .split-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    box-shadow: var(--shadow-pop);
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }

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

  .sidebar-open .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: rgba(15, 15, 15, 0.35);
  }

  .sidebar-toggle {
    display: inline-grid;
  }

  .history {
    display: none;
  }

  .content {
    border-top-left-radius: 0;
  }

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

  .summary-grid > :first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .topbar {
    gap: var(--space-2);
    padding: 0 var(--space-4);
  }

  .hide-sm {
    display: none;
  }

  .content {
    padding: var(--space-4);
  }

  .page-header,
  .activities .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar {
    width: 100%;
  }

  .input-search {
    flex: 1;
    width: auto;
  }

  .hide-md {
    display: none;
  }

  .chart {
    height: 234px;
  }

  .chart-tooltip {
    left: auto;
    right: calc(50% + 16px);
  }
}

@media (max-width: 480px) {
  .station-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stations .card-header,
  .sales .card-header {
    flex-direction: column;
  }

  .page-actions {
    flex-wrap: wrap;
  }

  .breadcrumb a,
  .breadcrumb .icon {
    display: none;
  }
}

@media (max-width: 1024px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }

  .auth-panel {
    display: none;
  }

  .auth-main {
    min-height: 100vh;
    padding: var(--space-5) var(--space-5) var(--space-4);
  }
}

@media (max-width: 480px) {
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-title {
    font-size: 1.5rem;
  }

  .otp {
    gap: 6px;
  }

  .otp input {
    height: 46px;
  }

  .toast {
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    max-width: none;
  }
}

@media (max-width: 1024px) {
  .ob-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .ob-aside {
    display: none;
  }

  .ob-progress {
    display: block;
    max-width: 760px;
    margin: 0 auto var(--space-6);
  }

  .ob-progress-text {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
  }

  .ob-progress-text span:last-child {
    font-weight: 500;
    color: var(--text);
  }

  .ob-progress-bar {
    height: 6px;
    overflow: hidden;
    background: var(--border);
    border-radius: var(--radius-full);
  }

  .ob-progress-bar span {
    display: block;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
  }
}

@media (max-width: 640px) {
  .ob-header {
    padding: 0 var(--space-4);
  }

  .ob-user-name {
    display: none;
  }

  .ob-main {
    padding: var(--space-5) var(--space-4) var(--space-8);
  }

  .choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .org-description {
    display: none;
  }

  .org-join {
    padding: 0;
    width: 32px;
    justify-content: center;
    font-size: 0;
  }

  .kyc-section,
  .kyc-footer {
    padding: var(--space-4);
  }

  .kyc-actions {
    flex-direction: column-reverse;
  }

  .kyc-actions .btn {
    width: 100%;
  }

  .detail {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .detail-value {
    grid-column: 2 / -1;
    grid-row: 2;
  }
}

@media (max-width: 900px) {
  .roles-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .roles-aside {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .roles-list {
    max-height: 260px;
  }

  .role-detail {
    padding: var(--space-5) var(--space-4);
  }

  .role-header {
    flex-direction: column;
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .ws-nav {
    position: static;
  }

  .ws-links {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }

  .ws-link {
    flex-shrink: 0;
  }

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

  .ws-columns,
  .ws-columns-wide {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

/* Dashboard (reuses the analytics cards, KPIs, ranks and tooltip) */
.db-kpis {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.db-kpi-link {
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.db-kpi-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.db-kpi-link:focus-visible,
.db-attention-item:focus-visible,
.db-rank:focus-visible,
.db-missed a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.db-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.db-notice h2 {
  margin: 0 0 2px;
  font-size: var(--text-sm);
  font-weight: 600;
}

.db-notice p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.db-notice-icon,
.db-attention-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--primary-600);
  background: var(--primary-50);
  border-radius: var(--radius-md);
}

.db-attention,
.db-missed {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.db-attention-item,
.db-missed li > a,
.db-missed li > span {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  margin: 0 -8px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-md);
}

a.db-attention-item:hover,
.db-missed li > a:hover {
  background: var(--bg-hover);
}

.db-attention-icon.is-warning {
  color: #b54708;
  background: var(--amber-soft);
}

.db-attention-icon.is-danger {
  color: #b42318;
  background: #fef3f2;
}

.db-attention-icon.is-muted {
  color: var(--text-muted);
  background: var(--bg-muted);
}

.db-attention-text,
.db-missed li b,
.db-activity-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.db-attention-text b,
.db-missed b {
  font-size: 13px;
  font-weight: 500;
}

.db-attention-text small,
.db-missed small,
.db-activity-text small,
.an-rank-name small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.db-missed li > a > span:nth-child(2),
.db-missed li > span > span:first-child {
  flex: 1;
  min-width: 0;
}

.db-missed .status-dot {
  background: var(--danger);
}

.db-list-end {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.db-coverage {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--success-text);
  font-variant-numeric: tabular-nums;
}

.db-coverage.is-short {
  color: #b54708;
}

.db-clear {
  gap: 8px;
  color: var(--success-text);
}

.db-more {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.db-rank {
  color: inherit;
  text-decoration: none;
}

.db-activity-text a {
  color: inherit;
  font-weight: 500;
}

/* Organization portal sidebar: identity card, tighter sections, KYC card */
.side-org {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: calc(var(--space-2) * -1) 0 var(--space-4);
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.side-org-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  font-size: 13px;
}

.side-org-text {
  flex: 1;
  min-width: 0;
}

.side-org-name {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.side-org-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}

.portal-organization .nav-section + .nav-section {
  margin-top: var(--space-4);
}

.side-kyc {
  display: block;
  color: inherit;
  text-decoration: none;
}

.side-kyc .progress-bar {
  margin-top: var(--space-3);
}

.side-kyc:hover {
  box-shadow: var(--shadow-sm);
}

/* ---------- Pipelines ---------- */
.pl-tabs{display:flex;gap:2px;border-bottom:1px solid var(--border);margin:0 0 var(--space-4);overflow-x:auto}
.pl-tab{padding:11px 14px;margin-bottom:-1px;font-size:var(--text-sm);color:var(--text-secondary);text-decoration:none;border-bottom:2px solid transparent;white-space:nowrap}
.pl-tab:hover{color:var(--text)}
.pl-tab[aria-current=page]{color:var(--primary-600);border-color:var(--primary-600);font-weight:600}
.pl-kpis{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}
.pl-kpis .an-label{display:flex;align-items:center;gap:9px}
.pl-ki{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:8px;flex-shrink:0;background:var(--bg-muted);color:var(--text-secondary)}
.pl-ki-blue{background:#eef4ff;color:#3538cd}
.pl-ki-green{background:#e3f4ea;color:#17683a}
.pl-ki-red{background:#fbe4e4;color:#b42318}
.pl-ki-amber{background:#fdf1d8;color:#935f00}
.pl-ki-teal{background:#e0f2f5;color:#0e7490}
.pl-ki-purple{background:#f1ecfd;color:#6d28d9}
.pl-bad{color:#a8431a;font-weight:600}
.pl-note{font-size:12.5px}
.pl-pad{padding:0 var(--space-4) var(--space-4)}
.pl-card{margin-bottom:var(--space-4)}
.pl-layout{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:var(--space-4);align-items:start;margin-bottom:var(--space-4)}
@media (max-width:1180px){.pl-layout{grid-template-columns:minmax(0,1fr)}}
.pl-cols{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:var(--space-4);align-items:start}
.pl-cols-wide{grid-template-columns:minmax(0,2fr) minmax(0,1fr)}
@media (max-width:1100px){.pl-cols,.pl-cols-wide{grid-template-columns:minmax(0,1fr)}}
.pl-stack{display:flex;flex-direction:column;min-width:0}
.pl-mapcard{overflow:hidden}
.pl-toolbar{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--border)}
.pl-chips{display:flex;flex-wrap:wrap;gap:6px}
.pl-chip{display:inline-flex;align-items:center;gap:7px;min-height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text-secondary);font:500 13px/1 var(--font-sans);cursor:pointer}
.pl-chip[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:#fff}
.pl-chip:focus-visible,.pl-trace:focus-visible,.pl-rowbtn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
.pl-sw{display:inline-block;width:14px;height:4px;border-radius:2px}
.pl-sw-good{background:#2e9d5b}.pl-sw-watch{background:#e8a317}.pl-sw-risk{background:#d9622b}.pl-sw-critical{background:#9f1d1d}
.pl-mapwrap{position:relative}
.pl-map{height:560px;background:#eef1ea;z-index:0}
@media (max-width:700px){.pl-map{height:420px}}
.pl-tip{position:absolute;z-index:500;display:grid;gap:3px;min-width:230px;max-width:300px;padding:10px 12px 10px 16px;border-radius:8px;background:rgba(16,24,40,.95);color:#d0d5dd;font-size:12px;line-height:1.4;pointer-events:none;box-shadow:0 8px 24px rgba(16,24,40,.25)}
.pl-tip b{color:#fff;font-size:12.5px}
.pl-tip-bar{position:absolute;left:0;top:0;bottom:0;width:5px;border-radius:8px 0 0 8px}
.pl-tip-warn{color:#fdb022;font-weight:600}
.pl-trace{position:absolute;z-index:400;top:12px;right:12px;display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:0 14px;border:1px solid var(--border-strong);border-radius:999px;background:var(--surface);font:600 13px/1 var(--font-sans);color:var(--text-secondary);cursor:pointer;box-shadow:var(--shadow-sm)}
.pl-trace::before{content:'';width:10px;height:10px;border-radius:50%;border:2px solid var(--text-subtle)}
.pl-trace[aria-pressed=true]{color:var(--primary-600);border-color:var(--primary-600)}
.pl-trace[aria-pressed=true]::before{background:var(--primary-600);border-color:var(--primary-600)}
.pl-drawbar{position:absolute;z-index:450;left:50%;bottom:44px;transform:translateX(-50%);display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 10px 8px 14px;border-radius:999px;background:var(--surface);box-shadow:var(--shadow-pop);font-size:13px;font-weight:500}
.pl-hint{position:absolute;z-index:400;left:12px;bottom:10px;margin:0;padding:6px 10px;border-radius:6px;background:rgba(255,255,255,.92);font-size:12px;color:var(--text-secondary);pointer-events:none}
.pl-legend{display:flex;flex-wrap:wrap;gap:12px 18px;padding:12px 14px;border-top:1px solid var(--border);font-size:12.5px;color:var(--text-secondary)}
.pl-legend span{display:inline-flex;align-items:center;gap:8px}
.pl-line{display:inline-block;width:26px;height:0;border-top:5px solid}
.pl-line-good{border-color:#2e9d5b}.pl-line-watch{border-color:#e8a317}.pl-line-risk{border-top-style:dashed;border-color:#d9622b}.pl-line-critical{border-top-style:dotted;border-color:#9f1d1d;border-top-width:6px}
.pl-dot{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--border-strong)}
.pl-dot-meter{background:#101828}.pl-dot-station{background:#1f1e31}.pl-dot-incident{background:#9f1d1d}
.pl-panel{position:sticky;top:calc(var(--topbar-height) + var(--space-3))}
.pl-panel.is-loading{opacity:.6}
.pl-panel-empty{display:grid;justify-items:center;gap:6px;padding:40px 24px;text-align:center;font-size:13.5px}
.pl-panel-empty p{margin:0}
.pl-panel-body{padding:18px}
.pl-panel-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.pl-eyebrow{margin:0;font-size:12px;color:var(--text-muted)}
.pl-panel-title{margin:2px 0 0;font-size:var(--text-md);font-weight: 700}
.pl-score{display:flex;align-items:baseline;gap:6px;margin:10px 0 0;color:var(--text-muted);font-size:13px}
.pl-score b{font-size:28px;color:var(--text);letter-spacing:-.02em}
.pl-dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px;margin:14px 0 0}
.pl-dl dt{display:flex;align-items:center;gap:5px;margin:0;font-size:12px;color:var(--text-muted)}
.pl-dl dd{margin:2px 0 0;font-size:14px;font-weight: 600;font-variant-numeric:tabular-nums}
.pl-sep{height:1px;background:var(--border);margin:14px 0}
.pl-label{margin:0;font-size:12.5px;font-weight:500;color:var(--text-secondary)}
.pl-big{margin:4px 0 0;font-size:20px;font-weight: 700;font-variant-numeric:tabular-nums}
.pl-big span{font-size:13px;font-weight:500}
.pl-meter{display:block;height:8px;margin-top:6px;border-radius:999px;background:var(--bg-muted);overflow:hidden}
.pl-meter i{display:block;height:100%;background:var(--primary-600);border-radius:999px}
.pl-path{margin:6px 0 10px;font-size:13px;line-height:1.6}
.pl-linked{list-style:none;margin:0;padding:0;display:grid;gap:8px;font-size:13.5px}
.pl-linked li{display:flex;justify-content:space-between;align-items:center;gap:12px}
.pl-linked-pad{padding:0 var(--space-4) var(--space-4)}
.pl-actions{display:flex;flex-wrap:wrap;gap:8px}
.pl-pill{display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 9px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;background:var(--bg-muted);color:var(--text-secondary)}
.pl-pill::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}
.pl-pill-good{background:#e3f4ea;color:#17683a}
.pl-pill-watch{background:#fdf1d8;color:#7a5200}
.pl-pill-risk{background:#fde7dc;color:#a8431a}
.pl-pill-critical{background:#fbe4e4;color:#8f1a1a}
.pl-rowbtn{all:unset;display:inline-flex;align-items:center;gap:10px;cursor:pointer;border-radius:6px}
.pl-rowbtn.is-static{cursor:default}
.pl-rowbtn:hover b{color:var(--primary-600)}
.pl-rowic{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:8px;flex-shrink:0;background:var(--bg-muted);color:var(--text-secondary)}
.pl-rowic-good{background:#e3f4ea;color:#17683a}.pl-rowic-watch{background:#fdf1d8;color:#935f00}.pl-rowic-risk{background:#fde7dc;color:#a8431a}.pl-rowic-critical{background:#fbe4e4;color:#8f1a1a}
.pl-sub{display:block;font-size:12px;color:var(--text-muted);font-weight:400}
.pl-rowactions{display:flex;gap:6px;justify-content:flex-end;align-items:center;white-space:nowrap}
.pl-mode{display:inline-block;width:10px;height:10px;margin-right:6px;border:2px solid var(--ink);border-radius:2px;vertical-align:-1px}
.pl-mode.is-auto{background:var(--ink)}
.pl-crumb{margin:0 0 4px;font-size:13px;color:var(--text-muted)}
.pl-titlerow{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.pl-strip{position:relative;height:78px;margin:6px 28px 14px}
.pl-strip-line{position:absolute;left:0;right:0;top:30px;height:8px;border-radius:999px;background:#2e9d5b}
.pl-strip-watch{background:#e8a317}.pl-strip-risk{background:#d9622b}.pl-strip-critical{background:#9f1d1d}
.pl-strip-hot{position:absolute;top:24px;height:20px;border-radius:5px;background:#9f1d1d;opacity:.22}
.pl-strip-mk{position:absolute;top:0;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;font-size: 12px;color:var(--text-secondary);white-space:nowrap}
.pl-strip-mk b{display:block;width:14px;height:14px;margin-top:27px;border-radius:50%;border:2.5px solid #fff;box-shadow:0 0 0 1px var(--border-strong);background:var(--ink)}
.pl-strip-mk span{margin-top:6px}
.pl-strip-mk-open b{background:#d9622b}.pl-strip-mk-past b{background:#9f1d1d}.pl-strip-mk-end b{background:#1f1e31}
.pl-bars{display:flex;align-items:flex-end;gap:4px;height:180px;margin:4px 16px 0}
.pl-bars i{flex:1;min-width:3px;border-radius:3px 3px 0 0;background:var(--primary-600);opacity:.85}
.pl-bars i.is-night{background:#d9622b;opacity:1}
.pl-bars-note{padding:10px 16px 16px;margin:0}
.pl-factor{display:grid;grid-template-columns:minmax(0,1fr) 64px;gap:4px 12px;align-items:center;padding:10px 16px;border-bottom:1px solid var(--border)}
.pl-factor:last-child{border-bottom:0}
.pl-factor p{margin:0;font-size:13.5px;font-weight: 600}
.pl-factor b{text-align:right;font-size:13.5px;font-variant-numeric:tabular-nums}
.pl-factor small{grid-column:1 / -1;font-size:12.5px;color:var(--text-muted)}
.pl-track{grid-column:1 / -1;height:6px;border-radius:999px;background:var(--bg-muted);overflow:hidden}
.pl-track i{display:block;height:100%;border-radius:999px}
.pl-fill-good{background:#2e9d5b}.pl-fill-watch{background:#e8a317}.pl-fill-risk{background:#d9622b}.pl-fill-critical{background:#9f1d1d}
.pl-actions-list{list-style:none;margin:0;padding:0 16px 16px;display:grid;gap:12px;counter-reset:a;font-size:13.5px;line-height:1.5}
.pl-actions-list li{display:grid;grid-template-columns:28px minmax(0,1fr);gap:10px}
.pl-actions-list li::before{counter-increment:a;content:counter(a);display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#e3f4ea;color:#17683a;font-weight:700;font-size:12.5px}
.pl-actions-list b,.pl-actions-list span{display:block}
.pl-timeline{list-style:none;margin:0;padding:0 16px 8px}
.pl-timeline li{display:grid;grid-template-columns:30px 96px minmax(0,1fr);gap:12px;padding:12px 0;border-bottom:1px solid var(--border);font-size:13.5px}
.pl-timeline li:last-child{border-bottom:0}
.pl-timeline time{font-size:12.5px;color:var(--text-muted)}
.pl-timeline p{margin:0}
.pl-tl-title{font-weight:600;margin-bottom:2px}
.pl-tl-actions{display:flex;gap:6px;margin-top:8px}
@media (max-width:600px){.pl-timeline li{grid-template-columns:30px minmax(0,1fr)}.pl-timeline time{grid-column:2}}
.pl-daynote{display:flex;align-items:center;gap:6px;margin:0 0 10px;font-size:13px;color:var(--text-secondary)}
.pl-flow{display:grid;grid-template-columns:minmax(0,1fr) 28px minmax(0,1fr) 28px minmax(0,1fr);gap:10px;align-items:stretch}
@media (max-width:1000px){.pl-flow{grid-template-columns:minmax(0,1fr)}.pl-arrow{transform:rotate(90deg);height:24px}}
.pl-arrow{display:grid;place-items:center;color:var(--text-subtle)}
.pl-fbox{padding:16px}
.pl-fbox h3{display:flex;align-items:center;gap:9px;margin:0;font-size:13px;font-weight:600;color:var(--text-secondary)}
.pl-fv{margin:10px 0 0;font-size:24px;font-weight: 700;font-variant-numeric:tabular-nums}
.pl-fbox ul{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:5px;font-size:13px}
.pl-fbox li{display:flex;justify-content:space-between;gap:10px;font-variant-numeric:tabular-nums}
.pl-stackbar{display:flex;height:12px;margin:14px 0 6px;border-radius:999px;overflow:hidden;background:var(--bg-muted)}
.pl-stackbar i{display:block;height:100%}
.pl-stackbar .d{background:var(--primary-600)}.pl-stackbar .r{background:#9f1d1d}.pl-stackbar .a{background:#d9622b}
.pl-subrow td:first-child{padding-left:34px;color:var(--text-secondary)}
.pl-hm{display:grid;grid-template-columns:110px repeat(var(--cols),minmax(30px,1fr));gap:3px;min-width:560px;font-size: 12px}
.pl-hm-d{text-align:center;color:var(--text-muted)}
.pl-hm-r{display:flex;align-items:center;font-weight:600;font-size:12.5px}
.pl-hm-c{position:relative;display:grid;place-items:center;height:32px;border-radius:4px;font-weight:600;font-variant-numeric:tabular-nums;background:var(--bg-muted);color:var(--text-muted)}
.pl-hm-good{background:#d5eedd;color:#135c32}.pl-hm-watch{background:#fbe7b5;color:#6b4700}.pl-hm-risk{background:#f7c9b0;color:#8a3512}.pl-hm-critical{background:#9f1d1d;color:#fff}
.pl-hm-missing{background:repeating-linear-gradient(45deg,#eef0f3 0 5px,#dfe3e8 5px 10px);color:#475467}
.pl-hm-live{background:#eef4ff;color:#3538cd}
.pl-hm-none{background:transparent}
.pl-hm-c.is-closed::after{content:'C';position:absolute;top:1px;right:3px;font-size:9px;font-weight:800;opacity:.8}
.pl-hm-key{display:flex;flex-wrap:wrap;gap:10px 16px;margin-top:12px;font-size:12.5px;color:var(--text-secondary)}
.pl-hm-key span{display:inline-flex;align-items:center;gap:6px}
.pl-hm-key i{display:inline-block;width:16px;height:12px;border-radius:3px}
.pl-rules{margin:0;padding:0 16px 16px 34px;display:grid;gap:10px;font-size:13.5px;line-height:1.5}
.pl-clear{gap:8px;color:var(--success-text)}
.pl-prose{font-size:13.5px;line-height:1.55;color:var(--text-secondary)}
.pl-prose p{margin:0}
.pl-code{margin:12px 0 0;padding:12px;border-radius:7px;background:var(--ink);color:#e4e7ec;font:12.5px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;overflow-x:auto;white-space:pre}
.pl-checks{display:grid;gap:6px;margin:0 0 var(--space-4);padding:0;border:0}
.pl-danger-link{color:var(--danger);margin-top:var(--space-2)}
.pl-token-value{display:block;margin:12px 0;padding:10px 12px;border-radius:7px;background:var(--bg-muted);font:13px ui-monospace,Menlo,monospace;word-break:break-all}
.pl-fleet{display:flex;height:10px;margin:0 0 14px;border-radius:999px;overflow:hidden;background:var(--bg-muted)}
.pl-fleet i{display:block;height:100%}
.pl-fleet-dot{display:inline-block;width:9px;height:9px;margin-right:8px;border-radius:50%}
.pl-fleet-ok{background:#2e9d5b}.pl-fleet-stale{background:#d9622b}.pl-fleet-due{background:#e8a317}.pl-fleet-suspect{background:#9f1d1d}.pl-fleet-new{background:#98a2b3}

/* ---------- Typography (aligned with the Triply admin) ----------
   Bold page titles, semibold section titles and labels, medium body
   emphasis; near-black values over cool grey meta text. */
.page-title{font-size:var(--text-2xl);font-weight:700;letter-spacing:-0.02em;color:var(--text);line-height:1.25}
.page-subtitle{font-size:var(--text-sm);color:var(--text-muted)}
.card-title,.an-card-head h2,.drawer-title,.pl-panel-title{font-weight:600;color:var(--text);letter-spacing:-0.01em}
.card-title{font-size:var(--text-md)}
.an-card-head h2{font-size:var(--text-md)}
.drawer-title{font-size:var(--text-lg)}
.form-section-title,.empty-title,.entity-name,.ws-org-name,.side-org-name{font-weight:600;color:var(--text)}
.an-value,.tile-value,.summary-value strong,.pl-fv,.pl-big,.pl-score b{font-weight:700;color:var(--ink);letter-spacing:-0.02em}
.an-label{font-weight:500;color:var(--text-secondary)}
.an-meta,.field-hint,.card-subtitle,.drawer-subtitle,.empty-text{color:var(--text-muted)}
.table th{font-size:var(--text-xs);font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.04em}
.table td{color:var(--text)}
.field-label{font-weight:500;color:var(--text)}
.nav-title{font-size: 12px;font-weight:600;color:var(--text-subtle);letter-spacing:0.06em}
.nav-link{font-weight:500}
.nav-link.is-active,.nav-sub-link.is-active{font-weight:600}
.brand-name{font-weight:700;color:var(--text)}
.btn{font-weight:600}
.an-eyebrow,.pl-eyebrow,.eyebrow{font-weight:600;color:var(--text-subtle)}

/* ---------- Readable data (typography principles) ----------
   Text meets 4.5:1 contrast (meta uses --text-muted, not --text-subtle),
   figures line up (tabular numbers), paragraphs stay ~50–75 characters
   with 1.5 line height, and nothing drops below 12px. */
.nav-title,.an-eyebrow,.pl-eyebrow,.eyebrow,.an-legend,.pl-legend,.pl-hm-d{color:var(--text-muted)}
.table td,.an-value,.an-meta,.pl-fbox li,.pl-linked,.tile-value,.summary-value strong{font-variant-numeric:tabular-nums}
.table td{line-height:1.45}
.page-subtitle,.empty-text,.drawer-subtitle,.pl-prose,.pl-rules,.pl-actions-list{max-width:72ch;line-height:1.55}
.an-meta,.pl-note,.field-hint{font-size:var(--text-xs);line-height:1.5}
::placeholder{color:var(--text-subtle)}

/* Mobile app hand-off (/app) */
.app-handoff{display:grid;place-items:center;min-height:100vh;padding:var(--space-6) 16px;background:var(--bg-content)}
.app-handoff-card{display:grid;justify-items:center;gap:var(--space-3);width:100%;max-width:440px;text-align:center}
.app-handoff-card .btn{width:100%;justify-content:center}
.app-handoff-icon{display:grid;place-items:center;width:56px;height:56px;border-radius:14px;background:var(--primary-50);color:var(--primary-600)}

/* Workspace sub-navigation sections */
.ws-links{gap:var(--space-4)}
.ws-section{display:grid;gap:2px}
.ws-section-title{margin:0 0 4px var(--space-3);font-size:11px;font-weight:600;letter-spacing:0.06em;text-transform:uppercase;color:var(--text-muted)}

/* Bills table: type tile, station avatar, payee logo */
.bill-type{display:grid;place-items:center;flex-shrink:0;width:34px;height:34px;border-radius:var(--radius-md)}
.bill-avatar{display:grid;place-items:center;flex-shrink:0;width:32px;height:32px;border-radius:var(--radius-md);object-fit:cover;font-size:var(--text-xs);font-weight:600;border:1px solid var(--border)}
.bill-payto,.bill-payto img{width:30px;height:30px}
.bill-group td{padding-top:var(--space-3);padding-bottom:var(--space-2);background:var(--bg-muted);border-bottom:1px solid var(--border)}
.bills-table tr.row-link td:first-child{padding-left:calc(var(--space-4) + 12px)}

/* Drawer content scrolls instead of squeezing its blocks: rows keep their
   natural height (cards with overflow:hidden could otherwise collapse and
   clip their bottom, e.g. a bill's "Settles to" details on short screens) */
.drawer-content{grid-auto-rows:max-content}

/* Workspace sub-nav scrolls on its own: it stays pinned below the topbar,
   fits the window, and scrolling over it doesn't move the main content */
@media (min-width: 1101px) {
  .ws-nav {
    max-height: calc(100vh - var(--topbar-height) - var(--space-4) * 2);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Scrolls with the wheel/trackpad but shows no scrollbar */
    scrollbar-width: none;
  }

  .ws-nav::-webkit-scrollbar {
    display: none;
  }
}

/* Select options with an icon (option[data-icon]) and the "search for more" hint */
.combo-icon{display:inline-block;background:var(--primary-50);border-color:transparent;position:relative}
.combo-icon::after{content:'';position:absolute;inset:4px;background:currentColor;-webkit-mask:var(--icon) center/contain no-repeat;mask:var(--icon) center/contain no-repeat}
.combo-icon:not([class*='tone-']){color:var(--text-secondary);background:var(--bg-muted)}
.combo-more{display:flex;align-items:center;gap:6px;padding:8px 12px;font-size:var(--text-xs);color:var(--text-muted);border-top:1px solid var(--border)}

/* Date range filter (From – To) in table toolbars */
.date-range{display:inline-flex;align-items:center;gap:6px;height:38px;padding:0 10px;background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--radius-md);color:var(--text-muted)}
.date-range:focus-within{border-color:var(--primary-500);box-shadow:var(--focus-ring)}
.date-range input{width:128px;height:100%;padding:0;border:0;background:transparent;font:inherit;font-size:var(--text-sm);color:var(--text);outline:none}
.date-range input::-webkit-calendar-picker-indicator{opacity:.6;cursor:pointer}
/* Toolbars with several filters: search flexes, dropdowns stay compact */
.table-toolbar .input-search{flex:1 1 200px;min-width:0}
.table-toolbar .select-sm .combo-trigger{min-width:150px}

/* Active workspace sub-nav item matches the main nav: black pill, white text */
.ws-link.is-active {
  font-weight: 600;
  color: #fff;
  background: var(--ink-gradient);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 9px rgba(0, 0, 0, 0.16);
}

.ws-link.is-active .icon {
  color: #fff;
}

.ws-link.is-active .ws-badge {
  color: var(--ink);
  background: #fff;
}
