/* SG Organic Rewards — Helium V2.6.5 Sage & Lavender product components (Milestone 5; was V2.6.2 Green + Purple).
   Consumes ONLY semantic tokens from helium-tokens.css. Evergreen carries primary actions, #73A656 active states;
   lavender (--helium-accent-gradient, solid in V2.6.5) is the single accent action; deep purple marks selection only.
   One shell = one visible perimeter (V2.6.2 single-perimeter rule). Squircle via corner-shape with radius fallback.
   Product adaptation tokens (documented in docs/DESIGN-SYSTEM.md): semantic status colours below. */
:root {
  /* Product adaptation tokens (DECISION-LOG D38/D39). Colour values come from helium-tokens.css (Helium V2.6.5)
     except the two functional status hues (danger, warning), which await design approval (D39). */
  --sgo-text-2: var(--he-text-secondary);                 /* small secondary text, 6.3:1 on Porcelain */
  --sgo-danger: #A8322A; --sgo-danger-bg: #FBE9E6;        /* D39 exception: chips/alerts only, always with icon + text */
  --sgo-warn: #8A5300; --sgo-warn-bg: #FBF0DC;            /* D39 exception */
  --sgo-info: var(--he-purple-ink); --sgo-info-bg: var(--he-purple-pale);
  --sgo-success: var(--he-green-evergreen); --sgo-success-bg: color-mix(in srgb, var(--he-green-active) 16%, var(--he-green-porcelain));
  --sgo-accent-soft: var(--he-purple-pale);
  --sgo-accent-ink: var(--he-violet-ink);
  --sgo-select: var(--he-violet);                         /* sparse deep purple: selection indicators only */
  --sgo-shadow: var(--he-card-shadow);
  --sgo-shadow-pop: 0 18px 48px -12px color-mix(in srgb, var(--helium-color-brand-dark) 28%, transparent);
  --sgo-sidebar: 248px;
  --sgo-gutter: clamp(16px, 3.4vw, 64px);
  color-scheme: light;
}
@media (min-width: 600px) and (max-width: 1023px) { :root { --sgo-gutter: 28px; } }
@media (max-width: 599px) { :root { --sgo-gutter: 16px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--helium-color-canvas); color: var(--helium-color-text); font: 400 15px/1.5 var(--helium-type-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(button, a, input, textarea, select, [tabindex], summary):focus-visible { outline: 3px solid var(--helium-color-focus); outline-offset: 2px; }
.sq { border-radius: var(--helium-radius-md); corner-shape: squircle; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--sgo-text-2); }
.num { font-variant-numeric: tabular-nums; }
.metric { font-family: var(--helium-type-metric); font-weight: 600; letter-spacing: -.02em; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--helium-sp-4); }
.row { display: flex; align-items: center; gap: var(--helium-sp-3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* ───────── App shell: persistent sidebar scrolls internally, independent of content ───────── */
.app { display: grid; grid-template-columns: var(--sgo-sidebar) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--helium-color-header); border-right: 1px solid var(--helium-color-border); z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: var(--helium-radius-sm); corner-shape: squircle; background: var(--helium-color-brand-dark); display: grid; place-items: center; color: var(--helium-color-brand); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-weight: 600; font-size: 15px; letter-spacing: -.02em; }
.brand-text span { font-size: 12px; color: var(--sgo-text-2); }
.sidebar-scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 16px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--sgo-text-2); padding: 6px 12px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: 14px; corner-shape: squircle; text-decoration: none; color: var(--helium-color-brand-dark); font-size: 14px; position: relative;
  transition: background-color var(--helium-base) var(--helium-ease), color var(--helium-base) var(--helium-ease); }
