/* Filename: main.css | Project folder: web/assets/css/ | Replaces existing file (11 October 2026, P-E3: the Sector Comparator's Screener cards keep a label inside its own figure cell - .scmp-card__metrics > div, .scmp-card__v and its .gap/.badge rules; FR 7.36. Before that, 9 October 2026, P3: the Sector Comparator is the Sector Valuation tab - the old plane-and-table rules removed (every one checked unused elsewhere), the sector chooser's three kept, and the comparator's list of companies not in the comparison added; FR 7.35-7.39. Earlier that day: the Sector Comparator test UI's classes added at the end under SECTOR COMPARATOR, FR 7.35-7.39 - no existing rule changed. 7 October 2026, later: Market Data's Sector Valuation tab's classes added at the end, FR 7.35-7.39 - no existing rule changed. Earlier that day the Valuation tab's classes added at the end, FR 7.26-7.34 - no existing rule changed. Before that, 2 October 2026: the Admin Panel / Capture button, the user menu and the Admin panel's dark side menu of four hubs, FR 16.21, 16.22; the gear and logout icons' rules removed with the icons)
   Project path: web/assets/css/main.css
   Status: REPLACES the existing file.
   ============================================================
   CSEye — Colombo Stock Exchange Intelligence System
   main.css v3.0  |  Apple-Inspired Design System — WCAG AA compliant
   Contrast ratios verified: all text >= 4.5:1 on backgrounds
   Minimum font sizes: body 15px, labels 13px, badges 12px
   ============================================================ */

/* ── Typography (Inter + JetBrains Mono for crisp Apple clarity) ─ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  /* Apple Canvas & Surfaces */
  --bg:              #F5F5F7;
  --bg-secondary:    #EBEBF0;
  --surface:         #FFFFFF;
  --surface-2:       #FAFAFC;
  --surface-subtle:  #F2F2F7;
  --surface-hover:   #F5F5F7;

  /* Borders & Dividers */
  --border:          #E5E5EA;
  --border-light:    #EFEFF4;
  --border-subtle:   rgba(0, 0, 0, 0.05);
  --border-focus:    #0071E3;

  /* Text Scale */
  --text-primary:    #1D1D1F;
  --text-secondary:  #424245;
  --text-muted:      #6E6E73;
  --text-tertiary:   #86868B;
  --text-inverse:    #FFFFFF;

  /* Apple Core Color Palette */
  --apple-blue:      #0071E3;
  --apple-blue-hover:#0077ED;
  --apple-blue-subtle:rgba(0, 113, 227, 0.08);
  --apple-blue-border:rgba(0, 113, 227, 0.20);

  /* Legacy & Semantic Color Mappings */
  --navy:            #0071E3;
  --navy-deep:       #1D1D1F;
  --navy-mid:        #0077ED;
  --navy-light:      #0A84FF;
  --navy-ghost:      rgba(0, 113, 227, 0.08);

  --gold:            #FF9500;
  --gold-light:      #FFB340;
  --gold-muted:      rgba(255, 149, 0, 0.12);

  --green:           #34C759;
  --green-dark:      #248A3D;
  --green-bg:        rgba(52, 199, 89, 0.12);

  --red:             #FF3B30;
  --red-dark:        #D70015;
  --red-bg:          rgba(255, 59, 48, 0.10);

  --amber:           #FF9500;
  --amber-dark:      #C93400;
  --amber-bg:        rgba(255, 149, 0, 0.12);

  --indigo:          #5856D6;
  --indigo-bg:       rgba(88, 86, 214, 0.10);

  /* Dark chrome: the Admin panel's side menu and the Admin Panel / Capture
     button (FR 16.21, 16.22). Text on --chrome-dark: --chrome-dark-text 12:1,
     --chrome-dark-muted 7:1, --navy-light 4.9:1. */
  --chrome-dark:        #0F172A;
  --chrome-dark-raised: #1E293B;
  --chrome-dark-edge:   #334155;
  --chrome-dark-text:   #CBD5E1;
  --chrome-dark-muted:  #94A3B8;

  /* Dimensions */
  --topbar-h:        52px;
  --sidebar-w:       248px;   /* the Admin panel's side menu (FR 16.22) */

  /* Typography Stack */
  --font-body:       -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display:    -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:       "JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* Apple Ambient Drop Shadows */
  --shadow-xs:       0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md:       0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-lg:       0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-topbar:   0 1px 0 rgba(0, 0, 0, 0.06), 0 4px 20px rgba(0, 0, 0, 0.03);

  /* Radii */
  --r-xs:            6px;
  --r-sm:            8px;
  --r-md:            12px;
  --r-lg:            16px;
  --r-xl:            20px;
  --r-full:          9999px;

  /* Transitions */
  --ease:            cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast:          140ms var(--ease);
  --t-mid:           240ms var(--ease);
  --t-slow:          380ms var(--ease);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--apple-blue);
  text-decoration: none;
  transition: color var(--t-fast), opacity var(--t-fast);
}
a:hover {
  color: var(--apple-blue-hover);
}

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

img {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

input, select, textarea {
  font-family: inherit;
}

/* ── Apple Frosted Topbar ─────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-topbar);
  display: flex;
  align-items: center;
  z-index: 900;
  padding: 0 1.25rem;
  transition: background var(--t-mid), border-color var(--t-mid);
}

.topbar-brand,
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  padding-right: 1.25rem;
  margin-right: 0.75rem;
  border-right: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.topbar-brand span,
.topbar__brand-sub {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--apple-blue);
  background: var(--apple-blue-subtle);
  padding: 2px 7px;
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-brand:hover,
.topbar__brand:hover {
  opacity: 0.85;
}

.topbar-nav,
.topbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topbar-nav a,
.topbar__nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 0.84375rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.topbar-nav a svg,
.topbar__nav-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: transform var(--t-fast), opacity var(--t-fast);
}

.topbar-nav a:hover,
.topbar__nav-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}
.topbar-nav a:hover svg,
.topbar__nav-link:hover svg {
  opacity: 1;
}

.topbar-nav a.active,
.topbar__nav-link.active {
  background: var(--apple-blue-subtle);
  color: var(--apple-blue);
  font-weight: 600;
}
.topbar-nav a.active svg,
.topbar__nav-link.active svg {
  opacity: 1;
  color: var(--apple-blue);
}

.topbar-right,
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-bell,
.topbar__icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--t-fast);
}

.topbar-bell:hover,
.topbar__icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.topbar-bell svg,
.topbar__icon-btn svg {
  width: 16px;
  height: 16px;
}

/* The open-alert count on the bell: pinned to its corner, so the bell stays
   centred in its circle whatever the number. */
.topbar-bell > .badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  padding: 1px 5px;
  justify-content: center;
  line-height: 1.2;
  box-shadow: 0 0 0 2px var(--surface);
}

.bell-badge,
.topbar__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--surface);
}

.topbar-avatar,
.topbar__user-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 4px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-subtle);
  cursor: default;
  margin-left: 4px;
}

.avatar-initials,
.topbar__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0071E3, #5856D6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.avatar-name,
.topbar__user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* The Admin Panel button (an Administrator) or Capture button (a Data Entry
   Operator), FR 16.21: dark, so it reads as the way into the panel rather than
   one more page of the menu. Accent blue while an Admin panel page is open. On
   a narrow phone its label folds away and the icon stays (see 640px below). */
.topbar-admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px 0 12px;
  border-radius: var(--r-full);
  background: var(--chrome-dark);
  color: var(--text-inverse);
  box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--chrome-dark-edge);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.topbar-admin svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--gold-light);
}
.topbar-admin:hover {
  background: var(--chrome-dark-raised);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--chrome-dark-edge);
}
.topbar-admin.active {
  background: var(--apple-blue);
  box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--apple-blue);
}
.topbar-admin.active svg {
  color: var(--text-inverse);
}
.topbar-admin.active:hover {
  background: var(--apple-blue-hover);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--apple-blue-hover);
}
.topbar-admin:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* The user menu (FR 16.21): the avatar opens a small card with the name, the
   role, the server's clock, Account and Log out. It is a <details>, so it opens
   without a script; the header's script closes it on a click outside or Esc. */
.user-menu {
  position: relative;
  flex-shrink: 0;
}
.user-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::marker { content: ""; }
.user-menu > summary:hover {
  background: rgba(0, 0, 0, 0.06);
}
.user-menu[open] > summary {
  background: var(--apple-blue-subtle);
  border-color: var(--apple-blue-border);
}
.user-menu > summary:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.user-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 950;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.14s var(--ease);
}

.user-menu__who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 10px 10px 4px;
}
.user-menu__name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.user-menu__clock {
  padding: 0 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.user-menu__link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.user-menu__link:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}
.user-menu__link.active {
  background: var(--apple-blue-subtle);
  color: var(--apple-blue);
  font-weight: 600;
}
.user-menu__link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}
/* Log out sits apart from the rest, behind a thin rule, in the red that warns. */
.user-menu__link--logout {
  position: relative;
  margin-top: 9px;
  color: var(--red-dark);
}
.user-menu__link--logout::before {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: -5px;
  border-top: 1px solid var(--border-light);
}
.user-menu__link--logout:hover {
  background: var(--red-bg);
  color: var(--red-dark);
}

/* ── Page Layout ──────────────────────────────────────────── */
.page-wrapper {
  min-height: calc(100vh - var(--topbar-h));
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.page-wrap {
  display: flex;
  min-height: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.content-area {
  padding: 20px 24px 48px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Apple Cards & Surfaces ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-mid), border-color var(--t-mid);
  overflow: hidden;
}

/* Allow cards with dropdowns / pickers / popovers to overflow cleanly */
.card:has(.company-choice),
.card:has([data-company-picker]),
.card--overflow-visible,
.company-choice-card {
  overflow: visible;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card--flat {
  box-shadow: none;
}
.card--flat:hover {
  box-shadow: none;
}

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
}

.card__title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card__subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card__body {
  padding: 20px;
}
.card__body--tight {
  padding: 14px 16px;
}
.card__body--flush {
  padding: 0;
}

.card__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
}

