/* ============================================================
   nvcaria · Dashboard
   A polished, professional console UI.
   ============================================================ */

/* ───────── Tokens ───────── */
:root {
  /*
   * NVCARIA palette — identical to the marketing site (nvcaria.io) so the
   * console reads as the same product: warm near-black surfaces, bone text,
   * no cool tint. Legacy token names (--teal*, --violet, --rose…) are kept so
   * existing selectors keep working; they now hold bone/grey values.
   */

  /* Surfaces — warm near-black */
  --bg:          #101011;
  --bg-2:        #151517;
  --surface:     #1a1a1c;
  --surface-2:   #1f1f22;
  --surface-hi:  #26262a;
  --sidebar:     #0c0c0d;
  --sidebar-2:   #0a0a0b;
  --overlay:     rgba(8, 8, 9, 0.78);

  /* Borders — bone at low alpha, matching the site's hairlines */
  --border:      rgba(242, 242, 243, 0.07);
  --border-mid:  rgba(242, 242, 243, 0.12);
  --border-hi:   rgba(242, 242, 243, 0.24);

  /* Text — bone through warm grey */
  --text-hi:     #f2f2f3;
  --text:        #d4d4d9;
  --text-mid:    #8b8b92;
  --text-lo:     #5f5f66;
  --text-faint:  #3a3a40;

  /* Brand accent — bone. Token names kept for selector compatibility. */
  --teal:        #8b8b92;
  --teal-hi:     #f2f2f3;
  --teal-glow:   rgba(242, 242, 243, 0.18);
  --teal-soft:   rgba(242, 242, 243, 0.08);
  --teal-bd:     rgba(242, 242, 243, 0.24);

  /* Secondary accents — all bone/grey for a monochrome surface */
  --violet:      #8b8b92;
  --violet-hi:   #d4d4d9;
  --amber:       #c2ab84;
  --amber-hi:    #d8c39c;
  --rose:        #d4d4d9;
  --emerald:     var(--text-hi);
  --emerald-hi:  var(--text-hi);

  /* Status — the site's single green accent, plus muted warn/danger */
  --danger:      #c87a72;
  --danger-soft: rgba(200, 122, 114, 0.14);
  --warn:        #e0c07a;
  --warn-soft:   rgba(224, 192, 122, 0.12);
  --ok:          #7fc98d;
  --ok-soft:     rgba(127, 201, 141, 0.12);

  --tag-bg:      rgba(242, 242, 243, 0.10);
  --tag-fg:      #d4d4d9;
  --tag-bd:      rgba(242, 242, 243, 0.24);

  /* Effects */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow:     0 4px 12px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-lg:  0 12px 32px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px var(--teal-bd), 0 6px 18px var(--teal-glow);

  /* Rounded, matching nvcaria.io's Getcracked-style soft panels. */
  --radius:      14px;
  --radius-sm:   10px;
  --radius-lg:   20px;
  --radius-pill: 999px;

  --fast:       120ms;
  --base:       180ms;
  --slow:       320ms;
  --ease:       cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Type — same families as nvcaria.io */
  --font:       'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 12% -5%, rgba(160, 164, 172, 0.07), transparent 70%),
    radial-gradient(900px 600px at 105% 110%, rgba(180, 184, 190, 0.06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--text-hi); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  color: var(--text-hi);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color var(--base) var(--ease), box-shadow var(--base) var(--ease);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(160, 164, 172, 0.2);
}
input::placeholder, textarea::placeholder { color: var(--text-lo); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #16181c;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #22262c; background-clip: padding-box; border: 2px solid transparent; }

::selection { background: rgba(160, 164, 172, 0.45); color: var(--text-hi); }

/* ───────── App layout ───────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ───────── Top bar ───────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 9, 8, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-mid);
}
/* Three tracks so the nav sits optically centred regardless of how wide the
   brand or the account controls are. */
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.topbar-brand {
  justify-self: start;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text-hi);
}
.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-cta {
  padding: 8px 16px;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-hi);
  white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.topbar-cta:hover { background: var(--surface-hi); border-color: var(--text-mid); }
.user-avatar-btn {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.user-avatar-btn::-webkit-details-marker { display: none; }
.user-avatar-btn .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 13px;
}
.user-pill-details[open] .user-avatar-btn .avatar { outline: 2px solid var(--border-hi); outline-offset: 2px; }
.topnav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
  /* Scrolls on narrow screens, but the scrollbar itself would draw a bar
     across the bar's full height — hide it in both engines. */
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  position: relative;
  padding: 21px 0;
  font-size: 13px;
  color: var(--text-mid);
  white-space: nowrap;
  transition: color var(--fast) var(--ease);
}
.topnav a:hover { color: var(--text-hi); }
.topnav a.active { color: var(--text-hi); }
.topnav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--text-hi);
}
.topbar .user-pill-details { flex: none; margin-left: auto; }
.topbar .user-menu-wrap { top: calc(100% + 10px); bottom: auto; left: auto; right: 0; }

.main {
  position: relative;
  overflow-x: auto;
}
.main::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 80px);
  pointer-events: none;
}
.main-inner {
  position: relative;
  max-width: 1180px;
  padding: 36px 40px 80px;
  margin: 0 auto;
}

/* ───────── Sidebar ───────── */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 0;
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #e8eaed 0%, var(--teal-hi) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-lo);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 13px;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.org-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.org-pill:hover { background: var(--surface-2); border-color: var(--border-mid); }
.org-icon { color: var(--teal-hi); display: inline-flex; }
.org-logo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  /* The logomark already has a dark rounded tile in its design; no extra framing needed */
}
.org-name { flex: 1; text-align: left; font-weight: 500; }
.org-caret { color: var(--text-lo); }

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
  margin-right: -2px;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-lo);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.nav-group-icon { color: var(--text-faint); font-size: 11px; }
