/* ============================================
   LottoHaus Portal — Application shell
   Brand colours live in :root. Change them here
   to re-skin the whole dashboard.
   ============================================ */

:root {
  --brand:            #0b3d91;
  --brand-deep:       #0a1f3c;
  --brand-light:      #1d5fd6;
  --brand-tint:       rgba(11, 61, 145, 0.08);
  /* Bright rose from the LottoHaus logo's crimson family.
     The accent does three jobs, so it needs three tokens:
       --accent       fills, and text on the dark navy shell   6.12:1
       --accent-ink   text sitting ON an accent fill           6.46:1
       --accent-text  accent-coloured text on light surfaces   6.91:1
     The old #ff7a1a orange was 2.61:1 with white text. */
  --accent:           #fb7185;
  --accent-dark:      #f43f5e;
  --accent-light:     #fda4af;
  --accent-ink:       #2a1503;
  --accent-text:      #b3122b;
  --accent-tint:      rgba(251, 113, 133, 0.14);

  --ok:      #0f9d58;
  --ok-tint: rgba(15, 157, 88, 0.12);
  --warn:    #d98324;
  --warn-tint: rgba(217, 131, 36, 0.13);
  --danger:  #dc2626;
  --danger-tint: rgba(220, 38, 38, 0.1);
  --info:    #0369a1;
  --info-tint: rgba(3, 105, 161, 0.1);

  --ink:      #16283d;
  --ink-2:    #3d5266;
  --muted:    #6b7f93;
  --faint:    #9aabbd;
  --line:     #e3ebf4;
  --line-2:   #eef3f9;
  --bg:       #f4f7fb;
  --surface:  #ffffff;
  --sidebar:  #0a1f3c;

  --r-sm: 7px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sh-xs: 0 1px 2px rgba(16, 36, 61, 0.05);
  --sh-sm: 0 1px 3px rgba(16, 36, 61, 0.07), 0 1px 2px rgba(16, 36, 61, 0.04);
  --sh-md: 0 4px 14px rgba(16, 36, 61, 0.08);
  --sh-lg: 0 14px 38px rgba(16, 36, 61, 0.13);
  --sh-xl: 0 30px 70px rgba(16, 36, 61, 0.2);

  --sidebar-w: 268px;
  --topbar-h: 68px;
  --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Calibri first, then Carlito, which is the metric-compatible open clone.
     The project targets Windows users, so Calibri is what they will see;
     Carlito keeps line lengths and wrapping identical on Linux, macOS,
     Android and iOS, none of which ship Calibri at all. */
  --font-ui: Calibri, Carlito, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: var(--font-ui);
  --font-mono: 'Cascadia Mono', Consolas, 'SF Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; }

/* ============================================
   SHELL
   ============================================ */

.app-shell { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; }

/* The seal alone (not the full lockup) so it stays legible in the narrow
   sidebar. Dark artwork on a white plate reads against the navy. */
.sidebar-mark {
  height: 30px;
  width: auto;
  object-fit: contain;
  padding: 5px 7px;
  background: #fff;
  border-radius: 7px;
  flex-shrink: 0;
}

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.sidebar-brand-name em { font-style: normal; color: var(--accent); }

.sidebar-brand-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
}
.sidebar-close:hover { background: rgba(255, 255, 255, 0.1); }

/* Company switcher block */

.sidebar-company {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 16px 14px 6px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
}

.company-avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sidebar-company-text { min-width: 0; display: flex; flex-direction: column; }

.sidebar-company-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-company-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot-live {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.2);
}

/* Nav */

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px 16px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }

.sidebar-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
  padding: 0 10px;
  margin: 18px 0 8px;
}
.sidebar-label:first-child { margin-top: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.68);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--t);
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.nav-item.is-active {
  background: linear-gradient(90deg, rgba(29, 95, 214, 0.45), rgba(29, 95, 214, 0.12));
  color: #fff;
  font-weight: 600;
}
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item.is-soon { opacity: 0.62; }

.nav-item-icon { display: grid; place-items: center; width: 20px; flex-shrink: 0; }
.nav-item-label { flex: 1; }

.nav-item-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

