/* 77 Carrental — Fleet Operations Console
   Refreshed: light sidebar, rounder cards, fully responsive.
   Single file. No framework. Light + dark.
*/

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #f4f6fb;
  --bg-elev: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --panel-hover: #eef2f9;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --line: #e6eaf2;
  --line-strong: #cfd6e3;
  --accent: #0048ff;
  --accent-strong: #0036cc;
  --accent-soft: #e6edff;
  --accent-soft-2: #d5e0ff;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --ok: #10b981;
  --ok-soft: #d1fae5;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --info: #3b82f6;
  --info-soft: #dbeafe;
  --teal: #14b8a6;
  --teal-soft: #ccfbf1;
  --slate: #64748b;
  --slate-soft: #e2e8f0;
  --sidebar: #ffffff;
  --sidebar-soft: #f5f7fb;
  --sidebar-active-bg: var(--accent);
  --sidebar-active-text: #ffffff;
  --sidebar-text: #334155;
  --sidebar-text-soft: #64748b;
  --ring: 0 0 0 3px rgba(0, 72, 255, 0.18);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px -12px rgba(15, 23, 42, 0.18);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, sans-serif;
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 248px;
}

[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg-elev: #0f172a;
  --panel: #111a2e;
  --panel-soft: #0f172a;
  --panel-hover: #182343;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --line: #1e293b;
  --line-strong: #334155;
  --accent: #4f8bff;
  --accent-strong: #6ea0ff;
  --accent-soft: #1b2845;
  --accent-soft-2: #243763;
  --danger: #f87171;
  --danger-soft: #3f1d1d;
  --ok: #34d399;
  --ok-soft: #0f3a2c;
  --warn: #fbbf24;
  --warn-soft: #3a2a0d;
  --info: #60a5fa;
  --info-soft: #16263d;
  --teal: #2dd4bf;
  --teal-soft: #0e2e29;
  --slate: #94a3b8;
  --slate-soft: #1e293b;
  --sidebar: #0b1220;
  --sidebar-soft: #111a2e;
  --sidebar-active-bg: var(--accent);
  --sidebar-active-text: #ffffff;
  --sidebar-text: #cbd5e1;
  --sidebar-text-soft: #94a3b8;
  --ring: 0 0 0 3px rgba(79, 139, 255, 0.32);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.36);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.52);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c;
    --bg-elev: #0f172a;
    --panel: #111a2e;
    --panel-soft: #0f172a;
    --panel-hover: #182343;
    --text: #f1f5f9;
    --text-soft: #cbd5e1;
    --muted: #94a3b8;
    --line: #1e293b;
    --line-strong: #334155;
    --accent: #4f8bff;
    --accent-strong: #6ea0ff;
    --accent-soft: #1b2845;
    --accent-soft-2: #243763;
    --danger: #f87171;
    --danger-soft: #3f1d1d;
    --ok: #34d399;
    --ok-soft: #0f3a2c;
    --warn: #fbbf24;
    --warn-soft: #3a2a0d;
    --info: #60a5fa;
    --info-soft: #16263d;
    --teal: #2dd4bf;
    --teal-soft: #0e2e29;
    --sidebar: #0b1220;
    --sidebar-soft: #111a2e;
    --sidebar-text: #cbd5e1;
    --sidebar-text-soft: #94a3b8;
    --ring: 0 0 0 3px rgba(79, 139, 255, 0.32);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.36);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.52);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
/* Never let the page scroll sideways. Beyond the obvious polish, a horizontal
   overflow makes the layout viewport wider than the screen, which shifts any
   full-screen position:fixed overlay (e.g. the document camera) off-centre.
   `clip` prevents the overflow without creating a scroll container, so sticky
   elements keep working. Tables/wide content still scroll inside .table-wrap. */
html { overflow-x: clip; }
body { overflow-x: clip; max-width: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img, svg { max-width: 100%; display: block; }

/* ---------- Custom scrollbars — thin, rounded, subtle, theme-aware ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(100,116,139,0.42) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.38); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,0.62); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
@media (prefers-color-scheme: dark) {
  * { scrollbar-color: rgba(148,163,184,0.40) transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.34); background-clip: content-box; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.60); background-clip: content-box; }
}
:root[data-theme="dark"] * { scrollbar-color: rgba(148,163,184,0.40) transparent; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.34); background-clip: content-box; }
:root[data-theme="light"] * { scrollbar-color: rgba(100,116,139,0.42) transparent; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.38); background-clip: content-box; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }

:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Layout shell ---------- */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns 0.22s ease;
}

/* Collapsible sidebar (desktop) — the topbar hamburger hides/shows it so agents
   can reclaim the space. State persists in localStorage (html.sb-collapsed is
   restored before first paint). On <=960px the same button drives the drawer. */
@media (min-width: 961px) {
  .sidebar { transition: transform 0.22s ease, visibility 0.22s ease; }
  html.sb-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr); }
  html.sb-collapsed .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    visibility: hidden;
  }
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}
[data-theme="dark"] .sidebar,
:root:not([data-theme="light"]) .sidebar { border-right-color: var(--line); }

/* Brand block */
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; padding: 6px 6px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.brand-logo {
  width: 132px; height: auto; flex-shrink: 0;
  display: block;
}
.brand-meta { display: grid; line-height: 1.2; min-width: 0; }
.brand-meta strong {
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-meta small {
  font-size: 11px; color: var(--muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
}
[data-theme="dark"] .brand-logo,
:root:not([data-theme="light"]) .brand-logo { filter: brightness(0) invert(1); opacity: 0.95; }

/* Nav */
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--sidebar-text);
  padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.sidebar nav a:hover {
  background: var(--sidebar-soft);
  color: var(--text);
}
.sidebar nav a:hover svg { opacity: 1; }
.sidebar nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: 0 4px 14px -2px rgba(0, 72, 255, 0.35);
}
.sidebar nav a.active svg { opacity: 1; }
[data-theme="dark"] .sidebar nav a.active,
:root:not([data-theme="light"]) .sidebar nav a.active {
  box-shadow: 0 4px 14px -2px rgba(79, 139, 255, 0.45);
}

.sidebar-status {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--sidebar-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 12px; font-weight: 700;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.sidebar-status:hover { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-strong); }
.sidebar-status .health-dot { width: 10px; height: 10px; flex-shrink: 0; }
.sidebar-foot {
  padding: 10px 12px;
  font-size: 12px; color: var(--muted);
}
.sidebar-foot strong { color: var(--text); display: inline; font-size: 12px; font-weight: 700; }
[data-theme="dark"] .sidebar-foot strong,
:root:not([data-theme="light"]) .sidebar-foot strong { color: #fff; }

/* Mobile nav backdrop — hidden by default so it doesn't take a grid cell. */
.nav-backdrop { display: none; }

/* Main pane */
.main {
  min-width: 0;
  padding: clamp(16px, 2vw, 28px) clamp(16px, 2.5vw, 32px) 48px;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 22px; flex-wrap: wrap;
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.eyebrow {
  margin: 0 0 4px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 11px; font-weight: 700;
}
h1 {
  margin: 0; font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.2;
}
h2 { margin: 0 0 14px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

.topbar-tools {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; justify-content: flex-end;
}

/* User box */
.userbox {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 10px 6px 6px;
  box-shadow: var(--shadow-xs);
}
.userbox-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.userbox-meta { display: grid; line-height: 1.2; }
.userbox-meta span { font-weight: 700; font-size: 13px; }
.userbox-meta small { color: var(--muted); text-transform: capitalize; font-size: 11px; }
.userbox a {
  color: var(--muted); text-decoration: none; font-size: 13px;
  margin-left: 4px; padding: 8px; border-radius: 8px;
  display: inline-flex; align-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.userbox a:hover { background: var(--accent-soft); color: var(--accent-strong); }

/* Icon button + theme toggle + hamburger */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text-soft); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-strong); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Notification bell toggle */
.notify-toggle .bell-off { display: none; }
.notify-toggle.muted .bell-on { display: none; }
.notify-toggle.muted .bell-off { display: inline-flex; color: var(--muted); }
.notify-toggle:not(.muted) svg {
  animation: bell-pulse 4s ease-in-out infinite;
  transform-origin: top center;
}
@keyframes bell-pulse {
  0%, 92%, 100% { transform: rotate(0deg); }
  94%           { transform: rotate(8deg); }
  96%           { transform: rotate(-8deg); }
  98%           { transform: rotate(4deg); }
}

/* Generic modal overlay (used by confirm + resign chooser etc.) */
html.modal-locked, html.modal-locked body { overflow: hidden; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px;
  animation: fade-in 200ms ease both;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px clamp(24px, 4vw, 32px);
  width: min(440px, 100%);
  box-shadow: var(--shadow-lg);
  animation: modal-in 240ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.modal-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; }

/* Customer-document tiles on the contract detail page */
.doc-tiles {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.doc-tile {
  display: grid; gap: 0;
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); cursor: pointer; overflow: hidden;
  text-align: left; font: inherit; color: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.doc-tile:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.doc-tile:focus-visible { box-shadow: var(--ring); }
.doc-tile-thumb {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  background: var(--panel-soft); overflow: hidden;
}
.doc-tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-tile-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; min-width: 0;
}
.doc-tile-meta strong { font-size: 13px; font-weight: 600; }
.doc-tile-meta small { font-size: 11px; }

/* Lightbox / zoom viewer */
/* The hidden attribute must always win, even over class-level display rules
   (e.g. .dep-mode-opts { display:grid } or .btn { display:inline-flex }). */
[hidden] { display: none !important; }

/* Deposit-mode chooser (Hold vs Charge) */
.dep-mode-opts { display: grid; gap: 10px; }
.dep-mode-opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-soft); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.dep-mode-opt:hover { border-color: var(--accent); background: var(--panel-hover); }
.dep-mode-opt:active { transform: translateY(1px); }
.dep-mode-ico { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.dep-mode-txt { display: flex; flex-direction: column; gap: 3px; }
.dep-mode-txt strong { font-size: 14px; color: var(--text); }
.dep-mode-txt small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.pmm-field { margin-bottom: 12px; }
.pmm-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.pmm-field input[type=file] { font-size: 13px; width: 100%; }

/* Top route-progress bar (instant-nav feel). Shown during page transitions. */
.route-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 10px var(--accent);
  opacity: 0; pointer-events: none;
  transition: width .24s ease, opacity .3s ease;
  border-top-right-radius: 3px; border-bottom-right-radius: 3px;
}
.route-progress.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .route-progress { transition: opacity .2s ease; }
}

