/*
 * LilloxOS Component Library — LOCKED 2026-08-02 (Decision 38)
 * Canonical, shared CSS for every reusable UI component. This file
 * is the single source of truth for composition (layout patterns,
 * component structure) the way tokens.css is the single source of
 * truth for design tokens (color/type/radius/spacing).
 *
 * Decisions 31/32 established the RULE that components must be
 * reused. This file is what makes that rule technically enforceable
 * instead of dependent on a developer remembering it by hand each
 * time — the gap found and closed under Decision 38.
 *
 * Dashboard (Decision 32) is the source: every class below that
 * already existed on Dashboard is extracted here VERBATIM, same
 * values, same behavior — Dashboard is proven to render identically
 * after migrating to this file (see the before/after screenshot
 * comparison in the Decision 38 record). Classes marked NEW below
 * did not exist before Decision 38 and are genuinely new, sanctioned
 * additions — not a competing pattern for something that already had
 * one.
 *
 * Usage: import this file AFTER tokens.css on every page.
 * <link rel="stylesheet" href="/tokens.css" />
 * <link rel="stylesheet" href="/components.css" />
 * A page's own <style> block should contain ONLY page-specific
 * layout (e.g. which panels go where), never a redefinition of any
 * class below.
 */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-page); color: var(--ink); font-family: var(--font-body); font-size: 12px; }
a { color: inherit; }

/* ==================== Shell / layout (from Dashboard) ==================== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--white); border-right: 1px solid var(--border);
  padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6);
}
.main { flex: 1; padding: var(--space-7); max-width: var(--container-max); margin: 0 auto; width: 100%; }
/* Content area with a topbar (Decision 39) — for pages that need a
   full-width header row ABOVE the padded content, without touching
   .main's own padding contract used by every other page. */
.content-area { flex: 1; display: flex; flex-direction: column; }
.content-area .main { max-width: none; margin: 0; }
.content-inner { max-width: var(--container-max); margin: 0 auto; width: 100%; padding: var(--space-7); }
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr !important; }
  .hero-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 768px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-6); }
  .sidebar nav { display: none; }
  .kpi-row { grid-template-columns: 1fr 1fr !important; }
  .main { padding: var(--space-5); }
  .topbar-search { order: 3; flex: 1 1 100%; max-width: none; }
}

/* ==================== Logo (from Dashboard, 04_LOCKED_DESIGN_SYSTEM.md §1) ==================== */
.logo { display: flex; align-items: center; gap: var(--space-4); }
.logo-tile { width: 34px; height: 34px; border-radius: 9px; background: var(--logo-gradient); box-shadow: 0 2px 5px rgba(0,71,217,0.28); display: flex; align-items: center; justify-content: center; }
.logo-tile svg { width: 16px; height: 18px; fill: white; }
.logo-word { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.06em; }

/* ==================== Navigation (from Dashboard, corrected against
   View 7 / 07_Projektdashboard.png reference, Decision 39) ==================== */
nav { display: flex; flex-direction: column; gap: var(--space-2); }
nav a { text-decoration: none; color: var(--text-2); font-size: 12px; font-weight: 400; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); display: flex; align-items: center; gap: var(--space-3); border-left: 3px solid transparent; }
nav a svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; }
nav a.active { background: var(--bg-page); color: var(--blue); font-weight: 700; border-left-color: var(--blue); }
nav a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.whoami { margin-top: auto; font-size: 11px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: var(--space-4); }
.whoami button {
  margin-top: var(--space-3); width: 100%; height: var(--input-height);
  border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-family: var(--font-body); font-weight: 700; font-size: 11px; cursor: pointer;
}

/* ==================== Page title (from Dashboard) ==================== */
h1 { font-family: var(--font-display); font-size: 21px; font-weight: 700; margin: 0 0 var(--space-6) 0; }

/* ==================== Top bar — NEW, corrected against View 7 reference (Decision 39) ====================
   A real header row above page content: breadcrumb-style context,
   a notification indicator driven by REAL pending-approval data (no
   fabricated count), a real user avatar (initials). No search box —
   no real search backend exists to wire it to; never fake an
   interactive element with nothing behind it. */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4) var(--space-7); background: var(--white); border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: var(--space-3); }