.nav-item-danger:hover { background: rgba(220, 38, 38, 0.16); color: #fca5a5; }

/* Sidebar footer */

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.trial-widget {
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.24);
  border-radius: var(--r-md);
  padding: 12px 13px;
  margin-bottom: 8px;
}

.trial-widget-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

.trial-days { color: var(--accent-text); font-weight: 700; }

.trial-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.trial-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: 3px;
}

.trial-upgrade {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 7px;
  border-radius: var(--r-sm);
  transition: var(--t);
}
.trial-upgrade:hover { background: var(--accent-dark); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.5);
  backdrop-filter: blur(2px);
  z-index: 55;
}

/* ============================================
   TOPBAR
   ============================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-burger {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  width: 36px; height: 36px;
  color: var(--ink);
  cursor: pointer;
  place-items: center;
}
.topbar-burger:hover { background: var(--line-2); }

.topbar-heading { min-width: 0; flex: 1; }

.topbar-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-search { position: relative; }

.topbar-search input {
  width: 230px;
  height: 38px;
  padding: 0 12px 0 34px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: var(--t);
}
.topbar-search input::placeholder { color: var(--faint); }
.topbar-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
  width: 270px;
}

.topbar-search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
}

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(11, 61, 145, 0.28); }
.btn-primary:hover { background: var(--brand-deep); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(11, 61, 145, 0.32); }

.btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(251, 113, 133, 0.35); }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); border-color: #d3dfec; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: rgba(220, 38, 38, 0.3); }
.btn-danger-ghost:hover { background: var(--danger-tint); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

/* User menu */

.topbar-user { position: relative; cursor: pointer; }

.avatar {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.avatar-lg { width: 42px; height: 42px; font-size: 15px; }

.topbar-user-meta { display: none; flex-direction: column; line-height: 1.25; }
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.topbar-user-role { font-size: 11px; color: var(--muted); }

.topbar-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: var(--t);
  z-index: 50;
}
.topbar-user.is-open .topbar-user-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 6px;
}
.user-menu-head div { min-width: 0; display: flex; flex-direction: column; }
.user-menu-head strong { font-size: 13.5px; color: var(--ink); }
.user-menu-head span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--t);
  text-align: left;
}
.user-menu-item:hover { background: var(--line-2); color: var(--ink); }
.user-menu-item-danger { color: var(--danger); }
.user-menu-item-danger:hover { background: var(--danger-tint); }

/* ============================================
   TOASTS
   ============================================ */

.toast-stack {
  position: fixed;
  top: calc(var(--topbar-h) + 14px);
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  font-size: 13.5px;
  color: var(--ink);
  animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.is-leaving { opacity: 0; transform: translateX(24px); transition: var(--t); }

.toast-icon {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  color: #fff;
  background: var(--info);
}

.toast-text { flex: 1; line-height: 1.5; }

.toast-close {
  background: none; border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--ink); background: var(--line-2); }

.toast-success { border-left-color: var(--ok); }
.toast-success .toast-icon { background: var(--ok); }
.toast-error   { border-left-color: var(--danger); }
.toast-error .toast-icon { background: var(--danger); }
.toast-warning { border-left-color: var(--warn); }
.toast-warning .toast-icon { background: var(--warn); }

/* ============================================
   CONTENT
   ============================================ */

.content { flex: 1; padding: 26px 28px 40px; }

.app-footer {
  padding: 20px 28px 28px;
  font-size: 12.5px;
  color: var(--faint);
  border-top: 1px solid var(--line-2);
}
.app-footer-sep { margin: 0 6px; }

