/* SitePunch Account — "Blueprint" design system.
   One token set drives every surface. Light is the default theme; dark only re-declares tokens.
   Names the scoped overview module (account-dashboard.js) reads are kept as aliases at the end of :root. */

:root {
  color-scheme: light;
  --bg: #f2f5f9;
  --bg-wash: radial-gradient(1100px 480px at 0 0, rgba(31, 200, 227, .07), transparent 62%);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf1f6;
  --field: #ffffff;
  --text: #0d1b2a;
  --text-2: #3f5165;
  --muted: #6b7c8f;
  --line: #e2e8f0;
  --line-2: #edf1f5;
  --line-strong: #cdd6e1;

  --brand: #1f5fbf;
  --brand-hover: #1a52a6;
  --brand-ink: #174a95;
  --brand-soft: #e9f1fc;
  --brand-border: #b9cff0;
  --cyan: #1fc8e3;
  --cyan-soft: rgba(31, 200, 227, .14);
  --grad: linear-gradient(135deg, #1f5fbf 0%, #1b7fd6 58%, #18a9d6 100%);
  --meter: linear-gradient(270deg, #1f5fbf, #3aa0f0 70%, #1fc8e3);
  --meter-warn: linear-gradient(270deg, #c27200, #f2a93b);
  --meter-full: linear-gradient(270deg, #b4232c, #ef6b5b);
  --meter-ok: linear-gradient(270deg, #128a5e, #2fd39a);
  --track: #e8edf4;

  --ok: #12825a;
  --ok-soft: rgba(23, 192, 138, .11);
  --ok-border: rgba(23, 160, 115, .3);
  --warn: #a96300;
  --warn-soft: #fdf3e2;
  --warn-border: #f1d29c;
  --danger: #b4232c;
  --danger-soft: #fdf0f0;
  --danger-border: #f0c1c4;
  --focus: #1f5fbf;
  --selection: rgba(31, 95, 191, .18);
  --scrim: rgba(10, 22, 36, .55);

  --side-bg: #0a1624;
  --side-text: #b8c6d5;
  --side-muted: #6b8199;
  --side-line: rgba(255, 255, 255, .08);

  --shadow-1: 0 1px 2px rgba(13, 27, 42, .04), 0 4px 16px rgba(13, 27, 42, .05);
  --shadow-2: 0 24px 60px rgba(13, 27, 42, .18);
  --glow: 0 0 0 1px rgba(31, 200, 227, .28), 0 0 18px rgba(31, 200, 227, .18);

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --control-h: 44px;
  --side-w: 264px;
  --gutter: clamp(16px, 2.6vw, 36px);
  --bottom-nav-h: 64px;
  --legal-bar-h: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-sans: 'IBM Plex Sans Hebrew', 'IBM Plex Sans Arabic', 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Aliases read by account-dashboard.js and older inline markup. */
  --white: var(--text);
  --border: var(--line);
  --bg2: var(--surface);
  --r: var(--r-lg);
  --gold: var(--brand);
  --gold-dim: var(--brand-soft);
  --gold-border: var(--brand-border);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08121e;
  --bg-wash: radial-gradient(1100px 480px at 0 0, rgba(31, 200, 227, .08), transparent 62%);
  --surface: #0f1c2b;
  --surface-2: #132335;
  --surface-3: #182b40;
  --field: #0b1724;
  --text: #edf3f9;
  --text-2: #b6c5d6;
  --muted: #8296ab;
  --line: #1f3247;
  --line-2: #1a2b3e;
  --line-strong: #2c4560;
  --brand: #4f95f0;
  --brand-hover: #6aa8f5;
  --brand-ink: #8cbcf7;
  --brand-soft: rgba(79, 149, 240, .13);
  --brand-border: rgba(79, 149, 240, .38);
  --track: #1b2d42;
  --ok: #4fd8a4;
  --ok-soft: rgba(47, 211, 154, .12);
  --ok-border: rgba(47, 211, 154, .32);
  --warn: #f4b558;
  --warn-soft: rgba(242, 169, 59, .12);
  --warn-border: rgba(242, 169, 59, .36);
  --danger: #f38b8b;
  --danger-soft: rgba(243, 139, 139, .1);
  --danger-border: rgba(243, 139, 139, .38);
  --focus: #6aa8f5;
  --selection: rgba(79, 149, 240, .35);
  --scrim: rgba(2, 8, 15, .72);
  --side-bg: #060e18;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .22);
  --shadow-2: 0 24px 60px rgba(0, 0, 0, .5);
}

/* ── BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: var(--selection); }
html { background: var(--bg); font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; font-family: var(--font-sans); font-size: .9375rem; line-height: 1.5;
  color: var(--text); background: var(--bg-wash), var(--bg); background-attachment: fixed;
  direction: rtl; -webkit-font-smoothing: antialiased; isolation: isolate;
}
[hidden] { display: none !important; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
:where(button, a, summary, [role="switch"], input[type="checkbox"]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--brand); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.portal-skip {
  position: fixed; inset-block-start: 8px; inset-inline-start: 16px; z-index: 2000; transform: translateY(-160%);
  padding: 12px 20px; background: var(--surface); border: 2px solid var(--focus); border-radius: var(--r-md); color: var(--text);
}
.portal-skip:focus { transform: none; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.bi { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; vertical-align: -.15em; }
.bi svg { width: 1em; height: 1em; display: block; }
.bi-gold, .bi-blue { color: var(--brand); }
.bi-green { color: var(--ok); }
.bi-red { color: var(--danger); }
.bi-neutral { color: var(--muted); }
.ui-icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── BUTTONS ── */
.btn-login, .btn-primary, .co-submit, .co-cta, .portal-primary {
  min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--grad); color: #fff; font: 600 .9rem/1.25 var(--font-sans);
  text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(31, 140, 214, .7), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: filter .15s, box-shadow .15s, transform .15s;
}
.btn-login:hover:not(:disabled), .btn-primary:hover:not(:disabled), .co-submit:hover:not(:disabled),
.co-cta:hover:not(:disabled), .portal-primary:hover:not(:disabled) { filter: brightness(1.07); box-shadow: 0 8px 22px -8px rgba(31, 160, 214, .85), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-login:active:not(:disabled), .btn-primary:active:not(:disabled), .co-submit:active:not(:disabled), .portal-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-login:disabled, .btn-primary:disabled, .co-submit:disabled, .co-cta:disabled, .portal-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn-contact-plan, .google-btn, .btn-secondary, .portal-secondary, .theme-toggle, #btnLogout, .icon-btn {
  min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: 600 .875rem/1.25 var(--font-sans);
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-contact-plan:hover, .google-btn:hover:not(:disabled), .btn-secondary:hover, .portal-secondary:hover:not(:disabled),
.theme-toggle:hover, #btnLogout:hover, .icon-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--brand-border); }
.btn-contact-plan { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-border); }
.btn-contact-plan:hover { background: var(--surface); }
.google-btn:disabled, .portal-secondary:disabled, .icon-btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: var(--control-h); padding: 0; }
.portal-text-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 2px;
  background: none; border: 0; color: var(--brand); font: 600 .8125rem/1.3 var(--font-sans); cursor: pointer; text-decoration: none;
}
.portal-text-btn:hover { text-decoration: underline; }
.btn-danger {
  min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border: 1px solid var(--danger-border); border-radius: var(--r-md);
  background: var(--danger-soft); color: var(--danger); font: 700 .875rem/1.25 var(--font-sans); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── FIELDS ── */
.form-group input, .co-input, .field {
  width: 100%; min-height: 46px; padding: 11px 14px;
  background: var(--field); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font: max(16px, 1rem)/1.4 var(--font-sans); outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-group input::placeholder, .co-input::placeholder, .field::placeholder { color: var(--muted); }
.form-group input:focus, .co-input:focus, .field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--cyan-soft); }
textarea.co-input { min-height: 150px; resize: vertical; line-height: 1.55; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: max(16px, 1rem); }

/* ── AUTH SCREENS ── */
.auth-screen {
  min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center;
  padding: 72px 20px calc(var(--legal-bar-h) + 40px); position: relative;
}
.login-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 380px at 92% 4%, rgba(31, 200, 227, .2), transparent 62%),
    radial-gradient(700px 480px at 0 100%, rgba(31, 95, 191, .28), transparent 62%),
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--side-bg);
}
.login-card {
  position: relative; width: 100%; max-width: 440px; padding: 34px 32px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2);
  animation: rise .5s var(--ease) both;
}
.login-card::before {
  content: ""; position: absolute; inset-block-start: -1px; inset-inline: 28px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.login-logo img { width: min(220px, 70%); height: auto; display: block; }
.login-title { text-align: center; font-size: 1.375rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 6px; }
.login-sub { text-align: center; font-size: .9rem; color: var(--muted); margin-bottom: 22px; line-height: 1.6; }
.auth-identity { text-align: center; font-size: .85rem; color: var(--text-2); margin: -10px 0 18px; direction: ltr; overflow-wrap: anywhere; }
.auth-identity:empty { display: none; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 52px; }
.pw-eye {
  position: absolute; inset-inline-end: 2px; inset-block-start: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); font-size: 1.15rem;
}
.pw-eye:hover { color: var(--text); background: var(--surface-2); }
.btn-login { width: 100%; margin-top: 6px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.auth-divider span { flex: 1; height: 1px; background: var(--line); }
.auth-divider em { font-style: normal; font-size: .8rem; color: var(--muted); }
.google-btn { width: 100%; }
.forgot-link {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--control-h); margin-top: 6px;
  font: 600 .875rem var(--font-sans); color: var(--brand); background: none; border: 0; cursor: pointer;
}
.forgot-link:hover { text-decoration: underline; }
.auth-msg {
  display: none; font-size: .875rem; line-height: 1.5; text-align: center; padding: 10px 14px; margin-bottom: 14px;
  border-radius: var(--r-md); background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); overflow-wrap: anywhere;
}
.auth-msg.ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.auth-switch {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted);
}
.auth-switch-link { min-height: var(--control-h); padding-inline: 8px; display: inline-flex; align-items: center; font-weight: 700; color: var(--brand); }
.auth-switch-link:hover { text-decoration: underline; }
.auth-back { text-align: center; }
.auth-back a { display: inline-flex; align-items: center; min-height: var(--control-h); color: var(--muted); font-size: .85rem; text-decoration: none; }
.auth-back a:hover { color: var(--text); text-decoration: underline; }
.consent-row { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 14px; font-size: .85rem; line-height: 1.55; color: var(--text-2); cursor: pointer; }
.consent-row input { width: 20px; height: 20px; margin-top: 1px; flex-shrink: 0; accent-color: var(--brand); }
#forgotScreen { display: none; }