.topbar-context { font-size: 11.5px; color: var(--text-3); }
.topbar-context strong { color: var(--ink); font-weight: 700; }
.topbar-search { position: relative; flex: 1 1 auto; min-width: 160px; max-width: 260px; }
.topbar-search input { width: 100%; height: 32px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-page); padding: 0 12px 0 32px; font-family: var(--font-body); font-size: 11.5px; box-sizing: border-box; }
.topbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; stroke: var(--text-3); fill: none; stroke-width: 1.8; pointer-events: none; }
.topbar-search-results { position: absolute; top: 38px; left: 0; width: 320px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); z-index: 20; max-height: 320px; overflow-y: auto; }
.topbar-search-results .doc-row { padding: var(--space-3) var(--space-4); cursor: pointer; }
.topbar-search-results .doc-row:hover { background: var(--bg-page); }
.topbar-right { display: flex; align-items: center; gap: var(--space-5); }
.topbar-bell { position: relative; width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.topbar-bell svg { width: 16px; height: 16px; stroke: var(--text-2); fill: none; stroke-width: 1.8; }
.topbar-bell .bell-count { position: absolute; top: -5px; right: -5px; background: var(--red); color: white; font-size: 9px; font-weight: 700; min-width: 15px; height: 15px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.topbar-avatar { width: 34px; height: 34px; border-radius: var(--radius-full); background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 12px; }

/* ==================== Buttons — NEW (Decision 38) ====================
   Formalizes what Dashboard's .whoami/login buttons already did
   consistently by hand (height var(--input-height), radius-md,
   weight 700, 11px) into one reusable class, so no page reinvents a
   button. */
.btn {
  height: var(--input-height); padding: 0 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--white); color: var(--ink);
  font-family: var(--font-body); font-weight: 700; font-size: 11px; cursor: pointer;
}
.btn-primary { background: var(--blue); color: white; border: none; box-shadow: 0 2px 8px rgba(11,124,226,0.28); }

/* ==================== KPI row (from Dashboard, §7) ==================== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); margin-bottom: var(--space-7); }
.kpi-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: var(--space-6); }
.kpi-label { font-family: var(--font-body); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi-icon svg { width: 13px; height: 13px; stroke: var(--text-3); fill: none; stroke-width: 1.8; }
.kpi-number { font-family: var(--font-display); font-weight: 700; font-size: 30px; margin: var(--space-3) 0 var(--space-2) 0; } /* = typography scale "metric", Decision 38 */
.kpi-delta { font-size: 11px; color: var(--text-3); }
.kpi-delta.warn { color: var(--orange); }
.kpi-delta.ok { color: var(--green); }
/* Priority variant (Decision 39) — for the ONE KPI that genuinely
   requires action today (e.g. pending approvals > 0), not a new
   parallel card type. Same .kpi-card, same .kpi-number sizing -
   only border/background differ, driven by real state (>0), never
   applied decoratively. */
.kpi-card.priority { border-color: var(--orange); background: rgba(245,158,11,0.04); }
.kpi-card.priority .kpi-number { color: var(--orange); }
.kpi-sub { font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* ==================== Margin gauge — NEW (Decision 42) ====================
   Real SVG ring, driven by real gross_margin_pct vs real
   cost_rates.target_margin - no fabricated "goal". */
.gauge-wrap { display: flex; align-items: center; gap: var(--space-6); }
.gauge-value { font-family: var(--font-display); font-weight: 700; font-size: 26px; }
.gauge-label { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }

/* ==================== Activity feed row — NEW (Decision 42) ====================
   Real audit_events, company-wide. */
.activity-row { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.activity-row:last-child { border-bottom: none; }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex-shrink: 0; margin-top: 5px; }
.activity-text { color: var(--ink-soft); }
.activity-time { color: var(--text-3); font-family: var(--font-mono); font-size: 9.5px; white-space: nowrap; }

/* ==================== Quick access grid — NEW (Decision 42) ====================
   Real navigation to real destinations, never a non-functional button. */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--white); cursor: pointer; text-decoration: none; color: var(--ink); font-size: 10.5px; font-weight: 700; text-align: center; }
.quick-btn:hover { background: var(--bg-page); }
.quick-btn svg { width: 20px; height: 20px; stroke: var(--blue); fill: none; stroke-width: 1.7; }

/* ==================== Reserved / not-yet-connected panel — NEW (Decision 43) ====================
   For a real, future component whose data source doesn't exist yet
   (Kassa, Kalender, historical sparklines, risk classification).
   Visually present and honestly labeled - never hidden, never faked.
   Same dashed-border "reserved" language as .nisse-placeholder, so
   the pattern reads consistently wherever it appears. Swapping in
   real data later means removing this block and rendering real
   content in the same panel - no layout change required. */