/* Page header block */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head-text { min-width: 0; }
.page-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 5px;
}
.page-heading { font-size: 23px; color: var(--ink); }
.page-lead { font-size: 14px; color: var(--muted); margin-top: 5px; max-width: 640px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.card-title { font-size: 15px; color: var(--ink); }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.card-body { padding: 20px; }
.card-foot { padding: 13px 20px; border-top: 1px solid var(--line-2); background: #fbfcfe; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-foot-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12.5px; }
.card-foot-note a { color: var(--accent-text); font-weight: 600; }

/* ============================================
   STAT CARDS
   ============================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 19px 20px;
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: var(--t);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }

.stat-card::after {
  content: '';
  position: absolute;
  right: -26px; top: -26px;
  width: 92px; height: 92px;
  border-radius: 50%;
  background: var(--brand-tint);
  opacity: 0.6;
}

.stat-card.accent::after { background: var(--accent-tint); }
.stat-card.ok::after     { background: var(--ok-tint); }
.stat-card.warn::after   { background: var(--warn-tint); }

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; position: relative; }

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brand-tint);
  color: var(--brand);
  position: relative;
}
.stat-card.accent .stat-icon { background: var(--accent-tint); color: var(--accent-text); }
.stat-card.ok .stat-icon     { background: var(--ok-tint); color: var(--ok); }
.stat-card.warn .stat-icon   { background: var(--warn-tint); color: var(--warn); }

.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  position: relative;
}

.stat-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  position: relative;
}
.stat-meta-up   { color: var(--ok); font-weight: 600; }
.stat-meta-down { color: var(--danger); font-weight: 600; }

/* ============================================
   GRIDS & PANELS
   ============================================ */

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }

/* ============================================
   BAR CHART (pure CSS)
   ============================================ */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 210px;
  padding: 14px 4px 0;
}

.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }

.chart-bars { display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; height: 100%; }

.chart-bar {
  width: 20px;
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
  position: relative;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}