.nav-group-label { flex: 1; text-align: left; }
.nav-group-caret { color: var(--text-faint); font-size: 11px; }
.nav-tag {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-hi) 100%);
  color: #06090b;
  font-size: 9px;
  letter-spacing: 0.06em;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.nav-list::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}
.nav-list li { position: relative; }
.nav-list a {
  display: block;
  padding: 6px 10px 6px 18px;
  margin: 0;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-mid);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-list a:hover { background: var(--surface); color: var(--text-hi); }
.nav-list a.active {
  background: linear-gradient(90deg, var(--teal-soft) 0%, transparent 100%);
  color: var(--text-hi);
  font-weight: 600;
}
.nav-list a.active::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal-hi);
  transform: translateY(-50%);
  box-shadow: 0 0 8px var(--teal-glow);
}

.nav-flat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
  font-weight: 500;
}
.nav-flat:hover { background: var(--surface); color: var(--text-hi); }
.nav-flat.active {
  background: linear-gradient(90deg, var(--teal-soft) 0%, transparent 100%);
  color: var(--text-hi);
  box-shadow: inset 2px 0 0 var(--teal-hi);
}

/* Sidebar bottom */
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.user-pill-details {
  margin-top: 8px;
  position: relative;
}
.user-pill-details > summary { list-style: none; }
.user-pill-details > summary::-webkit-details-marker { display: none; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.user-pill:hover { background: var(--surface-2); border-color: var(--border-mid); }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-hi) 100%);
  color: #08111a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.user-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-hi);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta {
  font-size: 11px;
  color: var(--text-lo);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User menu (open dropdown) */
.user-menu-wrap {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  z-index: 50;
}
.user-menu {
  /* Anchored to a 34px avatar, so the panel must set its own width or every
     label wraps to the button's size. */
  min-width: 268px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
}
.user-menu-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 8px;
}
.user-menu-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal-hi);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.user-menu-identity-text { display: flex; flex-direction: column; min-width: 0; }
.user-menu-identity-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-hi);
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-identity-sub {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-lo);
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.user-menu-role {
  padding: 2px 7px;
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-hi);
}
.user-menu-divider { height: 1px; background: var(--border-mid); margin: 4px 0; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.user-menu-item:hover { background: var(--surface-hi); color: var(--text-hi); }
.user-menu-icon {
  flex: none;
  width: 16px;
  color: var(--text-lo);
  display: inline-flex;
  justify-content: center;
}
.user-menu-ext { margin-left: auto; color: var(--text-lo); font-size: 12px; }
.user-menu-logout { margin: 0; padding: 0; }
.user-menu-danger { color: var(--text); }
.user-menu-danger:hover { background: var(--danger-soft); color: #e6a4a4; }
.user-menu-danger:hover .user-menu-icon { color: #e6a4a4; }

/* ───────── Page header ───────── */
.page-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}
.page-head-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-head-row::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
  margin-left: 6px;
}
.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-hi);
  letter-spacing: -0.01em;
}
.page-sub {
  color: var(--text-mid);
  margin: 0;
  font-size: 13.5px;
  padding-left: 2px;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal-hi);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--teal-soft);
  border: 1px solid var(--teal-bd);
  fill: currentColor;
  flex-shrink: 0;
  animation: section-icon-glow 5s ease-in-out infinite;
}
@keyframes section-icon-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--teal-glow); }
  50%      { box-shadow: 0 0 14px 0 var(--teal-glow); }
}

.section-h2 {
  margin: 30px 0 14px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-lo);
  font-weight: 700;
}

/* ───────── Greeting (console home) ───────── */
.greeting {
  margin: 0 0 24px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-hi);
  background: linear-gradient(135deg, #f1f5f8 0%, var(--teal-hi) 65%, var(--violet-hi) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ───────── Action cards row ───────── */
.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-hi);
  font-weight: 500;
  font-size: 14px;
  transition: transform var(--base) var(--ease), border-color var(--base) var(--ease),
              box-shadow var(--base) var(--ease);
  position: relative;
  overflow: hidden;
}
.action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(360px 140px at top right, var(--teal-soft), transparent 70%);
  opacity: 0;
  transition: opacity var(--slow) var(--ease);
  pointer-events: none;
}
.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal-bd);
  box-shadow: var(--shadow);
  color: var(--text-hi);
}
.action-card:hover::before { opacity: 1; }
.action-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-hi);
  border: 1px solid var(--teal-bd);
  font-size: 16px;
}