/* ── Apple Stat Cards ─────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-card__change {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--r-xs);
}

.stat-card__change--up  { color: var(--green-dark); background: var(--green-bg); }
.stat-card__change--dn  { color: var(--red-dark);   background: var(--red-bg); }
.stat-card__change--neu { color: var(--text-muted); background: var(--surface-subtle); }

.stat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon--blue   { background: var(--apple-blue-subtle); color: var(--apple-blue); }
.stat-card__icon--gold   { background: var(--gold-muted); color: var(--gold); }
.stat-card__icon--green  { background: var(--green-bg);   color: var(--green); }
.stat-card__icon--red    { background: var(--red-bg);     color: var(--red); }
.stat-card__icon svg     { width: 20px; height: 20px; }

/* ── Grid Helpers ─────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
/* Five and six across: the Snapshot's market-valuation and fundamentals rows (FR 7.19, 7.22).
   minmax(0, 1fr) keeps the columns equal however long a figure is; the figure wraps instead. */
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-5 .metric-tile__value, .grid-cols-6 .metric-tile__value { overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-5, .grid-cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
  .grid-cols-5, .grid-cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Sign-in Shell (FR 1.6) ───────────────────────────────────── */
/* Centres the sign-in card at every width; the page gutter comes from .content-area. */
.login-shell {
  width: 100%;
  max-width: 420px;
  margin: 48px auto 0;
}
@media (max-width: 640px) {
  .login-shell { margin-top: 24px; }
}

/* ── Apple Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all var(--t-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary,
.btn--primary {
  background: var(--apple-blue);
  color: #fff;
  border-color: var(--apple-blue);
  box-shadow: 0 1px 3px rgba(0, 113, 227, 0.25);
}
.btn-primary:hover,
.btn--primary:hover {
  color: #fff;
  background: var(--apple-blue-hover);
  border-color: var(--apple-blue-hover);
  box-shadow: 0 3px 8px rgba(0, 113, 227, 0.35);
}

.btn-secondary,
.btn--secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover,
.btn--secondary:hover {
  background: var(--surface-hover);
  border-color: #D1D1D6;
}

.btn-outline,
.btn--outline {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover,
.btn--outline:hover {
  background: var(--surface-hover);
  border-color: #D1D1D6;
  color: var(--apple-blue);
}

.btn-gold, .btn-amber,
.btn--gold, .btn--amber {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 1px 3px rgba(255, 149, 0, 0.3);
}
.btn-gold:hover, .btn-amber:hover,
.btn--gold:hover, .btn--amber:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
}

.btn-ghost,
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover,
.btn--ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.btn-danger,
.btn--danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 1px 3px rgba(255, 59, 48, 0.25);
}
.btn-danger:hover,
.btn--danger:hover {
  background: var(--red-dark);
}

.btn-link {
  display: inline;
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--apple-blue);
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover {
  text-decoration: underline;
  color: var(--apple-blue-hover);
}
.btn-link-danger {
  color: var(--red-dark);
}
.btn-link-danger:hover {
  color: var(--red);
}

.btn--sm, .btn-sm {
  padding: 5px 12px;
  font-size: 0.8125rem;
}
.btn--lg, .btn-lg {
  padding: 11px 22px;
  font-size: 0.9375rem;
}
.btn--full, .btn-full {
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ── Forms & Controls ─────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.form-label span {
  color: var(--red);
  margin-left: 2px;
}

.form-control,
.form-input {
  width: 100%;
  padding: 9px 13px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus,
.form-input:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.form-control::placeholder,
.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-control:disabled,
.form-input:disabled {
  background: var(--surface-subtle);
  opacity: 0.7;
  cursor: not-allowed;
}

.form-control.is-invalid,
.form-input.is-invalid {
  border-color: var(--red);
}
.form-control.is-invalid:focus,
.form-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.15);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--red);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-control {
  padding-left: 36px;
}
.input-group .input-group__icon {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}
.input-group .input-group__icon svg {
  width: 16px;
  height: 16px;
}

.input-group .input-group__suffix {
  position: absolute;
  right: 11px;
  color: var(--text-muted);
  display: flex;
  cursor: pointer;
}
.input-group .input-group__suffix svg {
  width: 16px;
  height: 16px;
}
.input-group .input-group__suffix:hover {
  color: var(--text-primary);
}

select.form-control,
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── Apple Segmented Control Tabs ─────────────────────────── */
.tabs {
  display: inline-flex;
  background: #E5E5EA;
  padding: 3px;
  border-radius: var(--r-md);
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: none;
  max-width: 100%;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.84375rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: calc(var(--r-md) - 3px);
  border: none;
  background: transparent;
  margin: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
  font-size: 0.90625rem;
}

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

.table tbody tr:hover td {
  background: rgba(0, 113, 227, 0.025);
}

.table .num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--apple-blue);
  font-size: 0.875rem;
}

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

/* A column's heading sits where its figures sit. `.table thead th` above says
   left and, on its own, outranks the one-class .text-right utility, so until
   29 September 2026 every right-aligned column carried a left-aligned heading.
   Naming the heading and the utility together outranks both. */
.table thead th.text-right {
  text-align: right;
}

/* A label down the side of a table: the label, then its value, in one row.
   Only a table's OWN rows - a table nested inside a row keeps its own headings.
   Without this the label took the browser's own look: centred, bold, and with
   no spacing at all, because the reset above takes every padding away. */
.table > tbody > tr > th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: top;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.table > tbody > tr:last-child > th {
  border-bottom: none;
}

.table > tbody > tr > th ~ td {
  vertical-align: top;
}

/* A cell cut short with "...": without a width of its own the cell simply grew
   to fit the whole line and pushed the table wider than its card. */
.table td.truncate {
  max-width: 24rem;
}

/* A list whose rows run to several lines reads along its top line. `.table
   tbody td` above centres every cell and, on its own, outranks a one-class
   modifier - the same trap as the headings - so .ui-table--compact asked for
   the top from the day it was written and never got it. Centred, a short cell
   floats halfway down beside a tall neighbour, and a small label opened in one
   cell (it opens in the flow) pushed every other cell of its row down with it.
   A row that is one setting beside one text box stays centred instead, because
   the box is taller than the line of text beside it. */
.table.ui-table--top > tbody > tr > td,
.table.ui-table--compact > tbody > tr > td {
  vertical-align: top;
}

.table.ui-table--middle > tbody > tr > td {
  vertical-align: middle;
}

/* A table of many columns lets its headings wrap. Held to one line, the
   headings alone set the width: the Recommendations list's nine needed 1,940px
   where a 1440px screen gives the card 1,333, and the Macro factor table ran
   262px past its card, so the last columns sat off to the side. A heading
   wraps only when the room runs out, and sits on the bottom line, above its
   column. */
.table.ui-table--wrap-head thead th {
  white-space: normal;
  vertical-align: bottom;
}

/* ── Badges & Status Chips ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--blue, .badge-blue     { background: var(--apple-blue-subtle); color: var(--apple-blue); }
.badge--gold, .badge-gold     { background: var(--gold-muted);        color: #995B00; }
.badge--green, .badge-green   { background: var(--green-bg);          color: var(--green-dark); }
.badge--red, .badge-red       { background: var(--red-bg);            color: var(--red-dark); }
.badge--amber, .badge-amber   { background: var(--amber-bg);          color: var(--amber-dark); }
.badge--neutral, .badge-neutral, .badge-grey, .badge--grey, .badge-gray, .badge--gray { background: var(--surface-subtle); color: var(--text-muted); border: 1px solid var(--border); }

.badge--dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  display: block;
  border-left: 3px solid;
  margin-bottom: 16px;
}

.alert svg {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert--error, .alert-error   { background: var(--red-bg);   border-color: var(--red);   color: var(--red-dark); }
.alert--success, .alert-success{ background: var(--green-bg); border-color: var(--green); color: var(--green-dark); }
.alert--warning, .alert-warning{ background: var(--amber-bg); border-color: var(--amber); color: var(--amber-dark); }
.alert--info, .alert-info     { background: var(--apple-blue-subtle); border-color: var(--apple-blue); color: #004F9E; }

/* ── Company Choice Control ───────────────────────────────── */
.company-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(100%, 320px);
}

.company-choice__search,
.company-choice__select {
  width: 100%;
  min-width: 260px;
}

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

.company-choice__results {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 310px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}

.company-choice__result {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
}

.company-choice__result:hover,
.company-choice__result.is-active {
  background: var(--apple-blue-subtle);
  color: var(--apple-blue);
  font-weight: 500;
}

.company-choice__empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.breadcrumb a:hover {
  color: var(--apple-blue);
}
.breadcrumb__sep {
  color: var(--border);
}
.breadcrumb__current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Values ───────────────────────────────────────────────── */
.val-pos { color: var(--green-dark); font-weight: 600; }
.val-neg { color: var(--red-dark);   font-weight: 600; }
.val-neu { color: var(--text-muted); }

/* ── Spinners ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 113, 227, 0.2);
  border-top-color: var(--apple-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--sm { width: 14px; height: 14px; }
.spinner--white { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }

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

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  color: var(--border);
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state__text {
  font-size: 0.875rem;
}

/* ── Sector Pill ──────────────────────────────────────────── */
.sector-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ── Metric Tile ──────────────────────────────────────────── */
.metric-tile {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  transition: transform var(--t-fast);
}

.metric-tile:hover {
  transform: translateY(-1px);
}