.chart-bar-a { background: linear-gradient(180deg, var(--brand-light), var(--brand)); }
.chart-bar-b { background: linear-gradient(180deg, #fecdd3, var(--accent-dark)); }

.chart-bar::after {
  content: attr(data-value);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: var(--t);
  white-space: nowrap;
}
.chart-bar:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

.chart-label { font-size: 11px; font-weight: 600; color: var(--faint); }

.chart-legend { display: flex; gap: 16px; padding: 12px 4px 0; border-top: 1px solid var(--line-2); margin-top: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.chart-legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ============================================
   PROGRESS BARS
   ============================================ */

.meter { margin-bottom: 14px; }
.meter:last-child { margin-bottom: 0; }

.meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.meter-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.meter-value { font-size: 12.5px; font-weight: 700; color: var(--ink); }

.meter-bar { height: 7px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--brand); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.meter-fill.ok     { background: var(--ok); }
.meter-fill.warn   { background: var(--warn); }
.meter-fill.danger { background: var(--danger); }
.meter-fill.accent { background: var(--accent); }

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-no-dot::before { display: none; }

.badge-success { background: var(--ok-tint); color: #0b7a44; }
.badge-warning { background: var(--warn-tint); color: #a8651a; }
.badge-danger  { background: var(--danger-tint); color: #b91c1c; }
.badge-info    { background: var(--info-tint); color: var(--info); }
.badge-muted   { background: var(--line-2); color: var(--muted); }
.badge-primary { background: var(--brand-tint); color: var(--brand); }
.badge-accent  { background: var(--accent-tint); color: var(--accent-text); }

/* ============================================
   TABLES
   ============================================ */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 11px 16px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #fbfcfe; }

.table a { color: var(--brand); font-weight: 600; }
.table a:hover { text-decoration: underline; }

.cell-strong { font-weight: 600; color: var(--ink); }
.cell-mono  { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.cell-num   { text-align: right; font-variant-numeric: tabular-nums; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-muted  { color: var(--faint); }

.row-actions { display: inline-flex; gap: 5px; opacity: 0.35; transition: var(--t); }
tr:hover .row-actions { opacity: 1; }

.icon-btn {
  width: 28px; height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: var(--t);
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); border-color: #d3dfec; }
.icon-btn-danger:hover { background: var(--danger-tint); color: var(--danger); border-color: rgba(220, 38, 38, 0.3); }

/* Identity cell */

.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }

.identity-avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-tint);
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}
.identity-avatar.is-accent { background: var(--accent-tint); color: var(--accent-text); }
.identity-avatar.is-lg { width: 52px; height: 52px; border-radius: var(--r-md); font-size: 17px; }

.identity-text { min-width: 0; display: flex; flex-direction: column; }
.identity-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-sub  { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================
   FILTERS
   ============================================ */

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-2);
}

.filter-search { position: relative; flex: 1; min-width: 210px; }
.filter-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 33px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: var(--t);
}
.filter-search input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.filter-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }

.filter-select {
  height: 36px;
  padding: 0 30px 0 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7f93' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: var(--t);
}
.filter-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* ============================================
   PAGINATION
   ============================================ */

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pagination-info { font-size: 12.5px; color: var(--muted); }
.pagination-links { display: flex; gap: 4px; }
.page-link {
  min-width: 30px; height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: var(--t);
}
.page-link:hover { background: var(--line-2); color: var(--ink); }
.page-link.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-link.is-disabled { opacity: 0.4; pointer-events: none; }

/* ============================================
   FORMS
   ============================================ */

.form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }

.form-section { margin-bottom: 18px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-head { padding: 17px 20px; border-bottom: 1px solid var(--line-2); }
.form-section-title { font-size: 15px; }
.form-section-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.form-grid { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-full { grid-column: 1 / -1; }

/* Two fields side by side. Used by the signup form, which has no card padding
   of its own and so needs a bare row primitive. */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 16px; display: flex; flex-direction: column; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.form-req { color: var(--accent-text); font-weight: 700; }

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: var(--t);
  appearance: none;
}
textarea.form-input { height: auto; padding: 10px 13px; line-height: 1.6; resize: vertical; }

.form-input::placeholder { color: var(--faint); }

.form-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

select.form-input {
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%236b7f93' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input.form-input[type="date"] { padding-right: 10px; }

/* Locked fields: a locked value must not look like an editable one. */
.form-input[readonly],
.form-input[disabled] {
  background: var(--line-2);
  color: var(--muted);
  border-style: dashed;
  cursor: not-allowed;
}
.form-input[disabled] { opacity: 0.9; }
select.form-input[disabled],
select.form-input[readonly] {
  cursor: not-allowed;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23a9b6c2' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.form-help.is-locked { color: var(--muted); }

.form-help { font-size: 11.5px; color: var(--faint); margin-top: 5px; line-height: 1.5; }

.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; font-weight: 500; display: block; }
/* The client-side validator and the server both write into the same element,
   so an empty one must collapse rather than leave a coloured gap. */
.form-error:empty { display: none; }

.form-group.has-error .form-input { border-color: var(--danger); }
.form-group.has-error .form-input:focus { box-shadow: 0 0 0 3px var(--danger-tint); }

.form-checkbox { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; margin-top: 1px; }

.check-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 16px; }
.check-row label { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; cursor: pointer; }
.check-row a { color: var(--brand); font-weight: 600; }
.check-row a:hover { text-decoration: underline; }

.form-alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 18px;
}
.form-alert-danger { background: var(--danger-tint); border: 1px solid rgba(220, 38, 38, 0.22); color: #991b1b; }
.form-alert-info   { background: var(--brand-tint); border: 1px solid rgba(11, 61, 145, 0.2); color: var(--brand-deep); }
.form-alert-warning { background: var(--warn-tint); border: 1px solid rgba(180, 83, 9, 0.22); color: #92400e; }
.form-alert svg { flex-shrink: 0; margin-top: 1px; }

.form-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--line-2);
  background: #fbfcfe;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex-wrap: wrap;
}

/* Read-only info rows (detail pages) */

.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-key { color: var(--muted); flex-shrink: 0; }
.info-val { color: var(--ink); font-weight: 500; text-align: right; word-break: break-word; }
.info-val a { color: var(--brand); }
.info-val a:hover { text-decoration: underline; }

/* ============================================
   EMPTY STATE
   ============================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px;
}
.empty-icon {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  border-radius: 18px;
  background: var(--brand-tint);
  color: var(--brand);
  margin-bottom: 18px;
}
.empty-title { font-size: 16px; color: var(--ink); margin-bottom: 7px; }
.empty-text { font-size: 13.5px; color: var(--muted); max-width: 380px; margin-bottom: 20px; line-height: 1.6; }

/* ============================================
   ACTIVITY FEED
   ============================================ */

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.feed-item:last-child { border-bottom: none; }

.feed-dot {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--brand-tint);
  color: var(--brand);
}
.feed-dot.ok     { background: var(--ok-tint); color: var(--ok); }
.feed-dot.warn   { background: var(--warn-tint); color: var(--warn); }
.feed-dot.danger { background: var(--danger-tint); color: var(--danger); }
.feed-dot.muted  { background: var(--line-2); color: var(--muted); }
.feed-dot.info   { background: var(--info-tint); color: var(--info); }