.nav-link svg { width: 19px; height: 19px; color: var(--sgo-text-2); flex: none; }
.nav-link:hover { background: var(--helium-color-card); }
.nav-link[aria-current="page"] { background: var(--helium-color-card); color: var(--helium-color-brand-dark); font-weight: 600; box-shadow: var(--sgo-shadow); }
.nav-link[aria-current="page"] svg { color: var(--helium-color-brand-dark); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--sgo-select); }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 8px; corner-shape: squircle; display: inline-grid; place-items: center; background: var(--helium-color-control); color: var(--helium-color-text); }
.nav-badge.alert { background: var(--sgo-danger-bg); color: var(--sgo-danger); }
.sidebar-foot { border-top: 1px solid var(--helium-color-border); padding: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; background: var(--helium-color-header); border-bottom: 1px solid var(--helium-color-border); min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px var(--sgo-gutter); }
.topbar .menu-btn { display: none; }
.content { padding: 24px var(--sgo-gutter) 64px; min-width: 0; flex: 1; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--sgo-text-2); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.crumbs svg { width: 14px; height: 14px; flex: none; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--helium-color-card); border: 2px solid transparent; border-radius: var(--helium-radius-md); corner-shape: squircle; min-height: 44px; padding: 0 12px; width: min(360px, 40vw); }
.search-box:focus-within { border-color: var(--helium-color-focus); outline: 3px solid var(--helium-color-focus); outline-offset: 2px; }
.search-box input:focus-visible { outline: none; } /* ring drawn on the box */
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; font-size: 14px; }
.search-box svg { width: 18px; height: 18px; color: var(--sgo-text-2); flex: none; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 0; background: transparent; border-radius: var(--helium-radius-md); corner-shape: squircle; min-height: 44px; }
.user-chip:hover { background: var(--helium-color-control-hover); }
.avatar { width: 32px; height: 32px; border-radius: 11px; corner-shape: squircle; background: var(--helium-color-brand-dark); color: var(--he-green-porcelain); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.scrim { display: none; }

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform var(--helium-overlay) var(--helium-ease); box-shadow: var(--sgo-shadow-pop); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: color-mix(in srgb, var(--helium-color-brand-dark) 40%, transparent); z-index: 19; }
  .topbar .menu-btn { display: inline-flex; }
  .search-box { width: auto; flex: 1; }
}
@media (max-width: 599px) { .topbar .hide-sm { display: none; } .content { padding-top: 16px; } }

/* ───────── Page header (title + subtitle + primary action + filters, compact) ───────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font: 300 clamp(26px, 2.3vw, 36px)/1.12 var(--helium-type-display); letter-spacing: -.045em; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--sgo-text-2); font-size: 14px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.section-title { font: 400 19px/1.25 var(--helium-type-display); letter-spacing: -.03em; margin: 0; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--sgo-text-2); }

/* ───────── Cards (solid Porcelain, one perimeter) ───────── */
.card { background: var(--helium-color-card); border: 1px solid var(--helium-color-border); border-radius: var(--helium-radius-lg); corner-shape: squircle; padding: 20px; min-width: 0; box-shadow: var(--sgo-shadow);
  transition: border-color var(--helium-base) var(--helium-ease), box-shadow var(--helium-base) var(--helium-ease); }
.card.compact { padding: 16px; } .card.feature { padding: 28px; border-radius: var(--helium-radius-xl); }
.card.flush { padding: 0; overflow: hidden; }
/* Aurora / Contained Light (selected feature cards): green-only field, foreground protected (V2.6.4 .h2-material.aurora). */
.card.aurora { background: var(--he-green-field); color: var(--he-color-on-green); border-color: var(--helium-color-border); }
.card.aurora .kpi-label, .card.aurora .kpi-foot, .card.aurora .eyebrow { color: var(--helium-color-brand-dark); }
/* Magnetic Chroma (premium areas only): purple-only field with ink text (V2.6.4 .he-chroma-card). */
.card.chroma { background: var(--he-purple-field); color: var(--helium-color-text); border-color: var(--he-purple-light); }
.card.chroma .eyebrow, .card.chroma .kpi-label { color: var(--he-purple-ink); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font: 400 17px/1.3 var(--helium-type-display); letter-spacing: -.025em; }
.card-head .sub { font-size: 13px; color: var(--sgo-text-2); }
.card.flush .card-head { padding: 16px 20px 0; }
button.card, a.card { text-align: left; text-decoration: none; cursor: pointer; display: block; width: 100%; }
button.card:hover, a.card:hover { border-color: color-mix(in srgb, var(--helium-color-brand-dark) 22%, var(--helium-color-border)); }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
.grid.bento { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1279px) { .grid.three, .grid.bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.main-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) { .grid.two, .grid.three, .grid.bento { grid-template-columns: minmax(0, 1fr); } }

