/* ════════════════════════════════════════════════════════════════════
   Repro Products Sales Portal — shared shell, nav & branding.
   Extracted from the Sales Dashboard so every tool (dashboard, CRM, quote,
   portal landing) shares one look. Tool-specific styles stay in each page.
   ════════════════════════════════════════════════════════════════════ */

/* Geist — same typeface as the ReproVerseQuote app (which loads it via next/font).
   Allowed by the portal CSP (style-src fonts.googleapis.com, font-src gstatic). */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');

:root {
  color-scheme: light;

  /* ════════════════════════════════════════════════════════════════
     ReproVerse Design System v1 — canonical tokens (source of truth:
     docs/design-system.md). Light theme only. Every app reads these.
     ════════════════════════════════════════════════════════════════ */

  /* ── Brand chrome ── */
  --rv-navy:          #0d1b2e;   /* sidebar / header background        */
  --rv-navy-light:    #1e3a5f;   /* sidebar/header hover, gradient     */

  /* ── Neutrals ── */
  --rv-bg:            #f1f5f9;   /* app canvas / page background        */
  --rv-canvas:        #fcfcfc;   /* elevated paper content canvas (v1.1)*/
  --rv-surface:       #ffffff;   /* card / panel / modal surface        */
  --rv-surface-2:     #f8fafc;   /* subtle raised surface, table head   */
  --rv-border:        #e2e8f0;   /* hairline borders, dividers          */
  --rv-border-strong: #cbd5e1;   /* stronger / hover border             */
  --rv-ink:           #0f172a;   /* primary text, headings              */
  --rv-ink-soft:      #475569;   /* secondary text / body               */
  --rv-muted:         #94a3b8;   /* muted text, labels, metadata        */

  /* ── Brand accent (Blue) ── */
  --rv-accent:        #3b82f6;   /* primary action, active nav, links   */
  --rv-accent-hover:  #2563eb;   /* hover                               */
  --rv-accent-active: #1d4ed8;   /* active / pressed                    */
  --rv-accent-soft:   #eff6ff;   /* tint background, soft fills         */
  --rv-accent-ring:   rgba(59,130,246,.40); /* focus ring color         */

  /* ── Semantic ── */
  --rv-success:       #10b981;  --rv-success-soft: #d1fae5;  --rv-success-ink: #047857;
  --rv-warning:       #f59e0b;  --rv-warning-soft: #fef3c7;  --rv-warning-ink: #b45309;
  --rv-danger:        #dc2626;  --rv-danger-soft:  #fef2f2;  --rv-danger-ink:  #b91c1c;
  --rv-info:          #3b82f6;

  /* ── Radius ── */
  --rv-radius-sm:     8px;       /* buttons, inputs, small chips        */
  --rv-radius-md:     10px;      /* medium controls                     */
  --rv-radius-lg:     12px;      /* cards                               */
  --rv-radius-xl:     16px;      /* large panels, modals, landing       */
  --rv-radius-pill:   9999px;    /* badges, pills                       */

  /* ── Shadows (subtle, single-layer; Dock-style) ── */
  --rv-shadow-xs:     0 1px 2px rgba(15,23,42,.04);
  --rv-shadow-sm:     0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --rv-shadow-md:     0 4px 14px rgba(15,23,42,.08);
  --rv-shadow-lg:     0 20px 50px rgba(15,23,42,.18);

  /* ── Feather shadows (Elevated UI layer v1.1 — soft, two-stop lift) ── */
  --rv-shadow-feather:        rgba(15,23,42,.04) 0 1px 2px, rgba(15,23,42,.04) 0 8px 24px -12px;
  --rv-shadow-feather-hover:  rgba(15,23,42,.07) 0 2px 6px, rgba(15,23,42,.10) 0 18px 40px -16px;

  /* ── Legacy aliases ── existing rules across the portal reference these
     short names; they now resolve to the canonical tokens above so old and
     new code stay in lock-step. */
  --navy:        var(--rv-navy);
  --navy-light:  var(--rv-navy-light);
  --blue:        var(--rv-accent);
  --bg:          var(--rv-bg);
  --ink:         var(--rv-ink);
  --ink-soft:    var(--rv-ink-soft);
  --muted:       var(--rv-muted);
  --border:      var(--rv-border);
  --surface:     var(--rv-surface);

  /* Cross-app chrome accent — links, focus, standard primary buttons. */
  --accent:      var(--rv-accent);
}

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

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--rv-canvas); color: var(--ink-soft); min-height: 100vh; font-size: 14px;
}