.feed-body { min-width: 0; flex: 1; }
.feed-text { font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.feed-time { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ============================================
   DETAIL HERO
   ============================================ */

.detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 22px;
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%);
  border-radius: var(--r-lg);
  color: #fff;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.detail-hero-avatar {
  width: 60px; height: 60px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
}
.detail-hero-main { flex: 1; min-width: 200px; }
.detail-hero-name { font-size: 21px; color: #fff; }
.detail-hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.detail-hero-code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}
.detail-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-hero .btn-ghost { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.detail-hero .btn-ghost:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
.detail-hero .btn-danger-ghost { background: rgba(220, 38, 38, 0.2); color: #fecaca; border-color: rgba(254, 202, 202, 0.3); }
.detail-hero .btn-danger-ghost:hover { background: rgba(220, 38, 38, 0.4); color: #fff; }

.hero-stat-strip {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.hero-stat { display: flex; flex-direction: column; }
.hero-stat-value { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: #fff; line-height: 1; }
.hero-stat-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); margin-top: 4px; }

/* ============================================
   TRIAL BANNER
   ============================================ */

.trial-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: linear-gradient(120deg, var(--accent-tint), rgba(251, 113, 133, 0.04));
  border: 1px solid rgba(251, 113, 133, 0.28);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.trial-banner-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  flex-shrink: 0;
}
.trial-banner-text { flex: 1; min-width: 200px; font-size: 13.5px; color: var(--ink-2); }
.trial-banner-text strong { color: var(--ink); }

/* ============================================
   TEAM
   ============================================ */

.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.team-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sh-sm);
  transition: var(--t);
  text-align: center;
}
.team-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }

.team-avatar {
  width: 58px; height: 58px;
  margin: 0 auto 13px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}
.team-name { font-size: 14.5px; color: var(--ink); }
.team-email { font-size: 12px; color: var(--faint); word-break: break-all; margin-bottom: 11px; }
.team-role { display: inline-flex; margin-bottom: 13px; }

/* ============================================
   MODAL (delete confirm)
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.55);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.is-open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  width: 100%;
  max-width: 420px;
  padding: 26px;
  animation: modal-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--danger-tint);
  color: var(--danger);
  margin-bottom: 16px;
}
.modal-title { font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.modal-text { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; }

/* ============================================
   NOTIFICATIONS
   ============================================ */

/* Bell sits in the topbar beside the user menu. Colour comes from the current
   text colour so it tracks the hover/active states of its neighbours. */
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--muted); cursor: pointer; }
.bell:hover { background: var(--line-2); color: var(--ink); }
.bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bell-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--accent-dark); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  border-radius: 999px;
  border: 2px solid var(--surface, #fff);
  pointer-events: none;
}

.bell-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg, 0 18px 40px rgba(10, 31, 60, 0.16));
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  overflow: hidden;
}
.bell.is-open .bell-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.bell-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.bell-menu-head strong { font-size: 13.5px; color: var(--ink); }
.bell-menu-head a { font-size: 12px; color: var(--accent-text); font-weight: 600; text-decoration: none; }
.bell-menu-head a:hover { text-decoration: underline; }

.bell-menu-list { max-height: 340px; overflow-y: auto; }
.bell-menu-row { border-bottom: 1px solid var(--line-2); }
.bell-menu-row:last-child { border-bottom: 0; }
.bell-menu-row form { margin: 0; }

.bell-menu-item {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  padding: 11px 14px; text-align: left;
  background: none; border: 0; cursor: pointer; font: inherit;
}
.bell-menu-item:hover { background: var(--line-2); }

.bell-menu-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-menu-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.bell-menu-msg {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.bell-menu-time { font-size: 11.5px; color: var(--muted); opacity: 0.8; }

.bell-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 999px; flex: 0 0 auto; }
.bell-dot-info { background: var(--info); }
.bell-dot-success { background: var(--ok); }
.bell-dot-warning { background: var(--warn); }
.bell-dot-error { background: var(--danger); }

.bell-menu-foot { border-top: 1px solid var(--line-2); }
.bell-menu-all {
  width: 100%; padding: 11px 14px;
  background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--accent-text);
  text-align: left;
}
.bell-menu-all:hover { background: var(--accent-tint); }