.metric-tile__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.metric-tile__value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.metric-tile__sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--apple-blue);
  transition: width 0.4s var(--ease);
}

.progress__bar--gold  { background: var(--gold); }
.progress__bar--green { background: var(--green); }
.progress__bar--red   { background: var(--red); }

/* ── Minimalist Apple Modals ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s var(--ease);
}

.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.22s var(--ease);
  border: 1px solid var(--border-subtle);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.modal-close:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.modal-body   { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
}

/* ═══════════════════════════════════════════════════════════════════════
   FINANCIAL MATRIX
   The one period-data table, shared by pages/company.php (P&L, Balance
   Sheet, Cash Flow, Shareholding) and pages/data-entry.php (existing
   records). Markup comes from templates/fin-matrix.php — keep the two
   together so the pages can never drift apart again.

   Layout: line items down the sticky first column, periods across the top
   (oldest left, newest right), horizontal scroll for the period columns.
═══════════════════════════════════════════════════════════════════════ */

.fin-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.fin-table {
  border-collapse: collapse;
  width: auto;
  min-width: 100%;
  font-size: 13px;
}

/* Header row — sticky so periods stay visible while scrolling down */
.fin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(245, 245, 247, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 11px 20px;
  text-align: right;
  white-space: nowrap;
  min-width: 132px;
  vertical-align: bottom;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.fin-date {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* First column — sticky line-item names */
.fin-table .fin-lbl {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  text-align: left;
  white-space: nowrap;
  min-width: 230px;
  border-right: 1px solid var(--border-light);
  box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
  color: var(--text-primary);
}

.fin-table thead th.fin-lbl,
.fin-table tbody td.fin-lbl {
  min-width: 230px;
  text-align: left;
}

.fin-table thead .fin-lbl {
  z-index: 4;
  background: rgba(245, 245, 247, 0.98);
}

.fin-note {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.fin-table tbody td {
  padding: 10px 20px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
  min-width: 132px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.fin-table tbody tr:hover td,
.fin-table tbody tr:hover .fin-lbl {
  background: rgba(0, 113, 227, 0.03);
}

.fin-table .fin-na {
  color: #C7C7CC;
}

/* Period columns can carry what an import is about to do to them. Only Get Data
   sets this; every other page renders no attribute and so is untouched. */
.fin-table th[data-state="new"],
.fin-table td[data-state="new"]     { background: #F5FBF7; }
.fin-table th[data-state="skipped"],
.fin-table td[data-state="skipped"] { background: #FFFAF2; }
.fin-table th[data-state="saved"],
.fin-table td[data-state="saved"]   { background: #FAFAFB; color: #8E8E93; }
.fin-table th[data-state="reading"],
.fin-table td[data-state="reading"] { background: #F7FBFF; }
.fin-table thead th[data-state]::after {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.fin-table thead th[data-state="new"]::after     { content: "NEW";           color: #248A3D; }
.fin-table thead th[data-state="skipped"]::after { content: "SKIPPED";       color: #C93400; }
.fin-table thead th[data-state="saved"]::after   { content: "ALREADY SAVED"; color: #8E8E93; }
.fin-table thead th[data-state="reading"]::after { content: "READING";       color: #0071E3; }

/* Headline lines: net profit, total equity, free cash flow */
.fin-row--strong td {
  font-weight: 600;
}
.fin-row--strong .fin-lbl {
  font-weight: 600;
  color: var(--apple-blue);
}

/* Growth rows */
.fin-row--growth td {
  font-size: 12px;
}
.fin-table tbody .fin-row--growth td,
.fin-table tbody .fin-row--growth .fin-lbl {
  background: var(--surface-2);
}
.fin-table tbody .fin-row--growth .fin-lbl {
  color: var(--text-secondary);
  font-weight: 500;
}
.fin-table tbody tr.fin-row--growth:hover td,
.fin-table tbody tr.fin-row--growth:hover .fin-lbl {
  background: rgba(0, 113, 227, 0.04);
}

/* Source / badge row */
.fin-table tbody .fin-row--badge td {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Card header extras */
.fin-hdr-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fin-units {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface-subtle);
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

.fin-foot  { font-size: 11px; color: var(--text-muted); padding: 12px 18px 14px; }
.fin-empty { padding: 32px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* Top-shareholders list */
.fin-table.th-list .fin-lbl.th-rank {
  min-width: 46px;
  text-align: right;
  color: var(--text-muted);
  font-weight: 400;
}
.fin-table.th-list thead .fin-lbl   { min-width: 46px; text-align: right; }
.fin-table.th-list .th-name         { text-align: left; white-space: normal; min-width: 280px; }
.fin-table.th-list tbody .th-agg td { border-top: 1px solid var(--border); }
.fin-asof { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 8px; }

/* ═══════════════════════════════════════════════════════════════════════
   FOREIGN FLOWS
═══════════════════════════════════════════════════════════════════════ */
.ff-tiles {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.ff-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-xs);
}

.ff-tile__lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.ff-tile__val {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.ff-tile__val--big { font-size: 19px; }
.ff-pos { color: var(--green-dark); }
.ff-neg { color: var(--red-dark); }
.ff-na  { color: #C7C7CC; }
.ff-tick { display: block; font-size: 10px; color: var(--text-muted); font-weight: 400; margin-top: 1px; }

.ff-side-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 600;
}
.ff-side-chip--buy  { background: var(--green-bg); color: var(--green-dark); }
.ff-side-chip--sell { background: var(--red-bg);   color: var(--red-dark); }

.fin-table.ff-hist .fin-lbl,
.fin-table.ff-rank .fin-lbl { min-width: 200px; white-space: normal; }
.fin-table.ff-rank .fin-lbl a { color: var(--apple-blue); text-decoration: none; }
.fin-table.ff-rank .fin-lbl a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   DROP A FILE HERE
═══════════════════════════════════════════════════════════════════════════ */
.cs-drop-over { position: relative; }
.cs-drop-over::after {
  content: "Drop the file here";
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--apple-blue);
  border-radius: var(--r-md);
  background: rgba(0, 113, 227, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--apple-blue);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  pointer-events: none;
}

/* ── Utilities ────────────────────────────────────────────── */
.d-flex    { display: flex; }
.d-none    { display: none; }
.ai-center { align-items: center; }
.ai-end    { align-items: end; }      /* a row of form fields lines up along its bottom edge: Admin > Filing Status's filter */
.jc-sb     { justify-content: space-between; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.gap-16    { gap: 16px; }
.gap-20    { gap: 20px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }
/* .muted is the shorter name 68 places use; until 30 September 2026 it was grey only inside a
   table (.table .muted), so a note written to be grey anywhere else printed in the ordinary colour. */
.text-muted, .muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8125rem; }
.text-right { text-align: right; }
.mono { font-family: var(--font-mono); }
.w-100 { width: 100%; }
.rounded { border-radius: var(--r-md); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Page Transitions ─────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.24s var(--ease) both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Site Footer ──────────────────────────────────────────── */
.site-footer {
  padding: 16px 28px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  background: var(--surface);
}

.site-footer__sep {
  color: var(--border);
}

/* ── Mobile Navigation Toggle & Drawer ────────────────────── */
.topbar-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
  cursor: pointer;
  margin-right: 8px;
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.topbar-mobile-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}
.topbar-mobile-toggle svg {
  width: 18px;
  height: 18px;
}

.mobile-nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}
.mobile-nav-drawer.is-open {
  display: block;
}
.mobile-nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.18s var(--ease);
}
.mobile-nav-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 82vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 2;
  transform: translateX(-100%);
  transition: transform 0.24s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.mobile-nav-drawer.is-open .mobile-nav-panel {
  transform: translateX(0);
}
.mobile-nav-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mobile-nav-links {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}
.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--t-fast);
}
.mobile-nav-links a svg {
  width: 18px;
  height: 18px;
  opacity: 0.75;
}
.mobile-nav-links a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}
.mobile-nav-links a.active {
  background: var(--apple-blue-subtle);
  color: var(--apple-blue);
  font-weight: 600;
}
.mobile-nav-links a.active svg {
  opacity: 1;
  color: var(--apple-blue);
}
.mobile-nav-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Admin Panel Side Menu (FR 16.22) ─────────────────────── */
/* Drawn by templates/admin-sidebar.php on the Admin panel's pages, which carry
   <body class="has-admin-sidebar">. On a wide screen it stands fixed down the
   left, below the top bar, and scrolls by itself; the page and the footer move
   right by its width. At 1100px and below - where the grids drop to two
   columns - it joins the page above the content and folds into one button
   naming the open screen (csToggleAdminSidebar() adds .is-open). */
.admin-sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 800;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--chrome-dark);
  border-right: 1px solid var(--chrome-dark-raised);
  color: var(--chrome-dark-text);
  scrollbar-width: thin;
  scrollbar-color: var(--chrome-dark-edge) transparent;
}

body.has-admin-sidebar .page-wrapper,
body.has-admin-sidebar .site-footer {
  margin-left: var(--sidebar-w);
}

.admin-sidebar__head {
  display: flex;
  align-items: center;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--chrome-dark-raised);
}

.admin-sidebar__title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--navy-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* The folded menu's button: hidden while the menu stands open down the side. */
.admin-sidebar__toggle {
  display: none;
}

.admin-sidebar__nav {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 14px 12px 16px;
}

.admin-sidebar__hub {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sidebar__hub-title {
  padding: 0 10px 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--chrome-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-sidebar__link {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 0.84375rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--chrome-dark-text);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.admin-sidebar__link:hover {
  background: var(--chrome-dark-raised);
  color: var(--text-inverse);
}
.admin-sidebar__link.active,
.admin-sidebar__link.active:hover {
  background: var(--apple-blue);
  color: var(--text-inverse);
  font-weight: 600;
}

/* Back to the Dashboard: at the foot of the menu, quieter than the screens. */
.admin-sidebar__back {
  display: block;
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--chrome-dark-raised);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--chrome-dark-muted);
  text-decoration: none;
}
.admin-sidebar__back:hover {
  color: var(--text-inverse);
}

.admin-sidebar__link:focus-visible,
.admin-sidebar__back:focus-visible,
.admin-sidebar__toggle:focus-visible {
  outline: 2px solid var(--navy-light);
  outline-offset: -2px;
}

/* A side-menu entry that jumps to a card (Held symbols, Sectors) lands with the
   card's heading clear of the sticky top bar. */
.admin-workbench [id] {
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

@media (max-width: 1100px) {
  .admin-sidebar {
    position: static;
    width: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--chrome-dark-raised);
  }

  body.has-admin-sidebar .page-wrapper,
  body.has-admin-sidebar .site-footer {
    margin-left: 0;
  }

  .admin-sidebar__head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 16px 12px;
    border-bottom: none;
  }

  .admin-sidebar__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--chrome-dark-edge);
    border-radius: var(--r-sm);
    background: var(--chrome-dark-raised);
    color: var(--text-inverse);
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: left;
    transition: background var(--t-fast), border-color var(--t-fast);
  }
  .admin-sidebar__toggle:hover {
    background: var(--chrome-dark-edge);
  }
  /* The chevron: points down while folded, up once open. */
  .admin-sidebar__toggle::after {
    content: "";
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin: -4px 2px 0 0;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--t-fast), margin var(--t-fast);
  }
  .admin-sidebar.is-open .admin-sidebar__toggle::after {
    margin-top: 4px;
    transform: rotate(-135deg);
  }

  /* Folded unless opened; open, the hubs share the width side by side where
     they fit and stack on a phone. */
  .admin-sidebar__nav {
    display: none;
  }
  .admin-sidebar.is-open .admin-sidebar__nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px 20px;
    padding: 6px 16px 16px;
  }
  .admin-sidebar__back {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1320px) {
  .main-content { padding: 18px 16px 40px; }
  .content-area { padding: 14px 16px 40px; }
  .topbar-nav, .topbar__nav  { display: none; }
  .topbar-mobile-toggle      { display: inline-flex; }
  .topbar                    { padding: 0 1rem; }
  .topbar-brand              { margin-right: auto; padding-right: 0.75rem; border-right: none; font-size: 1.05rem; }
}

/* The Admin Panel / Capture button keeps its icon and folds its label away, so
   the top bar never runs wider than a phone; the title still names it. */
@media (max-width: 640px) {
  .topbar-admin__label        { display: none; }
  .topbar-admin               { width: 32px; padding: 0; justify-content: center; }
}

@media (max-width: 520px) {
  .topbar-avatar .avatar-name { display: none; }
  .topbar-avatar              { padding: 2px; border: none; background: transparent; margin-left: 0; }
  .topbar-brand span          { display: none; }
  .topbar-right               { gap: 4px; }
}

/* ── WCAG AA Enforcement ─────────────────────────────────── */
.data-table th,
.data-table thead th,
.table thead th          { font-size: 0.8125rem !important; }

.data-table td,
.data-table tbody td,
.table tbody td          { font-size: 0.90625rem !important; }

.badge                   { font-size: 0.75rem !important; }

.form-input,
.form-control,
select.form-control,
input.form-control,
textarea.form-control    { font-size: 0.9375rem !important; }

.text-muted,
.card__subtitle,
.page-subtitle,
.breadcrumb,
.form-hint,
.site-footer             { color: var(--text-muted) !important; }

.topbar__nav-link,
.topbar-nav a            { font-size: 0.84375rem !important; }

.tab-btn                 { font-size: 0.84375rem !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   WORKED-OUT SHAREHOLDING FIGURES
   Shown under the top-shareholder list when a page printed only part of the
   summary. A calculated figure is deliberately styled differently from a
   printed one — the two must never look the same.
   ═══════════════════════════════════════════════════════════════════════════ */
.sh-derive               { border: 1px solid #d9e4f0; border-radius: 8px;
                           background: #f7fafd; padding: 12px 14px; margin: 0 0 1.25rem; }
.sh-derive__head         { display: flex; align-items: center; gap: 10px;
                           font-size: 12.5px; font-weight: 600; color: #0C447C;
                           margin-bottom: 8px; }
.sh-derive__busy         { font-size: 11px; font-weight: 400; color: #8a94a6; }
.sh-derive__tbl          { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sh-derive__tbl th       { text-align: right; font-size: 10.5px; text-transform: uppercase;
                           letter-spacing: .03em; color: #8a94a6; font-weight: 600;
                           padding: 3px 8px; border-bottom: 1px solid #e5e9f0; }
.sh-derive__tbl th:first-child,
.sh-derive__tbl td:first-child { text-align: left; }
.sh-derive__tbl td       { padding: 4px 8px; text-align: right;
                           font-variant-numeric: tabular-nums;
                           border-bottom: 1px solid #eef2f7; }
.sh-derive__tbl td:first-child { color: #55607a; font-variant-numeric: normal; }
.sh-derive__how,
.sh-derive__tbl td.sh-derive__how { text-align: left; color: #8a94a6; font-size: 11px;
                           font-variant-numeric: normal; }
.sh-derive__page         { color: #1a2b45; font-weight: 600; }
.sh-derive__calc         { color: #0C447C; font-weight: 600; }
.sh-derive__calc::after  { content: " calculated"; font-size: 9.5px; font-weight: 600;
                           letter-spacing: .04em; text-transform: uppercase;
                           color: #6f88a8; margin-left: 5px; }
.sh-derive__record       { color: #6b4c00; font-weight: 600; }
.sh-derive__record::after{ content: " on record"; font-size: 9.5px; font-weight: 600;
                           letter-spacing: .04em; text-transform: uppercase;
                           color: #a08a52; margin-left: 5px; }
.sh-derive__none         { color: #c3cad6; }
.sh-derive__msg          { font-size: 12px; line-height: 1.5; padding: 7px 10px;
                           border-radius: 6px; margin-bottom: 6px;
                           background: #FCF3E3; color: #6b4c00; border: 1px solid #f0e2c8; }
.sh-derive__msg--stop    { background: #FCEBEB; color: #791F1F; border-color: #f0cccc; }
.sh-derive__actions      { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOP-SHAREHOLDER LIST AND ITS COMPARISON
   One copy, shared by Financials and View Company — templates/th-list.php.
   A rise and a fall are told apart by an arrow and a word as well as by
   colour, so the meaning survives being printed, or being read by someone who
   cannot separate red from green.
   ═══════════════════════════════════════════════════════════════════════════ */
.th-cmp-note             { font-size: 12px; color: #77808f; padding: 8px 16px 10px; }
.th-cmp-note strong      { color: #1a2b45; font-weight: 600; }
.fin-table.th-list .th-name  { white-space: normal; min-width: 220px; }
.fin-table.th-list .th-num   { text-align: right; font-variant-numeric: tabular-nums;
                               white-space: nowrap; }
.fin-table.th-list .th-rank  { text-align: center; color: #8a94a6; }
.th-badge                { font-size: 10px; padding: 1px 5px; margin-left: 4px; }
.th-up                   { color: #1a7f4b; font-weight: 600; }
.th-down                 { color: #b91c1c; font-weight: 600; }
.th-flat                 { color: #8a94a6; }
.th-new                  { color: #0071E3; font-weight: 600; }
.th-matched              { display: block; font-size: 11px; color: #8a94a6;
                           margin-top: 2px; font-style: italic; }
.th-link-form            { display: inline; }
.th-link-btn             { background: none; border: none; padding: 0 0 0 4px;
                           font: inherit; font-style: normal; color: #0071E3;
                           cursor: pointer; text-decoration: underline; }
.th-link-btn:hover       { color: #0077ED; }
.th-exited               { padding: 10px 16px; border-top: 1px solid #eef2f7;
                           background: #f7f8fa; font-size: 12px; color: #55607a; }
.th-exited strong        { color: #1a2b45; display: block; margin-bottom: 3px; }
.th-exited .mono         { color: #8a94a6; }

/* A figure CSEye worked out, wherever one is shown beside figures that were
   read off a document. The two must never look the same. */
.fin-calc                { position: relative; }
.fin-calc::after         { content: "calc"; font-size: 9px; font-weight: 600;
                           letter-spacing: .04em; text-transform: uppercase;
                           color: #6f88a8; margin-left: 5px; vertical-align: super; }
.fin-calc-note           { font-size: 11.5px; color: #77808f; padding: 8px 16px;
                           border-top: 1px solid #eef2f7; }

/* S3-GD-01–15: compact collection choices and period-by-period financial review. */
.gd3-page [hidden] { display: none !important; }
.gd3-page h2 { font-size: 16px; margin: 0; }
.gd3-page h3 { font-size: 15px; margin: 0 0 12px; }
.gd3-company-row { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.gd3-company-row .form-group { flex: 1; min-width: 260px; margin: 0; }
.gd3-frequency { display: flex; border: 0; padding: 4px; margin: 0 0 24px; border-radius: 12px; background: #e9e9ef; max-width: 540px; }
.gd3-frequency label { flex: 1; text-align: center; cursor: pointer; padding: 10px 18px; border-radius: 9px; color: #596273; }
.gd3-frequency label:has(input:checked) { background: white; color: #0071e3; box-shadow: 0 1px 4px #00000012; font-weight: 600; }
.gd3-frequency input { margin-right: 6px; accent-color: #0071e3; }
.gd3-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.gd3-choice { background: #fafafd; border: 1px solid #e0e3e9; border-radius: 12px; padding: 16px; }
.gd3-choice h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.gd3-choice p { margin: 10px 0; }
.gd3-choice-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gd3-choice-title button { font-size: 11px; margin-left: 8px; }
.gd3-option { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 39px; padding: 8px 10px; border: 1px solid #e2e5eb; border-radius: 8px; margin-top: 7px; cursor: pointer; font-size: 13px; background: white; }
.gd3-option:has(input:checked) { border-color: #0071e3; color: #006bd6; background: #f5faff; }
.gd3-option input { accent-color: #0071e3; }
.gd3-quarter-date { font-size: 11px; white-space: nowrap; }
.gd3-target { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid #e2e5eb; padding-top: 18px; margin-top: 20px; }
.gd3-target > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.gd3-target .btn { flex-shrink: 0; }
.gd3-eyebrow { padding: 5px 8px; background: #edf5ff; color: #0071e3; border-radius: 4px; text-transform: uppercase; font-size: 10px; letter-spacing: .04em; font-weight: 700; }
.gd3-progress-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gd3-tabs { display: flex; gap: 4px; border-bottom: 1px solid #dfe4ec; overflow-x: auto; margin: 20px 0; }
.gd3-tabs a { padding: 12px 16px; white-space: nowrap; color: #586273; text-decoration: none; border-bottom: 2px solid transparent; }
.gd3-tabs a.is-active { color: #0071e3; border-bottom-color: #0071e3; font-weight: 600; background: #f6faff; }
.gd3-matrix .fin-table { width: 100%; }
.gd3-matrix .fin-table th:not(:first-child), .gd3-matrix .fin-table td:not(:first-child) { min-width: 195px; }
.gd3-matrix .fin-note { white-space: normal; max-width: 260px; }
.gd3-status { display: block; font-weight: 600; color: #0066bf; font-size: 12px; margin: 7px 0; }
.gd3-edit-input { min-width: 110px; max-width: 240px; text-align: right; margin-left: auto; }
.gd3-edit-input[aria-invalid=true] { border-color: #b84831; }
.gd3-field-error { display: block; color: #a13b27; font-size: 11px; white-space: normal; max-width: 320px; margin-top: 5px; }
.gd3-column-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.gd3-period-actions { flex: 1; min-width: 220px; border: 1px solid #e0e5ed; border-radius: 10px; padding: 16px; }
.gd3-period-actions .alert { font-size: 12px; }
.gd3-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.gd3-buttons .btn { font-size: 12px; padding: 8px 12px; }
.gd3-replace { display: block; font-size: 12px; margin: 12px 0; }
.gd3-details { margin-top: 14px; font-size: 12px; }
.gd3-details summary { color: #0071e3; cursor: pointer; }
.gd3-details p { overflow-wrap: anywhere; }
.gd3-bulk-form { border-top: 1px solid #e0e5ed; margin-top: 20px; padding-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gd3-holder { display: grid; gap: 5px; text-align: left; white-space: normal; }
.gd3-holder small { color: #758195; }
.gd3-holder input { text-align: left; margin: 0; }
@media (max-width: 700px) {
  .gd3-target { align-items: stretch; flex-direction: column; }
  .gd3-company-row .form-group { min-width: 100%; }
  .gd3-choice-grid { grid-template-columns: 1fr; }
  .gd3-frequency { max-width: none; }
}
.gd3-page .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.gd3-edit-extra { display: block; font-size: 12px; margin: 10px 0; }
.gd3-edit-extra .form-input { max-width: 100%; text-align: left; margin: 5px 0 12px; }

/* ───────────────────────────────────────────────────────────────────────────
   Shareholding tab (FR 4.37–4.40)
   Added 25 September 2026, bringing version 1's Top Shareholders screen across:
   the period picker, the Others and Total rows, percentage points, the
   "no longer in the list" panel and the quarter-by-quarter summary.
   ─────────────────────────────────────────────────────────────────────────── */

/* Screen-reader-only label, used by the period picker. The Get Data page has
   its own copy scoped to .gd3-page; this one is general. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.sh-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sh-picker     { margin: 0; }
.sh-picker select { min-width: 210px; }

/* One holder's movement, in version 1's words: an arrow, the change in shares,
   and the change in percentage POINTS. Points are not percent and never carry
   a % sign. */
.sh-up   { color: var(--green-dark); }
.sh-down { color: var(--red-dark); }
.sh-new  { color: var(--apple-blue); }

/* "shown as X before". Quiet, under the name, never louder than the name. */
.sh-alias {
  display: block;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 3px;
}
.sh-alias--maybe { font-style: normal; }

.sh-edit {
  font-style: normal;
  text-decoration: none;
  margin-left: 6px;
  opacity: 0.55;
}
.sh-edit:hover { opacity: 1; }

/* Others and Total, ruled off from the holders above them the way the printed
   report rules them off. */
.sh-total-row td        { border-top: 1px solid var(--border); background: var(--surface-subtle); }
.sh-total-row--last td  { border-top: 2px solid var(--border); border-bottom: 2px solid var(--border); }

/* "No longer in the list". The owner asked for a LARGER font and MORE space
   between the lines than version 1 had, so each departed holder is a block of
   its own rather than a cramped bullet. */
.sh-exited { list-style: none; margin: 0; padding: 0; }
.sh-exited li {
  font-size: 0.95rem;
  line-height: 1.65;
  padding: 10px 0 10px 18px;
  position: relative;
  border-bottom: 1px solid var(--border-light);
}
.sh-exited li:last-child { border-bottom: 0; }
.sh-exited li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}
.sh-exited__name  { font-weight: 500; }
.sh-exited__held  { color: var(--text-muted); margin-left: 6px; }

/* The quarter-by-quarter summary: the first column names the row and stays put
   while the quarters scroll sideways. */
.sh-history th:first-child,
.sh-history td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.sh-history th .muted      { font-weight: 400; font-size: 0.72rem; }

@media (max-width: 767px) {
  .sh-head-right    { width: 100%; }
  .sh-picker select { min-width: 0; width: 100%; }
}

/* ── AI Capture: paste, drop or choose a document ──────────────────────────
   Used by any capture panel marked data-ai-drop (web/assets/js/ai-capture-drop.js).
   Added 25 September 2026 with the owner's requirement that every capture place
   offer the same three ways in. */
.ai-drop {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--surface-subtle);
  padding: 14px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.ai-drop--hot {
  border-style: solid;
  border-color: var(--apple-blue);
  background: var(--navy-ghost);
}
.ai-drop__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.ai-drop__keys {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ai-drop__got {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 11px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.ai-drop__got--ok   { background: var(--green-bg); color: var(--green-dark); }
.ai-drop__got--warn { background: var(--amber-bg); color: var(--amber-dark); }
.ai-drop__thumb {
  width: 54px;
  height: 54px;
  flex: none;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.ai-drop__thumb--doc {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
}
.ai-drop__what { display: block; }
.ai-drop__meta {
  display: block;
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .ai-drop__got { flex-direction: column; }
}

/* ── "Test this model" on Admin > AI Config ────────────────────────────────
   Added 25 September 2026 with the owner's request for a way to find out
   whether the chosen model actually works before relying on it. */
.ai-test-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ── Clicking a sector to see its companies (Admin > Companies) ────────────
   Added 25 September 2026. Version 2 counted the companies in each sector and
   gave no way to see them; version 1 had a sector filter and this restores it. */
.sector-pick {
  display: inline-block;
  padding: 2px 8px;
  margin: -2px -8px;
  border-radius: var(--r-full);
  color: inherit;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.sector-pick:hover,
.sector-pick:focus-visible {
  background: var(--blue-subtle);
  color: var(--apple-blue);
}
.table tr.is-chosen {
  background: var(--blue-subtle);
  box-shadow: inset 3px 0 0 var(--apple-blue);
}
.table tr.is-chosen .sector-pick {
  color: var(--apple-blue);
  font-weight: 600;
}

/* ── Capturing a day's foreign flows: the columns need room ────────────────
   Added 26 September 2026. Every box took its share of the table, so the
   Buying/Selling menu collapsed to a bare arrow and 6,200,000 was clipped to
   "6,200" — the day had been read correctly and could not be seen. */
.ff-capture { table-layout: fixed; min-width: 1010px; }
.ff-capture th:nth-child(1), .ff-capture td:nth-child(1) { width: 146px; }  /* symbol: COMB.X0000 in full */
.ff-capture th:nth-child(2), .ff-capture td:nth-child(2) { width: 128px; }  /* buying or selling */
.ff-capture th:nth-child(3), .ff-capture td:nth-child(3) { width: 168px; }  /* net (LKR): room for a billion-rupee day, 1,234,567,890 */
.ff-capture th:nth-child(4), .ff-capture td:nth-child(4) { width: 112px; }  /* close: 1,234.50 */
.ff-capture th:nth-child(5), .ff-capture td:nth-child(5) { width: 96px; }   /* foreign % */
.ff-capture th:nth-child(7), .ff-capture td:nth-child(7) { width: 40px; }   /* the row's own button */
.ff-capture td { padding: 5px 6px; }
.ff-capture .form-input { padding: 7px 9px; }

/* The sheet prints net buying and net selling as two tables; the menu says
   which, in the sheet's own colours, so twenty rows can be checked at a
   glance instead of read one at a time. */
.ff-side { font-weight: 600; }
.ff-side--buy  { color: var(--green-dark); }
.ff-side--sell { color: var(--red-dark); }

/* Task-first screens: FR 6.8, 7.1, 8.1, 16.1-16.10, 16.18.
   Keep full evidence available without making every row an essay. */
.ui-details > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--text-primary); }
.ui-details > summary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.ui-details[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.ui-details--inline > summary { padding: 4px 0; font-size: .8125rem; color: var(--apple-blue); }
.ui-details--inline[open] { min-width: 12rem; max-width: 36rem; white-space: normal; overflow-wrap: anywhere; }
.ui-details p + p, .alert > div + div { margin-top: 8px; }
.ui-table-scroll { max-height: 32rem; overflow: auto; }
.ui-table--compact th, .ui-table--compact td { vertical-align: top; }
.ui-table--compact th:first-child, .ui-table--compact td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.ui-table--compact thead th { position: sticky; top: 0; background: var(--surface-subtle); z-index: 2; }
.ui-table--compact thead th:first-child { z-index: 3; }
.ui-table--compact td { max-width: 24rem; }
/* Long statement labels and missing-value reasons must not size whole columns. */
.fin-table .fin-lbl, .fin-table thead th.fin-lbl, .fin-table tbody td.fin-lbl {
  width: 230px; min-width: 230px; max-width: 230px; white-space: normal; overflow-wrap: anywhere;
}
.fin-row--growth_text td:not(.fin-lbl), .fin-row--text td:not(.fin-lbl) { white-space: normal; max-width: 190px; overflow-wrap: anywhere; }
.fin-date, .fin-note { font-size: 12px; }
.fin-table .fin-na { color: var(--text-muted); }
@media (max-width: 600px) {
  .fin-table .fin-lbl, .fin-table thead th.fin-lbl, .fin-table tbody td.fin-lbl {
    width: 132px; min-width: 132px; max-width: 132px; padding: 10px 8px;
  }
  .fin-table th, .fin-table td { padding-left: 8px; padding-right: 8px; }
  .card__header { flex-wrap: wrap; gap: 10px; }
  .card__body > form.d-flex, .page-actions { flex-wrap: wrap; }
  .card__header > *, .page-header > * { min-width: 0; }
  .ui-table--compact th:first-child, .ui-table--compact td:first-child { max-width: 120px; min-width: 95px; overflow-wrap: anywhere; }
  .ui-details--inline[open] { min-width: 10rem; }
}
.ui-reason-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; max-width: 24rem; }

/* ── GROWTH BARS: the Snapshot's "C" and "A" charts (templates/growth-bars.php, FR 7.23) ──
   Drawn on the server as a 100 x 100 SVG stretched to the card's width, so every line keeps
   one pixel whatever the stretch (vector-effect). A bar is a period's earnings per share and
   its colour is its growth on a year earlier: green at or above the mark, grey under it, red
   for a fall or a loss, pale where there is nothing a year earlier to compare with. */
.growth-bars { margin: 0; padding: 12px 12px 8px; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--r-md); }
.growth-bars__plot { display: block; width: 100%; height: 112px; overflow: visible; }
.growth-bars__bar { fill: var(--text-muted); fill-opacity: .45; }
.growth-bars__bar--met { fill: var(--green); fill-opacity: 1; }
.growth-bars__bar--negative { fill: var(--red); fill-opacity: 1; }
.growth-bars__bar--none { fill: var(--text-muted); fill-opacity: .18; }
.growth-bars__zero { stroke: var(--text-muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.growth-bars__bench { stroke: var(--apple-blue); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.growth-bars__labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin-top: 6px; }
.growth-bars__label { text-align: center; font-family: var(--font-mono); font-size: 0.6875rem; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.growth-bars__period { display: block; }
.growth-bars__figure { display: block; color: var(--text-secondary); }
.growth-bars__value { display: block; font-weight: 600; color: var(--text-secondary); }
.growth-bars__value.val-pos { color: var(--green-dark); }
.growth-bars__value.val-neg { color: var(--red-dark); }
.growth-bars__legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 0.75rem; color: var(--text-muted); }
.growth-bars__key { display: inline-flex; align-items: center; gap: 5px; }
.growth-bars__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--text-muted); opacity: .45; }
.growth-bars__swatch--met { background: var(--green); opacity: 1; }
.growth-bars__swatch--negative { background: var(--red); opacity: 1; }
.growth-bars__swatch--none { opacity: .18; }
.growth-bars__swatch--bench { width: 16px; height: 0; border-top: 1px dashed var(--apple-blue); background: none; border-radius: 0; opacity: 1; }
.growth-bars__empty { padding: 28px 8px; text-align: center; font-size: 0.8125rem; color: var(--text-muted); }
.growth-headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; }
.growth-headline .metric-tile__value { font-size: 1.5rem; }

/* ── SNAPSHOT: the minimal pieces (pages/company.php, FR 7.18-7.25) ────────────
   A GAP is a figure the Snapshot cannot give: a small pill ("No data", "n/a", "n/m")
   that opens, in place, to the reason - one click away rather than a paragraph on
   the page (FR 7.10-7.12, 8.9). It opens in the flow, not as a floating box, so a
   table's scrolling edge can never cut it off. */
.gap { display: inline-block; vertical-align: middle; max-width: 100%; margin-left: 4px; }
.gap:first-child { margin-left: 0; }
.gap > summary { list-style: none; cursor: pointer; user-select: none; font-family: var(--font-body); } /* one look in every cell, the figure columns' typewriter face included - as its reason already has */
.gap > summary::-webkit-details-marker { display: none; }
.gap > summary::after { content: "▾"; margin-left: 4px; font-size: 0.625rem; }
.gap[open] > summary::after { content: "▴"; }
.gap__why { margin-top: 6px; max-width: 20rem; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); font-family: var(--font-body); font-size: 0.75rem; font-weight: 400; line-height: 1.45; color: var(--text-secondary); white-space: normal; text-align: left; }
.text-right .gap__why { margin-left: auto; }
.snapshot-link { font-size: 0.8125rem; font-weight: 600; color: var(--apple-blue); text-decoration: none; white-space: nowrap; }
.snapshot-link:hover { text-decoration: underline; }
.snapshot-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; font-size: 0.8125rem; color: var(--text-muted); }
.snapshot-pair { gap: 12px; }
.snapshot-pair .metric-tile { padding: 10px 12px; }
.snapshot-list__row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 0.8125rem; }
.snapshot-list__row:last-child { border-bottom: 0; }
.snapshot-list__name { flex: 1 1 auto; font-weight: 500; color: var(--text-primary); }
.snapshot-list__period { flex: 0 1 auto; font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.snapshot-list__row > .badge { min-width: 5.25rem; justify-content: center; } /* one width for Current and Outdated, so the periods line up */
.snapshot-box { padding: 10px 12px; border: 1px solid var(--border-light); border-radius: var(--r-sm); background: var(--surface-2); }
.snapshot-box--blue { background: var(--apple-blue-subtle); border-color: var(--apple-blue-border); }
.snapshot-box__title { margin-bottom: 2px; font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.snapshot-box--blue .snapshot-box__title { color: var(--apple-blue); }
.snapshot-box__value { font-size: 0.9375rem; font-weight: 700; color: var(--text-primary); }
.snapshot-box__meta { margin-top: 2px; font-size: 0.75rem; color: var(--text-muted); }
.metric-tile__value--blue { color: var(--apple-blue); }

/* ── VALUATION TAB (pages/company/tab_valuation.php, templates/valuation-trend.php; FR 7.26-7.34) ──
   Added 7 October 2026 (P-V3). Where a share stands against its sector and the reference scale:
   two cards of two halves each, two price ladders with a spectrum beneath, and the reference
   matrix. The spectrum is server-drawn SVG with classes only, as the growth bars are; positions
   are SVG attributes, never a style. Its eight tints run from green at the lowest multiples to red
   at the highest - a picture of the scale, not a verdict. (9 October 2026, P4: the year-end
   history chart, its rank bar, its figure tiles and counts were removed with the history.
   10 October 2026, P-H3: they are back, word for word, for CSEye's OWN five-year history.) */
.valuation-id { margin-top: 14px; font-size: 0.8125rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.valuation-id + .valuation-id { margin-top: 4px; }
.valuation-pair { display: flex; flex-direction: column; gap: 12px; }
.valuation-pair__item { min-width: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--r-md); }
.valuation-pair__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 4px; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }
.valuation-pair__head .text-muted { font-size: 0.75rem; font-weight: 400; }
.valuation-pair__figure { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 600; line-height: 1.25; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.valuation-pair__rank { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.valuation-pair__line { margin-top: 4px; font-size: 0.8125rem; color: var(--text-muted); }
.valuation-pair__sentence { margin-top: 6px; font-size: 0.8125rem; line-height: 1.45; color: var(--text-secondary); }
.valuation-rank { display: block; width: 100%; height: 8px; margin-top: 6px; border-radius: var(--r-full); overflow: hidden; }
.valuation-rank__track { fill: var(--border); }
.valuation-rank__fill { fill: var(--apple-blue); fill-opacity: 0.55; }
.valuation-rank__mark { stroke: var(--apple-blue); stroke-width: 2; vector-effect: non-scaling-stroke; }
.valuation-ladder__basis { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 0.8125rem; }
.valuation-ladder__notes { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8125rem; color: var(--text-muted); }
/* The two price ladders sit side by side where both tables fit, one above the other where they would not. */
.valuation-ladders { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1439px) { .valuation-ladders { grid-template-columns: minmax(0, 1fr); } }
/* The tab's four tables: a little tighter than a list, so a ladder fits beside its twin. A figure keeps
   one line; a band's label keeps one line wherever there is room for it, and wraps on a phone. */
.table.valuation-table thead th, .table.valuation-table tbody td { padding: 10px 6px; }
.table.valuation-table tbody td { font-size: 0.8125rem; }
.valuation-nowrap { white-space: nowrap; }
@media (min-width: 601px) { .valuation-band { white-space: nowrap; } }
.table tbody tr.valuation-ladder__row--current > td { background: var(--apple-blue-subtle); font-weight: 600; }
.table tbody tr.valuation-ladder__row--current > td:first-child { box-shadow: inset 3px 0 0 var(--apple-blue); }
.valuation-spectrum { margin-top: 16px; }
.valuation-spectrum__caption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }
.valuation-spectrum__bar { display: block; width: 100%; height: 26px; border-radius: var(--r-sm); overflow: hidden; }
.valuation-spectrum__seg { stroke: var(--surface); stroke-width: 1; vector-effect: non-scaling-stroke; }
.valuation-spectrum__seg--t0 { fill: var(--green); fill-opacity: 0.6; }
.valuation-spectrum__seg--t1 { fill: var(--green); fill-opacity: 0.42; }
.valuation-spectrum__seg--t2 { fill: var(--green); fill-opacity: 0.26; }
.valuation-spectrum__seg--t3 { fill: var(--amber); fill-opacity: 0.2; }
.valuation-spectrum__seg--t4 { fill: var(--amber); fill-opacity: 0.34; }
.valuation-spectrum__seg--t5 { fill: var(--amber); fill-opacity: 0.5; }
.valuation-spectrum__seg--t6 { fill: var(--red); fill-opacity: 0.36; }
.valuation-spectrum__seg--t7 { fill: var(--red); fill-opacity: 0.55; }
.valuation-spectrum__marker { stroke: var(--text-primary); stroke-width: 3; vector-effect: non-scaling-stroke; }
.valuation-spectrum__edges { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 4px; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-muted); }
.valuation-spectrum__edge { text-align: right; white-space: nowrap; transform: translateX(50%); }
.valuation-trend { margin: 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--r-md); }
.valuation-trend__scroll { overflow-x: auto; }
.valuation-trend__svg { display: block; width: 100%; min-width: 760px; height: auto; }
.valuation-trend__grid { stroke: var(--border); stroke-width: 1; stroke-opacity: 0.7; }
.valuation-trend__axis { stroke: var(--text-tertiary); stroke-width: 1.25; }
.valuation-trend__tick { font-family: var(--font-mono); font-size: 12px; }
.valuation-trend__tick--pe { fill: var(--apple-blue); }
.valuation-trend__tick--pb { fill: var(--green-dark); }
.valuation-trend__median { stroke-width: 1.25; stroke-dasharray: 5 4; stroke-opacity: 0.6; }
.valuation-trend__median--pe { stroke: var(--apple-blue); }
.valuation-trend__median--pb { stroke: var(--green-dark); }
.valuation-trend__line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.valuation-trend__line--pe { stroke: var(--apple-blue); }
.valuation-trend__line--pb { stroke: var(--green-dark); }
.valuation-trend__dot { fill: var(--surface); stroke-width: 2; }
.valuation-trend__dot--pe { stroke: var(--apple-blue); }
.valuation-trend__dot--pb { stroke: var(--green-dark); }
.valuation-trend__value { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.valuation-trend__value--pe { fill: var(--text-primary); }
.valuation-trend__value--pb { fill: var(--green-dark); }
.valuation-trend__gap { font-size: 12px; font-weight: 600; fill: var(--red-dark); }
.valuation-trend__year { font-size: 13px; font-weight: 500; fill: var(--text-muted); }
.valuation-trend__legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 8px; font-size: 0.75rem; color: var(--text-muted); }
.valuation-trend__key { display: inline-flex; align-items: center; gap: 6px; }
.valuation-trend__swatch { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.valuation-trend__swatch--pe { background: var(--apple-blue); }
.valuation-trend__swatch--pb { background: var(--green-dark); }
.valuation-trend__swatch--median-pe { height: 0; border-top: 2px dashed var(--apple-blue); border-radius: 0; }
.valuation-trend__swatch--median-pb { height: 0; border-top: 2px dashed var(--green-dark); border-radius: 0; }
.valuation-stat { padding: 10px 12px; }
.valuation-stat--median { background: var(--apple-blue-subtle); border-color: var(--apple-blue-border); }
.valuation-stat__value { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600; line-height: 1.45; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.valuation-counts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 0.8125rem; color: var(--text-muted); }
.valuation-matrix__group { display: block; margin-top: 2px; font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
/* ── SECTOR CHOOSER (Market Data › Sector Valuation: templates/sector-comparator.php; FR 7.35-7.39) ──
   Added 7 October 2026 (P-S2) with the plane-and-table tab. That tab's plane, table, "Not on the
   plane" list and median cards were removed on 9 October 2026 (P3), when the Sector Comparator
   below became the tab; only the sector chooser's three rules are still used, by the comparator. */
.sector-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; max-width: 520px; }
.sector-picker .form-label { margin-bottom: 0; }
.sector-picker .form-input { flex: 1 1 240px; width: auto; min-width: 0; }
/* ── SECTOR COMPARATOR (Market Data › Sector Valuation: templates/sector-comparator.php,
   templates/sector-comparator/charts.php, assets/js/sector-comparator.js; FR 7.35-7.39) ──
   Added 9 October 2026 (UI-T1) as a test UI; the tab itself the same day (P3). The owner's design (docs/tasks/CSEye_Sector_Comparator_Design.html)
   drawn in CSEye's light theme: its layout, panels, cards, charts and interactions, in this sheet's
   own tokens - green for better than the median, amber for slightly worse, red for worse, blue and
   indigo for reference lines. The pictures are server-drawn SVG with classes only; positions are
   SVG attributes, never a style. Every class starts scmp-, so nothing else on the site changes.
   The inner views reuse .tabs/.tab-btn, the panels .card, the tables .table and .table-wrap, and the
   Signal tag .badge. A chart keeps 640px and scrolls inside its card on a phone, as the year-end
   chart does, so its labels stay legible. */
.scmp { min-width: 0; }
.scmp-head { flex-wrap: wrap; align-items: flex-start; }
.scmp-head__title { font-size: 1.0625rem; }
.scmp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.scmp-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface-2); font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.scmp-pill strong { font-weight: 600; color: var(--text-primary); }
.scmp-pill--live strong { color: var(--green-dark); }
.scmp-pill__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: scmp-pulse 2s infinite; }
@keyframes scmp-pulse { 0% { box-shadow: 0 0 0 0 var(--green); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .scmp-pill__dot { animation: none; } }

/* The five summary cards, each with its coloured edge */
.scmp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.scmp-kpi { position: relative; overflow: hidden; padding: 14px 16px 14px 19px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.scmp-kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--apple-blue); }
.scmp-kpi--blue::after { background: var(--apple-blue); }
.scmp-kpi--green::after { background: var(--green); }
.scmp-kpi--indigo::after { background: var(--indigo); }
.scmp-kpi--amber::after { background: var(--amber); }
.scmp-kpi--red::after { background: var(--red); }
.scmp-kpi__label { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.scmp-kpi__value { margin: 5px 0 2px; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.scmp-kpi__note { font-size: 0.75rem; color: var(--text-muted); }
.scmp-kpi__note strong { font-weight: 600; color: var(--text-primary); }
.scmp-kpi__note strong.scmp-good { color: var(--green-dark); }
.scmp-kpi__note strong.scmp-bad { color: var(--red-dark); }

/* Tones: better than the median, near it, worse */
.scmp-good { color: var(--green-dark); }
.scmp-bad { color: var(--red-dark); }
.scmp-near { color: var(--text-muted); }
.scmp-strong { font-weight: 700; }

/* Controls: search, sort, filter chips */
.scmp-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.scmp-controls--tight { margin-bottom: 0; }
.scmp-controls--presets { margin-top: 16px; }
.scmp-search { flex: 1 1 220px; width: auto; min-width: 0; max-width: 320px; }
.scmp-select { width: auto; max-width: 100%; }
.scmp-chip { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface); font-family: var(--font-body); font-size: 0.75rem; color: var(--text-secondary); cursor: pointer; transition: all var(--t-fast); }
.scmp-chip:hover { color: var(--text-primary); border-color: var(--text-tertiary); }
.scmp-chip.is-on { background: var(--green-bg); border-color: var(--green); color: var(--green-dark); font-weight: 600; }
.scmp-chip:focus-visible, .scmp-sort:focus-visible, .scmp-row:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* The comparison table and the scorecard */
.table.scmp-table { min-width: 940px; }
.table.scmp-table--history { min-width: 820px; }
.table.scmp-table thead th { white-space: nowrap; }
.scmp-sort { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.scmp-sort:hover { color: var(--text-primary); }
.scmp-arw { font-size: 0.5625rem; opacity: 0.3; }
.table thead th.is-sorted { color: var(--text-primary); }
.table thead th.is-sorted .scmp-arw { opacity: 1; color: var(--green-dark); }
.table.scmp-table tbody td { white-space: nowrap; }
.table tbody tr.scmp-row { cursor: pointer; }
.table tbody tr.scmp-row.is-open > td { background: var(--apple-blue-subtle); }
.scmp-caret { display: inline-block; width: 9px; margin-right: 6px; font-size: 0.5625rem; color: var(--text-tertiary); transition: transform var(--t-fast); }
.scmp-row.is-open .scmp-caret { transform: rotate(90deg); color: var(--green-dark); }
.scmp-name { font-weight: 600; color: var(--text-primary); }
.scmp-name--block { display: block; }
.scmp-ticker { display: block; margin-left: 15px; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-tertiary); }
.scmp-name--block + .scmp-ticker { margin-left: 0; }
.scmp-score { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; }
.scmp-score__n { width: 22px; font-size: 0.75rem; color: var(--text-muted); text-align: right; }

/* A thin bar (Value Score, detail tracks, market bands): server-drawn SVG */
.scmp-bar { display: block; overflow: hidden; }
.scmp-bar--score { width: 52px; height: 5px; border-radius: 3px; }
.scmp-bar--track { width: 100%; height: 7px; border-radius: 4px; }
.scmp-bar--band { width: 100%; height: 100%; }
.scmp-bar__track { fill: var(--surface-subtle); }
.scmp-bar--band .scmp-bar__track { fill: transparent; }
.scmp-fill--high, .scmp-fill--good, .scmp-fill--green { fill: var(--green); }
.scmp-fill--mid, .scmp-fill--caution { fill: var(--amber); }
.scmp-fill--low, .scmp-fill--red { fill: var(--red); }
.scmp-fill--blue { fill: var(--apple-blue); }
.scmp-fill--indigo { fill: var(--indigo); }
.scmp-fill--avg { fill: var(--text-tertiary); fill-opacity: 0.6; }

/* An opened row's four cards */
.table tbody tr.scmp-det > td { padding: 0; white-space: normal; background: var(--surface-2); }
.table tbody tr.scmp-det:hover > td { background: var(--surface-2); }
.scmp-det__in { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; padding: 16px 18px 18px; }
.scmp-det__card { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.scmp-det__title { margin-bottom: 9px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.scmp-cmp { margin-bottom: 9px; }
.scmp-cmp__row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; font-size: 0.75rem; }
.scmp-cmp__row > span:first-child { color: var(--text-muted); }
.scmp-cmp__row > span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.scmp-kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--border); font-size: 0.75rem; }
.scmp-kv:last-child { border-bottom: 0; }
.scmp-kv--first { margin-top: 8px; }
.scmp-kv > span:first-child { color: var(--text-muted); }
.scmp-kv > span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.scmp-verdict { font-size: 0.75rem; line-height: 1.55; color: var(--text-muted); }
.scmp-verdict strong { color: var(--text-primary); }
.scmp-empty { padding: 44px 20px; text-align: center; font-size: 0.8125rem; color: var(--text-tertiary); }

/* Legends */
.scmp-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 0.75rem; color: var(--text-muted); }
.scmp-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.scmp-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.scmp-swatch--green { background: var(--green); }
.scmp-swatch--amber { background: var(--amber); }
.scmp-swatch--red { background: var(--red); }
.scmp-swatch--blue { background: var(--apple-blue); }

/* Charts: server-drawn SVG; a chart keeps 640px and scrolls inside its card on a phone */
.scmp-chart { overflow-x: auto; }
.scmp-svg { display: block; width: 100%; min-width: 640px; height: auto; overflow: visible; }
.scmp-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .scmp-chart-grid { grid-template-columns: minmax(0, 1fr); } }
.scmp-grid { stroke: var(--border-light); stroke-width: 1; }
.scmp-axis { stroke: var(--border); stroke-width: 1; }
.scmp-tick { font-family: var(--font-body); font-size: 10.5px; fill: var(--text-tertiary); }
.scmp-axis-title { font-family: var(--font-body); font-size: 10.5px; fill: var(--text-muted); }
.scmp-pt-label { font-family: var(--font-body); font-size: 10px; font-weight: 600; fill: var(--text-primary); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.scmp-pt { cursor: pointer; }
.scmp-ref { stroke-width: 1.2; stroke-dasharray: 4 4; }
.scmp-ref--green { stroke: var(--green-dark); }
.scmp-ref--indigo { stroke: var(--indigo); }
.scmp-ref--amber { stroke: var(--amber-dark); }
.scmp-ref--blue { stroke: var(--apple-blue); }
.scmp-ref-text--green { fill: var(--green-dark); }
.scmp-ref-text--indigo { fill: var(--indigo); }
.scmp-ref-text--amber { fill: var(--amber-dark); }
.scmp-ref-text--blue { fill: var(--apple-blue); }
.scmp-bubble { fill-opacity: 0.18; stroke-width: 1.8; }
.scmp-bubble--high { fill: var(--green); stroke: var(--green); }
.scmp-bubble--mid { fill: var(--amber); stroke: var(--amber); }
.scmp-bubble--low { fill: var(--red); stroke: var(--red); }
.scmp-dot--high, .scmp-pin--high { fill: var(--green); }
.scmp-dot--mid, .scmp-pin--mid { fill: var(--amber); }
.scmp-dot--low, .scmp-pin--low { fill: var(--red); }
.scmp-pin { fill-opacity: 0.9; stroke: var(--surface); stroke-width: 1.5; }
.scmp-stem { stroke-width: 1; stroke-opacity: 0.4; }
.scmp-stem--high { stroke: var(--green); }
.scmp-stem--mid { stroke: var(--amber); }
.scmp-stem--low { stroke: var(--red); }
.scmp-pt:hover .scmp-bubble { fill-opacity: 0.32; }
.scmp-hname { font-family: var(--font-body); font-size: 10.5px; font-weight: 600; fill: var(--text-primary); }
.scmp-hbar--avg { fill: var(--text-tertiary); fill-opacity: 0.55; }
.scmp-hbar--below { fill: var(--green); }
.scmp-hbar--above { fill: var(--red); }
.scmp-hval--avg { fill: var(--text-muted); }
.scmp-hval--below { fill: var(--green-dark); font-weight: 600; }
.scmp-hval--above { fill: var(--red-dark); font-weight: 600; }
/* A history bar beyond its chart's end (P-R2, 10 October 2026): a break mark across the cut end, and
   the full figure written over the bar with a halo in the card's colour so it reads on any fill. */
.scmp-hbreak { stroke: var(--surface); stroke-width: 2; }
.scmp-hval--off { font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
/* The 5-Year History's P/E · P/B · ROE switch: the inner tabs' own look, a little closer to its chart. */
.scmp-tabs--sub { margin-bottom: 12px; }

/* The market bands */
.scmp-band { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.scmp-band__name { flex: none; width: 110px; font-size: 0.75rem; color: var(--text-muted); }
.scmp-band__track { flex: 1 1 auto; min-width: 0; height: 24px; overflow: hidden; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 6px; }
.scmp-band__pct { flex: none; width: 52px; text-align: right; font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.scmp-band__count { margin: -6px 0 12px 122px; font-size: 0.6875rem; color: var(--text-tertiary); }
.scmp-band__count span { color: var(--text-muted); }
@media (max-width: 480px) {
  .scmp-band__name { width: 84px; }
  .scmp-band__count { margin-left: 96px; }
}

/* The tooltip over a map or strip point (placed by the page script) */
.scmp-tip { position: fixed; left: 0; top: 0; z-index: 99; max-width: 240px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-size: 0.75rem; line-height: 1.6; color: var(--text-primary); opacity: 0; pointer-events: none; transition: opacity var(--t-fast); }
.scmp-tip.is-on { opacity: 1; }
.scmp-tip__head { margin-bottom: 4px; font-size: 0.8125rem; font-weight: 600; }
.scmp-tip__row { display: flex; justify-content: space-between; gap: 14px; }
.scmp-tip__row > span:first-child { color: var(--text-muted); }
.scmp-tip__row > span:last-child { font-variant-numeric: tabular-nums; }

/* The Screener */
.scmp-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; margin-bottom: 8px; }
.scmp-slider label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; font-size: 0.75rem; color: var(--text-muted); }
.scmp-slider label strong { font-size: 0.8125rem; color: var(--text-primary); }
.scmp-slider input[type=range] { width: 100%; accent-color: var(--green-dark); cursor: pointer; }
.scmp-match { margin: 4px 0 14px; font-size: 0.8125rem; color: var(--text-muted); }
.scmp-match strong { font-size: 0.875rem; color: var(--green-dark); }
.scmp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.scmp-cards__none { grid-column: 1 / -1; }
.scmp-card { padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); transition: transform var(--t-fast), border-color var(--t-fast); }
.scmp-card:hover { border-color: var(--apple-blue-border); transform: translateY(-2px); }
.scmp-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.scmp-card__top strong { font-size: 0.8125rem; font-weight: 600; }
.scmp-card__top span { font-size: 0.6875rem; color: var(--text-tertiary); }
.scmp-card__line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.scmp-card__price { font-size: 0.9375rem; font-weight: 700; }
.scmp-card__score { font-size: 0.75rem; font-weight: 700; }
.scmp-score-text--high { color: var(--green-dark); }
.scmp-score-text--mid { color: var(--amber-dark); }
.scmp-score-text--low { color: var(--red-dark); }
.scmp-card__metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); text-align: center; }
.scmp-card__k { font-size: 0.625rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.scmp-card__v { margin-top: 2px; font-size: 0.8125rem; font-weight: 600; }
/* P-E3 (11 October 2026): each of the three figure cells keeps its own third - min-width 0 - and a
   label ("NM", "No data", "Not available") shrinks or wraps inside it, centred, never running over
   the next figure; an "est." badge sits beside its figure or wraps beneath it. */
.scmp-card__metrics > div { min-width: 0; }
.scmp-card__v { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 4px; min-width: 0; overflow-wrap: anywhere; }
.scmp-card__v .gap { max-width: 100%; margin-left: 0; }
.scmp-card__v .badge { max-width: 100%; justify-content: center; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.scmp-card__v .gap__why { max-width: 100%; }

/* The footer notes */
.scmp-notes { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 0.75rem; line-height: 1.7; color: var(--text-tertiary); }
.scmp-notes strong { color: var(--text-secondary); }
.scmp-tabs { margin-bottom: 16px; }
.scmp-view { min-width: 0; }
.scmp-bar__fill, .scmp-hbar { shape-rendering: geometricPrecision; }
.scmp-dot { stroke: none; }
.table tbody tr.scmp-none > td { padding: 0; }
.scmp [hidden] { display: none !important; }
/* The companies not in the comparison, under the table, each with its reason (P3, 9 October 2026; FR 7.39) */
.scmp-unplaced { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.scmp-unplaced__title { margin-bottom: 8px; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }
.scmp-unplaced__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.scmp-unplaced__item { padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--r-md); font-size: 0.75rem; }
.scmp-unplaced__who { display: block; }
.scmp-unplaced__ticker { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-tertiary); }
.scmp-unplaced__why { display: block; margin-top: 3px; color: var(--text-muted); overflow-wrap: anywhere; }