/* ---------- Polish: smooth page entrance + consistent keyboard focus ring ---------- */
@media (prefers-reduced-motion: no-preference) {
  .main > :not(.topbar) { animation: page-enter .42s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
:where(a, button, .btn, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
html { scroll-behavior: smooth; }

.lightbox {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(7, 12, 24, 0.92);
  display: grid; place-items: center;
  padding: 56px 16px 80px;
  animation: fade-in 200ms ease both;
}
.lightbox[hidden] { display: none !important; }
.lightbox-stage {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  overflow: hidden;
}
.lightbox-stage img {
  max-width: 92vw; max-height: 80vh;
  width: auto; height: auto;
  display: block; user-select: none; cursor: zoom-in;
  transform-origin: center;
  transition: transform 180ms cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  border-radius: 8px;
}
.lightbox-stage iframe {
  width: 92vw; height: 82vh; max-width: 980px;
  border: 0; border-radius: 8px; background: #fff;
  transform-origin: center;
  transition: transform 180ms cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.lightbox-stage img[hidden],
.lightbox-stage iframe[hidden] { display: none !important; }
.lightbox-close {
  position: absolute; top: 14px; right: 14px;
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 22px; cursor: pointer;
  transition: background var(--t-fast);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 64px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.10); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 32px; cursor: pointer;
  transition: background var(--t-fast);
}
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-toolbar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 999px; padding: 6px 10px;
  color: #fff; font-size: 13px;
}
.lightbox-toolbar .icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: 0; color: #fff;
}
.lightbox-toolbar .icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.lightbox-zoom-label { min-width: 48px; text-align: center; font-weight: 600; }
.lightbox-label { padding: 0 10px; opacity: 0.85; }
@media (max-width: 600px) {
  .lightbox-nav { width: 40px; height: 56px; font-size: 24px; }
  .lightbox-prev { left: 8px; } .lightbox-next { right: 8px; }
  .lightbox-toolbar { gap: 4px; padding: 4px 8px; font-size: 12px; }
  .lightbox-label { display: none; }
}

/* Welcome overlay (one-shot, fires once per login) */
html.welcome-locked, html.welcome-locked body { overflow: hidden; }
.welcome-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: radial-gradient(ellipse at center, rgba(0, 30, 90, 0.75) 0%, rgba(0, 0, 0, 0.85) 90%);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity 480ms cubic-bezier(.2,.7,.2,1);
  cursor: pointer;
}
.welcome-overlay.show { opacity: 1; pointer-events: auto; }
.welcome-card {
  text-align: center; color: #fff;
  padding: 40px clamp(28px, 6vw, 56px);
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  transition: opacity 520ms 120ms cubic-bezier(.2,.7,.2,1), transform 520ms 120ms cubic-bezier(.2,.7,.2,1);
}
.welcome-overlay.show .welcome-card { opacity: 1; transform: translateY(0) scale(1); }
.welcome-greeting {
  font-size: clamp(14px, 1.6vw, 18px);
  color: rgba(255, 255, 255, 0.72); margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.welcome-name {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 64px); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.05;
  background: linear-gradient(180deg, #ffffff 0%, #c9d6ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: capitalize;
}
.welcome-sub {
  font-size: clamp(13px, 1.4vw, 15px);
  color: rgba(255, 255, 255, 0.62);
  margin-top: 14px;
}

/* Live-row highlight: a row briefly glows when inserted via Notify */
@keyframes row-highlight {
  0%   { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  100% { background: transparent;        box-shadow: inset 0 0 0 transparent; }
}
.row-new { animation: row-highlight 2.2s ease-out 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.nav-toggle { display: inline-flex; position: relative; }

/* Attention pulse: a soft blue halo that ripples out from the hamburger
   button so mobile/tablet users notice the navigation drawer. Applied
   only on first visit (toggled by JS via localStorage) and stops the
   moment the user taps it. */
.nav-toggle.nav-toggle-attention::before,
.nav-toggle.nav-toggle-attention::after {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: navHaloPulse 1.8s ease-out infinite;
}
.nav-toggle.nav-toggle-attention::after {
  animation-delay: 0.9s;
}
.nav-toggle.nav-toggle-attention {
  animation: navBlink 1.6s ease-in-out infinite;
}
@keyframes navBlink {
  0%, 100% { background: var(--panel-soft); }
  50%      { background: var(--accent-soft, rgba(0, 72, 255, 0.16)); }
}
@keyframes navHaloPulse {
  0%   { transform: scale(0.9); opacity: 0.7; }
  70%  { transform: scale(1.45); opacity: 0;   }
  100% { transform: scale(1.45); opacity: 0;   }
}
@media (prefers-reduced-motion: reduce) {
  .nav-toggle.nav-toggle-attention,
  .nav-toggle.nav-toggle-attention::before,
  .nav-toggle.nav-toggle-attention::after { animation: none; }
}

/* ---------- Grids ---------- */
.grid { display: grid; gap: 16px; }
/* Grid items default to min-width:auto, so a wide table or nowrap button can
   stretch the whole column past the viewport (and get clipped by the app-wide
   overflow-x:clip). Let every grid child shrink below its content size. */
.grid > *, .grid-2 > *, .two > * { min-width: 0; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr); margin-top: 16px; }

/* ---------- Card ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 1.8vw, 22px);
  box-shadow: var(--shadow-sm);
}

.stat {
  min-height: 120px;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 12px;
}
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat strong {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em;
  color: var(--text);
}

/* ---------- Buttons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  text-decoration: none; font-weight: 600; font-size: 14px;
  background: var(--panel); color: var(--text);
  cursor: pointer; font-family: inherit;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--accent-soft-2); color: var(--accent-strong); background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 6px 16px -4px rgba(0, 72, 255, 0.4);
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled], .btn.is-loading { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.vertical { align-items: stretch; flex-direction: column; }
.actions.right { justify-content: flex-end; }
.actions.between { justify-content: space-between; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover { background: var(--row-hover, rgba(0,72,255,0.045)); }
/* Search autocomplete dropdown */
.ac-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; display: none;
  background: var(--panel, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15,23,42,0.14)); overflow: hidden; max-height: 340px; overflow-y: auto; }
.ac-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line, #eef1f5); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.ac-active { background: var(--row-hover, rgba(0,72,255,0.06)); }
.ac-label { font-size: 14px; font-weight: 600; color: var(--text, #0f172a); }
.ac-sub { font-size: 12px; color: var(--muted, #64748b); margin-top: 1px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-soft);
  text-align: left; padding: 12px;
  color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
.table tbody td { padding: 14px 12px; border-bottom: 1px solid var(--line); color: var(--text-soft); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--panel-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody td strong { color: var(--text); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.detail-table th { width: 170px; color: var(--muted); font-weight: 600; padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }

.table-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.table-link:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--slate-soft); color: var(--text-soft);
  text-transform: capitalize;
  border: 1px solid transparent;
  line-height: 1.4;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.9;
}
.badge.draft     { background: var(--slate-soft);  color: var(--slate); }
.badge.sent      { background: var(--info-soft);   color: var(--info); }
.badge.viewed    { background: var(--warn-soft);   color: var(--warn); }
.badge.pending_signature,
.badge.pending   { background: var(--warn-soft);   color: var(--warn); }
.badge.signed    { background: var(--ok-soft);     color: var(--ok); }
.badge.paid      { background: var(--teal-soft);   color: var(--teal); }
.badge.completed { background: var(--ok-soft);     color: var(--ok); }
.badge.failed    { background: var(--danger-soft); color: var(--danger); }
.badge.super-admin {
  background: linear-gradient(135deg, #0048ff, #6d28d9);
  color: #fff;
  border: 0;
  padding: 4px 10px 4px 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px -3px rgba(0, 72, 255, 0.35);
}
.badge.super-admin::before { display: none; }
.badge.super-admin svg { width: 12px; height: 12px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea, .field select, .input {
  width: 100%; min-height: 44px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit; color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus, .field textarea:focus, .field select:focus, .input:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.field input[disabled] { background: var(--panel-soft); color: var(--muted); cursor: not-allowed; }

.search-input { position: relative; }
.search-input input {
  width: 100%; height: 44px; padding: 0 14px 0 40px;
  border: 1px solid var(--line-strong); background: var(--panel);
  border-radius: 12px; font: inherit; color: var(--text);
}
.search-input svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted);
}
.search-input input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text-soft); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { border-color: var(--accent-soft-2); color: var(--accent-strong); background: var(--accent-soft); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active .muted { color: rgba(255, 255, 255, 0.85); }

/* ---------- Notices ---------- */
.notice {
  background: var(--info-soft); border: 1px solid transparent;
  color: var(--info); border-radius: var(--radius);
  padding: 12px 14px; font-weight: 600; font-size: 14px;
  display: flex; gap: 10px; align-items: center;
}
.notice.ok    { background: var(--ok-soft);     color: var(--ok); }
.notice.warn  { background: var(--warn-soft);   color: var(--warn); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; }

.error {
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 14px; font-weight: 600; font-size: 14px;
}

/* ---------- Dashboard ---------- */
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}
.dash-toolbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }

.kpi-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}
.kpi {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 134px;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; inset: -1px -1px auto auto;
  width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle at top right, rgba(0, 72, 255, 0.10), transparent 70%);
  pointer-events: none;
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.kpi p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi strong {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 36px); font-weight: 700; letter-spacing: -0.02em;
  color: var(--text); position: relative; z-index: 1;
}
.kpi-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; position: relative; z-index: 1;
}
.trend {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 999px;
  font-weight: 700; font-size: 12px;
}
.trend-up   { background: var(--ok-soft);     color: var(--ok); }
.trend-down { background: var(--danger-soft); color: var(--danger); }
.trend-flat { background: var(--slate-soft);  color: var(--muted); }

.stat-icon.ok    { background: var(--ok-soft);    color: var(--ok); }
.stat-icon.warn  { background: var(--warn-soft);  color: var(--warn); }
.stat-icon.teal  { background: var(--teal-soft);  color: var(--teal); }
.stat-icon.danger{ background: var(--danger-soft);color: var(--danger); }