.auth-theme-toggle { position: fixed; inset-block-start: 16px; inset-inline-end: 20px; z-index: 120; width: var(--control-h); padding: 0; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #e7eef6; backdrop-filter: blur(10px); }
.auth-theme-toggle:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
.theme-toggle-icon { display: inline-flex; width: 20px; height: 20px; }
.theme-toggle-icon .bi, .theme-toggle-icon svg { width: 20px; height: 20px; color: inherit; }
.theme-toggle-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
body[data-screen="dash"] .auth-theme-toggle { display: none; }

.auth-legal-bar {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 110; min-height: var(--legal-bar-h);
  padding: 4px 16px max(4px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 0 20px; flex-wrap: wrap;
  background: rgba(6, 14, 24, .7); border-top: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(12px); color: #8ea3b9; font-size: .8125rem;
}
.auth-legal-bar button, .auth-legal-bar a {
  min-height: 40px; display: inline-flex; align-items: center; border: 0; padding: 0; background: transparent;
  color: #c8d5e2; font: 600 .8125rem/1.3 var(--font-sans); text-decoration: none; cursor: pointer;
}
.auth-legal-bar button:hover, .auth-legal-bar a:hover { color: #fff; text-decoration: underline; }
body[data-screen="dash"] .auth-legal-bar { display: none; }
body:not([data-screen="dash"]) .a11y-btn { bottom: calc(var(--legal-bar-h) + 14px); }
body:not([data-screen="dash"]) .a11y-panel { bottom: calc(var(--legal-bar-h) + 72px); }

/* ── LOADING ── */
#loadingScreen { display: none; min-height: 100vh; align-items: center; justify-content: center; flex-direction: column; gap: 18px; }
#loadingScreen.visible { display: flex; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--cyan) 70%, var(--brand)); animation: spin .9s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}
.loading-text { font-size: .9rem; color: var(--muted); }

/* ── SHELL: sidebar ── */
#mainNav {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 100; width: var(--side-w);
  display: flex; flex-direction: column; padding: 20px 16px 16px; color: var(--side-text); overflow-y: auto;
  background:
    radial-gradient(420px 260px at 100% 0, rgba(31, 200, 227, .15), transparent 60%),
    radial-gradient(380px 300px at 0 100%, rgba(31, 95, 191, .24), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .032) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, .032) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--side-bg);
}
.nav-logo { display: flex; align-items: center; padding: 2px 8px 18px; border-bottom: 1px solid var(--side-line); }
.nav-logo img { width: 150px; height: auto; display: block; }
.nav-org { margin: 16px 0 6px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07); min-width: 0; }
.nav-org #orgName { display: block; color: #fff; font-weight: 600; font-size: .875rem; overflow-wrap: anywhere; }
.nav-org-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; font-size: .75rem; color: var(--side-muted); }
.plan-badge:empty { display: none; }
.plan-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; color: #bdf3fb; background: rgba(31, 200, 227, .12); box-shadow: inset 0 0 0 1px rgba(31, 200, 227, .3); }
.plan-badge .bi { color: var(--cyan); }
.portal-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.portal-nav-label { margin: 18px 12px 6px; font-size: .6875rem; font-weight: 600; letter-spacing: .06em; color: var(--side-muted); }
.portal-nav-btn {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 12px;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--side-text);
  font: 500 .875rem var(--font-sans); text-align: start; cursor: pointer; transition: background-color .15s, color .15s;
}
.portal-nav-btn .ui-icon { opacity: .85; }
.portal-nav-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.portal-nav-btn.active { color: #fff; background: linear-gradient(270deg, rgba(31, 200, 227, .16), rgba(31, 95, 191, .1)); box-shadow: inset 0 0 0 1px rgba(31, 200, 227, .26); }
.portal-nav-btn.active::before { content: ""; position: absolute; inset-inline-start: -16px; inset-block: 9px; width: 3px; border-radius: 3px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.portal-nav-btn.active .ui-icon { color: var(--cyan); opacity: 1; }
.portal-nav-btn:focus-visible { outline-color: var(--cyan); }
.nav-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--side-line); display: grid; gap: 10px; }
.nav-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .8125rem; color: #fff; background: linear-gradient(135deg, #24425f, #16293d); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
#navUserName { color: #fff; font-size: .8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-actions { display: flex; gap: 8px; }
#mainNav .theme-toggle, #mainNav #btnLogout { min-height: 38px; background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .1); color: var(--side-text); }
#mainNav .theme-toggle { width: 38px; padding: 0; }
#mainNav #btnLogout { flex: 1; font-size: .8125rem; }
#mainNav .theme-toggle:hover, #mainNav #btnLogout:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); }