.reserved-body { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); border: 1.5px dashed var(--border); border-radius: var(--radius-lg); }
.reserved-icon { width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.reserved-icon svg { width: 18px; height: 18px; stroke: var(--text-3); fill: none; stroke-width: 1.6; }
.reserved-text { font-size: 11px; color: var(--text-3); line-height: 1.5; }
.reserved-text strong { color: var(--text-2); font-weight: 700; }

/* ==================== Page header with greeting (Decision 39) ====================
   Formalizes a richer page-title area than a bare <h1> - a greeting
   line + real current date, reusable by any page that wants it. */
.page-header { margin-bottom: var(--space-6); }
.page-header h1 { margin: 0; }
.page-header .page-subtitle { font-size: 12px; color: var(--text-3); margin-top: var(--space-2); }

/* ==================== Attention row (Decision 39) ====================
   For a real, itemized "needs your attention" list - distinct from
   .doc-row (which is for neutral listings) by having a status-colored
   left accent, matching .risk-inline's established left-border
   pattern rather than inventing a new visual language. */
.attention-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-left: 3px solid var(--orange); background: rgba(245,158,11,0.04); border-radius: var(--radius-sm); margin-bottom: var(--space-2); font-size: 11.5px; }
.attention-row:last-child { margin-bottom: 0; }
.attention-type { font-family: var(--font-body); font-weight: 700; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--orange); background: rgba(245,158,11,0.14); border-radius: var(--radius-sm); padding: 2px 6px; flex-shrink: 0; }

/* ==================== Two-column row (from Dashboard, §10) ==================== */
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--space-6); align-items: start; }
/* Beslut 76 (mobil-audit): grid-spar krymper ALDRIG under sitt
   innehalls min-content-bredd utan detta - annars vagrar kolumnen
   krympa till containern pa smala skarmar, oavsett 1fr/!important
   ovan. Standard CSS Grid-korrigering, ingen redesign. */
.two-col > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-6); }
/* Beslut 76 (mobil-audit): en rå <table> utan denna wrapper trycker
   HELA sidan i horisontell overflow pa smala skarmar istallet for
   att bara tabellen sjalv scrollar. Minimal, generisk verktygsklass
   - inte en ny tabellkomponent, bara inneslutning. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ==================== Panel / card (from Dashboard) ==================== */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: var(--space-6); }
.panel h2 { font-family: var(--font-display); font-size: 14px; font-weight: 700; margin: 0 0 var(--space-5) 0; }
.panel h3 { font-family: var(--font-body); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 0 var(--space-3) 0; }

/* ==================== Status badge (from Dashboard, §13) ====================
   Extended with more color variants (draft/sent/rejected) for pages
   with more workflow states than Dashboard needed — same class,
   same shape, no parallel "status-badge" invented. */
.badge { display: inline-block; border-radius: var(--radius-full); padding: 2px 10px; font-family: var(--font-body); font-weight: 700; font-size: 10px; }
.badge.active { background: rgba(60,193,122,0.12); color: var(--green); }
.badge.accepted { background: rgba(60,193,122,0.12); color: var(--green); }
.badge.avslutad { background: rgba(138,144,153,0.16); color: var(--text-3); }
.badge.draft { background: rgba(138,144,153,0.16); color: var(--text-2); }
.badge.sent { background: rgba(0,113,227,0.12); color: var(--blue); }
.badge.rejected { background: rgba(217,48,54,0.12); color: var(--red); }

/* ==================== Row list pattern (from Dashboard) ==================== */
.project-row, .doc-row, .contact-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
.project-row:last-child, .doc-row:last-child, .contact-row:last-child { border-bottom: none; }
.project-code, .doc-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
.project-name, .doc-name { font-weight: 700; font-size: 12px; }

/* ==================== AI insight card (from Dashboard, §13 — purple ONLY here, never elsewhere) ==================== */
.ai-card { border-left: 3px solid var(--purple); background: var(--white); border-radius: var(--radius-md); padding: var(--space-5); margin-bottom: var(--space-4); }
.ai-card:last-child { margin-bottom: 0; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--purple); display: inline-block; margin-right: var(--space-2); }
.ai-label { font-family: var(--font-body); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--purple); }
.ai-text { font-size: 11.5px; color: var(--ink-soft); margin-top: var(--space-2); line-height: 1.5; }