.dash-row {
  display: grid; gap: 16px; margin-bottom: 16px;
  align-items: start;
}
.dash-row-12-6 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-row-2-1  { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-row-3    { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); }

/* Today strip — high-density quick snapshot */
.today-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(14px, 2vw, 28px);
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.today-strip-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.today-strip-left strong { font-size: 14px; font-weight: 700; color: var(--text); }
.today-strip-left .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.today-strip-stats {
  display: flex; align-items: center; gap: clamp(14px, 2vw, 28px);
  flex-wrap: wrap;
}
.today-strip-stats > div {
  display: flex; align-items: baseline; gap: 8px;
  padding-right: clamp(14px, 2vw, 24px);
  border-right: 1px solid var(--line);
}
.today-strip-stats > div:last-child { border-right: 0; padding-right: 0; }
.today-strip-stats strong {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.01em;
}
.today-strip-stats .muted { font-size: 12px; font-weight: 600; }
.today-strip-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Pipeline */
.pipeline-card { margin-bottom: 16px; }
.pipeline-bar {
  display: flex; height: 28px;
  border-radius: 999px; overflow: hidden;
  background: var(--panel-soft);
}
.pipeline-seg {
  display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 700;
  transition: filter var(--t-fast);
  min-width: 0;
}
.pipeline-seg:hover { filter: brightness(1.08); }
.pipeline-seg span { padding: 0 6px; white-space: nowrap; }
.pipeline-legend {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 14px 24px;
  font-size: 13px;
}
.pipeline-legend li {
  display: flex; align-items: baseline; gap: 6px;
  color: var(--text-soft);
}
.pipeline-legend strong { font-weight: 700; color: var(--text); }
.pipeline-legend small { margin-left: 4px; }

/* Compact contract list (recent contracts on dashboard) */
.contract-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.contract-list-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background var(--t-fast);
  color: var(--text);
}
.contract-list-item:hover { background: var(--panel-soft); }
.contract-list-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center;
}
.contract-list-main { display: grid; gap: 2px; min-width: 0; }
.contract-list-main strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contract-list-main small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Scrollable activity list (caps the card so it doesn't push siblings) */
.activity-card { max-height: 100%; }
.activity-list-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}

.chart-card { display: flex; flex-direction: column; }
.chart-wrap { position: relative; height: 280px; }
.chart-wrap-sm { height: 220px; }

.legend { display: flex; align-items: center; font-size: 12px; color: var(--muted); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.legend-list {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid; gap: 6px; font-size: 13px;
}
.legend-list li {
  display: flex; align-items: center;
  padding: 4px 0; border-bottom: 1px dashed var(--line);
}
.legend-list li:last-child { border-bottom: 0; }
.legend-list strong { margin-left: auto; font-weight: 700; color: var(--text); }

/* Activity */
.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.activity-list li {
  display: grid; grid-template-columns: 10px 1fr; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px dashed var(--line);
}
.activity-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 8px;
}
.activity-main { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.activity-main strong { font-weight: 600; color: var(--text); text-transform: capitalize; }
.activity-main small { font-size: 11px; }
.activity-main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mini stats inside Quick Actions card */
.mini-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  text-align: center;
}
.mini-stats div { padding: 8px 4px; }
.mini-stats strong {
  display: block; font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--text);
}
.mini-stats small {
  display: block; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px;
}

/* ---------- Health page ---------- */
.health-hero {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 22px;
  padding: clamp(20px, 2.5vw, 32px);
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.health-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 100% at 0% 50%, rgba(16, 185, 129, 0.12), transparent 70%);
  pointer-events: none;
}
.health-hero.health-hero-warn::before  { background: radial-gradient(ellipse 60% 100% at 0% 50%, rgba(245, 158, 11, 0.14), transparent 70%); }
.health-hero.health-hero-error::before { background: radial-gradient(ellipse 60% 100% at 0% 50%, rgba(239, 68, 68, 0.15), transparent 70%); }
.health-hero > * { position: relative; z-index: 1; }

.health-hero-orb {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--ok-soft);
  display: grid; place-items: center;
  position: relative;
}
.health-hero.health-hero-warn  .health-hero-orb { background: var(--warn-soft); }
.health-hero.health-hero-error .health-hero-orb { background: var(--danger-soft); }
.health-hero-orb::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ok); opacity: 0.4;
  animation: pulse-ring 2s ease-out infinite;
}
.health-hero.health-hero-warn  .health-hero-orb::after { border-color: var(--warn); }
.health-hero.health-hero-error .health-hero-orb::after { border-color: var(--danger); }

.health-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ok);
  position: relative;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: pulse-dot 1.6s ease-out infinite;
}
.health-dot-ok    { background: var(--ok);     box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
.health-dot-warn  { background: var(--warn);   box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); animation-name: pulse-dot-warn; }
.health-dot-error { background: var(--danger); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);  animation-name: pulse-dot-error; }

@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0   rgba(16, 185, 129, 0.55); transform: scale(1); }
  70%  { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0);   transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0   rgba(16, 185, 129, 0);   transform: scale(1); }
}
@keyframes pulse-dot-warn {
  0%   { box-shadow: 0 0 0 0   rgba(245, 158, 11, 0.55); transform: scale(1); }
  70%  { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0);   transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0   rgba(245, 158, 11, 0);   transform: scale(1); }
}
@keyframes pulse-dot-error {
  0%   { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0.55); transform: scale(1); }
  70%  { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);   transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0);   transform: scale(1); }
}
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.7); opacity: 0; }
}

.health-hero-text { min-width: 0; }
.health-hero-text h2 {
  margin: 4px 0 6px; font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 28px); font-weight: 700; letter-spacing: -0.02em;
}
.health-time { margin-top: 8px; font-size: 12px; }
.health-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.health-grid {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.health-card {
  position: relative;
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.health-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.health-card-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--panel-soft); color: var(--muted);
}
.health-card-title { margin: 4px 0 0; font-size: 15px; font-weight: 700; }
.health-card-detail { margin: 0; font-size: 13px; line-height: 1.5; }

.health-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  background: var(--ok-soft); color: var(--ok);
}
.health-pill .health-dot { width: 8px; height: 8px; }
.health-pill-warn  { background: var(--warn-soft);   color: var(--warn); }
.health-pill-error { background: var(--danger-soft); color: var(--danger); }

.health-card.health-card-ok    { border-left: 3px solid var(--ok); }
.health-card.health-card-warn  { border-left: 3px solid var(--warn); }
.health-card.health-card-error { border-left: 3px solid var(--danger); }

.health-bar-wrap { margin-top: 4px; }
.health-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.health-bar {
  height: 8px; background: var(--panel-soft);
  border-radius: 999px; overflow: hidden;
}
.health-bar-fill {
  display: block; height: 100%; border-radius: 999px;
  transition: width var(--t-base);
}
.health-bar-ok    { background: linear-gradient(90deg, #10b981, #34d399); }
.health-bar-warn  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.health-bar-error { background: linear-gradient(90deg, #ef4444, #f87171); }

@media (max-width: 600px) {
  .health-hero {
    grid-template-columns: 1fr;
    text-align: left;
    gap: 14px;
  }
  .health-hero-orb { width: 64px; height: 64px; }
  .health-hero-actions { justify-content: flex-start; }
}

/* ---------- Tablet workspace ---------- */
.tablet-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px; min-height: calc(100vh - 142px);
}
.tablet-panel, .tablet-stage {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); min-width: 0;
  box-shadow: var(--shadow-sm);
}
.tablet-panel { display: flex; flex-direction: column; overflow: hidden; }
.tablet-head { display: flex; justify-content: space-between; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.tablet-head h2 { margin-bottom: 4px; }
.tablet-head p { margin: 0; }
.tablet-search-wrap { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tablet-list { overflow: auto; padding: 12px; display: grid; gap: 8px; -webkit-overflow-scrolling: touch; }
.tablet-contract {
  width: 100%;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 12px; min-height: 64px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text);
  cursor: pointer; font: inherit; text-align: left;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.tablet-contract:hover {
  border-color: var(--accent-soft-2);
  box-shadow: 0 6px 18px -6px rgba(0, 72, 255, 0.15);
  background: var(--panel-soft);
}
.tablet-contract:focus-visible { box-shadow: var(--ring); }
.tablet-contract.signed { opacity: 0.85; }
.tablet-doc-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong);
}
.tablet-doc-icon svg { width: 20px; height: 20px; }
.tablet-contract.signed .tablet-doc-icon { background: var(--ok-soft); color: var(--ok); }
.tablet-contract-main { min-width: 0; display: grid; gap: 3px; }
.tablet-contract-main strong, .tablet-contract-main small {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tablet-contract-main strong { font-size: 14px; font-weight: 600; color: var(--text); }
.tablet-contract-main small, .tablet-contract-meta small { color: var(--muted); font-size: 12px; }
.tablet-contract-meta { display: grid; justify-items: end; gap: 5px; }
.tablet-stage { min-height: 620px; display: grid; overflow: hidden; }
.tablet-empty { display: grid; place-content: center; text-align: center; padding: 28px; gap: 12px; }
.tablet-empty .illus { width: 72px; height: 72px; margin: 0 auto; color: var(--muted); opacity: 0.6; }
.tablet-empty h2 { font-size: 22px; margin: 0; }
.tablet-empty p { margin: 0; color: var(--muted); }
.tablet-frame-wrap { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 620px; }
.tablet-frame-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}
.tablet-frame-bar strong { display: block; font-size: 14px; }
.tablet-frame-bar span { color: var(--muted); font-size: 13px; }
.tablet-frame { min-height: 0; }
#tablet-frame { width: 100%; height: 100%; border: 0; background: var(--panel); }
.hidden { display: none !important; }

/* ---------- Empty / Skeleton ---------- */
.empty { padding: 28px; text-align: center; color: var(--muted); }
.empty.error-text { color: var(--danger); }
.skeleton-list { display: grid; gap: 8px; padding: 4px 0; }
.skeleton-row {
  height: 64px; border-radius: 12px;
  background: linear-gradient(90deg, var(--panel-soft) 0%, var(--line) 50%, var(--panel-soft) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* ---------- Toasts ---------- */
/* ---------- Pro toast notifications (assets/toast.js) ---------- */
.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 200;
  display: grid; gap: 12px; max-width: 380px;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.toast {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  gap: 12px; align-items: center;
  padding: 14px 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  font-size: 14px; line-height: 1.4;
  pointer-events: auto;
  overflow: hidden;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 320ms cubic-bezier(.2,.9,.25,1.2), opacity 220ms ease;
  will-change: transform, opacity;
}
.toast-show { transform: translateX(0); opacity: 1; }
.toast-out  { transform: translateX(110%); opacity: 0; transition-duration: 240ms; }

.toast-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--info);
  flex-shrink: 0;
}
.toast-icon svg { width: 22px; height: 22px; }
.toast-body { min-width: 0; }
.toast-title {
  font-weight: 700; color: var(--text);
  word-break: break-word;
}
.toast-sub {
  margin-top: 2px;
  font-size: 12.5px; font-weight: 500;
  color: var(--muted);
  word-break: break-word;
}
.toast-close {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--muted);
  font-size: 22px; line-height: 1;
  cursor: pointer; border-radius: 8px;
  transition: background 120ms ease, color 120ms ease;
}
.toast-close:hover { background: var(--panel-soft); color: var(--text); }

.toast-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(15, 23, 42, 0.06);
}
.toast-progress-bar {
  height: 100%;
  width: 100%;
  background: currentColor;
  opacity: 0.55;
}