.bell-menu-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 28px 16px; font-size: 13px; color: var(--muted);
}
.bell-check {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--ok-tint); color: var(--ok);
}

/* --- notification rows --- */

.note-list { list-style: none; margin: 0; padding: 0; }
.note-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-2);
}
.note-row:last-child { border-bottom: 0; }
.note-row.is-read { opacity: 0.62; }

.note-dot { width: 9px; height: 9px; margin-top: 7px; border-radius: 999px; flex: 0 0 auto; }
.note-dot-info { background: var(--info); }
.note-dot-success { background: var(--ok); }
.note-dot-warning { background: var(--warn); }
.note-dot-error { background: var(--danger); }

.note-body { flex: 1; min-width: 0; }
.note-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.note-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.note-level {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
}
.note-level-info { background: var(--info-tint); color: var(--info); }
.note-level-success { background: var(--ok-tint); color: var(--ok); }
.note-level-warning { background: var(--warn-tint); color: var(--warn); }
.note-level-error { background: var(--danger-tint); color: var(--danger); }
.note-read-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  background: var(--line-2); color: var(--muted);
}
.note-text { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 5px; }
.note-time { font-size: 11.5px; color: var(--muted); opacity: 0.85; }
.note-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.note-actions form { margin: 0; }

/* --- push panel --- */

.push-status { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.push-dot { width: 9px; height: 9px; border-radius: 999px; flex: 0 0 auto; }
.push-dot-wait { background: var(--muted); opacity: 0.5; }
.push-dot-ok { background: var(--ok); }
.push-dot-bad { background: var(--danger); }

.push-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.push-diagnostics {
  margin: 12px 0 0; padding: 12px;
  background: var(--line-2); border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px; line-height: 1.55; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow: auto;
}

/* Toggle switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 44px; height: 25px; padding: 2px; flex: 0 0 auto;
  background: var(--line); border-radius: 999px;
  transition: background 0.18s ease;
}
.switch-thumb {
  display: block; width: 21px; height: 21px;
  background: #fff; border-radius: 999px;
  box-shadow: 0 1px 3px rgba(10, 31, 60, 0.28);
  transition: transform 0.18s ease;
}
.switch input:checked + .switch-track { background: var(--accent-dark); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(19px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input[disabled] + .switch-track { opacity: 0.5; cursor: not-allowed; }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.switch-sub { font-size: 12.5px; color: var(--muted); }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-layout { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1080px) {
  .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--sh-xl); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: grid; place-items: center; }
  .sidebar-backdrop.is-open { display: block; }
  .main { margin-left: 0; }
  .topbar-burger { display: grid; }
  .topbar-search { display: none; }
  .content { padding: 20px 18px 32px; }
  .topbar { padding: 0 18px; }
  .app-footer { padding: 18px; }
}

/* ============================================
   MASTER PORTAL
   ============================================ */

/* Support-session banner. Amber rather than the brand blue so it can never be
   mistaken for ordinary chrome, and sticky so it stays visible while scrolling
   a long tenant page. */
.impersonation-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 26px;
  background: linear-gradient(90deg, #fef3c7, #ffedd5);
  border-bottom: 1px solid rgba(180, 83, 9, 0.28);
  box-shadow: 0 2px 10px rgba(146, 64, 14, 0.12);
}

.impersonation-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.18);
}

.impersonation-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #78350f;
}
.impersonation-text strong { color: #92400e; }

.impersonation-exit {
  height: 32px;
  padding: 0 14px;
  font-size: 12.5px;
  white-space: nowrap;
  background: #fff;
  color: #92400e;
  border-color: rgba(180, 83, 9, 0.35);
}
.impersonation-exit:hover { background: #fff7ed; color: #78350f; }

/* Two cards side by side: a plan breakdown next to an attention list. */
.master-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}

.master-back { color: var(--brand); font-weight: 700; }

/* ---- plan breakdown ---- */
.master-plans { list-style: none; margin: 0; padding: 0; }

.master-plans li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.master-plans li:last-child { border-bottom: none; }

.master-plan-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.master-plan-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--muted);
}
.master-plan-dot-starter   { background: var(--info); }
.master-plan-dot-business  { background: var(--brand); }
.master-plan-dot-enterprise { background: var(--accent); }