/* ───────── Recents ───────── */
.recents {
  list-style: none;
  margin: 0 0 36px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recent {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.recent:hover { border-color: var(--border-mid); background: var(--surface-2); }
.recent.empty {
  color: var(--text-lo);
  text-align: center;
  font-style: italic;
  padding: 28px 16px;
  background: transparent;
  border-style: dashed;
}
.recent-title {
  color: var(--text-hi);
  font-weight: 600;
  margin-bottom: 2px;
}
.recent-meta {
  font-size: 12px;
  color: var(--text-lo);
}

/* ───────── KPI Grid (admin) ───────── */
.kpi-grid {
  display: grid;
  /* Allow up to 4 tiles across with a comfortable minimum width.
     Narrower viewports auto-wrap to 2 columns, then 1. */
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-tile {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform var(--base) var(--ease),
              border-color var(--base) var(--ease),
              box-shadow var(--base) var(--ease);
}
/* Subtle left-edge accent on hover only — no permanent top stripe. */
.kpi-tile::before {
  content: '';
  position: absolute;
  top: 12px; bottom: 12px; left: -1px;
  width: 2px;
  background: var(--teal-hi);
  opacity: 0;
  transition: opacity var(--base) var(--ease);
  border-radius: 2px;
}
.kpi-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-mid);
  box-shadow: var(--shadow);
}
.kpi-tile:hover::before { opacity: 0.6; }

.kpi-label {
  font-size: 10.5px;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -0.015em;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  margin-bottom: 14px;
}

.kpi-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.kpi-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  line-height: 1.4;
}
.kpi-line > span:first-child {
  color: var(--text-lo);
  letter-spacing: 0.01em;
}
.kpi-line > span:last-child {
  color: var(--text);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

/* Legacy: keep .kpi-meta / .kpi-rule in case any view still uses them */
.kpi-rule {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 10px 0 8px;
}
.kpi-meta {
  color: var(--text-lo);
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-meta > span { display: block; }
.kpi-meta strong { color: var(--text); font-weight: 600; margin-left: 6px; }

.kpi-grid-secondary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.kpi-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color var(--fast) var(--ease);
}
.kpi-mini:hover { border-color: var(--border-mid); }
.kpi-mini-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-lo);
  font-weight: 700;
  margin-bottom: 4px;
}
.kpi-mini-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-hi);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* ───────── Activity list ───────── */
.activity-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--fast) var(--ease);
}
.activity-row:last-child { border-bottom: none; }
.activity-row:hover { background: var(--surface-2); }
.activity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a3138 0%, #1a1f25 100%);
  color: var(--teal-hi);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  border: 1px solid var(--border-mid);
  flex-shrink: 0;
}
.activity-main { flex: 1; min-width: 0; }
.activity-name {
  color: var(--text-hi);
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.activity-meta { color: var(--text-lo); font-size: 12px; margin-top: 1px; }

/* ───────── Role pill ───────── */
.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface-hi);
  color: var(--text-mid);
  border: 1px solid var(--border-mid);
  line-height: 1.4;
}
.role-pill-admin {
  background: linear-gradient(135deg, rgba(160, 164, 172, 0.18) 0%, rgba(160, 164, 172, 0.08) 100%);
  color: var(--teal-hi);
  border-color: var(--teal-bd);
  box-shadow: 0 0 0 1px rgba(160, 164, 172, 0.05) inset;
}
.activity-time {
  color: var(--text-mid);
  font-size: 12px;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.activity-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-lo);
  font-style: italic;
}

/* ───────── Tables ───────── */
.keys-table,
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0 24px;
  font-size: 13px;
}
.keys-table thead th,
table.data thead th {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-lo);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  text-align: left;
  padding: 10px 14px;
}
.keys-table tbody td,
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.keys-table tbody tr:last-child td,
table.data tbody tr:last-child td { border-bottom: none; }
.keys-table tbody tr:hover,
table.data tbody tr:hover { background: var(--surface-2); }

.key-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--teal-hi);
  letter-spacing: 0.02em;
  display: inline-block;
}

/* ───────── Plan grid / cards ───────── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.plan-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--base) var(--ease), border-color var(--base) var(--ease),
              box-shadow var(--base) var(--ease);
  position: relative;
  overflow: hidden;
}
.plan-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, transparent 0%, var(--teal-bd) 100%);
  border-radius: var(--radius-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--base) var(--ease);
  z-index: 0;
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  padding: 1px;
}
.plan-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-mid);
  box-shadow: var(--shadow);
}
.plan-card:hover::before { opacity: 1; }
.plan-card-active {
  border-color: var(--teal-bd);
  box-shadow: var(--shadow-glow);
}
.plan-card-active::after {
  content: 'ACTIVE';
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: #061114;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-hi) 100%);
  padding: 3px 7px;
  border-radius: 4px;
}
.plan-mode {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-lo);
  font-weight: 700;
}
.plan-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -0.005em;
}
.plan-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--teal-hi);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}
.plan-desc { color: var(--text-mid); font-size: 13px; margin: 2px 0 4px; }
.plan-cta { margin-top: 8px; align-self: stretch; text-align: center; }

/* ───────── Tags / pills ───────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--tag-bg);
  color: var(--tag-fg);
  border: 1px solid var(--tag-bd);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
  font-weight: 500;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.tag:hover { background: rgba(160, 164, 172, 0.22); color: var(--teal-hi); }
.tag::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal-hi);
  opacity: 0.7;
}

.status-pill {
  background: var(--tag-bg);
  color: var(--tag-fg);
  border: 1px solid var(--tag-bd);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

/* ───────── Access console big CTA ───────── */
.access-console {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background:
    linear-gradient(135deg, var(--teal-soft) 0%, transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--teal-bd);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease);
}
.access-console::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 200px at 100% 0%, var(--teal-glow), transparent 70%);
  opacity: 0.4;
  pointer-events: none;
}
.access-console:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.access-console-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-hi) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #06121a;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--teal-glow);
  position: relative;
  z-index: 1;
}
.access-console-body { flex: 1; position: relative; z-index: 1; }
.access-console-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -0.005em;
}
.access-console-sub {
  display: block;
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 2px;
}
.access-console-arrow {
  color: var(--teal-hi);
  font-size: 20px;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: transform var(--base) var(--ease);
}
.access-console:hover .access-console-arrow { transform: translateX(4px); }

/* ───────── Buttons ───────── */
.primary,
button.primary,
a.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-hi) 100%);
  color: #0a0b0e;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease),
              filter var(--base) var(--ease);
  box-shadow: 0 2px 8px rgba(160, 164, 172, 0.25);
}
.primary:hover,
button.primary:hover,
a.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--teal-glow);
  color: #0a0b0e;
  filter: brightness(1.05);
}
.primary:active { transform: translateY(0); }
.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.danger {
  background: linear-gradient(135deg, #b14b4b 0%, var(--danger) 100%);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  border: none;
  font-size: 12.5px;
  transition: filter var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.danger:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(214, 86, 86, 0.3); }

.inline-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-hi);
  font-weight: 600;
  font-size: 13px;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.inline-cta:hover { border-color: var(--teal-hi); color: var(--teal-hi); }