/* Type variants — left border + icon tint + progress bar colour */
.toast-success { border-left-color: var(--ok); }
.toast-success .toast-icon  { color: var(--ok); background: var(--ok-soft); }
.toast-success .toast-progress-bar { background: var(--ok); }

.toast-error   { border-left-color: var(--danger); }
.toast-error   .toast-icon  { color: var(--danger); background: var(--danger-soft); }
.toast-error   .toast-progress-bar { background: var(--danger); }

.toast-warn    { border-left-color: var(--warn); }
.toast-warn    .toast-icon  { color: var(--warn); background: var(--warn-soft); }
.toast-warn    .toast-progress-bar { background: var(--warn); }

.toast-info    { border-left-color: var(--info); }
.toast-info    .toast-icon  { color: var(--info); background: var(--info-soft); }
.toast-info    .toast-progress-bar { background: var(--info); }

.toast-new     { border-left-color: var(--accent); }
.toast-new     .toast-icon  { color: var(--accent); background: var(--accent-soft); }
.toast-new     .toast-progress-bar { background: var(--accent); }

/* Subtle pop-in for the icon, runs once per toast */
.toast-show .toast-icon { animation: toast-icon-pop 380ms cubic-bezier(.4, 1.6, .4, 1) both; }
@keyframes toast-icon-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

@media (max-width: 540px) {
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toast  { grid-template-columns: 32px 1fr 24px; padding: 12px 12px 14px; }
  .toast-icon { width: 32px; height: 32px; }
  .toast-icon svg { width: 18px; height: 18px; }
}

/* ---------- Glassmorphism auth pages (login / forgot / reset) ---------- */
.auth-page {
  min-height: 100vh; margin: 0; padding: 0;
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--font-sans);
}
.auth-bg {
  position: fixed; inset: 0; z-index: -2;
  background: url('/login_bg.png') center/cover no-repeat;
  background-color: #0b1220;
  animation: bg-drift 30s ease-in-out infinite alternate;
}
.auth-overlay {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 80% at 50% 50%, rgba(0, 30, 90, 0.25), transparent 70%),
    linear-gradient(180deg, rgba(11, 18, 32, 0.18) 0%, rgba(11, 18, 32, 0.42) 100%);
  pointer-events: none;
}
@keyframes bg-drift {
  0%   { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.06) translate(-1%, -1%); }
}

.glass {
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
          backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.auth-card {
  width: min(420px, 92vw);
  padding: clamp(28px, 4vw, 40px) clamp(24px, 4vw, 36px);
  border-radius: 22px;
  color: #fff;
  animation: card-rise 480ms cubic-bezier(.2,.7,.2,1.0) both;
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.glass-logo {
  width: 200px; max-width: 70%;
  display: block; margin: 0 auto 22px;
  filter: brightness(0) invert(1) drop-shadow(0 4px 16px rgba(0, 72, 255, 0.45));
  transition: transform 360ms cubic-bezier(.2,.7,.2,1.0);
}
.auth-card:hover .glass-logo { transform: scale(1.03) translateY(-1px); }

.auth-card h1 {
  text-align: center; color: #fff;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vw, 24px); font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.auth-card p {
  text-align: center; color: rgba(255, 255, 255, 0.78);
  font-size: 13px; margin: 0 0 22px;
}

.glass-alert {
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px; margin-bottom: 14px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.glass-alert svg { color: #fecaca; flex-shrink: 0; }

.glass-field {
  position: relative; display: block; margin-bottom: 12px;
}
.glass-field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  display: inline-flex;
}
.glass-field input {
  width: 100%; height: 48px;
  padding: 0 44px 0 44px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  font: inherit; font-size: 14px; color: #fff;
  transition: background 200ms, border-color 200ms, box-shadow 200ms;
}
.glass-field input::placeholder { color: rgba(255, 255, 255, 0.62); }
.glass-field input:hover  { background: rgba(255, 255, 255, 0.14); border-color: rgba(255,255,255,.32); }
.glass-field input:focus  {
  outline: none;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(0, 72, 255, 0.22);
}
.glass-field input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  transition: background-color 99999s;
  -webkit-box-shadow: 0 0 0 100px rgba(255, 255, 255, 0.10) inset;
  caret-color: #fff;
}

.glass-field-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 8px;
  background: transparent; border: 0; cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 160ms, color 160ms;
}
.glass-field-toggle:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.glass-field-toggle .eye-off { display: none; }
.glass-field-toggle.revealed .eye-on  { display: none; }
.glass-field-toggle.revealed .eye-off { display: inline-flex; }

.glass-submit {
  width: 100%; height: 50px; margin-top: 8px;
  border: 0; border-radius: 12px;
  background: linear-gradient(180deg, #4a90ff 0%, #0048ff 100%);
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 12px 28px -8px rgba(0, 72, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 160ms, box-shadow 200ms, filter 160ms;
}
.glass-submit:hover { filter: brightness(1.06); box-shadow: 0 18px 36px -10px rgba(0, 72, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.glass-submit:active { transform: translateY(1px); }

.glass-foot {
  text-align: center; margin-top: 16px;
  color: rgba(255, 255, 255, 0.7); font-size: 13px;
}
.glass-foot a { color: #fff; text-decoration: none; font-weight: 600; opacity: 0.9; }
.glass-foot a:hover { opacity: 1; text-decoration: underline; }

@media (max-width: 480px) {
  .auth-card { padding: 26px 22px; }
  .glass-logo { width: 160px; }
}

/* ---------- App-wide animated icons ---------- */
.sidebar nav a svg,
.btn svg,
.icon-btn svg,
.stat-icon svg,
.health-card-icon svg,
.userbox-avatar,
.tablet-doc-icon svg {
  transition: transform 240ms cubic-bezier(.2,.7,.2,1.0), opacity 200ms;
  will-change: transform;
}

.sidebar nav a:hover svg     { transform: rotate(-4deg) scale(1.12); }
.sidebar nav a.active svg    { animation: nav-active-bob 2.4s ease-in-out infinite; }
@keyframes nav-active-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}

.btn:hover svg               { transform: rotate(-6deg) scale(1.1); }
.btn.primary:hover svg       { transform: translateX(2px) scale(1.05); }
.icon-btn:hover svg          { transform: scale(1.12); }

.kpi:hover .stat-icon svg    { transform: rotate(12deg) scale(1.08); }
.stat-icon svg               { animation: icon-float 5s ease-in-out infinite; }
@keyframes icon-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}

.brand-logo { transition: transform 360ms cubic-bezier(.2,.7,.2,1.0); }
.brand:hover .brand-logo { transform: scale(1.04) translateY(-1px); }

.tablet-contract:hover .tablet-doc-icon svg { transform: rotate(-6deg) scale(1.08); }
.health-card:hover .health-card-icon svg    { transform: rotate(10deg) scale(1.08); }
.contract-list-item:hover .contract-list-icon svg { transform: scale(1.1); }

.theme-toggle:hover svg      { transform: rotate(35deg) scale(1.1); }

@media (prefers-reduced-motion: reduce) {
  .stat-icon svg, .sidebar nav a.active svg, .auth-bg { animation: none !important; }
}

/* ---------- Login layout (full-width, responsive) ---------- */
.login-page {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.login-hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.78) 0%, rgba(0, 72, 255, 0.55) 100%),
    url('/login_bg.png') center/cover no-repeat;
  color: #fff;
  padding: clamp(28px, 4vw, 56px) clamp(28px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 24px;
  min-height: 100vh;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 10% 0%, rgba(79, 139, 255, 0.45), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(0, 72, 255, 0.3), transparent 55%);
  pointer-events: none;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .brand { border: 0; padding: 0; color: #fff; }
.login-hero .brand-logo { filter: brightness(0) invert(1); width: 168px; opacity: 0.96; }
.login-hero .brand-meta strong { color: #fff; }
.login-hero .brand-meta small { color: rgba(255, 255, 255, 0.7); }
.login-hero h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 42px); font-weight: 700; letter-spacing: -0.025em;
  margin: 0 0 16px; line-height: 1.12;
  color: #fff;
  max-width: 520px;
}
.login-hero p { font-size: 16px; opacity: 0.92; max-width: 460px; margin: 0; line-height: 1.6; }
.login-hero-features { display: grid; gap: 10px; margin: 22px 0 0; padding: 0; max-width: 460px; }
.login-hero-features li {
  list-style: none; display: flex; align-items: center; gap: 10px;
  font-size: 14px; opacity: 0.92;
}
.login-hero-features svg { width: 18px; height: 18px; color: #4ade80; flex-shrink: 0; }
.login-hero-bottom { font-size: 13px; opacity: 0.7; }

.login-pane {
  position: relative;
  display: grid; place-items: center;
  padding: clamp(32px, 5vw, 64px) clamp(20px, 4vw, 48px);
  background: var(--bg);
}
.login-pane::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 25%, rgba(0, 72, 255, 0.05), transparent 70%);
  pointer-events: none;
}
[data-theme="dark"] .login-pane::before,
:root:not([data-theme="light"]) .login-pane::before {
  background: radial-gradient(ellipse 60% 50% at 50% 25%, rgba(79, 139, 255, 0.08), transparent 70%);
}
.login-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 40px) clamp(24px, 3.5vw, 36px);
  box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: clamp(22px, 2.4vw, 28px); margin: 0 0 8px; letter-spacing: -0.02em; }