.kpi { display: flex; flex-direction: column; gap: 6px; min-height: 118px; }
.kpi-label { font-size: 13px; color: var(--sgo-text-2); display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.kpi-label svg { width: 18px; height: 18px; color: var(--sgo-text-2); }
.kpi-value { font: 400 clamp(24px, 2vw, 32px)/1.05 var(--helium-type-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-foot { font-size: 12px; color: var(--sgo-text-2); margin-top: auto; }
.kpi-multi { display: flex; flex-direction: column; gap: 2px; }
.kpi-multi .kpi-value { font-size: clamp(20px, 1.6vw, 26px); }

/* ───────── Buttons (no vertical drift on hover) ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: var(--helium-radius-md); corner-shape: squircle; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.1; white-space: nowrap; text-decoration: none; transform: none !important;
  transition: background-color var(--helium-base) var(--helium-ease), border-color var(--helium-base) var(--helium-ease), filter var(--helium-base) var(--helium-ease), color var(--helium-base) var(--helium-ease); }
.btn svg { width: 18px; height: 18px; flex: none; }
/* V2.6.4/2.6.5 source: .he-btn-primary / .h2-primary = evergreen, white text, hover #5A8B4E. */
.btn-primary { background: var(--helium-color-brand-dark); color: var(--he-color-on-dark); }
.btn-primary:hover:not(:disabled) { background: var(--helium-color-brand-hover); }
.btn-primary:active:not(:disabled) { filter: brightness(.95); }
/* V2.6.4 source: .h2-accent = solid lavender, ink text. One per screen, for the key customer action. */
.btn-accent { background: var(--helium-accent-gradient); color: var(--helium-accent-ink); }
.btn-accent:hover:not(:disabled) { background: color-mix(in srgb, var(--he-purple-lavender) 82%, var(--he-violet)); }
.btn-secondary { background: var(--helium-color-card); border-color: var(--helium-color-border); color: var(--helium-color-text); }
.btn-secondary:hover:not(:disabled) { background: var(--helium-color-control-hover); }
.btn-brand { background: var(--helium-color-brand); color: var(--helium-color-brand-ink); }
.btn-brand:focus-visible, .btn-accent:focus-visible { outline-color: var(--he-violet-ink); }
.btn-brand:hover:not(:disabled) { background: var(--helium-color-brand-hover); }
.btn-ghost { background: transparent; color: var(--helium-color-text); }
.btn-ghost:hover:not(:disabled) { background: var(--helium-color-control-hover); }
.btn-danger { background: var(--sgo-danger-bg); color: var(--sgo-danger); border-color: color-mix(in srgb, var(--sgo-danger) 22%, transparent); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--sgo-danger) 14%, var(--he-green-porcelain)); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: var(--helium-radius-sm); }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.icon-btn { width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; border-radius: 14px; corner-shape: squircle; border: 0; background: transparent; color: var(--helium-color-text); flex: none; }
.icon-btn:hover { background: var(--helium-color-control-hover); }
.icon-btn svg { width: 20px; height: 20px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sgo-spin .7s linear infinite; flex: none; }
@keyframes sgo-spin { to { transform: rotate(360deg); } }

/* ───────── Fields: 2px transparent border reserved on all sides, coloured on focus (no geometry shift) ───────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 500; color: var(--helium-color-text); }
.field .hint { font-size: 12px; color: var(--sgo-text-2); }
.field .err { font-size: 12px; color: var(--sgo-danger); }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 0 14px; background: var(--helium-color-field); border: 2px solid transparent; border-radius: var(--helium-radius-md); corner-shape: squircle;
  font-size: 15px; color: var(--helium-color-text); outline: none; transition: border-color var(--helium-fast) var(--helium-ease), background-color var(--helium-fast) var(--helium-ease); }
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.45; }
.input:hover, .select:hover, .textarea:hover { background: color-mix(in srgb, var(--helium-color-field) 70%, var(--helium-color-control-hover)); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--helium-color-focus); background: var(--helium-color-card); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--sgo-danger); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .55; cursor: not-allowed; }
.input::placeholder, .textarea::placeholder { color: var(--helium-color-muted); opacity: 1; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23576957' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .affix { position: absolute; left: 14px; font-size: 14px; color: var(--sgo-text-2); pointer-events: none; }
.input-affix .input { padding-left: 52px; }
.otp-input { letter-spacing: .5em; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; line-height: 1.4; }
.check input { appearance: none; width: 22px; height: 22px; margin: 0; flex: none; border: 2px solid var(--helium-color-border); background: var(--helium-color-card); border-radius: 7px; corner-shape: squircle; display: grid; place-items: center; transition: background var(--helium-fast) var(--helium-ease), border-color var(--helium-fast) var(--helium-ease); }
.check input:checked { background: var(--helium-color-brand-dark); border-color: var(--helium-color-brand-dark); } /* evergreen keeps the white tick >= 3:1 (non-text) */
.check input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--he-green-porcelain); border-bottom: 2px solid var(--he-green-porcelain); transform: rotate(-45deg) translate(1px, -1px); }
/* Helium V2.6.5 controls-v265.css canonical switch: one pill, one round white thumb, 180ms, violet focus. */
.switch { appearance: none; position: relative; display: inline-block; width: 52px; min-width: 52px; height: 30px; padding: 0; border: 1px solid #C9D5C5; border-radius: 999px; corner-shape: round; background: var(--he-field-track); box-shadow: none; cursor: pointer; flex: none;
  transition: background var(--helium-base) ease, border-color var(--helium-base) ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--he-green-porcelain); box-shadow: 0 1px 3px #2B4E2720; transform: translateX(0); transition: transform var(--helium-base) ease; }