/* ───────── Forms ───────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-lo);
  font-weight: 700;
}
.select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--text-hi);
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-mid) 50%),
    linear-gradient(135deg, var(--text-mid) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}
.inline-form .field { flex: 1; min-width: 160px; margin-bottom: 0; }

.wb-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.wb-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ───────── Auth ───────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(160, 164, 172, 0.10), transparent 70%),
    radial-gradient(700px 500px at 80% 80%, rgba(180, 184, 190, 0.08), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 32px 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-hi);
  letter-spacing: -0.01em;
}
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-card label > span {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-lo);
  font-weight: 700;
}
.auth-card .primary {
  margin-top: 6px;
  padding: 11px 16px;
  font-size: 13.5px;
}
.auth-error {
  background: var(--danger-soft);
  border: 1px solid rgba(214, 86, 86, 0.35);
  color: #e6a4a4;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.legal-shell {
  align-items: flex-start;
  padding-top: 72px;
  padding-bottom: 72px;
}
.legal-card {
  max-width: 760px;
  gap: 16px;
  line-height: 1.65;
}
.legal-card h2 {
  margin: 10px 0 -4px;
  color: var(--text-hi);
  font-size: 15px;
  line-height: 1.3;
}
.legal-card p {
  margin: 0;
}

/* Google requires its own button treatment — white surface, unmodified mark —
   so this is a deliberate exception to the ashen palette. */
.google-button {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: var(--radius-sm);
  color: #1f1f1f;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.google-button:hover { background: #f7f8f8; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); color: #1f1f1f; }
.google-button svg { flex: none; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-lo);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border-mid);
}

/* ───────── Workspace overview (console home) ───────── */
.ws-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 22px;
}
.ws-eyebrow {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-lo); font-weight: 700;
}
.ws-greeting {
  margin: 10px 0 0;
  font-size: 28px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--text-hi);
}
.ws-view { font-size: 12px; color: var(--text-lo); white-space: nowrap; }

.ws-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.ws-panel {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ws-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-mid);
}
.ws-panel-head strong { font-size: 13px; color: var(--text-hi); }
.ws-panel-head a { font-size: 12px; color: var(--text-lo); }
.ws-panel-head a:hover { color: var(--text-hi); }

.ws-platform-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-mid);
  color: inherit;
  transition: background 0.15s;
}
.ws-platform-row:last-child { border-bottom: 0; }
.ws-platform-row:hover { background: var(--surface-2); }
.ws-platform-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ws-platform-id strong { font-size: 13px; color: var(--text-hi); }
.ws-platform-id small { font-size: 11px; color: var(--text-lo); margin-top: 2px; }

.ws-activity {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-mid);
}
.ws-activity:last-child { border-bottom: 0; }
.ws-activity-index { font-size: 11px; color: var(--text-lo); }
.ws-activity p { margin: 0; flex: 1; font-size: 13px; color: var(--text); }
.ws-activity time { font-size: 11px; color: var(--text-lo); white-space: nowrap; }
.ws-activity-empty {
  display: block; padding: 26px 16px;
  text-align: center; font-size: 13px; color: var(--text-lo); font-style: italic;
}

/* ───────── Platform product cards (eBay / YouTube) ───────── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.platform-card {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.platform-card:hover { border-color: var(--border-hi); background: var(--surface-2); }
.platform-card-active { border-color: var(--teal-bd); }
.platform-card-head { display: flex; align-items: center; gap: 12px; }
.platform-mark {
  flex: none;
  width: 54px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
}
.platform-logo { display: block; }
.platform-logo-ebay { width: 34px; height: 14px; }
.platform-logo-youtube { width: 24px; height: 17px; }
.platform-card-id { flex: 1; min-width: 0; }
.platform-card-name { font-size: 15px; font-weight: 700; color: var(--text-hi); }
.platform-card-tagline { font-size: 12px; color: var(--text-lo); margin-top: 2px; }
.platform-price {
  font-size: 24px; font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -0.01em;
}
.platform-empty { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-mid); }
.platform-plan {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.platform-plan-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-lo);
  border-bottom: 1px solid var(--border-mid);
}
.platform-plan-row:last-child { border-bottom: 0; }
.platform-plan-value { color: var(--text-hi); font-weight: 700; }
.platform-includes {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--text);
}
.platform-includes li::before { content: "▸"; color: var(--text-lo); margin-right: 8px; }
.platform-card-actions {
  margin-top: auto;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.platform-btn {
  flex: 1; min-width: 150px;
  padding: 10px 14px;
  border: 1px solid var(--teal-bd);
  border-radius: var(--radius-sm);
  background: var(--teal-hi);
  color: var(--bg);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.platform-btn:hover { background: #fff; color: var(--bg); }
.platform-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.platform-btn[disabled]:hover { background: var(--teal-hi); }
.platform-btn-quiet {
  background: transparent;
  color: var(--text-hi);
  border-color: var(--border-hi);
}
.platform-btn-quiet:hover { background: var(--surface-hi); color: var(--text-hi); }

.status-pill.status-ok   { color: #9fd2a8; border-color: rgba(159, 210, 168, 0.4); background: rgba(159, 210, 168, 0.1); }
.status-pill.status-warn { color: #e0c07a; border-color: rgba(224, 192, 122, 0.4); background: rgba(224, 192, 122, 0.1); }
.status-pill.status-off  { color: var(--text-lo); border-color: var(--border-hi); background: transparent; }

/* ───────── Misc utilities ───────── */
.muted { color: var(--text-mid); }
.muted.small { font-size: 12.5px; color: var(--text-lo); }
.small { font-size: 12.5px; }

.footer {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-lo);
}
.footer a:hover { color: var(--teal-hi); }

.callout {
  background: linear-gradient(135deg, var(--teal-soft) 0%, transparent 100%);
  border: 1px solid var(--teal-bd);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
}
.callout-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--teal-hi);
  margin-bottom: 4px;
}

.cards-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