.login-card p { color: var(--muted); margin: 0 0 24px; font-size: 14px; line-height: 1.55; }
.login-card .btn.primary { width: 100%; min-height: 48px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 20px 0 0; line-height: 1.6; }
.login-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---------- Responsive ---------- */

/* Tablet portrait + smaller — hide sidebar, hamburger nav. */
@media (max-width: 960px) {
  :root { --sidebar-width: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 272px; transform: translateX(-100%);
    transition: transform var(--t-base);
    z-index: 50;
    border-right: 1px solid var(--line);
  }
  .shell.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .nav-backdrop {
    display: block;
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4);
    z-index: 49; opacity: 0; pointer-events: none;
    transition: opacity var(--t-base);
  }
  .shell.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: inline-flex; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: minmax(0, 1fr); }
  .dash-row-12-6, .dash-row-2-1 { grid-template-columns: minmax(0, 1fr); }
  .dash-row-3 { grid-template-columns: 1fr 1fr; }
  .dash-row-3 .activity-card { grid-column: span 2; }
  .today-strip { grid-template-columns: 1fr; gap: 12px; }
  .today-strip-stats > div { padding-right: 14px; }
  .tablet-workspace { grid-template-columns: 1fr; }
  .tablet-stage { min-height: 540px; }
}

/* Tablet portrait — login still side-by-side until ~840px. Below, stack. */
@media (max-width: 840px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero {
    min-height: 0; padding: clamp(24px, 6vw, 48px);
  }
  .login-hero h2 { font-size: clamp(22px, 6vw, 32px); }
  .login-hero-features { margin-top: 14px; }
}

/* Phone — compress topbar, single-col stats, even tighter login. */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .main { padding: 14px 14px 32px; }
  /* Stack the header: title on its own row, tools on the next — this stops
     the language pills / icons from colliding with the page title. */
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 16px; }
  .topbar-title { gap: 8px; flex: none; width: 100%; }
  .topbar-tools {
    width: 100%; gap: 8px;
    justify-content: flex-end; flex-wrap: wrap;
    padding-top: 10px; border-top: 1px solid var(--line);
  }
  .lang-switch { margin-right: auto !important; }   /* language pills to the left */
  .userbox-meta { display: none; }
  .userbox { padding: 4px 8px 4px 4px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .dash-row-3 { grid-template-columns: minmax(0, 1fr); }
  .dash-row-3 .activity-card { grid-column: auto; }
  .today-strip-stats { gap: 16px; }
  .today-strip-stats > div { padding-right: 16px; }
  .today-strip-stats strong { font-size: 18px; }
  .pipeline-legend { gap: 10px 16px; font-size: 12px; }
  .chart-wrap { height: 240px; }
  .chart-wrap-sm { height: 200px; }
  .card { border-radius: var(--radius); }
  .login-pane { padding: clamp(20px, 5vw, 36px) 20px; }
  .login-card { padding: 24px 20px; border-radius: var(--radius); }
  .login-hero-features li { font-size: 13px; }
  /* Tighter action button wrap inside tables */
  .table tbody td .actions .btn { padding: 0 10px; min-height: 36px; font-size: 13px; }
}

/* Very small phones */
@media (max-width: 380px) {
  h1 { font-size: 18px; }
  .stat strong { font-size: 24px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
  .btn { padding: 0 12px; }
  .login-hero { padding: 24px 20px; }
  .login-hero h2 { font-size: 22px; }
}

/* ============================================================
   Global mobile polish (≤700px) — applies to every page that
   uses the shared layout: dashboard, contracts, contract detail,
   clients, tablet, settings, users, automations, health,
   change-password, forgot, reset. Adds the missing pieces on top
   of the existing breakpoints above.
   ============================================================ */
@media (max-width: 700px) {
  /* Make every action row wrap instead of overflowing horizontally. */
  .actions          { flex-wrap: wrap; gap: 8px; }
  .actions.between  { flex-wrap: wrap; align-items: flex-start; }
  .actions.right    { flex-wrap: wrap; justify-content: flex-end; }
  .actions.vertical { width: 100%; }
  .actions .btn,
  .actions .btn.sm { min-height: 40px; }
  .actions.vertical .btn { width: 100%; }

  /* Tables: any stray non-wrapped table should still scroll horizontally
     instead of pushing the page out. Detail tables stay 2-col but with
     tighter padding. */
  table.table:not(.detail-table) { min-width: 480px; }
  /* The base `.table` sets min-width:560px — the detail table inherits it and
     is forced wider than the phone (then clipped by overflow-x:clip). Drop the
     floor and switch to fixed layout so long values wrap instead of stretch. */
  .detail-table { table-layout: fixed; width: 100%; min-width: 0; }
  .detail-table th { width: 38%; font-size: 13px; padding-right: 8px; overflow-wrap: anywhere; }
  .detail-table td { font-size: 14px; word-break: break-word; overflow-wrap: anywhere; }
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* Cards: shrink padding so content uses more of the screen. */
  .card { padding: 16px; }
  .card h2 { font-size: 17px; }

  /* Section header rows: title + badge often share a flex row — let
     the badge drop under the title on narrow screens. */
  .actions.between > * { min-width: 0; }
  .actions.between h1, .actions.between h2 { font-size: 18px; }

  /* Modals: previously could overflow the viewport on small phones
     because of fixed widths inside .modal-card. */
  .modal-overlay { padding: 12px; align-items: flex-start; padding-top: 8vh; }
  .modal-card    { width: 100%; max-width: 100%; max-height: 86vh; padding: 22px; border-radius: 14px; }

  /* Lightbox toolbar: previously could overflow narrow screens. */
  .lightbox      { padding: 56px 8px 88px; }
  .lightbox-toolbar { max-width: calc(100vw - 24px); }

  /* Forms / inputs: ensure tap-target height + 16px font to avoid
     iOS auto-zoom on focus. */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], select, textarea {
    font-size: 16px; min-height: 44px;
  }
  .field input, .field select, .field textarea { min-height: 44px; }
  .glass-field input { font-size: 16px; min-height: 44px; }

  /* Document-tile grid on the contract detail page — make tiles
     narrower so two columns still fit on a phone. */
  .doc-tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .doc-tile-meta { padding: 8px 10px; }

  /* Notice banner padding tightened so it doesn't waste a third of the
     viewport on small screens. */
  .notice { padding: 10px 12px; font-size: 14px; }

  /* Topbar title eyebrow: keep on one line and small. */
  .topbar-title .eyebrow { font-size: 11px; }
  .topbar-title h1       { font-size: 18px; line-height: 1.2; }

  /* Tablet mode workspace: stage shrinks; PDF iframe height bound to
     viewport so the screen isn't 3000px tall on a phone. */
  .tablet-workspace .tablet-stage { min-height: 380px; }
}

/* Sign page: ensure the wizard step cards fit in narrow phones.
   sign.css already uses clamp() heavily; this just locks in tap targets. */
@media (max-width: 540px) {
  .sign-doc-grid { grid-template-columns: 1fr; }
  .sign-pdf-area { min-height: 380px; }
  .sign-actions  { flex-direction: column-reverse; gap: 8px; }
  .sign-actions .sign-btn { width: 100%; }
  .sign-stepper  { gap: 4px; padding: 0; font-size: 11px; }
  .sign-stepper li { padding: 6px 2px; }
}

/* ============================================================
   Deep responsive pass — page-specific tweaks for the workspaces
   that the dashboard breakpoints didn't fully cover (contracts,
   contract detail, client profile, users, settings, tablet,
   automations, health). Phone-first; tablet refinements where
   the layout would otherwise look stranded.
   ============================================================ */

/* ≤ 900px: any 2-column .grid.two collapses earlier so the contract
   profile / settings cards aren't cramped on tablets. */
@media (max-width: 900px) {
  .two              { grid-template-columns: minmax(0, 1fr); }
  .grid-2           { grid-template-columns: minmax(0, 1fr); }
  .dash-row-12-6,
  .dash-row-2-1    { grid-template-columns: minmax(0, 1fr); }
}

/* ≤ 760px tablets */
@media (max-width: 760px) {
  /* Every "header + status badge" row already wraps via .actions.between
     in the polish block; reinforce title sizing for tablets. */
  .card h2          { font-size: 18px; }
  .actions.between h2 { font-size: 17px; }
  .detail-table th  { width: 42%; }

  /* Workspace headers like "Workspace / Contract C-…" — keep eyebrow
     on one line, shrink heading just a touch. */
  .topbar h1        { font-size: 20px; }

  /* Tablet-mode page: it uses .tablet-workspace; make sure the
     embedded iframe area doesn't dictate a 720+px min-width. */
  .tablet-workspace { grid-template-columns: 1fr; gap: 12px; }
  .tablet-stage     { min-height: 480px; }
  iframe            { max-width: 100%; }
}