.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR (nav + branding) ── */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--navy);
  display: flex; flex-direction: column; overflow-y: auto;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo { border-bottom: 1px solid rgba(255,255,255,0.07); }
/* App-name header — one shared style so every tool matches ReproVerseQuote:
   logo mark + app name (14px/600 white) + subtitle (11px muted). */
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 14px 18px; text-decoration: none; transition: background .15s; }
.sidebar-brand:hover { background: rgba(255,255,255,0.05); }
/* App mark sits in a tinted chip at the top of the rail (v1.1). */
.sidebar-brand img {
  width: 38px; height: 38px; padding: 4px; border-radius: 10px;
  object-fit: contain; flex-shrink: 0; display: block;
  background: color-mix(in srgb, var(--accent) 22%, rgba(255,255,255,.04));
  border: 1px solid color-mix(in srgb, var(--accent) 38%, rgba(255,255,255,.10));
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sidebar-brand .brand-name { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.sidebar-brand small { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
/* Natural height (was flex:1) so the user block sits directly under the last
   nav item instead of being pinned to the bottom of the rail. */
.nav { padding: 12px 10px; }
.nav-group { margin-bottom: 20px; }
.nav-group-label {
  font-size: 9px; font-weight: 600; letter-spacing: .1em;
  /* #475569 on the --navy (#0d1b2e) rail was ~2.3:1 — failed WCAG AA. #7c8aa0
     is ~4.95:1 (passes AA) while staying dimmer than .nav-item (#94a3b8). */
  text-transform: uppercase; color: #7c8aa0; padding: 0 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; color: #94a3b8;
  cursor: pointer; transition: all .15s; margin-bottom: 1px;
  border: none; background: none; width: 100%; text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #cbd5e1; }
/* v1.1: active = white/10 surface + white text + blue icon (Salesforce rail). */
.nav-item.active { background: rgba(255,255,255,0.10); color: #fff; }
.nav-item.active svg { opacity: 1; color: var(--rv-accent); }
.nav-item svg { flex-shrink: 0; opacity: .8; }
.sidebar-user { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,0.07); }
.user-btn {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; transition: background .15s;
  width: 100%; background: none; border: none; text-decoration: none;
}
.user-btn:hover { background: rgba(255,255,255,0.05); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; text-align: left; }
.user-name { font-size: 12px; font-weight: 500; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-label { font-size: 10px; color: #64748b; }
/* Identity row — ONE shared layout so every tool's user widget matches, whether
   it's a <div> or a <button>. (Support used a <button> with no flex styling, so
   it collapsed and the avatar/name/role overlapped into a clump; the other tools
   set this inline. Neutralise button defaults + lay out as a full-width row.) */
.user-current {
  display: flex; align-items: center; gap: 9px;
  width: 100%; margin: 0; padding: 8px 10px;
  background: none; border: none; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  border-radius: var(--rv-radius-sm);
}
.user-current .user-avatar { width: 30px; height: 30px; }

/* ── APP SWITCHER (under the user block) ──
   Shared across every tool: each sibling app links with its icon graphic,
   matching the ReproVerseQuote sidebar. The current app is marked .active. */
.sidebar-apps { padding: 10px 10px 12px; border-top: 1px solid rgba(255,255,255,0.07); }
.app-link {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: 8px; margin-bottom: 1px;
  font-size: 12.5px; font-weight: 500; color: #94a3b8;
  text-decoration: none; transition: background .15s, color .15s;
}
.app-link img { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; flex-shrink: 0; display: block; }
.app-link:hover { background: rgba(255,255,255,0.05); color: #cbd5e1; }
.app-link.active { color: #fff; background: rgba(255,255,255,0.10); cursor: default; pointer-events: none; }

/* ── APP-SWITCHER DISCLOSURE (wired by shared/shell.js) ──
   The signed-in user's name/role row toggles the sibling .sidebar-apps list,
   which is collapsed by default. Only active on pages that render a real
   .user-current identity row; .has-app-disclosure is added by shell.js once
   that row exists, so pages without one (or with a back-link) are unaffected. */
.sidebar.has-app-disclosure .user-current {
  cursor: pointer; border-radius: var(--rv-radius-sm); transition: background .15s;
}
.sidebar.has-app-disclosure .user-current:hover { background: rgba(255,255,255,0.06); }
.sidebar.has-app-disclosure .user-current:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--rv-accent-ring);
}
/* chevron affordance — rotates when the list is open */
.sidebar.has-app-disclosure .user-current::after {
  content: ""; margin-left: auto; width: 16px; height: 16px; flex: none; align-self: center;
  background: center / 16px 16px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  transition: transform .18s ease;
}
.sidebar.has-app-disclosure.apps-open .user-current::after { transform: rotate(180deg); }
.sidebar.has-app-disclosure:not(.apps-open) .sidebar-apps { display: none; }

/* ════════════════════════════════════════════════════════════════════
   UNIFIED SIDEBAR ORDER (suite spec): top → bottom
     1 brand · 2 user (name folds the app switcher) · 3 workspace nav
     (collapsible, open by default) · 4 sign out (pinned to the bottom)
   Achieved with flex `order` so each tool's existing markup is untouched;
   shell.js relocates the sign-out to the bottom bar and removes the
   now-redundant "↩ Portal" link (the brand is the back-to-portal link).
   ════════════════════════════════════════════════════════════════════ */
.sidebar { overflow-y: hidden; }            /* the nav scrolls, not the whole rail */
.sidebar-logo    { order: 0; }
.sidebar-user    { order: 1; border-top: none; border-bottom: 1px solid rgba(255,255,255,0.07); }
.sidebar-apps    { order: 2; border-top: none; border-bottom: 1px solid rgba(255,255,255,0.07); }
.nav             { order: 3; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sidebar-signout { order: 4; padding: 10px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-signout .user-btn { justify-content: flex-start; color: #94a3b8; }
.sidebar-signout .user-btn:hover { color: #e2e8f0; }
.sidebar-signout .user-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Collapsible nav sections — start OPEN; clicking the label folds the group.
   Only the workspace nav's labels are wired (not the app switcher's), by
   shell.js. The chevron mirrors the app-switcher affordance. */
.nav .nav-group-label {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none; transition: color .15s;
}
.nav .nav-group-label:hover { color: #cbd5e1; }
.nav .nav-group-label::after {
  content: ""; width: 13px; height: 13px; flex: none; margin-left: auto;
  background: center / 13px 13px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%237c8aa0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  transition: transform .18s ease;
}
.nav .nav-group.collapsed .nav-group-label::after { transform: rotate(-90deg); }
.nav .nav-group.collapsed .nav-item { display: none; }

/* ════════════════════════════════════════════════════════════════════
   GLOBAL COMMAND SPINE (suite two-rail shell)
   The thin always-on rail — ⌂ Portal · the 8-app switcher (current lit) ·
   search · account — injected by shared/shell.js and identical across the
   suite. Desktop only: on mobile it hides and the existing off-canvas drawer
   keeps the in-rail switcher / user / sign-out. The spine is one value darker
   (#0a1626) than the wide rail (--navy) so the global frame reads as one
   "command center" in every app. See Knowledge/reproverse-shell-consistency-spec.
   ════════════════════════════════════════════════════════════════════ */
.spine {
  position: fixed; top: 0; left: 0; bottom: 0; width: 64px; z-index: 101;
  background: #0a1626; border-right: 1px solid rgba(0,0,0,.4);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0;
}
.spine-grow { flex: 1; }
.spine-div { width: 28px; height: 1px; background: rgba(255,255,255,.10); margin: 4px 0; }
.spine-icon {
  position: relative; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: #94a3b8; cursor: pointer;
  background: none; border: none; text-decoration: none; transition: background .12s, color .12s;
}
.spine-icon:hover { background: rgba(255,255,255,.06); color: #fff; }
.spine-icon svg { width: 20px; height: 20px; }
.spine-icon:focus-visible, .spine-mark:focus-visible, .spine-avatar:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--rv-accent-ring);
}
.spine-apps { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.spine-mark {
  position: relative; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; opacity: .6; border: 1px solid transparent;
  text-decoration: none; transition: opacity .12s, background .12s;
}
.spine-mark:hover { opacity: 1; background: rgba(255,255,255,.06); }
.spine-mark img { width: 30px; height: 30px; border-radius: 7px; object-fit: contain; display: block; }
.spine-mark.active { opacity: 1; cursor: default; }
.spine-mark.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 24px; border-radius: 0 3px 3px 0; background: var(--rv-accent);
}
.spine-mark.active img { box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 1px 4px rgba(0,0,0,.4); }
/* hover tooltip (anchored right of the rail) */
.spine-tip {
  position: absolute; left: 54px; top: 50%; transform: translateY(-50%) translateX(-4px);
  background: #0b1220; color: #fff; border: 1px solid rgba(255,255,255,.10);
  white-space: nowrap; padding: 5px 9px; border-radius: 7px; font-size: 12px;
  pointer-events: none; opacity: 0; transition: opacity .1s, transform .1s; z-index: 40;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.spine-icon:hover .spine-tip, .spine-mark:hover .spine-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
/* account */
.spine-acct { position: relative; }
.spine-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--rv-accent);
  color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; text-transform: uppercase;
  border: 2px solid transparent; display: grid; place-items: center;
}
.spine-avatar:hover { border-color: rgba(255,255,255,.3); }
.spine-pop {
  position: absolute; left: 52px; bottom: 0; width: 200px; z-index: 60;
  background: #0b1220; border: 1px solid rgba(255,255,255,.10); border-radius: 12px;
  padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.spine-pop[hidden] { display: none; }
.spine-pop-who { padding: 6px 10px 9px; border-bottom: 1px solid rgba(255,255,255,.10); margin-bottom: 6px; }
.spine-pop-who b { display: block; color: #fff; font-size: 13px; }
.spine-pop-who span { display: block; color: #94a3b8; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spine-pop-out {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border-radius: 8px; background: none; border: none; cursor: pointer;
  color: #cbd5e1; font: inherit; font-size: 13px; text-align: left;
}
.spine-pop-out:hover { background: rgba(220,38,38,.16); color: #fecaca; }
.spine-pop-out svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Desktop: the spine takes the far-left 64px; the wide rail + main shift over,
   and the wide rail's own switcher / user / sign-out give way to the spine. */
@media (min-width: 861px) {
  body.has-spine .sidebar { left: 64px; }
  body.has-spine .main { margin-left: 284px; }
  body.has-spine .sidebar-apps,
  body.has-spine .sidebar-user,
  body.has-spine .sidebar-signout { display: none; }
}
/* Mobile: hide the spine; the existing drawer keeps everything in the wide rail. */
@media (max-width: 860px) { .spine { display: none; } }

/* ── MAIN + TOPBAR ── */
.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; background: var(--rv-canvas); }
.topbar {
  background: rgba(255,255,255,0.86); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.topbar-sub   { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ── PAGE CHROME ── */
.page-body { padding: 20px 24px 36px; flex: 1; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: #64748b;
  background: none; border: none; cursor: pointer; padding: 4px 0; margin-bottom: 14px; transition: color .15s;
  text-decoration: none;
}
.back-btn:hover { color: var(--ink); }
.page-title { font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -0.025em; }
.page-meta  { font-size: 12px; color: var(--muted); margin-top: 3px; margin-bottom: 20px; }
/* Eyebrow label (v1.1): 11px / 700 / uppercase / wide tracking / accent. */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--rv-accent); }

/* ════════════════════════════════════════════════════════════════════
   DESIGN-SYSTEM CORE COMPONENTS (premium pass)
   Canonical baselines for buttons, cards, inputs & focus rings so every
   tool inherits one look. Per-tool pages may override with their signature
   hue for identity touches; these provide the shared, blue-accented default
   and — crucially — a visible focus ring on every interactive element.
   ════════════════════════════════════════════════════════════════════ */

/* ── Focus visible everywhere (accessibility + polish) ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible,
.app-link:focus-visible,
.widget:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rv-accent-ring);
  border-radius: var(--rv-radius-sm);
}
/* On the dark sidebar a lighter ring reads better. */
.sidebar a:focus-visible,
.sidebar button:focus-visible,
.nav-item:focus-visible,
.app-link:focus-visible,
.user-btn:focus-visible { box-shadow: 0 0 0 2px rgba(147,197,253,.65); }

/* ── Links ── unified to the brand blue everywhere. */
a { color: var(--rv-accent); }
a:hover { color: var(--rv-accent-hover); }

/* ── Buttons ── shared baseline (34px, 8px radius, 600/13px). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: var(--rv-radius-sm);
  border: 1px solid transparent; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Primary = brand blue (cross-app standard action). Stays flat per v1.1. */
.btn-primary { background: var(--rv-accent); color: #fff; border-color: var(--rv-accent); }
.btn-primary:hover { background: var(--rv-accent-hover); border-color: var(--rv-accent-hover); }
.btn-primary:active { background: var(--rv-accent-active); border-color: var(--rv-accent-active); }

/* Gradient primary — for the single top-priority action only (v1.1). */
.btn-gradient {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 1px 2px rgba(37,99,235,.35), 0 8px 20px -8px rgba(37,99,235,.55);
}
.btn-gradient:hover { filter: brightness(1.05); }

/* Secondary / ghost = white, hairline border, soft-ink text. */
.btn-ghost, .btn-secondary {
  background: var(--rv-surface); border-color: var(--rv-border); color: var(--rv-ink-soft);
}
.btn-ghost:hover, .btn-secondary:hover {
  background: var(--rv-surface-2); border-color: var(--rv-border-strong); color: var(--rv-ink);
}

/* Danger = white fill, danger border/text; soft tint on hover. */
.btn-danger { background: var(--rv-surface); border-color: #fecaca; color: var(--rv-danger); }
.btn-danger:hover { background: var(--rv-danger-soft); border-color: #f87171; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--rv-radius-sm); }

/* ── Cards ── 16px radius, hairline border, feather shadow, ≥20px padding (v1.1). */
.card {
  --accent: var(--rv-accent);
  background: var(--rv-surface); border: 1px solid var(--rv-border);
  border-radius: var(--rv-radius-xl); box-shadow: var(--rv-shadow-feather);
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
/* Interactive cards lift on hover with the feather-hover shadow + accent-tinted border. */
.card.interactive:hover, a.card:hover, button.card:hover {
  box-shadow: var(--rv-shadow-feather-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--rv-border));
  transform: translateY(-3px);
}

/* ── Inputs / selects / textareas ── shared baseline + accent focus. */
.field, .input, .select, .search,
input[type="text"], input[type="email"], input[type="search"],
input[type="number"], input[type="date"], input[type="password"], textarea {
  font: inherit; font-size: 13px; color: var(--rv-ink);
  background: var(--rv-surface); border: 1px solid var(--rv-border);
  border-radius: var(--rv-radius-sm); padding: 8px 12px;
  box-shadow: var(--rv-shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.field::placeholder, .input::placeholder, input::placeholder, textarea::placeholder { color: var(--rv-muted); }
.field:focus, .input:focus, .select:focus, .search:focus,
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--rv-accent); box-shadow: 0 0 0 3px var(--rv-accent-ring);
}

/* ── Status pills (v1.1) ── tinted bg + colored text + 6px leading dot.
   Shared so every tool gets a consistent live/pending/error signal. */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  border-radius: var(--rv-radius-pill); padding: 4px 11px; white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status-pill.is-success { color: var(--rv-success-ink); background: var(--rv-success-soft); }
.status-pill.is-warning { color: var(--rv-warning-ink); background: var(--rv-warning-soft); }
.status-pill.is-danger  { color: var(--rv-danger-ink);  background: var(--rv-danger-soft); }
.status-pill.is-info    { color: var(--rv-accent-active); background: var(--rv-accent-soft); }

/* ── Tinted icon chip (v1.1) ── wherever an app/section icon appears.
   Reads `--accent` (per-tool hue) for a quiet identity touch. */
.icon-chip {
  --accent: var(--rv-accent);
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--rv-border));
}
.icon-chip img, .icon-chip svg { width: 38px; height: 38px; object-fit: contain; display: block; }

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE / MOBILE — off-canvas sidebar drawer + adaptive chrome.
   The shell (sidebar / main / topbar) is shared by every app, so the mobile
   behaviour lives here once. `shared/shell.js` injects the hamburger button +
   overlay and toggles `body.nav-open`; it also wraps wide data tables in
   `.table-scroll`. Apps only need to load that script.
   ════════════════════════════════════════════════════════════════════ */

/* Hamburger toggle (injected into .topbar). Hidden until the drawer breakpoint. */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-right: 2px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--ink); cursor: pointer; padding: 0;
  transition: background .15s;
}
.nav-toggle:hover { background: var(--bg); }
.nav-toggle svg { width: 20px; height: 20px; }

/* Dim overlay behind the open drawer (injected after <body>). */
.nav-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8,15,30,.45); opacity: 0; visibility: hidden;
  transition: opacity .25s ease; border: none; margin: 0; padding: 0; cursor: pointer;
}

/* Horizontal-scroll wrapper for wide data tables (shell.js wraps .tbl/.opp-table). */
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 860px) {
  /* Sidebar slides off-canvas; revealed when body has .nav-open. */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 250px; box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }

  /* Main reclaims the full width. */
  .main { margin-left: 0; }

  /* Reveal the hamburger; let topbar controls wrap below the title. */
  .nav-toggle { display: inline-flex; }
  .topbar {
    height: auto; min-height: 56px; padding: 8px 14px;
    flex-wrap: wrap; gap: 8px 10px;
  }
  .topbar > div:first-of-type { flex: 1; min-width: 0; }
  .topbar-right {
    width: 100%; order: 3;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  /* Tighter gutters on small screens. */
  .page-body { padding: 16px 14px 32px; }
  .page-title { font-size: 18px; }

  /* Landing page chrome. */
  .land-header { padding: 16px 18px; }
  .land-main   { padding: 32px 18px; }
  .land-title  { font-size: 25px; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Reduced motion — respect the OS "reduce motion" setting. The shell and tools
   use spinners, card lifts, modal rise/fade and chevron rotations; collapse all
   of that to near-instant for users who ask for it (vestibular safety). Kept at
   the end so it overrides the transitions/animations declared above.
   ────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