/* Generic empty/empty-card */
.empty-card,
.empty {
  background: var(--surface);
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-align: center;
  color: var(--text-lo);
}
.empty-title { color: var(--text-hi); font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.empty-body { color: var(--text-mid); font-size: 13px; }

/* ───────── Workbench / docs / links ───────── */
.link-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.link-card:hover { border-color: var(--teal-bd); transform: translateY(-1px); }
.link-card-title { color: var(--text-hi); font-weight: 600; margin-bottom: 2px; }

.code-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--teal-hi);
  white-space: pre;
  overflow-x: auto;
  margin: 10px 0;
  line-height: 1.55;
}

.doc-h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-hi);
  margin: 22px 0 8px;
  letter-spacing: -0.005em;
}
.docs-toc {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 18px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.docs-toc a {
  color: var(--text-mid);
  padding: 2px 8px;
  border-radius: 4px;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.docs-toc a:hover { background: var(--surface-2); color: var(--text-hi); }

/* Steps (quickstart) */
/* Numbered steps. A hairline rule with set numerals, rather than filled
   circles — the badges drew more attention than the copy they labelled.
   (The old rules targeted `.steps li` while the markup uses `.step`, so the
   card styling never applied and only the badge was visible.) */
.steps {
  list-style: none;
  margin: 16px 0 28px;
  padding: 0;
  border-left: 1px solid var(--border-mid);
}
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  padding: 16px 0 18px 24px;
}
.step + .step { border-top: 1px solid var(--border); }
.step-num {
  padding-top: 1px;
  color: var(--text-lo);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.step-title { color: var(--text-hi); font-weight: 600; margin-bottom: 3px; }
.step-body { color: var(--text-mid); font-size: 13.5px; line-height: 1.65; }

/* Env / vault cards */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.env-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--fast) var(--ease);
}
.env-card:hover { border-color: var(--border-mid); }
.env-card-add {
  border-style: dashed;
  color: var(--text-lo);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
}
.env-card-add:hover { color: var(--teal-hi); border-color: var(--teal-bd); }
.env-name { color: var(--text-hi); font-weight: 600; margin-bottom: 4px; }

/* Upload */
.upload-zone {
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-mid);
  background: var(--surface);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.upload-zone:hover { border-color: var(--teal-bd); background: var(--surface-2); }
.upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal-hi);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

/* Remember row (login checkbox) */
.remember-row { flex-direction: row !important; align-items: center; gap: 8px; }
.remember-row input { width: auto !important; margin: 0; }

/* ───────── Chat ───────── */
.main-chat {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Session header — small persistent strip showing logo + agent + selected
   model. This is the one piece of "identity" we kept from the CLI design:
   you always know what you're talking to. */
.chat-session-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.chat-session-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.chat-session-logo {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 4px;
}
.chat-session-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-mid);
  min-width: 0;
}
.chat-session-agent {
  color: var(--text-hi);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chat-session-sep { color: var(--text-faint); }
.chat-session-model {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-session-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}
.chat-token-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-mid);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}
.chat-token-status.active {
  border-color: var(--teal-bd);
  color: var(--text-hi);
  background: var(--teal-soft);
}
.chat-session-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-mid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.chat-session-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal-hi);
  box-shadow: 0 0 0 0 rgba(200, 204, 210, 0.45);
  animation: chat-session-pulse 2.4s ease-in-out infinite;
}
@keyframes chat-session-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 204, 210, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(200, 204, 210, 0); }
}

/* Greeting (initial empty state) */
.chat-greeting {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20px 60px;
  text-align: center;
}
.chat-greeting-icon {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.chat-greeting-icon img {
  width: 160px;
  height: 160px;
  display: block;
}
.chat-greeting-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-hi);
  margin: 0 0 8px;
  letter-spacing: -0.4px;
}
.chat-greeting-sub {
  font-size: 15px;
  color: var(--text-mid);
  margin: 0;
}

/* Message history */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: none;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
.chat-history::-webkit-scrollbar { width: 4px; }
.chat-history::-webkit-scrollbar-track { background: transparent; }
.chat-history::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* Input area pinned at the bottom */
.chat-bottom {
  flex-shrink: 0;
  padding: 12px 32px 28px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.chat-input-wrap {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color var(--base) var(--ease), box-shadow var(--base) var(--ease);
}
.chat-input-wrap:focus-within {
  border-color: var(--teal-bd);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
.chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-hi);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  padding: 14px 16px 0;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  box-sizing: border-box;
}
.chat-input::placeholder { color: var(--text-lo); }
.chat-attachments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px 0;
}
/* The HTML `hidden` attribute is overridden by the class rule above due to
   specificity (class beats UA stylesheet). Restore expected hiding behavior. */
.chat-attachments[hidden] { display: none; }
.chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  min-height: 36px;
  padding: 4px 5px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-mid);
}
.chat-attachment img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}
.chat-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.chat-attachment-remove {
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-lo);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-attachment-remove:hover {
  color: var(--text-hi);
  border-color: var(--border);
  background: var(--surface);
}
.chat-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 10px;
  gap: 10px;
}
.chat-model-select {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-mid);
  font-size: 12px;
  font-family: var(--font);
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.chat-model-select:hover { border-color: var(--border-hi); color: var(--text); }
.chat-model-select:focus { border-color: var(--teal-bd); color: var(--text); }
.chat-model-select option { background: var(--surface-2); color: var(--text); }

.chat-action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.chat-icon-btn,
.chat-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.chat-icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.chat-icon-btn:hover {
  color: var(--text-hi);
  border-color: var(--border-hi);
  transform: scale(1.04);
}
.chat-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}
.chat-send-btn {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-hi) 100%);
  border: none;
  color: #0a0b0e;
}
.chat-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.chat-send-btn:not(:disabled):hover { opacity: 0.85; transform: scale(1.06); }
.chat-send-btn:not(:disabled):active { transform: scale(0.94); }
.chat-stop-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(244, 114, 182, 0.32);
  background: rgba(244, 114, 182, 0.12);
  color: var(--rose);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.chat-stop-btn:hover {
  border-color: rgba(244, 114, 182, 0.55);
  transform: scale(1.04);
}
.chat-stop-btn:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}
.chat-stop-btn[hidden] { display: none; }