/* ≤ 560px phones — per-page rules for everything else */
@media (max-width: 560px) {
  /* Contracts list: prefer scrolling the whole table over wrapping. But NOT
     the detail table — it must wrap and fit (see the min-width:0 rule above),
     so exclude it here or this higher-specificity floor would re-break it. */
  table.table:not(.detail-table) { min-width: 540px; font-size: 13px; }
  .table thead th { font-size: 11px; padding: 8px 10px; }
  .table tbody td { padding: 10px; }

  /* Contract detail: reset Actions row to stacked. */
  .actions.between {
    flex-direction: column;
    align-items: stretch !important;
  }
  .actions.between > .actions { width: 100%; justify-content: flex-start; }

  /* Vertical button stacks — fill width on phones for thumb-friendly UI */
  .actions.vertical .btn { width: 100%; justify-content: center; }
  .actions .btn,
  .actions .sign-btn,
  .actions a.btn { flex-grow: 1; min-width: 0; }

  /* Client profile: KPI grid stays 2-col (not 1-col) since the numbers
     are short and 1-col wastes too much vertical space. */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .kpi      { padding: 12px; }
  .kpi strong { font-size: 22px; }

  /* Charts on client profile + dashboard: bound the height so a tall
     canvas never pushes the page off-screen. */
  .chart-wrap        { height: 220px; }
  .chart-wrap-sm     { height: 180px; }

  /* Settings: the Mail/SMTP grid + Notifications card use .grid-2 — already
     collapsed earlier; tighten label/input spacing too. */
  .field            { margin-bottom: 12px; }
  .field label      { font-size: 13px; }

  /* Users page form: bind .grid-2 .field rows to single column */
  .users-form .grid-2 { grid-template-columns: 1fr; }

  /* Automations / health pages: every status row wraps cleanly */
  .health-grid      { grid-template-columns: 1fr; }
  .automation-cell  { word-break: break-word; }

  /* Sign-page header: brand + secure badge often clip together; allow wrap */
  .sign-header-inner { gap: 10px; flex-wrap: wrap; }
  .sign-header-right { gap: 8px; flex-wrap: wrap; }

  /* Login: glass card already collapses but reinforce minimum padding */
  .auth-card { padding: 22px 18px; border-radius: 16px; }
}

/* ≤ 380px — micro phones */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
  .kpi strong { font-size: 20px; }
  .topbar h1 { font-size: 18px; }
  .userbox-avatar { width: 30px; height: 30px; font-size: 12px; }
  .btn { padding: 0 12px; min-height: 38px; font-size: 13px; }
  .modal-card h2 { font-size: 18px; }
}

/* ============================================================
   Phone "full mobile pass" — opt-in patterns that turn the
   desktop list/detail UI into a native-feeling phone UX.
   Applies at ≤640px. Detail tables (`.detail-table`) are
   intentionally untouched — they're already 2-col key/value
   and look fine on phones with the earlier polish.
   ============================================================ */
@media (max-width: 640px) {

  /* --------------------------------------------------------
     1) Tables in a .table-wrap become CARDS.
        Each <tr> renders as a stacked card with primary
        identifier on top + last column ("Open ↗") as a
        right-aligned footer with a top divider.
     -------------------------------------------------------- */
  .table-wrap        { overflow-x: visible; margin: 0; border: 0; max-width: 100%; }
  .table-wrap .table { display: block; font-size: 14px; }
  /* Beat the `min-width: 480px` from the <=600px block (higher specificity)
     so a table-turned-card fits the phone width instead of overflowing. */
  .table-wrap table.table:not(.detail-table) { min-width: 0; width: 100%; }
  .table-wrap .table tbody tr { max-width: 100%; overflow: hidden; }
  /* Document tag chips wrap onto multiple lines inside the card. */
  .table-wrap .table tbody td .doc-tags { flex-wrap: wrap; }
  .table-wrap .table thead { display: none; }
  .table-wrap .table tbody { display: block; }
  .table-wrap .table tbody tr {
    display: block;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }
  .table-wrap .table tbody td {
    display: block;
    padding: 3px 0;
    border: 0;
    white-space: normal;
    word-break: break-word;
  }
  /* First cell = primary identifier (contract ref, client name, ...) */
  .table-wrap .table tbody td:first-child {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 4px;
  }
  /* Middle cells = secondary metadata, dimmed + smaller */
  .table-wrap .table tbody td:not(:first-child):not(:last-child) {
    font-size: 13px;
    color: var(--muted);
  }
  /* Last cell = action ("Open ↗") — top divider + right-aligned */
  .table-wrap .table tbody td:last-child {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    text-align: right;
    font-size: 14px;
    font-weight: 600;
  }
  /* Badges shouldn't get the muted treatment from the middle-cell rule */
  .table-wrap .table tbody td .badge { font-size: 12px; font-weight: 600; }
  /* Empty-state td that spans all columns — let it occupy the card cleanly */
  .table-wrap .table tbody td[colspan] {
    font-size: 14px; font-weight: 500;
    color: var(--muted); text-align: center;
    padding: 24px 8px;
    border-top: 0; margin-top: 0;
  }

  /* --------------------------------------------------------
     2) Sticky bottom action bar (opt-in via class).
        Pages add `sticky-actions-mobile` to the action card
        they want pinned. Currently used on contract.php
        (Reset / Delete) and client.php (Danger zone).
     -------------------------------------------------------- */
  .sticky-actions-mobile {
    position: sticky;
    bottom: 8px;
    z-index: 5;
    margin-top: 16px;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.10), 0 1px 0 var(--line);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
  }
  .sticky-actions-mobile .actions.between {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .sticky-actions-mobile .actions.between > .actions { width: 100%; }
  .sticky-actions-mobile .btn { width: 100%; justify-content: center; min-height: 46px; }

  /* --------------------------------------------------------
     3) Bottom-sheet modals.
        Slide up from the bottom with rounded top corners
        instead of the desktop centered modal.
     -------------------------------------------------------- */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
    background: rgba(7, 12, 24, 0.55);
  }
  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.32);
    animation: sheet-up 320ms cubic-bezier(.22, .9, .28, 1.15) both;
    max-height: 88vh;
    overflow-y: auto;
  }
  /* A grabber pill at the top for the affordance of a bottom sheet */
  .modal-card::before {
    content: '';
    display: block;
    width: 44px; height: 4px;
    background: var(--line);
    border-radius: 999px;
    margin: -8px auto 14px;
  }
  @keyframes sheet-up {
    from { transform: translateY(100%); opacity: 0.4; }
    to   { transform: translateY(0);    opacity: 1;   }
  }
  /* Modal actions: stack + full-width on phones for thumb-friendly hit area */
  .modal-card .actions.right {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }
  .modal-card .actions.right .btn { width: 100%; min-height: 46px; justify-content: center; }

  /* --------------------------------------------------------
     4) Tighter detail-table on contract / client pages.
     -------------------------------------------------------- */
  .detail-table th { width: 38%; font-size: 12.5px; padding: 6px 6px 6px 0; }
  .detail-table td { font-size: 13.5px; padding: 6px 0; }
}

/* ============================================================
   2FA — Google Authenticator enrollment + verify
   Standalone full-page flow (no app shell). Designed to feel like
   a focused, premium setup wizard: hero icon, progress stepper,
   QR card with branded corner ticks, separated-cell OTP input.
   ============================================================ */
.enroll-page {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  /* Soft radial wash so the page doesn't feel flat. */
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(ellipse 60% 50% at 110% 110%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 50%),
    var(--bg);
  overflow-x: hidden;
}
.enroll-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* Top bar with logo + signed-in pill */
.enroll-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}
.enroll-brand { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
.enroll-brand img {
  height: 28px !important;     /* belt-and-braces in case the SVG ships without explicit dims */
  width: auto !important;
  max-width: 160px;
  display: block;
}
.enroll-user {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 60vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.enroll-user-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

/* Hero */
.enroll-hero { text-align: center; max-width: 560px; margin: 0 auto 28px; }
.enroll-hero-icon {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background:
    linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #2563eb) 100%);
  box-shadow:
    0 14px 30px -10px color-mix(in srgb, var(--accent) 65%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent) inset;
}
.enroll-hero h1 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 3.2vw, 34px);
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.enroll-sub {
  color: var(--text-soft); font-size: 15px; line-height: 1.55;
  margin: 0;
}

/* Stepper */
.enroll-stepper {
  list-style: none; padding: 0;
  display: flex; justify-content: center; align-items: center;
  gap: 6px;
  margin: 0 auto 28px;
  max-width: 520px;
}
.enroll-stepper li {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  position: relative;
}
.enroll-stepper li + li::before {
  content: ''; display: inline-block;
  width: 28px; height: 2px;
  background: var(--line);
  margin-right: 8px;
}
.enroll-stepper .dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line);
  font-weight: 700; font-size: 11px;
}
.enroll-stepper .is-active .dot {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.enroll-stepper .is-active .label { color: var(--text); font-weight: 600; }

/* Inline banner (forced enrollment notice / errors) */
.enroll-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent-strong);
  margin: 0 auto 18px;
  max-width: 560px;
}
.enroll-banner.is-error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  color: var(--danger);
}

/* The main wizard card */
.enroll-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow:
    0 30px 60px -30px rgba(15, 23, 42, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
}
.enroll-row { display: flex; gap: 18px; align-items: flex-start; }
.enroll-row-num {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  font-family: 'Inter Tight', 'Inter', sans-serif;
}
.enroll-row-body { flex: 1; min-width: 0; }
.enroll-row-body h3 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 17px; font-weight: 700;
  margin: 6px 0 6px;
  letter-spacing: -0.005em;
}
.enroll-row-body p.muted-2 { color: var(--text-soft); font-size: 13.5px; margin: 0 0 12px; line-height: 1.55; }

.enroll-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 24px 0;
}

