/*
  SPOT design language: tokens, the app shell, the phoenix bridge and shared components.
  One neutral ground, one green accent, one typeface (IBM Plex Sans). Panels separate with a
  1px line; shadows are only for things that float (menus, dialogs, toasts).

  Loaded ONLY by base_v2.html, which puts class="sp-shell" on <body>. Every rule that touches
  phoenix or bootstrap markup is scoped to body.sp-shell, so pages still on base.html are untouched.
*/

/* 1. Tokens */
:root {
  /* Surfaces */
  --spot-ground:   #F5F6F8;
  --spot-surface:  #FFFFFF;
  --spot-sunken:   #EEF0F3;
  --spot-line:     #E3E6EB;
  --spot-line-soft:#ECEEF2;
  --spot-line-strong: #D5D9E0;

  /* Text */
  --spot-ink:   #111827;
  --spot-body:  #374151;
  --spot-muted: #5B6472;

  /* Accent (the only brand color) */
  --spot-accent:        #0B7A5B;
  --spot-accent-hover:  #096348;
  --spot-accent-text:   #0B6B50;
  --spot-accent-soft:   #E6F4EF;
  --spot-accent-line:   #B5DDCF;

  /* Status: always paired with a word, never color alone */
  --spot-attention:      #C2410C;
  --spot-attention-text: #9A3412;
  --spot-attention-soft: #FDEEE4;
  --spot-danger:         #B42318;
  --spot-danger-soft:    #FDECEA;

  /* Data series, in order */
  --spot-series-1: #0B7A5B;
  --spot-series-2: #1D4ED8;
  --spot-series-3: #6B7280;

  /* Type */
  --spot-font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --spot-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --spot-text-figure: 1.25rem;   /* 20 KPI figure */
  --spot-text-title:  0.9375rem; /* 15 page title */
  --spot-text-body:   0.75rem;   /* 12 body, panel title */
  --spot-text-small:  0.6875rem; /* 11 label, meta */

  /* Shape */
  --spot-radius-chip:    4px;
  --spot-radius-control: 6px;
  --spot-radius-panel:   8px;

  /* Space: 4 8 12 16 20 32 */
  --spot-space-1: 4px;
  --spot-space-2: 8px;
  --spot-space-3: 12px;
  --spot-space-4: 16px;
  --spot-space-5: 20px;
  --spot-space-6: 32px;

  /* Control heights */
  --spot-control-h:    32px;
  --spot-control-h-sm: 28px;

  /* Shell measures */
  --spot-rail-w:      48px;
  --spot-rail-open-w: 240px;
  --spot-topbar-h:    46px;

  /* Elevation: floating layers only */
  --spot-shadow-float: 0 8px 24px rgba(17, 24, 39, .12), 0 1px 3px rgba(17, 24, 39, .08);

  --spot-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spot-duration: 150ms;
}

/* 2. Shell: restyles the existing phoenix nav markup into an icon rail and a thin top bar.
      The markup and its role logic stay in base.html, so there is one nav to maintain. */
body.sp-shell {
  --phoenix-body-font-family: var(--spot-font);
  --phoenix-body-bg: var(--spot-ground);
  --phoenix-body-color: var(--spot-body);
  font-family: var(--spot-font);
  font-size: var(--spot-text-body);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  background: var(--spot-ground);
  color: var(--spot-ink);
}

/* Top bar */
body.sp-shell #top .navbar-top {
  height: var(--spot-topbar-h) !important;
  min-height: 0 !important;
  padding: 0 var(--spot-space-4) 0 0 !important;
  background: var(--spot-surface) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid var(--spot-line) !important;
  box-shadow: none !important;
}
body.sp-shell #top .navbar-top > .navbar-collapse { gap: var(--spot-space-3); flex-wrap: nowrap; height: 100%; width: 100%; min-width: 0; }
body.sp-shell #top .navbar-top .navbar-logo {
  flex: 0 0 var(--spot-rail-w); width: var(--spot-rail-w); height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--spot-line);
}
body.sp-shell #top .navbar-top .navbar-brand { margin: 0 !important; padding: 0; }
body.sp-shell #top .navbar-top .logo-text { display: none; }
body.sp-shell #top .navbar-top .navbar-nav-icons { align-items: center; gap: var(--spot-space-1); }
body.sp-shell #top .navbar-top .navbar-nav-icons > .nav-item > .nav-link { color: var(--spot-body); }
body.sp-shell #spot-guide-nav-btn {
  height: var(--spot-control-h-sm); border-radius: var(--spot-radius-control);
  border: 1px solid var(--spot-line-strong); color: var(--spot-body);
  font-size: var(--spot-text-small); font-weight: 500;
}
body.sp-shell #spot-guide-nav-btn:hover { border-color: var(--spot-line-strong); background: var(--spot-ground); color: var(--spot-ink); }
body.sp-shell #top .navbar-top .avatar.avatar-l { width: 28px; height: 28px; }
body.sp-shell .nav-avatar-img { background: var(--spot-ink) !important; font-weight: 600 !important; }