.chat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}
.chat-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  color: var(--text-mid);
  font-size: 13px;
  font-family: var(--font);
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.chat-chip:hover {
  border-color: var(--teal-bd);
  color: var(--teal-hi);
  background: var(--teal-soft);
}

/* Message rows */
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
  box-sizing: border-box;
  align-items: flex-start;
}
.chat-msg-user { flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}
.chat-msg-avatar img { width: 32px; height: 32px; display: block; }

.chat-msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  max-width: calc(100% - 50px);
  word-break: break-word;
}
.chat-msg-bubble code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--teal-hi);
}
.chat-msg-bubble h1, .chat-msg-bubble h2, .chat-msg-bubble h3 {
  font-weight: 700;
  color: var(--text-hi);
  margin: 14px 0 6px;
}
.chat-msg-bubble h1 { font-size: 18px; }
.chat-msg-bubble h2 { font-size: 16px; }
.chat-msg-bubble h3 { font-size: 14px; }
.chat-msg-bubble h1:first-child,
.chat-msg-bubble h2:first-child,
.chat-msg-bubble h3:first-child { margin-top: 0; }
.chat-msg-bubble p { margin: 0 0 8px; }
.chat-msg-bubble p:last-child { margin: 0; }
.chat-msg-bubble ul, .chat-msg-bubble ol { margin: 4px 0 8px; padding-left: 22px; }
.chat-msg-bubble li { margin: 2px 0; }
/* Code blocks: match the console page bg so the code feels embedded into
   the conversation surface, not floating on a separate slab. */
.chat-msg-bubble pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  margin: 8px 0;
  overflow-x: auto;
}
.chat-msg-bubble pre code,
.chat-msg-bubble pre code.hljs {
  background: var(--bg) !important;     /* hljs theme tries to paint here too — kill it */
  border: none;
  padding: 10px 12px;
  display: block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
}

/* highlight.js token retune — match the illuminated-grey palette.
   The atom-one-dark CSS file is loaded as a base, but every token color is
   overridden here so the syntax reads as quiet monochrome with a few muted
   accents (olive strings, amber numbers, off-white function names). */
.chat-msg-bubble pre code.hljs                 { color: var(--text); }
.chat-msg-bubble .hljs-comment,
.chat-msg-bubble .hljs-quote                   { color: var(--text-lo); font-style: italic; }
.chat-msg-bubble .hljs-keyword,
.chat-msg-bubble .hljs-selector-tag,
.chat-msg-bubble .hljs-subst                   { color: var(--text-hi); font-weight: 600; }
.chat-msg-bubble .hljs-string,
.chat-msg-bubble .hljs-doctag,
.chat-msg-bubble .hljs-meta-string             { color: var(--ok); }       /* olive sage */
.chat-msg-bubble .hljs-number,
.chat-msg-bubble .hljs-literal,
.chat-msg-bubble .hljs-variable,
.chat-msg-bubble .hljs-template-variable       { color: var(--amber); }    /* muted tan */
.chat-msg-bubble .hljs-title,
.chat-msg-bubble .hljs-section,
.chat-msg-bubble .hljs-function .hljs-title,
.chat-msg-bubble .hljs-title.function_         { color: var(--teal-hi); }  /* silver-bright */
.chat-msg-bubble .hljs-class .hljs-title,
.chat-msg-bubble .hljs-type,
.chat-msg-bubble .hljs-title.class_            { color: var(--amber-hi); }
.chat-msg-bubble .hljs-built_in,
.chat-msg-bubble .hljs-name,
.chat-msg-bubble .hljs-attr                    { color: var(--text-mid); }
.chat-msg-bubble .hljs-symbol,
.chat-msg-bubble .hljs-bullet,
.chat-msg-bubble .hljs-link,
.chat-msg-bubble .hljs-meta                    { color: var(--violet-hi); }
.chat-msg-bubble .hljs-tag,
.chat-msg-bubble .hljs-tag .hljs-name          { color: var(--text); }
.chat-msg-bubble .hljs-tag .hljs-attr          { color: var(--amber); }
.chat-msg-bubble .hljs-params                  { color: var(--text-mid); }
.chat-msg-bubble .hljs-deletion                { color: var(--danger); }
.chat-msg-bubble .hljs-addition                { color: var(--ok); }
.chat-msg-bubble .hljs-emphasis                { font-style: italic; }
.chat-msg-bubble .hljs-strong                  { font-weight: 700; color: var(--text-hi); }
.chat-msg-bubble blockquote {
  border-left: 3px solid var(--teal-bd);
  padding: 2px 0 2px 12px;
  margin: 8px 0;
  color: var(--text-mid);
}
.chat-msg-bubble strong { color: var(--text-hi); font-weight: 600; }
.chat-msg-bubble em { font-style: italic; }
.chat-msg-bubble a { color: var(--teal-hi); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg-bubble a:hover { color: var(--text-hi); }

.chat-msg-user .chat-msg-bubble {
  background: var(--teal-soft);
  border-color: var(--teal-bd);
  color: var(--text-hi);
}
.chat-user-text + .chat-user-images { margin-top: 8px; }
.chat-user-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 120px));
  gap: 8px;
  max-width: 260px;
}
.chat-user-images img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg);
}
.chat-msg-error-bubble {
  background: var(--danger-soft) !important;
  border-color: rgba(200, 122, 114, 0.35) !important;
  color: var(--danger) !important;
}

/* Typing dots */
.chat-msg-bubble.chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--teal);
  border-radius: 50%;
  animation: chat-dot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes chat-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* Inline tool-step blocks */