.master-plan-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
  justify-content: flex-end;
}

.master-plan-price {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.master-plan-count {
  min-width: 34px;
  text-align: right;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}

/* ---- attention list ---- */
.master-attn-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 8px;
}
.master-attn-label:not(:first-child) { margin-top: 18px; }

.master-attn-list { list-style: none; margin: 0 0 4px; padding: 0; }

.master-attn-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line-2);
}
.master-attn-list li:last-child { border-bottom: none; }
.master-attn-list a { font-weight: 600; color: var(--ink); }
.master-attn-list a:hover { color: var(--brand); }

.master-attn-note {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.master-empty {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.master-empty-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ok-tint);
  color: var(--ok);
}

/* ---- pending upgrade requests ---- */
.master-upgrade-list { list-style: none; margin: 0; padding: 0; }

.master-upgrade {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-2);
}

.master-upgrade:last-child { border-bottom: none; padding-bottom: 0; }
.master-upgrade:first-child { padding-top: 0; }

.master-upgrade-main { flex: 1; min-width: 240px; }

.master-upgrade-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.master-upgrade-company { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.master-upgrade-company:hover { color: var(--brand); }

.master-upgrade-meta {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 1px;
}

.master-upgrade-ref {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 5px;
}

.master-upgrade-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 7px;
  padding: 8px 11px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 2px solid var(--accent);
}

.master-upgrade-actions { margin: 0; }

/* ---- tenant upgrade page ---- */
.upgrade-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  counter-reset: none;
}

.upgrade-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.upgrade-steps strong { color: var(--ink); font-weight: 650; }

.upgrade-step-num {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
}

.upgrade-history { list-style: none; margin: 0; padding: 0; }

.upgrade-history li {
  padding: 13px 0;
  border-bottom: 1px solid var(--line-2);
}

.upgrade-history li:first-child { padding-top: 0; }
.upgrade-history li:last-child { border-bottom: none; padding-bottom: 0; }

.upgrade-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.upgrade-history-plan { font-size: 13.5px; font-weight: 700; color: var(--ink); }

.upgrade-history-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
}

.upgrade-history-time { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.upgrade-history-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 7px;
  padding: 8px 11px;
  background: var(--bg);
  border-radius: 8px;
}

/* ---- company table ---- */
.master-cell-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.master-usage { display: flex; flex-direction: column; gap: 5px; min-width: 92px; }

.master-usage-count {
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.master-usage-bar { height: 5px; display: block; }

.master-row-actions { text-align: right; white-space: nowrap; }

.master-empty-cell {
  padding: 34px 20px !important;
  text-align: center;
  color: var(--muted);
}

/* ---- company detail ---- */
.master-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.master-facts-compact { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line-2); }

.master-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.master-fact-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.master-fact-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.master-inline-form {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line-2);
}

.master-hint {
  font-size: 12px;
  color: var(--muted);
}

/* The switch-into-company form sits in the page header, so it needs to lay
   itself out rather than inherit the default inline button behaviour. */
.master-enter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.master-enter-form .filter-select { min-width: 210px; }

/* ---- owners ---- */
.master-owner-list,
.master-activity-list { list-style: none; margin: 0; padding: 0; }

.master-owner-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.master-owner-list li:last-child { border-bottom: none; }