.sp-topbar-center { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--spot-space-3); }
.sp-crumbs { min-width: 0; display: flex; align-items: center; gap: var(--spot-space-2); color: var(--spot-muted); white-space: nowrap; overflow: hidden; }
.sp-crumbs a, body.sp-shell .sp-crumbs a { color: var(--spot-body); text-decoration: none; }
.sp-crumbs a:hover, body.sp-shell .sp-crumbs a:hover { color: var(--spot-ink); }
.sp-crumbs .sep { color: var(--spot-muted); }
.sp-crumbs .here { color: var(--spot-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sp-topbar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: var(--spot-space-2); }

/* Content area */
body.sp-shell #top > .content {
  padding: var(--spot-topbar-h) 0 0 !important;
  min-height: 100vh;
  background: var(--spot-ground);
}
body.sp-shell #top > .content > .footer { display: none; }
.sp-page { padding: 10px var(--spot-space-4) var(--spot-space-4); }

/* Small screens: keep the top bar on one line */
@media (max-width: 991.98px) {
  body.sp-shell #top .navbar-top { padding-right: var(--spot-space-3) !important; }
  body.sp-shell #top .navbar-top .navbar-logo { flex-basis: auto; width: auto; padding: 0 var(--spot-space-2); border-right: 0; gap: var(--spot-space-1); }
  body.sp-shell #spot-guide-nav-btn { display: none; }
  .sp-crumbs > :not(.here) { display: none; }
  .sp-topbar-actions .sp-btn.secondary, .sp-topbar-actions .sp-btn.quiet { display: none; }
  .sp-page { padding: var(--spot-space-3); }
  .sp-pagehead { padding-left: var(--spot-space-3); padding-right: var(--spot-space-3); }
}