/* Compact AI insight row — NEW, corrected against VC-COMP-0010 (AI
   Widget) §05 "Kompakt (dashboard)" variant, Decision 39. Icon +
   text + a severity badge (4 locked levels), matching the component
   blueprint exactly instead of the plain border-only treatment this
   replaces on dashboards specifically. .ai-card above remains valid
   for plain, non-severity AI text (e.g. Offert's historical
   comparison, which has no severity level to show). */
.insight-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.insight-row:last-child { border-bottom: none; }
.insight-icon { width: 26px; height: 26px; border-radius: var(--radius-full); background: rgba(122,72,237,0.12); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.insight-icon svg { width: 13px; height: 13px; stroke: var(--purple); fill: none; stroke-width: 2; }
.insight-text { font-size: 11.5px; color: var(--ink-soft); flex: 1; line-height: 1.4; }
.severity-badge { font-family: var(--font-body); font-weight: 700; font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; border-radius: var(--radius-sm); padding: 3px 8px; flex-shrink: 0; }
.severity-badge.lag { background: rgba(138,144,153,0.14); color: var(--text-2); }
.severity-badge.medel { background: rgba(245,158,11,0.14); color: var(--orange); }
.severity-badge.hog { background: rgba(217,48,54,0.12); color: var(--red); }
.severity-badge.kritisk { background: var(--red); color: white; }

.empty-state { color: var(--text-3); font-size: 11.5px; text-align: center; padding: var(--space-6) 0; }

/* ==================== Login screen (from Dashboard) ==================== */
#loginScreen { max-width: 340px; margin: 80px auto; }
#loginScreen .panel, #loginScreen .kpi-card { padding: var(--space-7); }
#loginScreen input { width: 100%; height: var(--input-height); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 8px 12px; font-family: var(--font-body); font-size: 11.5px; margin-bottom: var(--space-4); }
#loginScreen button { width: 100%; height: var(--input-height); border-radius: var(--radius-md); background: var(--blue); color: white; border: none; font-weight: 700; font-size: 11px; cursor: pointer; }
#loginErr { color: var(--red); font-size: 11px; margin-top: var(--space-3); }

/* ==================== Tables — NEW (Decision 38) ====================
   Formalizes 04_LOCKED_DESIGN_SYSTEM.md §12 (already written, never
   actually implemented anywhere before Offert) as real, reusable CSS. */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; background: var(--bg-page); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: var(--space-3); }
td { padding: var(--space-3); border-bottom: 1px solid var(--border); font-size: 11.5px; }
td.num, th.num { text-align: right; font-family: var(--font-mono); }

/* ==================== Hero metric — NEW (Decision 38) ====================
   For the ONE dominant decision signal on a page (e.g. Offert
   cockpit's margin). Uses typography scale "heroMetric" (36-40px),
   formally added to tokens.json/04_LOCKED_DESIGN_SYSTEM.md under this
   same decision — never a locally hardcoded size. */
.hero { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: var(--space-7); margin-bottom: var(--space-6); }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-7); align-items: center; }
.hero-label { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: var(--space-3); }
.hero-metric { font-family: var(--font-display); font-weight: 700; font-size: 38px; line-height: 1; } /* = typography scale "heroMetric" */
.hero-metric.ok { color: var(--green); } .hero-metric.warn { color: var(--orange); } .hero-metric.bad { color: var(--red); }
.hero-verdict { font-size: 13px; color: var(--ink-soft); margin-top: var(--space-3); max-width: 380px; }
.hero-meta-row { display: flex; gap: var(--space-3); margin-top: var(--space-5); flex-wrap: wrap; }

/* ==================== Neutral info pill — NEW (Decision 38) ====================
   For supplementary context (e.g. confidence level) that must NEVER
   read as an alarm the way a blocking risk does. Never red by its
   own styling — any red comes only from a locked backend label
   (e.g. a confidence emoji), never added by this component. */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--radius-full); padding: 4px 12px; font-size: 10.5px; font-weight: 700; background: var(--bg-page); color: var(--text-2); }
.pill.warn { background: rgba(245,158,11,0.14); color: var(--orange); }

.risk-inline { border-left: 3px solid var(--orange); background: rgba(245,158,11,0.06); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-size: 11px; color: var(--ink-soft); margin-top: var(--space-3); }