.switch[aria-checked="true"] { background: var(--helium-color-brand); border-color: var(--helium-color-brand); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.switch:focus-visible { outline: 2px solid var(--he-violet); outline-offset: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 639px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-narrow { max-width: 560px; }

/* ───────── Segmented control / tabs ───────── */
.segment { display: inline-flex; gap: 4px; padding: 4px; background: var(--helium-color-control); border-radius: var(--helium-radius-md); corner-shape: squircle; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segment button { border: 0; background: transparent; min-height: 40px; padding: 0 14px; border-radius: 13px; corner-shape: squircle; font-size: 13px; color: var(--sgo-text-2); white-space: nowrap;
  transition: background-color var(--helium-base) var(--helium-ease), color var(--helium-base) var(--helium-ease); }
.segment button:hover { color: var(--helium-color-text); }
.segment button[aria-selected="true"], .segment button[aria-pressed="true"] { background: var(--helium-color-card); color: var(--helium-color-brand-dark); font-weight: 600; box-shadow: var(--sgo-shadow); }
.tabs-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--helium-color-border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs-bar button { border: 0; background: transparent; padding: 12px 14px; font-size: 14px; color: var(--sgo-text-2); position: relative; white-space: nowrap; min-height: 44px; }
.tabs-bar button[aria-selected="true"] { color: var(--helium-color-text); font-weight: 600; }
.tabs-bar button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--sgo-select); }

/* ───────── Status chips ───────── */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 10px; corner-shape: squircle; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--helium-color-control); color: var(--helium-color-text); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 3px; background: currentColor; opacity: .75; }
.chip.plain::before { display: none; }
.chip.success { background: var(--sgo-success-bg); color: var(--sgo-success); }
.chip.warn { background: var(--sgo-warn-bg); color: var(--sgo-warn); }
.chip.danger { background: var(--sgo-danger-bg); color: var(--sgo-danger); }
.chip.info { background: var(--sgo-info-bg); color: var(--sgo-info); }
.chip.accent { background: var(--sgo-accent-soft); color: var(--sgo-accent-ink); }
.chip.demo { background: var(--sgo-warn-bg); color: var(--sgo-warn); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }

/* ───────── Tables ───────── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--sgo-text-2); padding: 10px 14px; border-bottom: 1px solid var(--helium-color-border); white-space: nowrap; background: var(--helium-color-card); position: sticky; top: 0; }
.table th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table th button svg { width: 14px; height: 14px; }
.table td { padding: 12px 14px; border-bottom: 1px solid color-mix(in srgb, var(--helium-color-border) 70%, transparent); vertical-align: middle; max-width: 340px; overflow-wrap: anywhere; }
.table td.r, .table th.r { text-align: right; white-space: nowrap; }
.table tbody tr { transition: background-color var(--helium-base) var(--helium-ease); }
.table tbody tr:hover { background: color-mix(in srgb, var(--helium-color-control) 45%, transparent); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--sgo-text-2); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--helium-color-border); font-size: 13px; color: var(--sgo-text-2); flex-wrap: wrap; }
@media (max-width: 767px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--helium-color-border); }
  .table.responsive td { border: 0; padding: 3px 0; max-width: none; display: flex; justify-content: space-between; gap: 12px; }
  .table.responsive td::before { content: attr(data-label); font-size: 12px; color: var(--sgo-text-2); flex: none; }
  .table.responsive td.r { text-align: right; }
}

/* ───────── States ───────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--sgo-text-2); }
.empty svg { width: 36px; height: 36px; color: var(--sgo-text-2); }
.empty h3 { margin: 0; color: var(--helium-color-text); font: 400 17px var(--helium-type-display); }
.empty p { margin: 0; max-width: 46ch; font-size: 14px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--helium-radius-md); corner-shape: squircle; font-size: 14px; background: var(--sgo-info-bg); color: var(--sgo-info); }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.warn { background: var(--sgo-warn-bg); color: var(--sgo-warn); }
.alert.danger { background: var(--sgo-danger-bg); color: var(--sgo-danger); }
.alert.success { background: var(--sgo-success-bg); color: var(--sgo-success); }
.alert strong { display: block; }
.alert .actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.skeleton { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--helium-color-control) 0%, var(--helium-color-field) 50%, var(--helium-color-control) 100%); background-size: 200% 100%; animation: sgo-shimmer 1.4s ease-in-out infinite; }
.skeleton.lg { height: 28px; width: 60%; }
@keyframes sgo-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ───────── Dialog (native) / drawer / toast ───────── */
dialog.dialog { border: 1px solid var(--helium-color-border); padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border-radius: var(--helium-radius-xl); corner-shape: squircle; background: var(--helium-color-card); color: var(--helium-color-text); box-shadow: var(--sgo-shadow-pop); overflow: auto; }
dialog.dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: color-mix(in srgb, var(--helium-color-brand-dark) 42%, transparent); }
dialog.dialog[open] { animation: sgo-dialog-in var(--helium-overlay) var(--helium-ease); }
.dialog-body { padding: 24px 24px 20px; }
.dialog-body h2 { margin: 0 0 6px; font: 400 22px/1.2 var(--helium-type-display); letter-spacing: -.035em; }
.dialog-body > p { margin: 0 0 16px; color: var(--sgo-text-2); font-size: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 0 24px 24px; flex-wrap: wrap; }
.dialog-close { position: absolute; right: 12px; top: 12px; }
@keyframes sgo-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.toaster { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--helium-color-brand-dark); color: var(--he-green-porcelain); padding: 14px 16px; border-radius: var(--helium-radius-md); corner-shape: squircle; box-shadow: var(--sgo-shadow-pop); font-size: 14px; animation: sgo-dialog-in var(--helium-content) var(--helium-ease); }
.toast.error { background: var(--sgo-danger); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.menu { position: absolute; z-index: 60; min-width: 220px; background: var(--helium-color-card); border: 1px solid var(--helium-color-border); border-radius: var(--helium-radius-md); corner-shape: squircle; padding: 6px; box-shadow: var(--sgo-shadow-pop); }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 11px; corner-shape: squircle; font-size: 14px; text-decoration: none; min-height: 40px; }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--helium-color-control-hover); }
.menu svg { width: 18px; height: 18px; color: var(--sgo-text-2); }
.menu hr { border: 0; border-top: 1px solid var(--helium-color-border); margin: 6px 4px; }