/* Icon rail (desktop). Below 992px phoenix's own slide-in menu is kept. */
@media (min-width: 992px) {
  body.sp-shell #top .navbar-top .navbar-toggler { display: none !important; }
  body.sp-shell #top > .content { margin-left: var(--spot-rail-w) !important; }
  body.sp-shell #top .navbar-vertical {
    position: fixed !important; top: var(--spot-topbar-h) !important; left: 0; bottom: 0;
    width: var(--spot-rail-w) !important; max-width: none; height: auto !important;
    padding: 0 !important; margin: 0 !important; overflow: hidden;
    background: var(--spot-surface) !important;
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    border-right: 1px solid var(--spot-line) !important;
    transition: width var(--spot-duration) var(--spot-ease), box-shadow var(--spot-duration) var(--spot-ease);
    z-index: 1020;
  }
  body.sp-shell #top .navbar-vertical:hover,
  body.sp-shell #top .navbar-vertical:focus-within {
    width: var(--spot-rail-open-w) !important;
    box-shadow: var(--spot-shadow-float);
  }
  body.sp-shell #top .navbar-vertical .navbar-collapse {
    display: block !important; width: 100%; height: 100% !important;
    overflow-y: auto; overflow-x: hidden; padding: 0 !important; margin: 0 !important;
    background: transparent !important; scrollbar-width: none;
  }
  body.sp-shell #top .navbar-vertical .navbar-collapse::-webkit-scrollbar { display: none; }
  body.sp-shell #top .navbar-vertical .navbar-vertical-content { padding: 6px 4px var(--spot-space-3) !important; width: auto !important; }
  body.sp-shell #top .navbar-vertical .navbar-nav { gap: 0; }
  body.sp-shell #top .navbar-vertical .nav-item-wrapper { padding: 0 !important; margin: 0 0 2px !important; }
  body.sp-shell #top .navbar-vertical .nav-link {
    display: flex !important; align-items: center; height: 36px; padding: 0 !important; margin: 0 !important;
    border-radius: var(--spot-radius-panel); color: var(--spot-muted) !important;
    font-size: var(--spot-text-body); font-weight: 500; white-space: nowrap; overflow: hidden;
  }
  body.sp-shell #top .navbar-vertical .nav-link > .d-flex { width: 100%; flex-wrap: nowrap; }
  body.sp-shell #top .navbar-vertical .nav-link-icon {
    flex: 0 0 40px; width: 40px; height: 36px; margin: 0 !important; padding: 0 !important;
    display: flex; align-items: center; justify-content: center; color: inherit !important;
  }
  body.sp-shell #top .navbar-vertical .nav-link-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
  body.sp-shell #top .navbar-vertical .nav-link-text-wrapper { padding-left: var(--spot-space-1); }
  body.sp-shell #top .navbar-vertical .nav-link-text { font-size: var(--spot-text-body); color: inherit; }
  body.sp-shell #top .navbar-vertical .nav-link:hover { background: var(--spot-sunken); color: var(--spot-ink) !important; }
  body.sp-shell #top .navbar-vertical .nav-link.active { background: var(--spot-accent-soft); color: var(--spot-accent) !important; font-weight: 600; }

  /* Group headings: a hairline when collapsed, the label when open */
  body.sp-shell #top .navbar-vertical .navbar-vertical-label {
    display: none; margin: var(--spot-space-3) 0 var(--spot-space-1) !important; padding: 0 10px !important;
    font-size: var(--spot-text-small); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--spot-muted);
  }
  body.sp-shell #top .navbar-vertical .navbar-vertical-line {
    display: block !important; width: 44px; margin: var(--spot-space-2) 0 !important; border: 0;
    border-top: 1px solid var(--spot-line); opacity: 1;
  }
  body.sp-shell #top .navbar-vertical:hover .navbar-vertical-label,
  body.sp-shell #top .navbar-vertical:focus-within .navbar-vertical-label { display: block; }
  body.sp-shell #top .navbar-vertical:hover .navbar-vertical-line,
  body.sp-shell #top .navbar-vertical:focus-within .navbar-vertical-line { width: auto; }

  /* Business switcher: the initial only when collapsed */
  body.sp-shell #top .navbar-vertical .biz-switch { border-color: transparent; background: transparent; padding: 0 0 0 10px; height: 40px; font-family: var(--spot-font); overflow: hidden; }
  body.sp-shell #top .navbar-vertical .biz-switch-name,
  body.sp-shell #top .navbar-vertical .biz-switch-chev { visibility: hidden; }
  body.sp-shell #top .navbar-vertical:hover .biz-switch-name,
  body.sp-shell #top .navbar-vertical:hover .biz-switch-chev,
  body.sp-shell #top .navbar-vertical:focus-within .biz-switch-name,
  body.sp-shell #top .navbar-vertical:focus-within .biz-switch-chev { visibility: visible; }
  body.sp-shell #top .navbar-vertical .biz-switch-av { background: var(--spot-ink); border-radius: var(--spot-radius-control); }
  body.sp-shell #top .navbar-vertical .nav-item-wrapper.px-2 { padding: 0 !important; }
  body.sp-shell #top .navbar-vertical:hover .biz-switch,
  body.sp-shell #top .navbar-vertical:focus-within .biz-switch { border-color: var(--spot-line-strong); background: var(--spot-surface); padding-right: 10px; }

  body.sp-shell #top .navbar-vertical-footer { display: none !important; }
  /* The old shell's "Collapsed View" preference (html.navbar-vertical-collapsed) must not change the rail */
  body.sp-shell #top .navbar-vertical .nav-link-text-wrapper,
  body.sp-shell #top .navbar-vertical .nav-link-text { display: inline-block !important; opacity: 1 !important; visibility: visible !important; }
}