/* ==================== What-if / simulate box — NEW (Decision 38) ====================
   For any "what happens to X if I change Y" control (first used by
   Offert's negotiation engine) - reusable wherever a future page
   needs the same live-preview pattern. */
.whatif-label { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: var(--space-4); }
.whatif-box { display: flex; gap: var(--space-3); align-items: flex-end; }
.whatif-box input { width: 70px; height: 38px; border-radius: var(--radius-md); border: 1px solid var(--border); padding: 8px 12px; font-family: var(--font-body); font-size: 13px; text-align: center; }
.whatif-box button { height: 38px; padding: 0 16px; border-radius: var(--radius-md); border: none; background: var(--purple); color: white; font-weight: 700; font-size: 11px; cursor: pointer; }
.whatif-outcome { font-size: 13px; margin-top: var(--space-4); min-height: 20px; }
.whatif-outcome strong { font-family: var(--font-display); font-size: 18px; }

/* ==================== NISSE panel — NEW (Decision 38) ====================
   A sanctioned, elevated container for AI/NISSE content, distinct
   from a plain .panel. Uses --purple at low opacity as a background
   tint — the SAME opacity-tinting pattern already established for
   .badge backgrounds, applied here rather than inventing a new
   technique. Individual insights inside still use the existing
   .ai-card, never redefined. Dashboard is not required to adopt this
   — it remains valid to show AI content in a plain .panel with
   .ai-card, exactly as it already does; this is an additional,
   optional treatment for pages that need NISSE's presence elevated. */
.nisse-panel { background: linear-gradient(160deg, rgba(122,72,237,0.07), rgba(122,72,237,0.02)); border: 1px solid rgba(122,72,237,0.25); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: var(--space-7); }
[data-theme="dark"] .nisse-panel { background: linear-gradient(160deg, rgba(154,111,255,0.12), var(--surface-2) 140%); border-color: rgba(154,111,255,0.32); }
.nisse-header { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-5); padding-bottom: var(--space-5); border-bottom: 1px solid rgba(122,72,237,0.16); }
/* NISSE:s RIKTIGA porträtt (Beslut 40/44) — beskuret ur det låsta
   referensbladet (4-nisse-referensblad-original), samma bild, ingen
   ny illustration. En cirkulär ram i --purple (gränssnittets AI-röst,
   Beslut 15) inramar hans EGET, faktiska ansikte — han ersätts
   aldrig av en ikon eller bara ordet NISSE. Storlek höjd (Beslut 44)
   - han är centralt i Lillox, inte en liten avatar i ett vanligt kort. */