/* App-chip suggestions (step 1) */
.app-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.app-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--text-soft);
}
.app-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex: none;
}
.app-chip .dot.google { background: #4285f4; }
.app-chip .dot.ms     { background: #00a4ef; }
.app-chip .dot.authy  { background: #ef4836; }
.app-chip .dot.onep   { background: #0a84ff; }
.app-chip .dot.bitw   { background: #175ddc; }

/* QR card (step 2) */
.qr-card {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 22px;
  align-items: stretch;
}
.qr-frame {
  position: relative;
  width: 232px; height: 232px;
  border-radius: 18px;
  background: #fff;
  box-shadow:
    0 12px 30px -16px rgba(15, 23, 42, 0.30),
    0 0 0 1px var(--line);
  display: flex; align-items: center; justify-content: center;
}
.qr-frame .corner {
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid var(--accent);
  border-radius: 4px;
}
.qr-frame .corner.tl { top: 10px;    left: 10px;    border-right: 0; border-bottom: 0; }
.qr-frame .corner.tr { top: 10px;    right: 10px;   border-left:  0; border-bottom: 0; }
.qr-frame .corner.bl { bottom: 10px; left: 10px;    border-right: 0; border-top:    0; }
.qr-frame .corner.br { bottom: 10px; right: 10px;   border-left:  0; border-top:    0; }
.qr-frame #qr { width: 200px; height: 200px; display: flex; align-items: center; justify-content: center; }
.qr-frame #qr canvas, .qr-frame #qr img { display: block; }
.qr-skeleton {
  width: 100%; height: 100%;
  background: repeating-linear-gradient(45deg, #eee 0 8px, #f5f5f5 8px 16px);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px;
  animation: qr-shimmer 1.4s ease-in-out infinite;
}
@keyframes qr-shimmer { 0%,100% { opacity: .65 } 50% { opacity: 1 } }

.qr-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.qr-meta { display: grid; gap: 8px; font-size: 13px; }
.qr-meta > div { display: flex; flex-direction: column; gap: 1px; }
.qr-meta span { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; font-weight: 600; }
.qr-meta strong { color: var(--text); font-weight: 600; word-break: break-all; }

.manual-toggle {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  overflow: hidden;
}
.manual-toggle summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600; font-size: 13px;
  user-select: none;
  display: flex; align-items: center; gap: 8px;
}
.manual-toggle summary::-webkit-details-marker { display: none; }
.manual-toggle summary::before {
  content: '+';
  font-weight: 700; font-size: 16px; line-height: 1;
  width: 16px; display: inline-block; text-align: center;
  color: var(--accent-strong);
}
.manual-toggle[open] summary::before { content: '−'; }
.manual-toggle[open] summary { border-bottom: 1px solid var(--line); }
.manual-key {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
}
.manual-key code {
  flex: 1; min-width: 0;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px; letter-spacing: 0.06em; font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 8px;
  word-break: break-all;
}

/* OTP — 6 separated cells (step 3 + verify) */
.otp-cells {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  max-width: 360px;
}
.otp-cells.centered { margin: 0 auto; }
.otp-cell {
  width: 100%;
  height: 60px;
  text-align: center;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 28px; font-weight: 700;
  letter-spacing: 0;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.otp-cell:focus {
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.otp-cell:not(:placeholder-shown), .otp-cell[value]:not([value=""]) {
  background: var(--panel);
}
.otp-cell:disabled { opacity: .5; cursor: not-allowed; }

/* "Paste code" affordance under the OTP boxes */
.otp-paste-row { display: flex; justify-content: center; margin-top: 14px; }
.otp-paste-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--panel-soft); color: var(--muted);
  border: 1px solid var(--line);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.otp-paste-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--panel);
}
.otp-paste-btn:active:not(:disabled) { transform: scale(.97); }
.otp-paste-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Backup-code input on the verify page */
.backup-field {
  display: flex; flex-direction: column; gap: 6px;
  max-width: 320px; margin: 0 auto;
}
.backup-label {
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
  text-align: center;
}
.backup-field input {
  text-align: center;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 18px; font-weight: 700;
  letter-spacing: 0.12em;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  outline: none;
  text-transform: uppercase;
}
.backup-field input:focus {
  border-color: var(--accent); background: var(--panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Wizard actions */
.enroll-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 15px; }

/* Success card — backup codes vault */
.success-card { padding: 28px; }
.success-card h2 {
  margin: 0 0 6px;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 20px; font-weight: 700;
}
.codes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 4px;
  padding: 18px;
  background:
    repeating-linear-gradient(0deg, transparent 0 18px, color-mix(in srgb, var(--accent) 4%, transparent) 18px 19px),
    var(--panel-soft);
  border: 1px dashed color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 14px;
}
.code-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.code-tile .code-index {
  font-size: 11px; font-weight: 700; color: var(--muted);
  width: 18px; text-align: center; flex: none;
}
.code-tile code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--text);
}

/* Verify card is narrower & centered */
.verify-card { max-width: 460px; margin: 0 auto; padding: 32px 24px; }

/* Footer */
.enroll-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
}
.enroll-foot a { color: var(--muted); text-decoration: none; }
.enroll-foot a:hover { color: var(--accent-strong); text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
  .enroll-shell { padding: 20px 14px 60px; }
  .enroll-topbar { margin-bottom: 26px; }
  .enroll-card { padding: 22px 18px; border-radius: 18px; }
  .enroll-row { gap: 12px; }
  .enroll-row-num { width: 30px; height: 30px; font-size: 13px; }
  .qr-card { grid-template-columns: 1fr; }
  .qr-frame { width: 100%; max-width: 232px; height: auto; aspect-ratio: 1 / 1; margin: 0 auto; }
  .qr-frame #qr { width: 80%; height: 80%; }
  .otp-cells { max-width: 100%; }
  .otp-cell { height: 56px; font-size: 24px; }
  .codes-grid { grid-template-columns: 1fr; }
  .enroll-stepper { gap: 4px; }
  .enroll-stepper li + li::before { width: 18px; }
  .enroll-stepper .label { display: none; }
}

@media print {
  .enroll-topbar, .enroll-foot, .enroll-actions, button { display: none !important; }
  .enroll-hero-icon { background: none !important; color: #000 !important; box-shadow: none !important; }
  .enroll-card { box-shadow: none; border: 1px solid #ccc; }
  .codes-grid { break-inside: avoid; }
  .enroll-page { background: #fff !important; }
}

/* ------------------------------------------------------------
   Verify page — animated background + glassmorphic card + ring
   pulse on the hero icon. Pure CSS, GPU-accelerated transforms.
   ------------------------------------------------------------ */
.verify-page { position: relative; overflow-x: hidden; }

/* Drifting aurora blobs. Three large blurred gradient circles
   that slowly translate + scale, giving the background a calm
   "expert-tier" liquid feel without distracting from the OTP. */
.aurora {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none;
  overflow: hidden;
}
.aurora-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.aurora-blob.b1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  top: -120px; left: -120px;
  animation: aurora-drift-1 24s ease-in-out infinite;
}
.aurora-blob.b2 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, #2dd4bf, transparent 70%);
  bottom: -180px; right: -140px;
  animation: aurora-drift-2 30s ease-in-out infinite;
}
.aurora-blob.b3 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  top: 45%; left: 55%;
  transform: translate(-50%, -50%);
  animation: aurora-drift-3 34s ease-in-out infinite;
  opacity: 0.40;
}
@keyframes aurora-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(80px, 100px) scale(1.10); }
  66%      { transform: translate(-50px, 140px) scale(0.95); }
}
@keyframes aurora-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-100px, -80px) scale(1.08); }
}
@keyframes aurora-drift-3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1)     rotate(0deg); }
  50%      { transform: translate(-30%, -65%) scale(1.18) rotate(20deg); }
}

/* Soft grid veil — adds depth, masks to the centre so edges fade. */
.grid-veil {
  position: fixed; inset: 0;
  z-index: 1; pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 50%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 55% at 50% 50%, #000 30%, transparent 75%);
}
html[data-theme='dark'] .grid-veil {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

/* Lift app content above the background layers. */
.verify-page .enroll-shell { position: relative; z-index: 2; }

/* Glassy verify card with a polished entrance. */
.verify-page .verify-card {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow:
    0 40px 80px -30px rgba(15, 23, 42, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.55) inset;
  animation: card-enter 700ms cubic-bezier(.22, .9, .28, 1.15) both;
}
@keyframes card-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Pulse rings around the shield icon. Two phase-offset rings
   create a continuous outward pulse — feels alive without being
   loud. */
.verify-page .enroll-hero-icon {
  position: relative;
  animation: hero-float 5.5s ease-in-out infinite;
}
.verify-page .enroll-hero-icon::before,
.verify-page .enroll-hero-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  pointer-events: none;
  animation: ring-pulse 2.8s ease-out infinite;
}
.verify-page .enroll-hero-icon::after { animation-delay: 1.4s; }
@keyframes ring-pulse {
  0%   { transform: scale(1);    opacity: 0.65; }
  100% { transform: scale(1.65); opacity: 0; }
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Verify hero copy + sub fade up after the card. */
.verify-page .enroll-hero h1   { animation: hero-fade-up 700ms 80ms cubic-bezier(.22, .9, .28, 1.15) both; }
.verify-page .enroll-hero p    { animation: hero-fade-up 700ms 160ms cubic-bezier(.22, .9, .28, 1.15) both; }
.verify-page .enroll-foot      { animation: hero-fade-up 700ms 240ms cubic-bezier(.22, .9, .28, 1.15) both; }
@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Premium verify button — gradient + soft lift on hover. */
.verify-page .btn.primary.lg {
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 65%, #2563eb) 100%);
  border-color: transparent;
  box-shadow:
    0 12px 28px -10px color-mix(in srgb, var(--accent) 70%, transparent),
    0 1px 0 rgba(255, 255, 255, 0.20) inset;
  transition: transform .15s ease, box-shadow .15s ease;
  letter-spacing: 0.01em;
}
.verify-page .btn.primary.lg:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 20px 38px -10px color-mix(in srgb, var(--accent) 80%, transparent),
    0 1px 0 rgba(255, 255, 255, 0.22) inset;
}
.verify-page .btn.primary.lg:active:not(:disabled) { transform: translateY(0); }

/* OTP cells get a softer pop when they receive a digit. */
.verify-page .otp-cell:focus { transform: translateY(-1px); }
.verify-page .otp-cell { transition: border-color .12s ease, box-shadow .12s ease, background .12s ease, transform .12s ease; }

/* Honor reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .aurora-blob,
  .verify-page .verify-card,
  .verify-page .enroll-hero-icon,
  .verify-page .enroll-hero-icon::before,
  .verify-page .enroll-hero-icon::after,
  .verify-page .enroll-hero h1,
  .verify-page .enroll-hero p,
  .verify-page .enroll-foot {
    animation: none !important;
  }
  .verify-page .enroll-hero-icon::before,
  .verify-page .enroll-hero-icon::after { display: none; }
}

/* Mobile — keep the aurora but shrink so blobs don't overflow weirdly. */
@media (max-width: 640px) {
  .aurora-blob.b1 { width: 320px; height: 320px; }
  .aurora-blob.b2 { width: 360px; height: 360px; }
  .aurora-blob.b3 { width: 280px; height: 280px; }
}

/* Policy radio cards in /settings.php */
.policy-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.policy-opt:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); }
.policy-opt input[type="radio"] {
  margin-top: 3px;
  width: 18px; height: 18px;
  min-height: 0;
  flex: none;
  accent-color: var(--accent);
}
.policy-opt span { line-height: 1.5; font-size: 14px; }
.policy-opt small { display: inline-block; margin-top: 2px; font-size: 12.5px; }