/* 3. Phoenix bridge: bootstrap and phoenix pieces a migrated page may still contain */
body.sp-shell a { color: var(--spot-accent); }
body.sp-shell a:hover { color: var(--spot-accent-hover); }
body.sp-shell :focus-visible { outline: 2px solid var(--spot-accent) !important; outline-offset: 2px !important; }
body.sp-shell .form-control:focus,
body.sp-shell .form-select:focus {
  border-color: var(--spot-accent) !important;
  box-shadow: 0 0 0 3px var(--spot-accent-soft) !important;
}
body.sp-shell .btn-phoenix-primary,
body.sp-shell .btn-primary:not(.btn-phoenix-secondary):not(.btn-outline-primary) {
  background-color: var(--spot-accent) !important;
  border-color: var(--spot-accent) !important;
  color: #fff !important;
  box-shadow: none !important;
  transform: none !important;
}
body.sp-shell .btn-phoenix-primary:hover,
body.sp-shell .btn-primary:not(.btn-phoenix-secondary):not(.btn-outline-primary):hover {
  background-color: var(--spot-accent-hover) !important;
  border-color: var(--spot-accent-hover) !important;
  transform: none !important;
  box-shadow: none !important;
}
body.sp-shell .card {
  background: var(--spot-surface) !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  border: 1px solid var(--spot-line) !important;
  border-radius: var(--spot-radius-panel) !important;
  box-shadow: none !important;
  transition: none !important;
}
body.sp-shell .card:hover { transform: none !important; box-shadow: none !important; }
body.sp-shell .dropdown-menu { border: 1px solid var(--spot-line-strong); border-radius: var(--spot-radius-panel); box-shadow: var(--spot-shadow-float) !important; font-size: var(--spot-text-body); }
body.sp-shell .dropdown-item.active,
body.sp-shell .dropdown-item:active { background-color: var(--spot-accent-soft) !important; color: var(--spot-accent-text) !important; }
body.sp-shell .table tbody tr:hover { background-color: var(--spot-ground) !important; }
body.sp-shell .form-check-input:checked { background-color: var(--spot-accent) !important; border-color: var(--spot-accent) !important; }
body.sp-shell .progress-bar { background-color: var(--spot-accent) !important; }
body.sp-shell .badge.bg-primary,
body.sp-shell .badge-phoenix-primary { background-color: var(--spot-accent-soft) !important; color: var(--spot-accent-text) !important; }
body.sp-shell svg[aria-label="SPOT"],
body.sp-shell svg[aria-label="SPOT"] path,
body.sp-shell svg[aria-label="SPOT"] circle { stroke: none !important; filter: none !important; }

/* 4. Components (opt-in, .sp-*) */

/* Page head: title, meta and tabs in a white band under the top bar */
.sp-pagehead { background: var(--spot-surface); border-bottom: 1px solid var(--spot-line); padding: 12px var(--spot-space-4) 0; display: flex; flex-direction: column; gap: 6px; }
.sp-pagehead.no-tabs { padding-bottom: 12px; }
.sp-pagehead-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.sp-title { margin: 0; font-family: var(--spot-font); font-size: var(--spot-text-title); font-weight: 600; letter-spacing: -.01em; line-height: 1.3; color: var(--spot-ink); }
.sp-meta { font-size: var(--spot-text-small); color: var(--spot-muted); }

/* Tabs */
.sp-tabs { display: flex; flex-wrap: wrap; gap: var(--spot-space-1); }
.sp-tabs.lined { border-bottom: 1px solid var(--spot-line); }
.sp-tab { display: flex; align-items: center; height: 36px; padding: 0 12px; font-size: var(--spot-text-body); font-weight: 500;
  color: var(--spot-muted) !important; text-decoration: none; background: none; border: 0; cursor: pointer; }
.sp-tab:hover { color: var(--spot-ink) !important; }
.sp-tab.active, .sp-tab[aria-selected="true"], .sp-tab[aria-current="page"] { color: var(--spot-ink) !important; font-weight: 600; box-shadow: inset 0 -2px 0 var(--spot-accent); }