/* ── SHELL: page ── */
#dashScreen { display: none; padding-inline-start: var(--side-w); min-height: 100vh; }
#dashScreen.visible { display: flex; flex-direction: column; }
.dash-main { flex: 1; min-width: 0; padding: 26px var(--gutter) 40px; outline: none; }
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-hero-title { min-width: 0; }
.portal-kicker { font-size: .8125rem; color: var(--muted); }
.dash-hero h1 { font-size: clamp(1.5rem, 2vw, 1.75rem); font-weight: 700; letter-spacing: -.015em; line-height: 1.25; margin-top: 2px; }
.dash-welcome { margin-top: 6px; font-size: .875rem; color: var(--text-2); max-width: 80ch; overflow-wrap: anywhere; }
.dash-welcome:empty { display: none; }
body[data-portal-kind="root_admin"] .dash-welcome { display: none; }
/* Organization data tabs exist only for an organization owner or admin. */
body:not([data-portal-kind="root_admin"]) [data-admin-only] { display: none !important; }
.org-chooser { margin-top: 10px; }
.dash-hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: .75rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line);
}
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.sync[data-state="ready"]::before { background: #17c08a; box-shadow: 0 0 0 3px rgba(23, 192, 138, .16), 0 0 8px rgba(23, 192, 138, .8); }
.sync[data-state="loading"]::before { background: var(--cyan); animation: pulse 1.1s ease-in-out infinite; }
.sync[data-state="error"]::before, .sync[data-state="stale"]::before { background: #f2a93b; }
.sync:empty { display: none; }
#portalRefreshTop[data-state="loading"] .ui-icon { animation: spin .9s linear infinite; }
.dash-tab-panel { display: none; }
.dash-tab-panel.active { display: block; animation: fade .35s var(--ease) both; }

/* ── CARDS ── */
.card {
  position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card::before {
  content: ""; position: absolute; inset-block-start: -1px; inset-inline: 18px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(31, 200, 227, .55), transparent);
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h2, .card-h h3 { font-size: .96875rem; font-weight: 600; letter-spacing: -.005em; }
.card-b { padding: 18px 20px; }
.card-note { font-size: .78125rem; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.section-heading { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.section-heading.danger { color: var(--danger); }
.section-text { font-size: .875rem; color: var(--text-2); line-height: 1.75; max-width: 90ch; overflow-wrap: anywhere; }
.page-grid { display: grid; gap: 18px; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.stack { display: grid; gap: 18px; min-width: 0; }

/* ── OVERVIEW: plan strip ── */
.plan-strip {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px 28px;
  padding: 22px 26px; margin-bottom: 18px; overflow: hidden;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(120deg, rgba(31, 95, 191, .55), rgba(31, 200, 227, .55) 40%, var(--line) 72%) border-box;
  border: 1px solid transparent;
}
.plan-strip::before { inset-block: 0; inset-inline: auto; inset-inline-start: -1px; width: 3px; height: auto; background: var(--grad); box-shadow: 0 0 16px rgba(31, 200, 227, .6); }
.plan-strip::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(520px 170px at 100% 0, rgba(31, 200, 227, .09), transparent 70%); }
.plan-id { display: grid; gap: 2px; padding-inline-end: 28px; border-inline-end: 1px solid var(--line-2); min-width: 0; }
.plan-id small { font-size: .75rem; color: var(--muted); }
.plan-id h2 { font-size: 1.875rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; overflow-wrap: anywhere; }
.plan-id p { font-size: .8125rem; color: var(--text-2); }
.plan-facts { display: flex; flex-wrap: wrap; gap: 14px 32px; min-width: 0; }
.plan-fact { display: grid; gap: 3px; min-width: 0; }
.plan-fact dt { font-size: .75rem; color: var(--muted); }
.plan-fact dd { font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.plan-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-3); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill[data-tone="ok"] { color: var(--ok); background: var(--ok-soft); box-shadow: inset 0 0 0 1px var(--ok-border); }
.pill[data-tone="ok"]::before { box-shadow: 0 0 8px currentColor; }
.pill[data-tone="warn"] { color: var(--warn); background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn-border); }
.portal-state { padding: 22px 26px; margin-bottom: 18px; }
.portal-state h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }

/* ── OVERVIEW: meters ── */
.meters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.meter { padding: 16px 18px 14px; display: grid; gap: 10px; align-content: start; }
.meter-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.meter-h .ui-icon { color: var(--muted); width: 17px; height: 17px; }
.meter-v { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-height: 34px; }
.meter-v b { font-family: var(--font-mono); font-size: 1.625rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.meter-v span { font-size: .8125rem; color: var(--muted); }
.meter-v .meter-text { font-family: var(--font-sans); font-size: 1rem; font-weight: 600; letter-spacing: 0; }
.meter-f { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--muted); min-height: 1.2em; }
.meter-f [data-tone="warn"] { color: var(--warn); font-weight: 600; }
.meter-f [data-tone="full"] { color: var(--danger); font-weight: 600; }
.meter[data-state="loading"] .meter-v b { color: transparent; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; min-width: 64px; }

.bar { position: relative; height: 6px; border-radius: 6px; background: var(--track); overflow: hidden; }
.bar > i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 6px; background: var(--meter); box-shadow: 0 0 12px rgba(31, 200, 227, .35); transform-origin: right center; animation: grow 1.1s var(--ease) both; animation-delay: var(--d, 0s); }
html[dir="ltr"] .bar > i { transform-origin: left center; }
.bar > i::after { content: ""; position: absolute; inset-inline-end: 0; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #c8f6fd; box-shadow: 0 0 6px 2px rgba(31, 200, 227, .9); }
.bar > i::before { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); animation: sweep 2.6s 1.5s ease-in-out infinite; }
.bar[data-tone="warn"] > i { background: var(--meter-warn); box-shadow: 0 0 12px rgba(242, 169, 59, .35); }
.bar[data-tone="warn"] > i::after { background: #ffe7c2; box-shadow: 0 0 6px 2px rgba(242, 169, 59, .9); }
.bar[data-tone="full"] > i { background: var(--meter-full); box-shadow: 0 0 12px rgba(239, 107, 91, .4); }
.bar[data-tone="full"] > i::after { background: #ffd9d4; box-shadow: 0 0 6px 2px rgba(239, 107, 91, .9); }
.bar[data-tone="ok"] > i { background: var(--meter-ok); box-shadow: 0 0 12px rgba(47, 211, 154, .35); }
.bar[data-tone="ok"] > i::after { background: #d4fbe9; box-shadow: 0 0 6px 2px rgba(47, 211, 154, .9); }

/* ── OVERVIEW: projects table ── */
.search-box { position: relative; display: flex; align-items: center; width: min(280px, 100%); }
.search-box .ui-icon { position: absolute; inset-inline-start: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; min-height: 38px; padding: 6px 12px; padding-inline-start: 34px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font: inherit; }
.search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--cyan-soft); background: var(--field); }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { padding: 10px 20px; font-size: .75rem; font-weight: 500; color: var(--muted); text-align: start; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.ptable td { padding: 13px 20px; font-size: .875rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tbody tr { transition: background-color .15s; }
.ptable tbody tr:hover { background: var(--surface-2); }
.ptable .pname { font-weight: 500; overflow-wrap: anywhere; }
.ptable .pnum { font-family: var(--font-mono); font-size: .78125rem; color: var(--muted); white-space: nowrap; }
.load { display: flex; align-items: center; gap: 12px; }
.load b { min-width: 3ch; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.load .bar { flex: 1; max-width: 200px; }
.empty { padding: 26px 20px; font-size: .875rem; color: var(--muted); text-align: center; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── OVERVIEW: side cards ── */
.cmp { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 9px 22px; font-size: .84375rem; align-items: baseline; margin-bottom: 16px; }
.cmp .h { font-family: var(--font-sans); font-size: .71875rem; color: var(--muted); font-weight: 500; }
.cmp .n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: end; }
.cmp .up { color: var(--brand); font-weight: 600; }
.wide { width: 100%; }
.timeline { display: grid; }
.ev { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.ev:last-child { border-bottom: 0; }
.ev-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.ev[data-tone="ok"] .ev-dot { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft), 0 0 10px rgba(23, 192, 138, .6); }
.ev[data-tone="muted"] .ev-dot { border-color: var(--line-strong); box-shadow: none; }
.ev b { font-size: .875rem; font-weight: 600; display: block; overflow-wrap: anywhere; }
.ev small { display: block; margin-top: 2px; font-size: .78125rem; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.doc-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-md);
  background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; transition: background-color .15s;
}
.doc-link:hover { background: var(--surface-2); }
.doc-link > span:nth-child(2) { flex: 1; min-width: 0; }
.doc-link b { display: block; font-size: .875rem; font-weight: 600; }
.doc-link small { display: block; font-size: .75rem; color: var(--muted); }
.doc-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.doc-link > .ui-icon { color: var(--muted); width: 16px; height: 16px; }
.help-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; flex-wrap: wrap; }
.help-card h3 { font-size: .9375rem; font-weight: 600; }
.help-card p { font-size: .8125rem; color: var(--muted); }

/* ── DETAILS TAB: scoped module (account-dashboard.js) ── */
#accountModuleStatus { padding: 18px 20px; margin-bottom: 18px; }
#accountModuleStatusText { font-size: .875rem; line-height: 1.7; margin-bottom: 12px; }
#account-v2-root.sp2-root { color: var(--text); font-size: .9375rem; }
#account-v2-root .sp2-shell { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
#account-v2-root .sp2-toolbar { grid-column: 1 / -1; justify-content: flex-end; }
#account-v2-root #sp2-context, #account-v2-root #sp2-projects, #account-v2-root #sp2-figures { grid-column: 1 / -1; }
#account-v2-root .sp2-section { position: relative; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
#account-v2-root .sp2-section::before { content: ""; position: absolute; inset-block-start: -1px; inset-inline: 18px; height: 1px; background: linear-gradient(90deg, transparent, rgba(31, 200, 227, .55), transparent); }
#account-v2-root .sp2-h { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 14px; }
#account-v2-root .sp2-h3, #account-v2-root .sp2-h4, #account-v2-root .sp2-h5 { color: var(--text); font-weight: 600; }
#account-v2-root .sp2-facts { gap: 12px 18px; }
#account-v2-root .sp2-fact { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
#account-v2-root .sp2-fact dt { font-size: .75rem; color: var(--muted); }
#account-v2-root .sp2-fact dd { font-size: .9375rem; color: var(--text); font-variant-numeric: tabular-nums; }
#account-v2-root .sp2-note { font-size: .78125rem; color: var(--muted); line-height: 1.6; }
#account-v2-root .sp2-state { color: var(--text-2); }
#account-v2-root .sp2-row, #account-v2-root .sp2-unit { border-color: var(--line); border-radius: var(--r-md); background: var(--surface); }
#account-v2-root .sp2-row:hover { background: var(--surface-2); }
#account-v2-root .sp2-btn, #account-v2-root .sp2-select, #account-v2-root .sp2-input {
  min-height: 40px; background: var(--field); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: max(16px, 1rem);
}
#account-v2-root .sp2-btn { background: var(--surface); font-size: .875rem; font-weight: 600; }
#account-v2-root .sp2-btn:hover:not([disabled]) { background: var(--surface-2); border-color: var(--brand-border); }
#account-v2-root .sp2-btn[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
#account-v2-root .sp2-input:focus, #account-v2-root .sp2-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--cyan-soft); }
#account-v2-root :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#account-v2-root .sp2-progress { appearance: none; height: 6px; border: 0; border-radius: 6px; overflow: hidden; background: var(--track); margin-top: 10px; }
#account-v2-root .sp2-progress::-webkit-progress-bar { background: var(--track); }
#account-v2-root .sp2-progress::-webkit-progress-value { background: var(--meter); border-radius: 6px; }
#account-v2-root .sp2-progress::-moz-progress-bar { background: var(--brand); }
#account-v2-root .sp2-link { color: var(--brand); font-weight: 600; }

/* ── PLAN TAB ── */
.plan-card { padding: 22px 24px; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px; }
.plan-card-info { flex: 1 1 320px; min-width: 0; }
.plan-name-big { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 6px; }
.plan-price { font-size: .875rem; color: var(--text-2); line-height: 1.6; }
.usage-note { font-size: .78125rem; color: var(--muted); line-height: 1.6; margin-top: 8px; }
.usage-note:empty { display: none; }
.plan-card-action { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; min-width: 200px; }
#plansCompare .ladder { margin-top: 18px; }
.plan-card .compare-features { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; }
.ladder { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.compare-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px 16px 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2);
}
.compare-card[data-current="true"] {
  background: linear-gradient(180deg, var(--brand-soft), var(--surface)) padding-box, linear-gradient(140deg, var(--brand), var(--cyan)) border-box;
  border-color: transparent; box-shadow: var(--glow);
}
.compare-tag { position: absolute; inset-block-start: -10px; inset-inline-start: 14px; padding: 1px 9px; border-radius: 999px; font-size: .6875rem; font-weight: 700; color: #fff; background: var(--grad); box-shadow: 0 0 12px rgba(31, 200, 227, .5); }
.compare-name { font-size: 1.0625rem; font-weight: 700; }
.compare-price { font-size: .9375rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.compare-features { list-style: none; display: grid; gap: 5px; font-size: .8125rem; color: var(--text-2); flex: 1; align-content: start; }
.compare-features li { display: flex; gap: 7px; align-items: flex-start; line-height: 1.45; }
.compare-features li::before { content: ""; width: 14px; height: 14px; flex: none; margin-top: 2px; background: var(--ok); -webkit-mask: var(--check) center / contain no-repeat; mask: var(--check) center / contain no-repeat; }
.compare-card .btn-contact-plan, .compare-card .btn-primary { width: 100%; min-height: 40px; }
.compare-card[data-offer="operations"] .compare-name { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root { --check: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2012l4%204L19%206%22%2F%3E%3C%2Fsvg%3E"); }
.portal-request-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sub-block { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.sub-block h3 { font-size: .9375rem; font-weight: 600; margin-bottom: 4px; }
.notice { margin: 12px 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--brand-soft); border: 1px solid var(--brand-border); }
.notice-title { display: flex; align-items: center; gap: 6px; font-size: .9375rem; font-weight: 700; color: var(--brand-ink); margin-bottom: 6px; }
.notice-text { font-size: .875rem; color: var(--text-2); line-height: 1.65; margin-bottom: 6px; }
.notice-sub { font-size: .8125rem; color: var(--muted); }
#downgradeButtons { margin: 12px 0; }
#downgradeButtons button {
  min-height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: 600 .84375rem var(--font-sans); cursor: pointer;
}
#downgradeButtons button:hover { border-color: var(--brand-border); background: var(--surface-2); }
.confirm-card { margin-top: 12px; padding: 16px; border-radius: var(--r-md); background: var(--danger-soft); border: 1px solid var(--danger-border); }
.confirm-text { font-size: .9rem; color: var(--danger); line-height: 1.6; margin-bottom: 12px; }
.confirm-terms { display: none; align-items: flex-start; gap: 12px; font-size: .875rem; line-height: 1.55; color: var(--text-2); margin-bottom: 12px; }
.confirm-terms input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }
.settings-msg { font-size: .84375rem; line-height: 1.6; margin-top: 10px; overflow-wrap: anywhere; }
.settings-msg:empty { display: none; }
.danger-zone > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; cursor: pointer; color: var(--danger); font-weight: 600; font-size: .9375rem; }
.danger-zone > summary::-webkit-details-marker { display: none; }
.danger-zone > summary::after { content: ""; width: 9px; height: 9px; border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
.danger-zone[open] > summary::after { transform: rotate(-135deg); }
.danger-zone[open] > summary { border-bottom: 1px solid var(--line-2); }
.danger-card { padding: 18px 20px 20px; }
.danger-title { font-size: .9375rem; font-weight: 700; color: var(--danger); margin-bottom: 6px; }
.danger-text { font-size: .875rem; color: var(--text-2); line-height: 1.75; margin-bottom: 16px; overflow-wrap: anywhere; }
.danger-text strong { color: var(--text); }

/* ── DOCUMENTS ── */
.doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.doc-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.doc-card h3 { font-size: 1rem; font-weight: 600; }
.doc-card p { font-size: .84375rem; color: var(--muted); line-height: 1.7; flex: 1; }
.doc-card .doc-icon { width: 44px; height: 44px; border-radius: 12px; }
.doc-card .doc-icon .ui-icon { width: 21px; height: 21px; }

/* ── PERSONAL ── */
.settings-row { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 12px 28px; padding: 20px; border-bottom: 1px solid var(--line-2); align-items: start; }
.settings-row:last-child { border-bottom: 0; }
.settings-row h3 { font-size: .9375rem; font-weight: 600; }
.settings-hint { font-size: .8125rem; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.settings-email { font-size: .875rem; color: var(--text-2); direction: ltr; text-align: end; overflow-wrap: anywhere; margin-bottom: 10px; }
.settings-form { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-form .field { flex: 1 1 200px; }
.settings-form .btn-primary { flex: 0 0 auto; min-width: 140px; }

/* ── SUPPORT ── */
.support-form { display: grid; gap: 12px; }
.co-form { display: flex; flex-direction: column; gap: 10px; }
.file-drop {
  display: flex; align-items: center; gap: 8px; min-height: var(--control-h); padding: 10px 14px; cursor: pointer;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: .875rem;
  transition: border-color .15s, background-color .15s;
}
.file-drop:hover, .file-drop:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.file-list { font-size: .84375rem; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.file-list:empty { display: none; }
.ticket-status { display: none; font-size: .875rem; border-radius: var(--r-md); padding: 12px 14px; line-height: 1.6; overflow-wrap: anywhere; }
.contact-list { display: grid; gap: 10px; }
.contact-card {
  display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px 16px; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); transition: border-color .15s, background-color .15s;
}
.contact-card:hover { border-color: var(--brand-border); background: var(--surface-2); }
.contact-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.contact-label { font-size: .78125rem; color: var(--muted); font-weight: 500; }
.contact-value { font-size: .9375rem; font-weight: 600; overflow-wrap: anywhere; }

/* ── FOOTER ── */
.dash-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .78125rem; color: var(--muted); }
.footer-links { display: flex; gap: 2px 18px; flex-wrap: wrap; }
.footer-links a, .footer-links button { min-height: 36px; display: inline-flex; align-items: center; background: none; border: 0; padding: 0; font: 500 .78125rem var(--font-sans); color: var(--text-2); text-decoration: none; cursor: pointer; }
.footer-links a:hover, .footer-links button:hover { color: var(--text); text-decoration: underline; }

/* ── BOTTOM NAV (mobile) ── */
.dash-bottom-nav { display: none; position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 100; padding-block-end: env(safe-area-inset-bottom, 0px); background: rgba(10, 22, 36, .92); backdrop-filter: blur(14px); border-top: 1px solid rgba(255, 255, 255, .08); }
.dash-bottom-nav-inner { display: flex; }
.bottom-nav-btn {
  position: relative; flex: 1; min-width: 0; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px; background: none; border: 0; cursor: pointer; color: #8ea3b9; font: 600 .6875rem var(--font-sans);
}
.bottom-nav-btn .ui-icon { width: 21px; height: 21px; }
.bottom-nav-btn.active { color: #fff; }
.bottom-nav-btn.active .ui-icon { color: var(--cyan); filter: drop-shadow(0 0 6px rgba(31, 200, 227, .7)); }
.bottom-nav-btn.active::before { content: ""; position: absolute; inset-block-start: 0; inset-inline: 28%; height: 2px; border-radius: 0 0 2px 2px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

/* ── CHECKOUT MODAL ── */
.checkout-overlay { display: none; position: fixed; inset: 0; z-index: 500; background: var(--scrim); backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; }
.checkout-overlay.open { display: flex; }
.checkout-modal { position: relative; width: 100%; max-width: 540px; margin: auto; padding: 28px 26px 24px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2); animation: rise .25s var(--ease) both; }
.checkout-modal::before { content: ""; position: absolute; inset-block-start: -1px; inset-inline: 28px; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); }
.checkout-modal a { color: var(--brand); font-weight: 600; }
.checkout-close, .legal-close { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; border-radius: var(--r-md); color: var(--muted); font-size: 1.15rem; cursor: pointer; }
.legal-close { position: static; }
.checkout-close:hover, .legal-close:hover { background: var(--surface-2); color: var(--text); }
.checkout-badge { display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 52px); margin-bottom: 12px; padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--brand-ink); background: var(--brand-soft); border: 1px solid var(--brand-border); }
.checkout-badge:empty, .checkout-title:empty { display: none; }
.checkout-title { font-size: 1.25rem; font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.checkout-features { list-style: none; display: grid; gap: 8px; margin-bottom: 16px; }
.checkout-features li { display: flex; align-items: flex-start; gap: 8px; font-size: .875rem; color: var(--text-2); }
.checkout-features li::before { content: ""; width: 16px; height: 16px; flex: 0 0 16px; background: var(--ok); -webkit-mask: var(--check) center / contain no-repeat; mask: var(--check) center / contain no-repeat; }
.checkout-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.checkout-total-label { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.checkout-total-price { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.co-step-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.co-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0 0 14px; padding: 12px 14px; font-size: .875rem; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.co-summary dt { color: var(--muted); }
.co-summary dd { font-weight: 600; overflow-wrap: anywhere; }
.co-check-row { display: flex; align-items: flex-start; gap: 12px; min-height: var(--control-h); margin-bottom: 16px; cursor: pointer; }
.co-check-row input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--brand); }
.co-check-row span { font-size: .875rem; color: var(--text-2); line-height: 1.55; }
.co-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.co-actions .co-cta { flex: 1 1 200px; }
.co-pay-label { margin-bottom: 10px; font-size: .84375rem; font-weight: 600; color: var(--text-2); line-height: 1.5; }
.co-pay-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.co-pay-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; padding: 10px; border-radius: var(--r-md); background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); font: 700 .9375rem var(--font-sans); cursor: pointer; }
.co-pay-btn:hover { background: var(--surface-2); }
.co-pay-btn .co-pay-app { display: inline-flex; align-items: center; gap: 6px; }
.co-pay-btn .co-pay-price { font-size: .8rem; font-weight: 500; color: var(--muted); }
.co-pay-btn[aria-pressed="true"], .co-contact-pref[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.co-contact-pref { width: 100%; }
.co-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; font-size: .84375rem; font-weight: 600; color: var(--muted); }
.co-or::before, .co-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.co-contact-title { font-size: .875rem; font-weight: 600; margin-bottom: 10px; }
.co-contact-title:empty { display: none; }
.co-submit { width: 100%; }
.co-note { margin-top: 12px; font-size: .84375rem; color: var(--muted); text-align: center; line-height: 1.6; overflow-wrap: anywhere; }
.co-note-start { text-align: start; margin-block: 0 14px; }
.co-error { margin-top: 8px; font-size: .875rem; color: var(--danger); line-height: 1.5; overflow-wrap: anywhere; }
.co-error:empty { display: none; }
.checkout-modal:focus, .legal-box:focus, .co-error:focus { outline: none; }
.checkout-success { display: none; flex-direction: column; align-items: center; gap: 12px; padding: 16px 0 4px; text-align: center; }
.checkout-success.show { display: flex; }
.checkout-success-icon { font-size: 2.5rem; line-height: 1; color: var(--ok); }
.checkout-success-title { font-size: 1.125rem; font-weight: 700; }
.checkout-success-sub { font-size: .875rem; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.checkout-success .btn-primary { min-width: 180px; margin-top: 8px; }
#entTosCheckLabel { color: var(--text-2) !important; }
#entTosCta:not(:disabled) { background: var(--grad) !important; color: #fff !important; border: 1px solid transparent !important; cursor: pointer !important; }
#entTosCta:disabled { background: var(--surface-2) !important; color: var(--muted) !important; border: 1px solid var(--line) !important; box-shadow: none !important; cursor: not-allowed !important; }
#unsubCloseBtn { background: var(--grad) !important; color: #fff !important; border: 1px solid transparent !important; border-radius: var(--r-md) !important; }

/* Colours that script writes inline (state messages) follow the semantic tokens in both themes. */
.dash-main [style*="248, 113, 113"], .dash-main [style*="color:#f87171"], .dash-main [style*="color: rgb(248, 113, 113)"],
.dash-main [style*="color:#fca5a5"] { color: var(--danger) !important; }
.dash-main [style*="74, 222, 128"], .dash-main [style*="134, 239, 172"], .dash-main [style*="color:#86efac"] { color: var(--ok) !important; }
.dash-main [style*="color:rgba(200,200,210"], .dash-main [style*="color:#9ca3af"] { color: var(--muted) !important; }

/* ── LEGAL MODAL ── */
.legal-overlay { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--scrim); backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.legal-overlay.open { display: flex; }
.legal-box { display: flex; flex-direction: column; width: 100%; max-width: 680px; max-height: min(82dvh, 760px); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2); animation: rise .25s var(--ease) both; }
.legal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; padding-inline-start: 24px; border-bottom: 1px solid var(--line); }
.legal-header h2 { font-size: 1.125rem; font-weight: 700; }
.legal-body { padding: 20px 24px 24px; overflow-y: auto; font-size: .90625rem; line-height: 1.8; color: var(--text-2); overflow-wrap: anywhere; }
.legal-body h3 { color: var(--text); font-size: 1rem; margin: 18px 0 8px; }
.legal-body ul { padding-inline-start: 20px; }
.legal-body li { margin-bottom: 5px; }
.legal-body p { margin-bottom: 10px; }

/* ── ACCESSIBILITY WIDGET ── */
.a11y-btn { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 900; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; border: 2px solid var(--surface); font-size: 1.35rem; cursor: pointer; box-shadow: 0 8px 22px -6px rgba(31, 140, 214, .7); }
.a11y-panel { position: fixed; bottom: 78px; inset-inline-end: 20px; z-index: 900; width: min(300px, calc(100vw - 32px)); max-height: calc(100dvh - 120px); display: none; flex-direction: column; overflow-y: auto; font-size: .875rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.a11y-panel.open { display: flex; }
.a11y-ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 8px; padding-inline-start: 16px; background: var(--brand-soft); border-bottom: 1px solid var(--line); }
.a11y-ph-title { font-size: .9375rem; font-weight: 700; }
.a11y-ph-close { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: var(--r-md); color: var(--muted); cursor: pointer; }
.a11y-ph-close:hover { color: var(--text); background: var(--surface-2); }
.a11y-section { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.a11y-section-title { margin-bottom: 8px; font-size: .8125rem; font-weight: 600; color: var(--muted); }
.a11y-font-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.a11y-font-btn, .a11y-contrast-opt, .a11y-link-btn { min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font: .84375rem var(--font-sans); cursor: pointer; }
.a11y-font-btn { flex: 1; padding: 0 6px; }
.a11y-font-btn:hover, .a11y-contrast-opt:hover, .a11y-link-btn:hover { background: var(--surface-2); border-color: var(--brand-border); }
.a11y-font-counter { min-width: 32px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.a11y-contrast-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y-contrast-opt { padding: 0 6px; }
.a11y-contrast-opt.active { background: var(--brand-soft); border-color: var(--brand); font-weight: 700; }
.a11y-toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--control-h); padding: 4px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.a11y-toggle-row:last-child { border-bottom: 0; }
.a11y-toggle-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.a11y-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background-color .15s; }
.a11y-switch.on { background: var(--brand); border-color: var(--brand); }
.a11y-switch::after { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: inset-inline-start .15s; }
.a11y-switch.on::after { inset-inline-start: 20px; }
.a11y-links { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.a11y-link-btn { justify-content: flex-start; padding: 0 12px; }
.a11y-reset { margin: 0 16px 16px; min-height: var(--control-h); border-radius: var(--r-sm); background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); font: 600 .875rem var(--font-sans); cursor: pointer; }

/* ── MOTION ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sweep { from { transform: translateX(120%); } to { transform: translateX(-260%); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.dash-tab-panel.active .card, .dash-tab-panel.active .plan-strip { animation: rise .55s var(--ease) both; animation-delay: var(--d, 0s); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── RESPONSIVE ── */
@media (max-width: 1380px) {
  .meters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .plan-strip { grid-template-columns: minmax(0, 1fr); }
  .plan-id { padding-inline-end: 0; border-inline-end: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
  .plan-actions { justify-content: flex-start; }
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #account-v2-root .sp2-shell { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --side-w: 0px; }
  #mainNav { position: sticky; inset-block-start: 0; width: auto; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; overflow: visible; }
  .nav-logo { padding: 0; border: 0; }
  .nav-logo img { width: 118px; }
  .nav-org, .portal-nav, .nav-user { display: none; }
  .nav-foot { margin: 0; margin-inline-start: auto; padding: 0; border: 0; }
  .dash-bottom-nav { display: block; }
  .dash-main { padding-block: 18px calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px)); }
  body[data-screen="dash"] .a11y-btn { bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom, 0px)); }
  body[data-screen="dash"] .a11y-panel { bottom: calc(var(--bottom-nav-h) + 72px + env(safe-area-inset-bottom, 0px)); }
  .meters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .auth-screen { padding: 64px 14px calc(var(--legal-bar-h) + 56px); }
  .login-card { padding: 28px 20px 22px; }
  .auth-legal-bar { gap: 0 14px; }
  .auth-legal-bar > span { flex: 0 0 100%; text-align: center; font-size: .75rem; }
  .dash-hero { align-items: flex-start; }
  .dash-hero-actions { width: 100%; }
  .dash-hero-actions .portal-primary { flex: 1; }
  .plan-strip, .portal-state { padding: 18px; }
  .plan-id h2 { font-size: 1.5rem; }
  .meters { gap: 10px; }
  .meter { padding: 14px; }
  .meter-v b { font-size: 1.3rem; }
  .meter-f { flex-direction: column; gap: 2px; }
  .doc-grid, .ladder { grid-template-columns: minmax(0, 1fr); }
  .ptable th:nth-child(2), .ptable td:nth-child(2) { display: none; }
  .ptable th, .ptable td { padding-inline: 14px; }
  .card-h { padding: 14px 16px; }
  .search-box { width: 100%; }
  .co-actions .co-cta, .co-actions .btn-secondary { flex-basis: 100%; }
  .checkout-modal { padding: 24px 16px 20px; }
  .plan-card-action { min-width: 0; flex-basis: 100%; }
}

/* The header refresh drives the detailed view; its own copy of the button is not repeated. */
#account-v2-root #sp2-refresh { display: none; }
.cmp .h.n { font-family: var(--font-sans); }
/* Values older than the freshness window stay visible, dimmed, until the next refresh. */
.meter[data-state="stale"] .meter-v b, .meter[data-state="stale"] .bar, .ptable[data-state="stale"] .load { opacity: .5; transition: opacity .4s; }
.meter[data-state="stale"] .meter-f span:last-child { color: var(--warn); font-weight: 600; }
/* Detailed project list: cards side by side instead of one tall column. */
#account-v2-root #sp2-projects .sp2-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
#account-v2-root #sp2-projects .sp2-search { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
#account-v2-root #sp2-projects .sp2-search label { display: grid; gap: 6px; flex: 1 1 280px; font-size: .8125rem; color: var(--muted); }