.nisse-portrait { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--purple); flex-shrink: 0; box-shadow: 0 4px 18px rgba(122,72,237,0.4); }
.nisse-header-text .nisse-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.nisse-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 6px var(--green); }
.nisse-header-text .nisse-sub { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.nisse-greeting { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; margin-bottom: var(--space-5); font-style: italic; }

/* NISSE MASTER CHARACTER — placeholder (Beslut 41). EXAKT samma
   mått/position som .nisse-portrait (52px cirkel) så den riktiga
   bilden, när den levereras, ersätter ENDAST img[src] eller byter ut
   denna div mot <img class="nisse-portrait">, ingen layoutändring
   krävs. Neutral avsiktligt: ingen gammal Nisse, ingen emoji, ingen
   generisk AI-ikon, ingen ny illustration - en ren systemplaceholder,
   samma mönster som ett standardanvändaravatar-utrymme innan ett
   foto laddats upp. */
.nisse-placeholder { width: 52px; height: 52px; border-radius: 50%; border: 2px dashed var(--purple); background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nisse-placeholder svg { width: 22px; height: 22px; stroke: var(--purple); fill: none; stroke-width: 1.6; opacity: 0.7; }
.nisse-placeholder.small { width: 36px; height: 36px; }
.nisse-placeholder.small svg { width: 16px; height: 16px; }

/* NISSE-popup (Beslut 41) — förberedd infrastruktur för "Nisse dyker
   upp". Användarutlöst nu (ikonknapp i topbar); händelsetriggad
   auto-visning är en separat, senare utökning som återanvänder
   EXAKT samma popup-uppmärkning, bara ett annat sätt att öppna den.
   Blockerar aldrig arbetsytan (fixed, hörnplacerad, ingen overlay/
   scrim), stängs direkt. */
.nisse-popup-trigger { width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.nisse-popup-trigger svg { width: 16px; height: 16px; stroke: var(--purple); fill: none; stroke-width: 1.8; }
/* ==================== NISSE mini-window (Decision 45) ====================
   Was too small / read like a system notification. Now a real
   mini-NISSE window: bigger portrait, clear identity, room for his
   message, and an honest "show all insights" expansion (real data,
   same severity badges - never a fabricated free-text chat, since
   NISSE has no live generative model, confirmed in the Readiness
   Assessment). Still discreet - fixed corner, no overlay/scrim,
   dismissible immediately, never blocks work. */
.nisse-popup { position: fixed; bottom: var(--space-7); right: var(--space-7); width: 380px; background: var(--white); border: 1px solid rgba(122,72,237,0.3); border-radius: var(--radius-xl); box-shadow: var(--shadow-modal); padding: var(--space-6); z-index: 50; max-height: 70vh; overflow-y: auto; }
[data-theme="dark"] .nisse-popup { background: linear-gradient(160deg, rgba(154,111,255,0.1), var(--white) 60%); }
.nisse-popup-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid rgba(122,72,237,0.16); }
.nisse-popup-portrait { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--purple); flex-shrink: 0; box-shadow: 0 4px 14px rgba(122,72,237,0.35); }
.nisse-popup-close { width: 24px; height: 24px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-3); cursor: pointer; font-size: 14px; line-height: 1; flex-shrink: 0; }
.nisse-popup-close:hover { background: var(--bg-page); }
.nisse-popup-body { display: flex; gap: var(--space-3); align-items: flex-start; }
.nisse-popup-text { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.nisse-popup-context { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--purple); font-weight: 700; margin-bottom: var(--space-2); }
.nisse-popup-expand { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.nisse-popup-expand-btn { width: 100%; text-align: center; padding: var(--space-3); border-radius: var(--radius-md); border: 1px dashed rgba(122,72,237,0.4); background: transparent; color: var(--purple); font-weight: 700; font-size: 10.5px; cursor: pointer; }
.nisse-popup-expand-btn:hover { background: rgba(122,72,237,0.06); }

/* Floating mobile trigger (Decision 45) — NISSE reachable without
   scrolling to his panel. Hidden on desktop (topbar trigger already
   covers it there); visible as a fixed round button on mobile. */
.nisse-fab { display: none; }
@media (max-width: 768px) {
  .nisse-fab { display: flex; position: fixed; bottom: var(--space-6); right: var(--space-6); width: 56px; height: 56px; border-radius: 50%; z-index: 40; align-items: center; justify-content: center; border: 2px solid var(--purple); background: var(--white); box-shadow: 0 6px 20px rgba(122,72,237,0.4); cursor: pointer; padding: 0; }
  .nisse-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
  .nisse-popup { left: var(--space-4); right: var(--space-4); width: auto; bottom: 88px; }
}

/* ==================== Kundportal (Decision 46) ====================
   A deliberately DIFFERENT, simpler pattern set - same tokens, same
   card/badge/button primitives, but no KPI density, no internal
   search, no reserved-engine panels. Built for a customer reviewing
   their own quotes/projects/invoices, not an operator running a
   business. */
.portal-item-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: var(--space-6); margin-bottom: var(--space-4); cursor: pointer; }
.portal-item-card:hover { border-color: var(--blue); }
.portal-item-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: var(--space-2); }
.portal-item-meta { font-size: 11px; color: var(--text-3); }
.portal-action-row { display: flex; gap: var(--space-3); margin-top: var(--space-5); }

/* ==================== Collapsible secondary info — NEW (Decision 38) ====================
   For content that must remain available but must not compete with
   decision-relevant information (e.g. Audit Trail). */
details.collapsible-details { font-size: 11px; }
details.collapsible-details summary { cursor: pointer; font-weight: 700; font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: var(--space-2) 0; list-style: none; }
details.collapsible-details summary::-webkit-details-marker { display: none; }
details.collapsible-details summary::before { content: '▸ '; }
details.collapsible-details[open] summary::before { content: '▾ '; }
.audit-row { display: flex; justify-content: space-between; font-size: 10.5px; padding: var(--space-2) 0; border-bottom: 1px solid var(--border); color: var(--text-3); }
.audit-row .audit-action { font-family: var(--font-mono); color: var(--ink-soft); }