.chat-tool-steps {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-tool-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.chat-tool-name {
  font-family: var(--font-mono);
  color: var(--teal-hi);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.chat-tool-name::before { content: "⚙ "; opacity: 0.7; }
.chat-tool-detail { flex: 1; min-width: 0; }
.chat-tool-detail summary {
  cursor: pointer;
  color: var(--text-lo);
  font-size: 11px;
  user-select: none;
  list-style: none;
}
.chat-tool-detail summary::-webkit-details-marker { display: none; }
.chat-tool-detail summary::before { content: "▶ "; font-size: 9px; }
.chat-tool-detail[open] summary::before { content: "▼ "; }
.chat-tool-result {
  margin: 4px 0 0;
  padding: 6px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mid);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

/* KaTeX in chat */
.chat-msg-bubble .katex { color: var(--text-hi); font-size: 1.02em; }
.chat-msg-bubble .katex-display { margin: 10px 0; overflow-x: auto; overflow-y: hidden; }

/* ───────── Responsive ───────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
  .nav { overflow-y: visible; }
  .main-inner { padding: 24px 20px 60px; }
  .greeting { font-size: 26px; }
}

@media (max-width: 600px) {
  .main-inner { padding: 20px 16px 50px; }
  .kpi-value { font-size: 24px; }
  .greeting { font-size: 22px; }
  .actions { grid-template-columns: 1fr; }
  .footer { gap: 12px; }
  .chat-session-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .chat-session-right {
    width: 100%;
    justify-content: space-between;
  }
  .chat-input-footer {
    align-items: flex-end;
  }
  .chat-model-select {
    min-width: 0;
    max-width: 180px;
  }
  .chat-attachment {
    max-width: 100%;
  }
}

/* ───────── Data tables (admin) ───────── */
.section-count {
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-mid);
  letter-spacing: 0;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-lo);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-mid);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .num { text-align: right; font-family: var(--font-mono); }
.cell-name { font-weight: 600; color: var(--text-hi); }
.cell-sub { font-size: 12px; color: var(--text-lo); }
.cell-live { font-size: 12px; color: var(--ok); }

/* ───────── Development notice banner ───────── */
.dev-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-hi);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.dev-banner.dev-banner-hidden { display: none; }
.dev-banner strong { color: var(--text-hi); font-weight: 600; }
.dev-banner-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px rgba(224, 192, 122, 0.6);
}
.dev-banner-close {
  flex: none;
  margin-left: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-lo);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}
.dev-banner-close:hover { color: var(--text-hi); }

/* ───────── Getcracked-style rounding: pill action buttons ───────── */
.primary,
.platform-btn,
.topbar-cta,
.google-button,
.auth-card .primary,
.wb-actions .primary {
  border-radius: var(--radius-pill);
}
/* Slightly tighter inner radius for list rows / inputs so they sit inside cards. */
.auth-card input,
.field input,
.field textarea,
.wb-form textarea {
  border-radius: var(--radius-sm);
}

/* ───────── eBay Accountant Management dashboard ───────── */
.page-head-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.ebay-connect {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
}
.ebay-connect-ok { border-color: rgba(159, 210, 168, 0.3); }
.ebay-connect-main { display: flex; flex-direction: column; gap: 4px; }
.ebay-connect-main strong { font-size: 15px; color: var(--text-hi); }
.ebay-connect-main span { font-size: 13px; color: var(--text-mid); }
.ebay-connect-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.ebay-connect-actions form { margin: 0; }

.finance-notice, .page-notice {
  margin-top: 12px;
  padding: 11px 14px;
  border-left: 2px solid var(--ok);
  background: var(--ok-soft);
  color: var(--text);
  font-size: 13px;
}
.page-notice-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.sync-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-mid);
  color: var(--text-mid);
  font-size: 12px;
}
.sync-strip > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sync-strip strong { color: var(--text-hi); font-size: 13px; }
.sync-strip > span { white-space: nowrap; }
.sync-error { color: var(--danger); overflow-wrap: anywhere; }

.finance-period {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(145px, 0.8fr) minmax(145px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.finance-period label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.finance-period label > span {
  color: var(--text-lo);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.finance-period .platform-btn { height: 40px; }
.finance-period-label {
  grid-column: 1 / -1;
  color: var(--text-mid);
  font-size: 12px;
}
.finance-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finance-kpis .kpi-value { font-size: 24px; overflow-wrap: anywhere; }

.finance-table { min-width: 880px; }
.finance-table td { vertical-align: top; }
.ledger-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ledger-sale, .ledger-credit { color: var(--ok); border-color: rgba(134, 201, 127, 0.3); }
.ledger-refund, .ledger-dispute { color: var(--danger); border-color: rgba(200, 122, 114, 0.3); }
.ledger-purchase, .ledger-shipping_label, .ledger-non_sale_charge { color: var(--warn); border-color: rgba(224, 192, 122, 0.3); }
.ledger-memo { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.ledger-amount { font-weight: 700; color: var(--text-hi); }
.amount-credit { color: var(--ok) !important; }
.amount-debit { color: var(--danger) !important; }
.finance-empty { padding: 28px !important; text-align: center; color: var(--text-lo); }

@media (max-width: 820px) {
  .ebay-connect { align-items: flex-start; flex-direction: column; }
  .ebay-connect-actions { width: 100%; justify-content: space-between; }
  .finance-period { grid-template-columns: 1fr 1fr; }
  .finance-period label:first-child { grid-column: 1 / -1; }
  .finance-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .sync-strip { flex-direction: column; gap: 8px; }
  .finance-period { grid-template-columns: 1fr; }
  .finance-period label:first-child { grid-column: auto; }
  .finance-period-label { grid-column: auto; }
  .finance-kpis { grid-template-columns: 1fr; }
}

/* Signup email verification — the emailed one-time code. */

/* .auth-shell centres one flex child, so the card and the resend link are
   stacked here rather than being laid out side by side as row siblings. */
.auth-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
}
.otp-input {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 10px;
  /* Letter-spacing also applies after the final digit, and centring counts that
     trailing gap — which drags the digits visibly left. Indenting by one step
     puts them back on the optical centre. */
  text-indent: 10px;
  text-align: center;
  padding-top: 14px;
  padding-bottom: 14px;
}
.auth-aside {
  margin-top: 16px;
  text-align: center;
}
.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-mid);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.linklike:hover { color: var(--text-hi); }

/* Buyer Messages — template editor. */
.msg-editor {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
  align-items: start;
}
.msg-editor-main { display: flex; flex-direction: column; gap: 14px; }
.msg-editor textarea { font-size: 14px; line-height: 1.6; resize: vertical; }
.msg-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.msg-tokens-label {
  color: var(--text-lo); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; margin-right: 2px;
}
.msg-token {
  padding: 5px 10px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}
.msg-token:hover { color: var(--text-hi); border-color: var(--text-lo); }
.msg-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.msg-fields .field { margin: 0; }
.msg-toggle {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.msg-toggle input { width: auto; margin: 2px 0 0; }
.msg-toggle strong { display: block; font-size: 14px; color: var(--text-hi); }
.msg-toggle small { display: block; margin-top: 2px; color: var(--text-mid); font-size: 12px; }
.msg-preview {
  padding: 18px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.msg-preview-head {
  color: var(--text-lo); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px;
}
.msg-preview-body {
  white-space: pre-wrap;
  color: var(--text-hi);
  font-size: 14px;
  line-height: 1.65;
}
.page-notice-danger { border-left-color: var(--danger); background: var(--danger-soft); }

@media (max-width: 900px) {
  .msg-editor { grid-template-columns: 1fr; }
  .msg-fields { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Deal calculator
   Costs render in graduated greys and eBay's cut in amber, leaving green for
   what the seller actually keeps — so the bar reads at a glance while staying
   inside the monochrome palette.
--------------------------------------------------------------------------- */
.calc {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) 1.15fr;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(680px 300px at 100% 0%, rgba(242, 242, 243, 0.05), transparent 70%),
    var(--surface);
}
.calc-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.calc-inputs .field { margin: 0; }
.calc-hint {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--text-lo);
  font-size: 11.5px;
  line-height: 1.5;
}

/* Currency/percent affix sits inside the control so the number stays aligned. */
.input-money { position: relative; display: flex; align-items: center; }
.input-money > span {
  position: absolute; left: 12px;
  color: var(--text-lo); font-size: 13px; pointer-events: none;
}
.input-money input { padding-left: 26px; font-family: var(--font-mono); }
.input-pct > span { left: auto; right: 12px; }
.input-pct input { padding-left: 12px; padding-right: 28px; }
/* Multi-letter suffixes ("APR") need clearance from the number spinner. */
.input-pct-wide input { padding-right: 48px; }

.calc-result {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--bg-2);
}
.calc-hero { display: flex; flex-direction: column; gap: 2px; }
.calc-hero-label {
  color: var(--text-lo); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
}
.calc-hero strong {
  font-family: var(--font-mono);
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  transition: color var(--base) var(--ease);
}
.calc-hero-sub { color: var(--text-mid); font-size: 13px; }

.calc-bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(242, 242, 243, 0.05);
}
.calc-bar .seg { transition: width var(--base) var(--ease); }
.seg-cost   { background: rgba(242, 242, 243, 0.58); }
.seg-ship   { background: rgba(242, 242, 243, 0.40); }
.seg-ads    { background: rgba(242, 242, 243, 0.26); }
.seg-cap    { background: rgba(242, 242, 243, 0.15); }
.seg-fees   { background: var(--warn); }
.seg-profit { background: var(--ok); }
/* At a loss there is no profit slice; the fee segment carries the warning. */
.calc-loss .seg-fees { background: var(--danger); }

.calc-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin: 0; padding: 0; list-style: none;
}
.calc-legend li {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-mid); font-size: 12px;
}
.calc-legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.calc-legend b {
  color: var(--text-hi); font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
}

.calc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.calc-tile {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.calc-tile > span {
  color: var(--text-lo); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.calc-tile strong {
  color: var(--text-hi); font-family: var(--font-mono);
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
}
.calc-tile small { color: var(--text-lo); font-size: 11px; }

.calc-aside {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: end;
  gap: 16px;
  margin-top: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--surface);
}
.calc-aside-head { display: flex; flex-direction: column; gap: 3px; }
.calc-aside-head strong { color: var(--text-hi); font-size: 14px; }
.calc-aside-head span { color: var(--text-mid); font-size: 12.5px; }
.calc-aside .field { margin: 0; width: 130px; }
.calc-aside-out { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.calc-aside-out span {
  color: var(--text-lo); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.calc-aside-out strong {
  color: var(--ok); font-family: var(--font-mono);
  font-size: 24px; font-weight: 700; letter-spacing: -0.01em;
}

@media (max-width: 980px) {
  .calc { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .calc-inputs { grid-template-columns: 1fr; }
  .calc-tiles { grid-template-columns: 1fr; }
  .calc-aside { grid-template-columns: 1fr; align-items: stretch; }
  .calc-aside .field { width: auto; }
  .calc-aside-out { text-align: left; }
}

/* Prefill strip — pulls the calculator's inputs from real synced history. */
.calc-prefill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 14px 18px;
  border: 1px solid var(--border-mid);
  border-left: 2px solid var(--ok);
  border-radius: var(--radius);
  background: var(--surface);
}
.calc-prefill-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calc-prefill-main strong { color: var(--text-hi); font-size: 14px; }
.calc-prefill-main span { color: var(--text-mid); font-size: 12.5px; }
.calc-prefill .platform-btn { flex: none; }

@media (max-width: 720px) {
  .calc-prefill { flex-direction: column; align-items: stretch; }
}