/* Segmented switch */
.sp-seg { display: inline-flex; border: 1px solid var(--spot-line-strong); border-radius: var(--spot-radius-control); overflow: hidden; font-weight: 500; }
.sp-seg > * { display: flex; align-items: center; height: var(--spot-control-h-sm); padding: 0 10px; font-size: var(--spot-text-small) !important; color: var(--spot-body) !important; text-decoration: none; background: var(--spot-surface); border: 0; cursor: pointer; font: inherit; font-weight: 500; }
.sp-seg > .active, .sp-seg > [aria-current] { background: var(--spot-ink); color: #fff !important; }

/* Layout helpers */
.sp-stack { display: flex; flex-direction: column; gap: 10px; }
.sp-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.sp-row > * { min-width: 0; }

/* Panel */
.sp-panel { background: var(--spot-surface); border: 1px solid var(--spot-line); border-radius: var(--spot-radius-panel); padding: 12px 14px; }
.sp-panel.flush { padding: 0; }
.sp-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--spot-space-2); padding: 12px 14px 8px; }
.sp-panel > .sp-panel-head { padding: 0 0 10px; }
.sp-panel.flush > .sp-panel-head { padding: 12px 14px 8px; }
.sp-panel-title { margin: 0; font-size: var(--spot-text-body); font-weight: 600; color: var(--spot-ink); }

/* Buttons: one primary per screen */
.sp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--spot-control-h); padding: 0 14px;
  font-family: var(--spot-font); font-size: var(--spot-text-body); font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  border: 1px solid var(--spot-ink); border-radius: var(--spot-radius-control); background: var(--spot-ink); color: #fff !important;
  transition: background-color var(--spot-duration) var(--spot-ease); }
.sp-btn:hover { background: #000; border-color: #000; }
.sp-btn.accent { background: var(--spot-accent); border-color: var(--spot-accent); }
.sp-btn.accent:hover { background: var(--spot-accent-hover); border-color: var(--spot-accent-hover); }
.sp-btn.secondary { background: var(--spot-surface); border-color: var(--spot-line-strong); color: var(--spot-ink) !important; font-weight: 500; padding: 0 12px; }
.sp-btn.secondary:hover { background: var(--spot-ground); border-color: var(--spot-line-strong); }
.sp-btn.quiet { background: transparent; border-color: transparent; color: var(--spot-body) !important; font-weight: 500; padding: 0 12px; }
.sp-btn.quiet:hover { background: var(--spot-sunken); color: var(--spot-ink) !important; }
.sp-btn.danger { background: var(--spot-surface); border-color: var(--spot-danger); color: var(--spot-danger) !important; font-weight: 500; padding: 0 12px; }
.sp-btn.danger:hover { background: var(--spot-danger-soft); }
.sp-btn.sm { height: var(--spot-control-h-sm); padding: 0 10px; }
.sp-btn:disabled, .sp-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Status chips */
.sp-chip { display: inline-block; font-size: var(--spot-text-small); font-weight: 500; line-height: 1.5; padding: 1px 8px;
  border-radius: var(--spot-radius-chip); background: var(--spot-sunken); color: var(--spot-body); white-space: nowrap; }
.sp-chip.ok { background: var(--spot-accent-soft); color: var(--spot-accent-text); }
.sp-chip.attention { background: var(--spot-attention-soft); color: var(--spot-attention-text); }
.sp-chip.danger { background: var(--spot-danger-soft); color: var(--spot-danger); }

/* Fields */
.sp-field { display: flex; flex-direction: column; gap: 6px; }
.sp-label { font-size: var(--spot-text-small); font-weight: 500; color: var(--spot-body); }
.sp-input, .sp-select { height: var(--spot-control-h); padding: 0 10px; font-family: var(--spot-font); font-size: var(--spot-text-body);
  color: var(--spot-ink); background: var(--spot-surface); border: 1px solid var(--spot-line-strong); border-radius: var(--spot-radius-control); }
textarea.sp-input { height: auto; padding: 8px 10px; line-height: 1.45; }
.sp-input::placeholder { color: var(--spot-muted); }
.sp-input:focus, .sp-select:focus { outline: none; border-color: var(--spot-accent); box-shadow: 0 0 0 3px var(--spot-accent-soft); }

/* KPI strip */
.sp-kpis { display: flex; flex-wrap: wrap; background: var(--spot-surface); border: 1px solid var(--spot-line); border-radius: var(--spot-radius-panel); overflow: hidden; }
.sp-kpi { flex: 1 1 150px; padding: 12px 14px; box-shadow: 1px 0 0 var(--spot-line), 0 1px 0 var(--spot-line); }
.sp-kpi-label { font-size: var(--spot-text-small); color: var(--spot-muted); }
.sp-kpi-value { font-size: var(--spot-text-figure); font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--spot-ink); }
.sp-kpi-unit { font-size: var(--spot-text-body); font-weight: 500; letter-spacing: 0; color: var(--spot-muted); }
.sp-kpi-note { font-size: var(--spot-text-small); color: var(--spot-muted); }
.sp-kpi-note.up { color: var(--spot-accent-text); font-weight: 500; }
.sp-kpi-note.down { color: var(--spot-attention-text); font-weight: 500; }