/* ------------------------------------------------------------
   "Secure your account" — optional 2FA nudge modal that appears
   after the welcome overlay for users who haven't enrolled yet.
   Dismiss is persisted in sessionStorage so it doesn't nag during
   the current browser session; it returns on next login.
   ------------------------------------------------------------ */
.enable-2fa-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 12, 24, 0.55);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(.22, .9, .28, 1.15);
}
.enable-2fa-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.enable-2fa-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 32px 28px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow:
    0 40px 90px -30px rgba(15, 23, 42, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.55) inset;
  transform: translateY(24px) scale(0.97);
  transition: transform 420ms cubic-bezier(.22, .9, .28, 1.15);
}
.enable-2fa-overlay.show .enable-2fa-card { transform: translateY(0) scale(1); }

.enable-2fa-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.enable-2fa-close:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

.enable-2fa-icon {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #2563eb) 100%);
  box-shadow:
    0 14px 30px -10px color-mix(in srgb, var(--accent) 60%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent) inset;
}

.enable-2fa-card h2 {
  text-align: center;
  margin: 0 0 8px;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.005em;
}
.enable-2fa-card > p {
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 18px;
}

.enable-2fa-benefits {
  list-style: none;
  padding: 14px;
  margin: 0 0 22px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 8px;
}
.enable-2fa-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.4;
}
.enable-2fa-benefits svg {
  color: var(--ok);
  flex: none;
  width: 14px; height: 14px;
}

.enable-2fa-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.enable-2fa-actions .btn { width: 100%; justify-content: center; min-height: 46px; }
@media (min-width: 481px) {
  .enable-2fa-actions { flex-direction: row-reverse; }
  .enable-2fa-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .enable-2fa-overlay,
  .enable-2fa-card { transition: none; }
}

/* Wide / ultra-wide — soft content max-widths inside hero/pane stay capped via clamp(). */

/* ============================================================
   Required-document upload slots (contract detail Documents card)
   ============================================================ */
.doc-slots { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.doc-slots-title { margin: 0 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.doc-slot { position: relative; display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-soft); padding: 4px 10px 4px 4px; }
.doc-slot-trigger { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px; background: none; border: 0; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.doc-slot-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 8px; background: var(--panel-hover); color: var(--muted); }
.doc-slot-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.doc-slot-text strong { font-size: 14px; }
.doc-slot-status { font-size: 12px; color: var(--muted); }
.doc-slot-badge { margin-left: auto; display: none; place-items: center; }
.doc-slot-view { flex: none; font-size: 13px; font-weight: 600; text-decoration: none; padding: 6px 12px; border-radius: 8px; white-space: nowrap; color: var(--accent); background: var(--accent-soft); }
.doc-slot-view[hidden] { display: none; }

/* Missing -> blinking red */
.doc-slot.is-missing { border-color: var(--danger); animation: docslot-blink 1.4s ease-in-out infinite; }
.doc-slot.is-missing .doc-slot-ico { background: var(--danger-soft); color: var(--danger); }
.doc-slot.is-missing .doc-slot-status { color: var(--danger); }
@keyframes docslot-blink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%       { box-shadow: 0 0 0 4px rgba(239,68,68,.22); }
}

/* Present -> solid green */
.doc-slot.is-present { border-color: var(--ok); }
.doc-slot.is-present .doc-slot-ico { background: var(--ok-soft); color: var(--ok); }
.doc-slot.is-present .doc-slot-status { color: var(--ok); }
.doc-slot.is-present .doc-slot-badge { display: grid; color: var(--ok); margin-right: 4px; }

/* Uploading */
.doc-slot.is-uploading { opacity: .6; pointer-events: none; }
.doc-slot.is-uploading .doc-slot-status::after { content: " - uploading"; }

@media (prefers-reduced-motion: reduce) {
  .doc-slot.is-missing { animation: none; box-shadow: 0 0 0 2px rgba(239,68,68,.28); }
}

/* ============================================================
   Contract-list missing-document tags
   ============================================================ */
.doc-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.doc-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.doc-tag.ok { color: var(--ok); background: var(--ok-soft); }
.doc-tag.missing { color: var(--danger); background: var(--danger-soft); }
.doc-tag.missing-count { color: var(--danger); background: transparent; border: 1px solid var(--danger); }

/* Admin delete button on a document slot */
.doc-slot-del { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--danger); background: transparent; color: var(--danger); cursor: pointer; margin-left: 4px; }
.doc-slot-del:hover { background: var(--danger-soft); }
.doc-slot-del[hidden] { display: none; }

/* ============================================================
   Contract activity timeline
   ============================================================ */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 14px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child::before { display: none; }
.timeline-ico { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--panel-hover); color: var(--muted); z-index: 1; }
.timeline-ico.contract_signed, .timeline-ico.contract_created { background: var(--ok-soft); color: var(--ok); }
.timeline-ico.doc_deleted, .timeline-ico.contract_deleted, .timeline-ico.contract_reset, .timeline-ico.signing_link_email_failed { background: var(--danger-soft); color: var(--danger); }
.timeline-body { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; min-width: 0; }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-detail { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; word-break: break-word; }


/* ============================================================
   WhatsApp "coming soon" promo banner (dashboard top)
   ============================================================ */
.promo-banner { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); background: linear-gradient(90deg, #25D366, #128C7E); color: #fff; box-shadow: 0 6px 18px rgba(18,140,126,.25); }
.promo-banner-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: rgba(255,255,255,.18); }
.promo-banner-icon svg { width: 22px; height: 22px; }
.promo-banner-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.promo-banner-text strong { font-size: 15px; }
.promo-banner-text span { font-size: 13px; opacity: .92; }
.promo-banner-badge { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.2); padding: 5px 10px; border-radius: 999px; }
.promo-banner-close { flex: none; background: transparent; border: 0; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; opacity: .85; padding: 0 4px; }
.promo-banner-close:hover { opacity: 1; }
@media (max-width: 640px) { .promo-banner-badge { display: none; } .promo-banner { margin-left: 0; } }


/* ============================================================
   Vehicle videos (contract detail)
   ============================================================ */
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
@media (max-width: 720px) { .video-grid { grid-template-columns: 1fr; } }
.video-slot { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-soft); padding: 12px; }
.video-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.video-player { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px; display: block; }
.video-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; }
.video-countdown { font-weight: 600; color: #b45309; background: #fef3c7; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.video-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 150px; border: 2px dashed var(--line-strong); border-radius: 10px; cursor: pointer; color: var(--muted); }
.video-drop:hover { border-color: var(--accent); color: var(--text); background: var(--panel-hover); }
.video-drop-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.video-drop-txt { display: flex; flex-direction: column; line-height: 1.35; }
.video-progress { margin-top: 10px; height: 8px; border-radius: 999px; background: var(--panel-hover); position: relative; overflow: hidden; }
.video-progress-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width .15s; }
.video-progress-txt { position: absolute; right: 6px; top: -18px; font-size: 11px; color: var(--muted); }

/* "Coming soon" blue blinking banner (users without the feature) */
.video-soon { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--radius-sm); color: #fff; background: linear-gradient(90deg,#2563eb,#1d4ed8); font-size: 15px; box-shadow: 0 6px 18px rgba(37,99,235,.25); animation: videosoon-pulse 1.6s ease-in-out infinite; }
.video-soon-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: videosoon-dot 1.2s infinite; }
@keyframes videosoon-pulse { 0%, 100% { box-shadow: 0 6px 18px rgba(37,99,235,.25); } 50% { box-shadow: 0 6px 26px rgba(37,99,235,.55); } }
@keyframes videosoon-dot { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
@media (prefers-reduced-motion: reduce) { .video-soon, .video-soon-dot { animation: none; } }


/* Optional document slot (e.g. Passport back) — dashed, no blink */
.doc-slot.is-optional { border-style: dashed; border-color: var(--line-strong); }
.doc-slot.is-optional .doc-slot-ico { background: var(--panel-hover); color: var(--muted); }
.doc-slot-opt { font-weight: 500; font-size: 11px; color: var(--muted); }


/* ============================================================
   Payment (Viva Smart Checkout) card
   ============================================================ */
.pay-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
@media (max-width: 720px) { .pay-grid { grid-template-columns: 1fr; } }
.pay-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-soft); padding: 14px; }
.pay-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pay-amount { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.pay-cur { font-size: 18px; font-weight: 700; color: var(--muted); }
.pay-input { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--text); }
.pay-input[readonly] { background: var(--panel-soft); color: var(--text-soft); }
.pay-chip { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.pay-chip.paid, .pay-chip.captured { color: var(--ok); background: var(--ok-soft); }
.pay-chip.held { color: var(--accent); background: var(--accent-soft); }
.pay-chip.pending { color: #b45309; background: #fef3c7; }
.pay-chip.failed { color: var(--danger); background: var(--danger-soft); }
.pay-chip.released { color: var(--muted); background: var(--panel-hover); }

/* Payment result page */
.pay-result-ico { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; }
.pay-result-ico.ok { background: var(--ok-soft); color: var(--ok); }
.pay-result-ico.fail { background: var(--danger-soft); color: var(--danger); }


/* Blue payment "coming soon" promo banner (dashboard, slow pulse, dismissible) */
.promo-banner.pay { background: linear-gradient(90deg, #2563eb, #1d4ed8); box-shadow: 0 6px 18px rgba(37,99,235,.25); animation: promo-pay-blink 1.8s ease-in-out infinite; }
@keyframes promo-pay-blink { 0%, 100% { opacity: 1; box-shadow: 0 9px 28px rgba(37,99,235,.55); } 50% { opacity: .45; box-shadow: 0 6px 18px rgba(37,99,235,.18); } }
@media (prefers-reduced-motion: reduce) { .promo-banner.pay { animation: none; } }


/* Time-gated "coming soon" document slot */
.doc-slot.is-locked { border-style: dashed; opacity: .75; }
.doc-slot.is-locked .doc-slot-trigger { cursor: not-allowed; }
.doc-slot.is-locked .doc-slot-ico { background: var(--panel-hover); color: var(--muted); }
.doc-slot-soon { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }

