/* ==========================================================
   FleetFixer Account console (account.fleetfixer.io).
   A unified, signed-in management surface for every FleetFixer
   platform: launch apps, manage club subscriptions and handle
   billing. A dark brand rail plus a light working canvas, built
   on the same tokens as auth.fleetfixer.io and the marketing site
   so the whole product reads as one continuous, established brand.
   ========================================================== */

:root {
  --accent:       #1f5fa8;
  --accent-2:     #2e7fc1;
  --accent-light: #4fb3d6;
  --accent-glow:  #6fd0ea;
  --accent-dark:  #17477e;
  --accent-soft:  #eaf1fb;
  --red:          #c8102e;

  --text:    #0b2545;
  --muted:   #64748b;
  --faint:   #94a3b8;
  --stroke:  #e2e8f0;
  --stroke-2:#eef2f7;
  --bg:      #f4f7fb;
  --panel:   #ffffff;
  --panel-2: #f1f5f9;
  --ink:     #060d1b;   /* brand rail base */

  --ok:     #166534; --ok-soft:     #f0fdf4; --ok-line:     #bbf7d0;
  --warn:   #b45309; --warn-soft:   #fff7ed; --warn-line:   #fed7aa;
  --info:   #1f5fa8; --info-soft:   #eff6ff; --info-line:   #bfdbfe;
  --danger: #b91c1c; --danger-soft: #fef2f2; --danger-line: #fecaca;

  --radius:    16px;
  --radius-sm: 11px;
  --shadow:    0 1px 2px rgba(11,37,69,.04), 0 10px 30px rgba(11,37,69,.06);
  --shadow-lift: 0 20px 48px rgba(11,37,69,.13);
  --brand-gradient: linear-gradient(135deg,#1f5fa8 0%,#2e7fc1 50%,#4fb3d6 100%);
  --rail-w: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── App shell ─────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

/* ── Brand rail ────────────────────────────────────────── */
.side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  color: #cdd9ec;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(79,179,214,.16), transparent 60%),
    linear-gradient(180deg, #0a1426 0%, var(--ink) 100%);
  border-right: 1px solid rgba(148,163,184,.14);
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 6px 22px;
  border-bottom: 1px solid rgba(148,163,184,.14);
  margin-bottom: 18px;
}
.side-brand img { height: 34px; width: auto; display: block; }
.side-brand .bn { display: flex; flex-direction: column; line-height: 1.1; }
.side-brand .bn b { color: #fff; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.side-brand .bn span {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-glow); margin-top: 3px;
}

.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #aab8d0; text-decoration: none;
  font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  transition: background .14s, color .14s;
}
.side-nav a i { width: 18px; text-align: center; font-size: 14px; color: #8295b4; transition: color .14s; }
.side-nav a:hover { background: rgba(148,163,184,.10); color: #fff; }
.side-nav a:hover i { color: var(--accent-glow); }
.side-nav a.on { background: rgba(79,179,214,.16); color: #fff; box-shadow: inset 2px 0 0 var(--accent-light); }
.side-nav a.on i { color: var(--accent-glow); }

.side-foot { margin-top: auto; padding-top: 18px; }
.side-help {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 12px; border-radius: 12px; text-decoration: none;
  background: rgba(148,163,184,.08); border: 1px solid rgba(148,163,184,.14);
  color: #cdd9ec; transition: background .14s, border-color .14s;
}
.side-help:hover { background: rgba(148,163,184,.14); border-color: rgba(148,163,184,.28); }
.side-help i { font-size: 15px; color: var(--accent-glow); }
.side-help .h-t { display: flex; flex-direction: column; line-height: 1.25; }
.side-help .h-t b { color: #fff; font-size: 13px; font-weight: 700; }
.side-help .h-t span { font-size: 11px; color: var(--faint); }
.side-legal {
  margin-top: 14px; padding: 0 4px;
  font-size: 11px; line-height: 1.5; color: #5f6f8a;
}

/* ── Main column ───────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 34px;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--stroke);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.topbar-title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.env-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: -.01em;
  border: 1px solid var(--stroke); background: var(--panel); color: var(--muted);
}
.env-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.env-chip.ok   { color: var(--ok);   border-color: var(--ok-line);   background: var(--ok-soft); }
.env-chip.ok .dot   { background: #22c55e; }
.env-chip.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.env-chip.warn .dot { background: #f59e0b; }
.env-chip.info { color: var(--info); border-color: var(--info-line); background: var(--info-soft); }
.env-chip.info .dot { background: var(--accent-2); }

.user { display: flex; align-items: center; gap: 11px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; letter-spacing: .02em;
  background: var(--brand-gradient); box-shadow: 0 4px 12px rgba(31,95,168,.32);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; max-width: 190px; }
.user-meta strong { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--stroke); background: var(--panel); color: var(--muted);
  cursor: pointer; font-size: 15px; transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--stroke); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Content canvas ────────────────────────────────────── */
.content { width: 100%; max-width: 1140px; margin: 0 auto; padding: 30px 34px 56px; }
.block { margin-bottom: 34px; scroll-margin-top: 84px; }
.block:empty { margin: 0; }

.block-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.block-head h2 { font-size: 16px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.block-head .b-sub { font-size: 13px; color: var(--muted); }
.block-head .b-spacer { flex: 1; }
.sect-title { /* legacy hook still used by render fns */
  font-size: 16px; font-weight: 800; letter-spacing: -.02em; color: var(--text); margin: 0 0 16px;
}

/* ── Overview: greeting + stat strip + trust row ───────── */
.hello { margin-bottom: 22px; }
.hello h2 { font-size: 25px; font-weight: 800; letter-spacing: -.025em; margin: 0; }
.hello p { margin: 6px 0 0; font-size: 15px; color: var(--muted); line-height: 1.55; max-width: 640px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--brand-gradient); opacity: .9;
}
.stat .s-ico {
  width: 38px; height: 38px; border-radius: 11px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 16px;
}
.stat .s-val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat .s-lab { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 7px; }
.stat .s-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.stat.tone-ok::before   { background: linear-gradient(90deg,#22c55e,#16a34a); }
.stat.tone-ok .s-ico    { background: var(--ok-soft);   color: var(--ok); }
.stat.tone-warn::before { background: linear-gradient(90deg,#f59e0b,#d97706); }
.stat.tone-warn .s-ico  { background: var(--warn-soft); color: var(--warn); }
.stat.tone-warn .s-val  { color: var(--warn); }
.stat.tone-info .s-ico  { background: var(--info-soft); color: var(--info); }
.stat.tone-neutral::before { background: linear-gradient(90deg,#cbd5e1,#94a3b8); }
.stat.tone-neutral .s-ico  { background: var(--panel-2); color: var(--muted); }

.trust {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
}
.trust .t-item { display: flex; align-items: center; gap: 12px; }
.trust .t-item + .t-item { border-left: 1px solid var(--stroke-2); padding-left: 20px; }
.trust .t-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 14px;
}
.trust .t-txt b { display: block; font-size: 13px; font-weight: 700; }
.trust .t-txt span { font-size: 12px; color: var(--muted); }

/* ── Alert banner ──────────────────────────────────────── */
.banner {
  border-radius: 12px; padding: 14px 16px; margin-bottom: 22px;
  font-size: 14px; font-weight: 500; display: none; align-items: center; gap: 12px;
  border: 1px solid var(--stroke);
}
.banner .b-ico { font-size: 16px; flex-shrink: 0; }
.banner .b-body { flex: 1; }
.banner.ok   { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok);     display: flex; }
.banner.err  { background: var(--danger-soft);  border-color: var(--danger-line); color: var(--danger); display: flex; }
.banner.warn { background: var(--warn-soft);     border-color: var(--warn-line);   color: var(--warn);   display: flex; }
.banner .banner-btn {
  flex-shrink: 0; border: 0; border-radius: 8px; padding: 9px 16px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  background: var(--warn); color: #fff;
}
.banner .banner-btn:hover:not([disabled]) { filter: brightness(.94); }
.banner .banner-btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ── Toolbar (billing interval) ────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.toggle {
  display: inline-flex; border: 1px solid var(--stroke); border-radius: 999px;
  overflow: hidden; background: var(--panel); box-shadow: var(--shadow);
}
.toggle button {
  background: transparent; color: var(--muted); border: 0; padding: 9px 20px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: color .14s;
}
.toggle button.active { background: var(--accent); color: #fff; }
.toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toolbar .save-note {
  font-size: 12px; font-weight: 700; color: var(--ok);
  background: var(--ok-soft); border: 1px solid var(--ok-line);
  padding: 5px 11px; border-radius: 999px;
}

/* ── Cards (launcher / discover / club platforms) ──────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 9px; min-height: 168px;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card.on:hover, .card.launch:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: #cfe0f5; }
.card.discover { background: #fbfdff; border-style: dashed; }
.card.discover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-light); }
.card .ico {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 2px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 19px; background: var(--brand-gradient);
  box-shadow: 0 6px 16px rgba(31,95,168,.26);
}
.card.discover .ico { box-shadow: none; opacity: .92; }
.card h3 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin: 2px 0 0; }
.card p { font-size: 13px; color: var(--muted); margin: 0; flex: 1; line-height: 1.5; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }

/* ── Pills / status ────────────────────────────────────── */
.pill {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  text-transform: capitalize; letter-spacing: .01em; display: inline-flex; align-items: center; gap: 5px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.active, .pill.member { background: var(--ok-soft); color: var(--ok); }
.pill.grandfathered, .pill.pilot, .pill.trialing { background: var(--info-soft); color: var(--info); }
.pill.past_due { background: var(--warn-soft); color: var(--warn); }
.pill.none { background: var(--panel-2); color: var(--muted); }
.pill.none::before { opacity: .5; }

/* ── Club (subscription) panels ────────────────────────── */
.club {
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.club-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.club-head .club-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 15px;
}
.club-head h2 { font-size: 18px; font-weight: 800; margin: 0; letter-spacing: -.02em; flex: 1; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  border: 1px solid var(--stroke); border-radius: 10px; padding: 9px 15px; font: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px; background: var(--panel); color: var(--text);
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px rgba(31,95,168,.22); }
.btn-primary:hover:not([disabled]) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not([disabled]) { background: var(--panel-2); color: var(--text); border-color: var(--stroke); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .65; cursor: not-allowed; }

/* ── Misc states ───────────────────────────────────────── */
.muted { color: var(--muted); font-size: 13px; }
.empty, .error-state {
  text-align: center; padding: 48px 24px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty {
  color: var(--muted); background: var(--panel); border: 1px solid var(--stroke);
}
.empty .e-ico {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 22px;
}
.empty h3 { font-size: 18px; font-weight: 800; color: var(--text); margin: 0 0 6px; letter-spacing: -.02em; }
.empty p { margin: 0 auto; max-width: 440px; line-height: 1.55; }
.empty p + p { margin-top: 8px; }
.empty .empty-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.error-state {
  border: 1px solid var(--danger-line); border-left: 4px solid var(--danger);
  background: var(--danger-soft); color: var(--danger);
}
.error-state p { margin: 0 0 6px; }
.error-state .muted { color: #9b5b5b; }
.error-state .btn { margin-top: 12px; }
a.plain { color: var(--accent); font-weight: 700; text-decoration: underline; }
a.plain:hover { color: var(--accent-dark); }
.skel { color: var(--muted); padding: 36px 0; font-size: 14px; }

/* ── Hub footer ────────────────────────────────────────── */
.hub-foot {
  margin-top: 18px; padding-top: 26px; border-top: 1px solid var(--stroke);
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
}
.hub-foot .f-brand { display: flex; align-items: center; gap: 10px; }
.hub-foot .f-brand img { height: 24px; opacity: .9; }
.hub-foot .f-brand b { font-size: 13px; font-weight: 800; letter-spacing: -.01em; }
.hub-foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.hub-foot nav a { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.hub-foot nav a:hover { color: var(--accent); }
.hub-foot .f-spacer { flex: 1; }
.hub-foot .f-social { display: flex; gap: 14px; }
.hub-foot .f-social a { color: var(--faint); font-size: 16px; }
.hub-foot .f-social a:hover { color: var(--accent); }
.hub-foot .f-legal {
  flex-basis: 100%; font-size: 11.5px; line-height: 1.6; color: var(--faint); margin-top: 4px;
}
.hub-foot .f-legal a { color: inherit; text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; height: auto; flex-direction: row; align-items: center;
    padding: 12px 18px; border-right: 0; border-bottom: 1px solid rgba(148,163,184,.18);
  }
  .side-brand { padding: 0; margin: 0; border: 0; }
  .side-nav, .side-foot { display: none; }
  .topbar { padding: 14px 20px; }
  .content { padding: 22px 20px 48px; }
}
@media (max-width: 720px) {
  .topbar-title p { display: none; }
  .user-meta { display: none; }
  .topbar { gap: 10px; }
  .topbar-right { gap: 10px; }
  .env-chip { display: none; }
  .stats { grid-template-columns: 1fr; }
  .trust { grid-template-columns: 1fr; }
  .trust .t-item + .t-item { border-left: 0; border-top: 1px solid var(--stroke-2); padding-left: 0; padding-top: 14px; }
  .cards { grid-template-columns: 1fr; }
  .card .row { flex-direction: column; align-items: stretch; gap: 10px; }
  .card .row .btn { width: 100%; justify-content: center; }
  .toggle button { padding: 11px 18px; min-height: 44px; }
  .btn { min-height: 44px; }
  .hub-foot .f-spacer { display: none; }
  .hello h2 { font-size: 22px; }
}