/* Table */
.sp-table-wrap { overflow-x: auto; }
.sp-table { width: 100%; border-collapse: collapse; font-size: var(--spot-text-body); color: var(--spot-ink); }
.sp-table th { text-align: left; font-size: var(--spot-text-small); font-weight: 500; color: var(--spot-muted); background: var(--spot-ground);
  padding: 8px var(--spot-space-4); border-top: 1px solid var(--spot-line); border-bottom: 1px solid var(--spot-line); white-space: nowrap; }
.sp-table td { padding: 9px var(--spot-space-4); border-bottom: 1px solid var(--spot-line-soft); }
.sp-table tbody tr:last-child td { border-bottom: 0; }
.sp-table tbody tr:hover { background: var(--spot-ground); }
.sp-table .num { text-align: right; }
.sp-table tr.total td, .sp-table tr.total th { background: var(--spot-ground); font-weight: 600; }

/* Empty state */
.sp-empty { text-align: center; padding: 48px var(--spot-space-4); color: var(--spot-muted); }
.sp-empty-title { font-size: var(--spot-text-body); font-weight: 600; color: var(--spot-ink); }
.sp-empty-text { font-size: var(--spot-text-body); margin: 6px auto 0; max-width: 46ch; }

/* Slide-over (floats over the right edge) */
.sp-slideover { position: fixed; top: var(--spot-topbar-h); right: 0; bottom: 0; width: 360px; max-width: 100%;
  background: var(--spot-surface); border-left: 1px solid var(--spot-line-strong); box-shadow: -12px 0 32px rgba(17, 24, 39, .10);
  display: flex; flex-direction: column; z-index: 1030; }
.sp-slideover-head { padding: 14px var(--spot-space-4) 12px; border-bottom: 1px solid var(--spot-line); }
.sp-slideover-body { flex: 1; overflow-y: auto; padding: var(--spot-space-4); display: flex; flex-direction: column; gap: var(--spot-space-5); }
.sp-slideover-foot { padding: var(--spot-space-3) var(--spot-space-4); border-top: 1px solid var(--spot-line); display: flex; flex-wrap: wrap; gap: var(--spot-space-2); }

/* 5. Sign-in and account pages (auth/_base.html): the form on the left, a brand panel on the right */
body.sp-auth {
  margin: 0; min-height: 100vh; display: flex;
  font-family: var(--spot-font); font-size: var(--spot-text-body); line-height: 1.5; color: var(--spot-ink);
  background: var(--spot-surface); font-variant-numeric: tabular-nums;
}
body.sp-auth *, body.sp-auth *::before, body.sp-auth *::after { box-sizing: border-box; }
.sp-auth-main { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; padding: var(--spot-space-6) var(--spot-space-5); }
.sp-auth-logo { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; color: var(--spot-ink); text-decoration: none; font-size: 1rem; font-weight: 700; letter-spacing: .02em; }
.sp-auth-form { width: 100%; max-width: 380px; margin: auto; padding: var(--spot-space-6) 0; display: flex; flex-direction: column; gap: var(--spot-space-5); }
.sp-auth-title { margin: 0; font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.sp-auth-sub { margin: 6px 0 0; color: var(--spot-muted); }
.sp-auth-fields { display: flex; flex-direction: column; gap: var(--spot-space-4); }
.sp-auth .sp-input { height: 40px; width: 100%; font-size: 0.875rem; }
.sp-auth .sp-btn { height: 40px; font-size: 0.875rem; }
.sp-auth .sp-btn.block { width: 100%; }
.sp-auth-labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spot-space-4); }
.sp-auth a.link, .sp-auth-foot a { color: var(--spot-accent-text); font-weight: 600; text-decoration: none; }
.sp-auth a.link:hover, .sp-auth-foot a:hover { text-decoration: underline; text-underline-offset: 2px; }
.sp-auth-divider { display: flex; align-items: center; gap: var(--spot-space-3); color: var(--spot-muted); font-size: var(--spot-text-small); }
.sp-auth-divider::before, .sp-auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--spot-line); }
.sp-auth-sso { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spot-space-2); }
.sp-auth-sso .sp-btn svg { width: 17px; height: 17px; flex: none; }
.sp-auth-foot { margin: 0; color: var(--spot-muted); text-align: center; }
.sp-auth-legal { margin: 0; color: var(--spot-muted); font-size: var(--spot-text-small); }