/* ───────── Domain pieces ───────── */
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--sgo-text-2); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, var(--helium-color-border) 70%, transparent); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.tl-icon { width: 36px; height: 36px; border-radius: 12px; corner-shape: squircle; display: grid; place-items: center; background: var(--helium-color-control); }
.tl-icon svg { width: 18px; height: 18px; }
.tl-icon.plus { background: var(--sgo-success-bg); color: var(--sgo-success); }
.tl-icon.minus { background: var(--sgo-accent-soft); color: var(--sgo-accent-ink); }
.tl-icon.hold { background: var(--sgo-warn-bg); color: var(--sgo-warn); }
.tl-title { font-size: 14px; font-weight: 500; }
.tl-sub { font-size: 12px; color: var(--sgo-text-2); }
.tl-amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.tl-amt.plus { color: var(--sgo-success); }
.progress { height: 10px; border-radius: 6px; background: var(--helium-color-control); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--helium-color-brand); border-radius: 6px; transition: width var(--helium-content) var(--helium-ease); }
.wallet-hero { display: flex; flex-direction: column; gap: 14px; min-height: 220px; }
.wallet-points { font: 600 clamp(48px, 6vw, 76px)/1 var(--helium-type-metric); letter-spacing: -.03em; color: var(--helium-color-brand-dark); }
.member-card { position: relative; isolation: isolate; overflow: hidden; border-radius: var(--helium-radius-xl); corner-shape: squircle; padding: 24px; min-height: 210px; border: 1px solid var(--he-purple-light);
  background: var(--he-purple-field); /* V2.6.4 Chroma: purple-only */
  color: var(--he-material-ink); display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.member-card > * { position: relative; z-index: 3; }
.qr-box { background: var(--he-green-porcelain); padding: 12px; border-radius: var(--helium-radius-md); corner-shape: squircle; display: inline-grid; place-items: center; border: 1px solid var(--helium-color-border); }
.qr-box img { width: min(220px, 60vw); height: auto; image-rendering: pixelated; }
.chart { width: 100%; height: 220px; display: block; }
.chart .grid-line { stroke: var(--helium-color-border); stroke-width: 1; }
.chart .axis { fill: var(--sgo-text-2); font-size: 11px; font-family: var(--helium-type-body); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--sgo-text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper span { font-size: 12px; padding: 6px 10px; border-radius: 10px; corner-shape: squircle; background: var(--helium-color-control); color: var(--sgo-text-2); }
.stepper span[aria-current="step"] { background: var(--sgo-accent-soft); color: var(--sgo-accent-ink); font-weight: 600; }
.stepper span.done { background: var(--sgo-success-bg); color: var(--sgo-success); }

/* Cashier: task-first, tablet-optimised */
.cashier { max-width: 1100px; margin: 0 auto; }
.cashier-search { display: flex; gap: 8px; }
.cashier-search .input { min-height: 56px; font-size: 17px; }
.big-amount { font: 400 clamp(30px, 4vw, 44px)/1.05 var(--helium-type-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.keyline { border-top: 1px solid var(--helium-color-border); margin: 16px 0; }

/* Auth surfaces */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }

/* Magnetic Light is opt-in (see css/magnetic.css). Keep resting state white Porcelain. */
.he-magnetic-card { background: var(--helium-color-card); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
  dialog.dialog::backdrop { background: color-mix(in srgb, var(--helium-color-brand-dark) 70%, transparent); }
}
@media print { .sidebar, .topbar, .page-actions, .filters { display: none !important; } .app { display: block; } .card { box-shadow: none; } }