.master-owner-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.master-owner-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.master-owner-email {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- audit trail ---- */
.master-activity-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.master-activity-list li:last-child { border-bottom: none; }

.master-activity-list .badge { flex-shrink: 0; margin-top: 1px; }

.master-activity-text {
  flex: 1;
  min-width: 0;
  color: var(--ink-2);
  line-height: 1.45;
}

.master-activity-time {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .topbar-btn span { display: none; }
  .topbar-btn { width: 38px; padding: 0; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .toast-stack { right: 12px; left: 12px; max-width: none; }
  .card-body, .filter-bar { padding: 15px; }
  .detail-hero { padding: 17px; }
  .bell-menu { right: -46px; }
  .note-row { flex-wrap: wrap; padding: 14px 15px; }
  .note-actions { width: 100%; padding-left: 21px; }

  .impersonation-bar { flex-wrap: wrap; padding: 11px 18px; }
  .impersonation-text { flex-basis: 100%; order: 2; }
  .impersonation-exit { order: 3; width: 100%; }
  .master-facts { grid-template-columns: 1fr; }
  .master-plan-meta { min-width: 0; }
  .master-enter-form { width: 100%; }
  .master-enter-form .filter-select { flex: 1; min-width: 0; }
}

@media (max-width: 980px) {
  .master-split { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .row-actions, .toast-stack { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}

@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .row-actions, .toast-stack { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ============================================
   COMPANY LOGO
   Tokens are this file's own.
   ============================================ */

/* Logos appear on the dark sidebar and on light pages alike, and company logos
   arrive with all sorts of backgrounds, so the image always sits on white rather
   than inheriting whatever is behind it. */
.company-logo {
  flex-shrink: 0;
  object-fit: contain;
  background: var(--white, #fff);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
}

.company-logo-sm { width: 34px; height: 34px; }
.company-logo-md { width: 44px; height: 44px; border-radius: 10px; }
.company-logo-lg { width: 76px; height: 76px; border-radius: 14px; }

.sidebar-company .company-logo {
  border-color: rgba(255, 255, 255, 0.22);
}

.company-logo-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--accent-dark));
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
}

.company-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.company-logo-row-text {
  min-width: 0;
}

.company-logo-row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.company-logo-row-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.cell-company {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cell-company-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- the upload control on the profile page ---- */

.logo-upload {
  margin-bottom: 20px;
}

.logo-upload .company-logo-row {
  align-items: flex-start;
  margin-bottom: 0;
  padding-bottom: 20px;
}

.logo-upload-fields {
  margin-top: 10px;
}

.form-file {
  padding: 7px 10px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  max-width: 100%;
}

.form-file::file-selector-button {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  margin-right: 10px;
  cursor: pointer;
}

.form-file::file-selector-button:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.logo-clear {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.logo-clear:hover {
  color: var(--danger);
}

.logo-upload.has-error .form-file {
  border-color: var(--danger);
}

/* ============================================
   CUSTOM EXCEL EXPORT
   ============================================ */

.export-card {
  margin-top: 18px;
}

.export-howto {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.export-howto li + li {
  margin-top: 0.25rem;
}

.export-fields-head {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

/* Only the group matching the chosen record type is shown; the template ships
   them all hidden and portal-side JavaScript reveals one. */
.export-field-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--brand-tint);
}

.export-field-group[hidden] {
  display: none;
}

.export-field-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
}

.export-field-check input {
  margin-top: 2px;
  flex-shrink: 0;
}

.export-hint {
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .export-field-group {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   AGENT INTAKE - SETUP STEPS AND SECRETS
   ============================================ */

/* Numbered walkthrough on the Agent Intake page. Counter-driven so inserting a
   step renumbers the rest without editing markup. */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: intake-step; }
.step {
  position: relative;
  counter-increment: intake-step;
  padding: 0 0 20px 40px;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  content: counter(intake-step);
  position: absolute;
  left: 0; top: -1px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-text);
  font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
/* Connector between markers, stopped before the last one. */
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px; top: 30px; bottom: 4px;
  width: 1px;
  background: var(--line-2);
}
.step-title { font-size: 14px; font-weight: 650; color: var(--ink); margin: 4px 0 3px; }
.step-text { font-size: 13px; color: var(--muted); line-height: 1.62; }
.step-text code,
.form-help code,
.form-alert code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--accent-tint);
  color: var(--accent-text);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Monospace block for the Apps Script call and the intake secrets. Long
   tokens must not reflow mid-string, and selecting to copy is the point. */
.code-block {
  font-family: var(--font-mono) !important;
  font-size: 12.5px !important;
  line-height: 1.7 !important;
  white-space: pre-wrap;
  word-break: break-all;
  cursor: pointer;
  background: #f8fafc !important;
}

/* Small print under the intake page. */
.page-foot-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.6;
}
.page-foot-note strong { color: var(--muted); }

@media (max-width: 640px) {
  .step { padding-left: 34px; }
  .step::before { width: 22px; height: 22px; font-size: 11.5px; }
  .step::after { left: 11px; }
}