.sp-alert { padding: 10px 12px; border-radius: var(--spot-radius-control); border: 1px solid var(--spot-line-strong); background: var(--spot-ground); color: var(--spot-body); font-weight: 500; }
.sp-alert.success { border-color: var(--spot-accent-line); background: var(--spot-accent-soft); color: var(--spot-accent-text); }
.sp-alert.danger, .sp-alert.error { border-color: #F3B8B2; background: var(--spot-danger-soft); color: var(--spot-danger); }
.sp-alert.warning { border-color: #F3C9A8; background: var(--spot-attention-soft); color: var(--spot-attention-text); }

.sp-auth-side {
  flex: 1 1 480px; min-width: 0; position: relative; overflow: hidden; color: #fff;
  background-color: #0B3D2E;
  background-image: radial-gradient(#2F7059 2px, transparent 2.2px); background-size: 20px 20px;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 56px;
}
.sp-auth-side svg.spot { position: absolute; top: 50%; left: 50%; width: min(78%, 520px); height: auto; transform: translate(-50%, -58%); }
.sp-auth-side-text { position: relative; max-width: 22ch; margin: 0; font-size: 1.625rem; line-height: 1.12; font-weight: 500; letter-spacing: -.025em; background: #0B3D2E; padding: 6px 10px 6px 0; }
.sp-auth-side-sub { position: relative; margin: 12px 0 0; max-width: 44ch; color: #D3E5DD; background: #0B3D2E; padding: 4px 10px 4px 0; align-self: flex-start; }
@media (max-width: 959.98px) { .sp-auth-side { display: none; } }

/* Chart tooltip (base_v2.html): one floating label for any element with data-tip */
.sp-tip { position: fixed; z-index: 2000; max-width: 280px; padding: 6px 9px; border-radius: 6px; background: var(--spot-ink); color: #fff;
  font-size: var(--spot-text-small); line-height: 1.4; white-space: pre-line; pointer-events: none; box-shadow: var(--spot-shadow-float); }
[data-tip] { cursor: default; }
svg rect.sp-hit { fill: transparent; }
svg rect.sp-hit:hover { fill: rgba(17, 24, 39, .04); }

/* Search in the top bar (base_v2.html) */
.sp-search { position: relative; display: flex; align-items: center; gap: 8px; height: var(--spot-control-h-sm); padding: 0 10px; border: 1px solid var(--spot-line); border-radius: var(--spot-radius-control); background: var(--spot-ground); color: var(--spot-muted); }
.sp-search:focus-within { border-color: var(--spot-accent); background: var(--spot-surface); }
.sp-search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--spot-ink); width: 220px; }
#sp-results { position: absolute; top: calc(100% + 6px); right: 0; width: 380px; max-height: 440px; overflow-y: auto; z-index: 1100; padding: 4px; background: var(--spot-surface); border: 1px solid var(--spot-line-strong); border-radius: var(--spot-radius-panel); box-shadow: var(--spot-shadow-float); }
#sp-results .grp { padding: 6px 8px 2px; font-size: var(--spot-text-small); font-weight: 600; color: var(--spot-muted); }
#sp-results a { display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 4px; color: var(--spot-ink) !important; text-decoration: none; }
#sp-results a span:last-child { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--spot-muted); font-size: var(--spot-text-small); }
#sp-results a.on, #sp-results a:hover { background: var(--spot-sunken); }
#sp-results .none { padding: 8px; color: var(--spot-muted); }
@media (max-width: 991.98px) { .sp-search input { width: 120px; } }
.sp-search input:focus, .sp-search input:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; }
