/* ═══════════════════════════════════════════════
   WAVE AI CRM — Tennstrøm Design System
   ═══════════════════════════════════════════════ */

/* ── Aspekta variable font ── */
@font-face {
  font-family: "Aspekta";
  src: url("/fonts/AspektaVF.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Tennstrøm brand tokens ── */
:root {
  /* Palette */
  --ts-lin:           #E3E3DF;
  --ts-ink:           #1C1C1A;
  --ts-skog-900:      #131B16;
  --ts-skog-800:      #16201A;
  --ts-skog-700:      #1A241E;
  --ts-skog-600:      #212D25;
  --ts-fosfor-50:     #EDF7F0;
  --ts-fosfor-100:    #D6EDDF;
  --ts-fosfor-200:    #8FCCA5;
  --ts-fosfor-300:    #3EA764;
  --ts-fosfor-400:    #2F8B51;
  --ts-fosfor-500:    #16522E;
  --ts-fosfor-600:    #0E3A1F;
  --ts-warning:       #C8871F;
  --ts-danger:        #C6453A;
  --ts-success-text:  #16522E;
  --ts-warning-text:  #5C3D07;
  --ts-danger-text:   #7A2118;

  /* Semantic surface tokens — light */
  --fg-1:      #1C1C1A;
  --fg-2:      #3A3F39;
  --fg-3:      #444942;
  --fg-muted:  #6B6F68;
  --fg-accent: #16522E;
  --fg-accent-text: #16522E;

  --bg-canvas: #E3E3DF;
  --bg-card:   #EFEFEC;
  --bg-nested: #E9E9E5;

  --border-1:  rgba(28,28,26,0.07);
  --border-2:  rgba(28,28,26,0.13);
  --border-3:  rgba(28,28,26,0.24);
  --border-strong: #6B6F68;

  --scrim-modal:  rgba(28,28,26,0.42);
  --scrim-subtle: rgba(28,28,26,0.06);
  --focus-ring:   #16522E;

  /* Accent aliases used throughout components */
  --ts-fosfor:    #3EA764;
  --accent:       #3EA764;
  --accent-dim:   rgba(62,167,100,0.12);
  --accent-dim2:  rgba(62,167,100,0.06);
  --accent-ring:  rgba(62,167,100,0.22);
  --accent-dark:  #2F8B51;
  --accent-deep:  #16522E;
  --accent-deepest: #0E3A1F;

  --sidebar-bg: #131B16;

  /* Elevation */
  --elev-1:     0 1px 2px rgba(10,10,9,0.04), 0 1px 3px rgba(10,10,9,0.06);
  --elev-2:     0 4px 12px rgba(10,10,9,0.06), 0 2px 4px rgba(10,10,9,0.04);
  --elev-modal: 0 12px 32px rgba(10,10,9,0.08), 0 4px 8px rgba(10,10,9,0.04);
  --elev-card:  var(--elev-2);

  /* Spacing (4pt grid) */
  --sp-1:4px;  --sp-2:8px;  --sp-3:12px; --sp-4:16px;
  --sp-5:20px; --sp-6:24px; --sp-7:28px; --sp-8:32px;

  /* Radius */
  --r-xs: 4px;  --r-sm: 6px;  --r-md: 8px;
  --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;

  /* Motion */
  --ease-product:  cubic-bezier(0.4,0,0.2,1);
  --ease-material: cubic-bezier(0.4,0,0.2,1);
  --ease-spring:   cubic-bezier(0.34,1.45,0.5,1);
  --dur-hover: 150ms;
  --dur-panel: 260ms;

  /* Fonts */
  --font-display: "Aspekta","Helvetica Neue",Helvetica,Arial,sans-serif;
  --font-sans:    "Aspekta","Helvetica Neue",Helvetica,Arial,sans-serif;
  --font-mono:    ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}

/* ── Dark mode — .ts-dark on <html> ── */
.ts-dark {
  --fg-1:      #E3E3DF;
  --fg-2:      #CFD6CD;
  --fg-3:      #CFD6CD;
  --fg-muted:  #7E8C82;
  --fg-accent: #8FCCA5;
  --fg-accent-text: #8FCCA5;

  --bg-canvas: #16201A;
  --bg-card:   #1A241E;
  --bg-nested: #131B16;

  --border-1:  #202B23;
  --border-2:  #2E3D33;
  --border-3:  #3D5044;
  --border-strong: #7E8C82;

  --scrim-modal:  rgba(4,8,5,0.62);
  --scrim-subtle: rgba(227,227,223,0.06);
  --focus-ring:   #3EA764;

  --accent-dim:   rgba(62,167,100,0.14);
  --accent-dim2:  rgba(62,167,100,0.07);
  --accent-ring:  rgba(62,167,100,0.25);
  --accent-deep:  #3EA764;
  --accent-deepest: #2F8B51;

  --ts-success-text: #8FCCA5;
  --ts-warning-text: #E8B45F;
  --ts-danger-text:  #F4A199;

  --elev-1:     0 1px 3px rgba(0,0,0,0.28);
  --elev-modal: 0 12px 32px rgba(0,0,0,0.44), 0 4px 8px rgba(0,0,0,0.28);
}

/* ═══ RESET ══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-canvas);
  color: var(--fg-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-hover) var(--ease-product),
              color var(--dur-hover) var(--ease-product);
}
h1, h2, h3, h4 { font-family: var(--font-display); }

/* ═══ LAYOUT ═════════════════════════════════════ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  border-right: 1px solid rgba(227,227,223,0.05);
}
.main-content { margin-left: 220px; flex: 1; padding: var(--sp-8); min-width: 0; }

/* ═══ SIDEBAR ════════════════════════════════════ */
.sidebar-header {
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  border-bottom: 1px solid rgba(227,227,223,0.05);
}
.sidebar-logo-row {
  display: flex; align-items: center; gap: var(--sp-2);
  text-decoration: none;
}
.sidebar-mark {
  width: 28px; height: 28px; flex-shrink: 0;
}
.sidebar-wordmark {
  display: block; height: 13px; width: auto;
  opacity: .90;
}
.logo-sub { font-size: 9px; color: rgba(227,227,223,0.28); letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; display: block; }

.nav-section { padding: var(--sp-3) var(--sp-2) var(--sp-1); }
.nav-section-label {
  font-size: 9.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(227,227,223,0.22);
  padding: 0 var(--sp-2); margin-bottom: var(--sp-1);
}
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.nav-links li a {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2); border-radius: var(--r-sm);
  color: rgba(227,227,223,0.50); font-size: 13px; font-weight: 400;
  text-decoration: none;
  transition: background var(--dur-hover) var(--ease-product),
              color var(--dur-hover) var(--ease-product);
}
.nav-links li a:hover { background: rgba(227,227,223,0.06); color: rgba(227,227,223,0.85); }
.nav-links li a.active {
  background: var(--accent-dim); color: var(--accent); font-weight: 500;
}
.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: .9; }

.sidebar-footer {
  margin-top: auto; padding: var(--sp-3);
  border-top: 1px solid rgba(227,227,223,0.05);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.session-user { display: flex; align-items: center; gap: var(--sp-2); }
.session-avatar {
  width: 30px; height: 30px; border-radius: var(--r-pill); flex-shrink: 0;
  background: var(--accent-dim); color: var(--accent);
  font-size: 10px; font-weight: 700; font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(62,167,100,0.25);
}
.session-info { min-width: 0; }
.session-name  { font-size: 12px; font-weight: 600; color: rgba(227,227,223,0.80); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-email { font-size: 10px; color: rgba(227,227,223,0.28); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-actions { display: flex; gap: var(--sp-2); }
.btn-signout {
  flex: 1; text-align: center; padding: 6px;
  background: rgba(227,227,223,0.05); color: rgba(227,227,223,0.36);
  border-radius: var(--r-sm); text-decoration: none; font-size: 11px;
  transition: background var(--dur-hover), color var(--dur-hover);
}
.btn-signout:hover { background: rgba(227,227,223,0.10); color: rgba(227,227,223,0.80); }
.btn-theme {
  padding: 6px 8px; background: rgba(227,227,223,0.05);
  border: none; border-radius: var(--r-sm); cursor: pointer;
  color: rgba(227,227,223,0.36);
  transition: background var(--dur-hover), color var(--dur-hover);
}
.btn-theme:hover { background: rgba(227,227,223,0.10); color: rgba(227,227,223,0.80); }
.theme-icon-dark  { display: none; }
.theme-icon-light { display: inline; }
.ts-dark .theme-icon-dark  { display: inline; }
.ts-dark .theme-icon-light { display: none; }

/* ═══ PAGE HEADER ═════════════════════════════════ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.page-header h1 {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  letter-spacing: -.5px; color: var(--fg-1);
}
.header-actions { display: flex; gap: var(--sp-2); align-items: center; }

/* ═══ BUTTONS ═════════════════════════════════════ */
.btn {
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); border: none;
  cursor: pointer; font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  transition: background var(--dur-hover) var(--ease-product),
              opacity var(--dur-hover);
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.btn-primary { background: var(--ts-ink); color: var(--ts-lin); }
.btn-primary:hover { background: #2A2A26; }
.btn-secondary {
  background: var(--bg-card); color: var(--fg-1);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--bg-nested); }
.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: 12px; }
.btn-ai {
  background: var(--accent-deep);
  color: #E3E3DF; white-space: nowrap; flex-shrink: 0;
  border: 1px solid rgba(62,167,100,0.3);
}
.btn-ai:hover:not(:disabled) { background: var(--accent-deepest); }
.btn-ai:disabled { opacity: .35; cursor: not-allowed; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  padding: 4px 6px; border-radius: var(--r-sm);
  color: var(--fg-3);
  transition: background var(--dur-hover), color var(--dur-hover);
}
.btn-icon:hover { background: var(--bg-nested); color: var(--fg-1); }
.btn-danger:hover { color: var(--ts-danger-text); }
.btn-warning { color: var(--fg-3); }
.btn-warning-active { color: var(--ts-warning-text); }
.btn-danger-outline {
  background: none; border: 1px solid rgba(198,69,58,0.30);
  color: var(--ts-danger-text); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md); font-size: 13px; cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--dur-hover);
}
.btn-danger-outline:hover { background: rgba(198,69,58,0.06); }
.btn-text { background: none; border: none; color: var(--fg-accent); font-size: 12px; cursor: pointer; padding: 0 4px; font-family: var(--font-sans); }
.btn-text:hover { text-decoration: underline; }

/* ═══ STATS GRID ══════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--elev-1);
  transition: background var(--dur-hover), border-color var(--dur-hover);
}
.stat-card .stat-value {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  letter-spacing: -.5px; color: var(--fg-1);
}
.stat-card .stat-label { font-size: 10px; color: var(--fg-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .08em; }
.accent-green .stat-value { color: var(--ts-fosfor-300); }
.accent-red   .stat-value { color: var(--ts-danger-text); }
.accent-yellow .stat-value { color: var(--ts-warning-text); }
.accent-blue  .stat-value { color: var(--accent-dark); }
.stat-currency { font-size: 11px; font-weight: 600; opacity: .50; margin-left: 2px; }

/* ═══ DASHBOARD ═══════════════════════════════════ */
.dashboard-tables { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.table-section {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--elev-1);
  transition: background var(--dur-hover);
}
.table-section h2 {
  font-family: var(--font-sans); font-size: 10px; font-weight: 600;
  margin-bottom: var(--sp-3); text-transform: uppercase;
  letter-spacing: .10em; color: var(--fg-muted);
}
.pipeline-row { display: flex; align-items: center; gap: var(--sp-2); padding: 7px 0; border-bottom: 1px solid var(--border-1); }
.pipeline-row:last-child { border-bottom: none; }
.pipeline-count { font-size: 12px; color: var(--fg-3); }
.pipeline-value { font-size: 12px; color: var(--ts-fosfor-300); font-weight: 700; margin-left: auto; }

/* ═══ TABS ════════════════════════════════════════ */
.tab-bar { display: flex; gap: 2px; margin-bottom: var(--sp-4); border-bottom: 1px solid var(--border-2); }
.tab {
  background: none; border: none; padding: var(--sp-2) var(--sp-4);
  cursor: pointer; font-size: 13px; font-family: var(--font-sans);
  color: var(--fg-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur-hover);
}
.tab:hover { color: var(--fg-1); }
.tab.active { color: var(--fg-1); border-bottom-color: var(--ts-ink); font-weight: 500; }

/* ═══ SEARCH / FILTER BAR ═════════════════════════ */
.search-bar { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.search-input {
  padding: var(--sp-2) var(--sp-3); background: var(--bg-card);
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  color: var(--fg-1); width: 280px; font-size: 13px; font-family: var(--font-sans);
  transition: border-color var(--dur-hover), box-shadow var(--dur-hover);
}
.search-input::placeholder { color: var(--fg-muted); }
.search-input:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 2px var(--focus-ring); }
.filter-select {
  padding: 7px var(--sp-2); background: var(--bg-card);
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  color: var(--fg-1); font-size: 13px; font-family: var(--font-sans);
  transition: background var(--dur-hover);
}
.show-deleted-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-3); cursor: pointer; }

/* ═══ DATA TABLE ══════════════════════════════════ */
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--elev-1);
  transition: background var(--dur-hover);
}
.data-table th {
  text-align: left; padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-sans); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .10em; color: var(--fg-muted);
  border-bottom: 1px solid var(--border-2);
  background: var(--bg-nested);
  transition: background var(--dur-hover);
}
.data-table td { padding: 11px var(--sp-3); border-bottom: 1px solid var(--border-1); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--scrim-subtle); }
.row-onhold td { opacity: .6; }
.row-deleted td { opacity: .35; }
.row-deleted strong { text-decoration: line-through; }
.row-clickable { cursor: pointer; }
.empty-row { text-align: center; color: var(--fg-muted); padding: 40px !important; }
.date-overdue { color: var(--ts-danger-text); font-weight: 600; }

/* ═══ BADGES ══════════════════════════════════════ */
.type-badge { display: inline-block; padding: 2px var(--sp-2); border-radius: var(--r-pill); font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.type-customer { background: var(--accent-dim2); color: var(--accent-dark); border: 1px solid rgba(62,167,100,0.15); }
.type-partner  { background: var(--accent-dim);  color: var(--accent);      border: 1px solid rgba(62,167,100,0.25); }

.stage-badge { display: inline-block; padding: 2px var(--sp-2); border-radius: var(--r-pill); font-size: 11px; font-weight: 500; }
.stage-lead        { background: var(--bg-nested); color: var(--fg-3); border: 1px solid var(--border-2); }
.stage-qualified   { background: rgba(62,167,100,0.10); color: var(--accent-dark); border: 1px solid rgba(62,167,100,0.20); }
.stage-proposal    { background: rgba(200,135,31,0.10); color: var(--ts-warning-text); border: 1px solid rgba(200,135,31,0.20); }
.stage-negotiation { background: var(--accent-dim); color: var(--fg-accent); border: 1px solid rgba(62,167,100,0.22); }
.stage-closedwon   { background: rgba(62,167,100,0.12); color: var(--ts-fosfor-300); border: 1px solid rgba(62,167,100,0.25); }
.stage-closedlost  { background: rgba(198,69,58,0.10); color: var(--ts-danger-text); border: 1px solid rgba(198,69,58,0.20); }

.ts-dark .stage-proposal    { color: var(--ts-warning-text); }
.ts-dark .stage-negotiation { color: var(--fg-accent); }
.ts-dark .stage-closedwon   { color: var(--ts-fosfor-200); }

/* Task status badges */
.state-badge { display: inline-block; padding: 2px var(--sp-2); border-radius: var(--r-pill); font-size: 11px; font-weight: 500; }
.state-todo       { background: var(--bg-nested); color: var(--fg-3); border: 1px solid var(--border-2); }
.state-inprogress { background: var(--accent-dim); color: var(--fg-accent); border: 1px solid rgba(62,167,100,0.22); }
.state-done       { background: rgba(62,167,100,0.12); color: var(--ts-fosfor-300); border: 1px solid rgba(62,167,100,0.25); }
.ts-dark .state-done { color: var(--ts-fosfor-200); }

/* Task priority badges */
.priority-badge {
  display: inline-block; padding: 1px var(--sp-2); border-radius: var(--r-pill);
  font-size: 9.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; flex-shrink: 0;
}
.priority-high { background: rgba(198,69,58,0.10); color: var(--ts-danger-text); border: 1px solid rgba(198,69,58,0.22); }
.priority-low  { background: var(--bg-nested); color: var(--fg-muted); border: 1px solid var(--border-1); }

/* Task cards */
.task-card.card-priority-high { border-left: 2px solid var(--ts-danger); }
.task-card.card-priority-low  { border-left: 2px solid var(--border-2); }
.task-title-done { text-decoration: line-through; opacity: .55; }
.card-lead-link {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--fg-accent);
  margin-bottom: var(--sp-2);
}
.card-lead-link svg { width: 11px; height: 11px; flex-shrink: 0; }
.card-description {
  font-size: 11px; color: var(--fg-3); line-height: 1.45;
  margin-bottom: var(--sp-2);
}

.badge-deleted { background: rgba(198,69,58,0.10); color: var(--ts-danger-text); font-size: 10px; font-weight: 600; padding: 1px var(--sp-2); border-radius: var(--r-pill); margin-left: var(--sp-2); }
.badge-set     { background: rgba(62,167,100,0.10); color: var(--ts-fosfor-300); font-size: 11px; font-weight: 500; padding: 1px var(--sp-2); border-radius: var(--r-pill); border: 1px solid rgba(62,167,100,0.20); }
.badge-unset   { background: var(--bg-nested); color: var(--fg-muted); font-size: 11px; padding: 1px var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--border-1); }

/* ═══ KANBAN ══════════════════════════════════════ */
.kanban-board {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3); align-items: start; width: 100%;
}
.kanban-column {
  min-width: 0; background: var(--bg-nested);
  border-radius: var(--r-lg); border: 1px solid var(--border-1);
  overflow: hidden; transition: background var(--dur-hover);
}
.kanban-column:has(.stage-lead)        { border-top: 2px solid var(--border-3); }
.kanban-column:has(.stage-qualified)   { border-top: 2px solid rgba(62,167,100,0.50); }
.kanban-column:has(.stage-proposal)    { border-top: 2px solid rgba(200,135,31,0.60); }
.kanban-column:has(.stage-negotiation) { border-top: 2px solid var(--accent); }
.kanban-column:has(.stage-closedwon)   { border-top: 2px solid var(--ts-fosfor-300); }
.kanban-column:has(.stage-closedlost)  { border-top: 2px solid var(--ts-danger); }
.ts-dark .kanban-column:has(.stage-lead) { border-top: 2px solid rgba(227,227,223,0.10); }

/* Task board: three wider columns instead of the pipeline's six */
.kanban-board--tasks { grid-template-columns: repeat(3, 1fr); }
.kanban-column:has(.state-todo)       { border-top: 2px solid var(--border-3); }
.kanban-column:has(.state-inprogress) { border-top: 2px solid var(--accent); }
.kanban-column:has(.state-done)       { border-top: 2px solid var(--ts-fosfor-300); }
.ts-dark .kanban-column:has(.state-todo) { border-top: 2px solid rgba(227,227,223,0.10); }

.kanban-column-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  border-bottom: 1px solid var(--border-1);
}
.kanban-empty {
  font-size: 11px; color: var(--fg-muted); text-align: center;
  padding: var(--sp-4) 0;
}
.kanban-count {
  font-size: 11px; font-weight: 600; color: var(--fg-muted);
  background: var(--bg-card); border: 1px solid var(--border-1);
  padding: 1px var(--sp-2); border-radius: var(--r-pill);
}
.kanban-cards { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2); min-height: 80px; }

.kanban-card {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-3) var(--sp-2);
  cursor: grab; user-select: none;
  box-shadow: var(--elev-1);
  transition: box-shadow var(--dur-hover) var(--ease-product),
              transform var(--dur-hover) var(--ease-product),
              background var(--dur-hover);
}
.kanban-card:hover { box-shadow: var(--elev-modal); transform: translateY(-1px); }
.card-dragging { opacity: .25; transform: scale(.97); }
.card-onhold { border-left: 2px solid var(--ts-warning); }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); margin-bottom: 4px; }
.card-header strong { font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--fg-1); }
.badge-onhold { color: var(--ts-warning-text); font-size: 11px; flex-shrink: 0; }
.card-contact { font-size: 11px; color: var(--fg-3); margin-bottom: var(--sp-2); }
.card-value {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-size: 12px; font-weight: 700; color: var(--ts-fosfor-300);
  background: var(--accent-dim2); padding: 1px var(--sp-2);
  border-radius: var(--r-sm); margin-bottom: var(--sp-2);
  border: 1px solid rgba(62,167,100,0.15);
}
.card-value .currency { font-size: 9px; opacity: .6; }
.card-meta { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: 3px; }
.card-assignee-pill {
  width: 20px; height: 20px; border-radius: var(--r-pill); flex-shrink: 0;
  background: var(--accent-dim); color: var(--accent);
  font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.card-assignee-name { font-size: 11px; color: var(--fg-3); }
.card-closing { font-size: 10px; color: var(--fg-muted); margin-top: 2px; }
.card-closing-overdue { color: var(--ts-danger-text); font-weight: 700; }
.card-actions {
  display: flex; gap: 2px; margin-top: var(--sp-2);
  padding-top: var(--sp-2); border-top: 1px solid var(--border-1);
}

/* ═══ OVERDUE BANNER ══════════════════════════════ */
.overdue-banner {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  background: rgba(200,135,31,0.06); border: 1px solid rgba(200,135,31,0.18);
  border-left: 3px solid var(--ts-warning);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5);
}
.overdue-banner-icon { font-size: 15px; flex-shrink: 0; line-height: 1.6; }
.overdue-banner-body { flex: 1; min-width: 0; }
.overdue-banner-title { font-size: 12px; font-weight: 700; color: var(--ts-warning-text); margin-bottom: var(--sp-2); }
.overdue-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.overdue-chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--r-pill); padding: 3px var(--sp-3);
  font-size: 11px; color: var(--fg-1); cursor: pointer;
  transition: background var(--dur-hover);
}
.overdue-chip:hover { background: var(--bg-nested); }
.overdue-chip-user { color: var(--fg-3); }
.overdue-chip-date { color: var(--ts-danger-text); font-weight: 700; }

/* ═══ ALERTS ══════════════════════════════════════ */
.alert { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); margin-bottom: var(--sp-3); font-size: 13px; border-left-width: 3px; }
.alert-success { background: var(--bg-nested); color: var(--ts-success-text); border: 1px solid rgba(62,167,100,0.20); border-left: 3px solid var(--ts-fosfor-300); }
.alert-error   { background: var(--bg-nested); color: var(--ts-danger-text);  border: 1px solid rgba(198,69,58,0.20); border-left: 3px solid var(--ts-danger); }

/* ═══ SLIDE PANEL ═════════════════════════════════ */
.panel-overlay { position: fixed; inset: 0; background: var(--scrim-modal); z-index: 1000; }
.slide-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 490px; max-width: 100vw;
  background: var(--bg-card); z-index: 1001;
  display: flex; flex-direction: column;
  box-shadow: var(--elev-modal);
  border-left: 1px solid var(--border-2);
  animation: slideInRight var(--dur-panel) var(--ease-product) forwards;
  transition: background var(--dur-hover);
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6) var(--sp-3);
  border-bottom: 1px solid var(--border-1); flex-shrink: 0;
}
.panel-header h2 { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.panel-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--fg-muted); line-height: 1; padding: 2px;
  transition: color var(--dur-hover);
}
.panel-close:hover { color: var(--fg-1); }
.panel-body { padding: var(--sp-5) var(--sp-6); overflow-y: auto; flex: 1; }
.panel-footer {
  padding: var(--sp-3) var(--sp-6); border-top: 1px solid var(--border-1);
  display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0;
}

/* ═══ FORM ════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-field { display: flex; flex-direction: column; gap: var(--sp-1); }
.form-field-wide { grid-column: 1 / -1; }
.form-field label {
  font-size: 9.5px; font-weight: 600; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: .10em;
}
.form-field input,
.form-field select,
.form-field textarea {
  padding: var(--sp-2) var(--sp-2); background: var(--bg-nested);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font-size: 13px; font-family: var(--font-sans);
  width: 100%; color: var(--fg-1);
  transition: border-color var(--dur-hover), background var(--dur-hover), box-shadow var(--dur-hover);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none; border-color: var(--border-strong);
  box-shadow: 0 0 0 2px var(--focus-ring);
  background: var(--bg-card);
}
.input-with-button { display: flex; gap: var(--sp-2); }
.input-with-button input { flex: 1; }
.field-error { font-size: 11px; color: var(--ts-danger-text); margin-top: 2px; }
.inline-input {
  padding: var(--sp-1) var(--sp-2); background: var(--bg-nested);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font-size: 13px; font-family: var(--font-sans); width: 100%; color: var(--fg-1);
}

/* ═══ AI RESEARCH PANEL ═══════════════════════════ */
.enrich-panel-inline {
  margin-top: var(--sp-5); background: var(--accent-dim2);
  border: 1px solid rgba(62,167,100,0.15);
  border-radius: var(--r-md); padding: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.enrich-panel-header { display: flex; align-items: center; justify-content: space-between; }
.enrich-title { font-size: 9.5px; font-weight: 600; color: var(--fg-accent); text-transform: uppercase; letter-spacing: .10em; }
.enrich-close { background: none; border: none; cursor: pointer; color: var(--fg-muted); font-size: 14px; }
.enrich-disclaimer { font-size: 11px; color: var(--ts-warning-text); line-height: 1.4; }
.enrich-section {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: var(--r-sm); padding: var(--sp-2);
  display: flex; flex-direction: column; gap: var(--sp-1);
}
.enrich-section-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .10em; color: var(--fg-accent); }
.enrich-text { font-size: 12px; color: var(--fg-2); line-height: 1.5; word-break: break-word; }
.enrich-link { color: var(--accent-dark); }
.btn-apply {
  align-self: flex-start; background: var(--accent-dim); border: 1px solid rgba(62,167,100,0.20);
  color: var(--fg-accent); font-size: 11px; font-weight: 600;
  padding: 2px var(--sp-2); border-radius: var(--r-xs); cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--dur-hover);
}
.btn-apply:hover { background: rgba(62,167,100,0.18); }

/* ═══ ACTIVITY TIMELINE ═══════════════════════════ */
.activity-section { margin-top: var(--sp-6); border-top: 1px solid var(--border-1); padding-top: var(--sp-5); }
.activity-section-header {
  font-size: 9.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .10em; color: var(--fg-muted); margin-bottom: var(--sp-3);
}
.note-composer { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.note-input {
  padding: var(--sp-2) var(--sp-2); background: var(--bg-nested);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font-size: 13px; resize: vertical; font-family: var(--font-sans); color: var(--fg-1);
  transition: border-color var(--dur-hover), box-shadow var(--dur-hover);
}
.note-input:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 2px var(--focus-ring); }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: var(--sp-3); padding-bottom: var(--sp-3); position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border-2); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 13px; height: 13px; border-radius: var(--r-pill); flex-shrink: 0; margin-top: 3px; border: 2px solid; }
.timeline-note .timeline-dot { background: var(--accent-dim); border-color: var(--accent); }
.timeline-auto .timeline-dot { background: var(--bg-nested); border-color: var(--border-2); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-note-text {
  font-size: 13px; color: var(--fg-1); line-height: 1.5;
  background: var(--bg-nested); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-2);
  margin-bottom: var(--sp-1); white-space: pre-wrap;
}
.timeline-auto-text { font-size: 12px; color: var(--fg-3); margin-bottom: 3px; }
.timeline-meta { display: flex; gap: var(--sp-2); align-items: center; }
.timeline-author { font-size: 11px; font-weight: 600; color: var(--fg-3); }
.timeline-date { font-size: 11px; color: var(--fg-muted); }
.timeline-empty { font-size: 12px; color: var(--fg-muted); text-align: center; padding: var(--sp-4) 0; }

/* ═══ REPORTS ═════════════════════════════════════ */
.report-label { font-size: 13px; color: var(--fg-3); margin-bottom: var(--sp-5); }
.report-tables { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-top: var(--sp-5); }
.win-rate-bar-wrap { margin: var(--sp-1) 0 var(--sp-2); }
.win-rate-label { font-size: 12px; color: var(--fg-3); margin-bottom: var(--sp-2); }
.win-rate-track { height: 6px; background: rgba(198,69,58,0.12); border-radius: var(--r-pill); overflow: hidden; }
.win-rate-fill { height: 100%; background: var(--ts-fosfor-300); border-radius: var(--r-pill); transition: width .4s var(--ease-product); }

/* ═══ IMPORT MODAL ════════════════════════════════ */
.import-modal {
  position: fixed; top: 50%; left: 50%; z-index: 1001;
  transform: translate(-50%, -50%);
  width: 640px; max-width: calc(100vw - 40px);
  background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--r-xl); box-shadow: var(--elev-modal);
  display: flex; flex-direction: column; max-height: 90vh;
  animation: fadeScaleIn 180ms var(--ease-product) forwards;
}
@keyframes fadeScaleIn {
  from { opacity: 0; transform: translate(-50%,-50%) scale(.97); }
  to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
.import-modal-body { padding: var(--sp-5) var(--sp-6); overflow-y: auto; flex: 1; }
.import-example {
  background: var(--bg-nested); border: 1px solid var(--border-1);
  border-radius: var(--r-md); overflow: hidden;
}
.import-example-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border-1);
}
.import-example-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .10em; color: var(--fg-muted); }
.btn-copy {
  background: none; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  font-size: 11px; font-weight: 600; color: var(--fg-accent);
  padding: 2px var(--sp-2); cursor: pointer; font-family: var(--font-sans);
  transition: background var(--dur-hover);
}
.btn-copy:hover { background: var(--accent-dim2); }
.import-example-code {
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.6; color: var(--fg-2);
  padding: var(--sp-3); overflow-x: auto; white-space: pre;
  margin: 0;
}
.import-textarea {
  width: 100%; padding: var(--sp-2) var(--sp-3);
  background: var(--bg-nested); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); color: var(--fg-1);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  resize: vertical; transition: border-color var(--dur-hover), box-shadow var(--dur-hover);
}
.import-textarea:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 2px var(--focus-ring); }

/* ═══ MISC ════════════════════════════════════════ */
.loading { color: var(--fg-muted); padding: 40px 0; }
.spinner { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ LOGIN PAGE ══════════════════════════════════ */
.login-body { background: var(--ts-skog-900); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--ts-skog-800); border: 1px solid rgba(227,227,223,0.07);
  border-radius: var(--r-xl); padding: 40px; width: 360px;
  box-shadow: var(--elev-modal);
}
.login-logo-row { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: 4px; }
.login-mark { width: 32px; height: 32px; flex-shrink: 0; }
.login-wordmark { height: 18px; width: auto; opacity: .92; }
.login-title-sub { font-family: var(--font-sans); font-size: 11px; color: rgba(227,227,223,0.40); letter-spacing: .14em; text-transform: uppercase; margin-bottom: var(--sp-6); }
.login-title { font-family: var(--font-sans); font-size: 13px; color: rgba(227,227,223,0.36); font-weight: 400; margin-bottom: var(--sp-6); }
.login-card .form-field label { color: rgba(227,227,223,0.40); }
.login-card .form-field input {
  background: rgba(227,227,223,0.05); border-color: rgba(227,227,223,0.10); color: var(--ts-lin);
}
.login-card .form-field input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(62,167,100,0.30);
  background: rgba(227,227,223,0.08);
}
.login-card .btn-primary { width: 100%; justify-content: center; padding: var(--sp-3); font-size: 14px; }
.login-card .alert-error { background: rgba(198,69,58,0.10); color: var(--ts-danger-text); border-left-color: var(--ts-danger); }

/* ═══════════════════════════════════════════════
   SALES PORTAL
   ═══════════════════════════════════════════════ */

.portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}
.portal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-8);
  background: var(--ts-skog-900);
  border-bottom: 1px solid rgba(227,227,223,0.05);
}
.portal-logo { display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; }
.portal-mark { width: 32px; height: 32px; flex-shrink: 0; }
.portal-wordmark { height: 16px; width: auto; opacity: .90; }
.portal-header .logo-sub { font-family: var(--font-sans); font-size: 10px; color: rgba(227,227,223,0.30); text-transform: uppercase; letter-spacing: .10em; }
.portal-header-actions { display: flex; align-items: center; gap: var(--sp-3); }

.portal-main {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: var(--sp-8) var(--sp-6);
  gap: var(--sp-8);
}
.portal-hero { }
.portal-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--fg-1);
  margin: 0;
}

/* CTA row (unused, kept for compatibility) */
.portal-cta-row {
  display: flex; gap: var(--sp-4); flex-wrap: wrap;
}
.portal-cta {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  border-radius: var(--r-pill);
  font-family: var(--font-display); font-weight: 700;
  text-decoration: none;
  transition: transform var(--dur-hover) var(--ease-product),
              box-shadow var(--dur-hover) var(--ease-product),
              filter var(--dur-hover);
  cursor: pointer;
}
.portal-cta:hover { transform: translateY(-2px); text-decoration: none; }

.portal-cta--crm {
  padding: var(--sp-4) var(--sp-6); font-size: .95rem; font-weight: 500;
  font-family: var(--font-sans);
  background: var(--ts-ink); color: var(--ts-lin);
  border: 1px solid transparent;
  box-shadow: 0 4px 16px rgba(28,28,26,0.18);
}
.portal-cta--crm svg { width: 16px; height: 16px; flex-shrink: 0; }
.portal-cta--crm:hover { filter: brightness(1.12); color: var(--ts-lin); }
.ts-dark .portal-cta--crm { background: var(--ts-lin); color: var(--ts-ink); }
.ts-dark .portal-cta--crm:hover { color: var(--ts-ink); }

.portal-cta--demo {
  padding: var(--sp-4) var(--sp-6); font-size: .95rem; font-weight: 500;
  font-family: var(--font-sans);
  background: var(--bg-card); color: var(--fg-1);
  border: 1px solid var(--border-2);
  box-shadow: var(--elev-1);
}
.portal-cta--demo svg { width: 16px; height: 16px; flex-shrink: 0; }
.portal-cta--demo:hover { border-color: var(--border-strong); color: var(--fg-1); }

/* Presentations & Prices sections */
.portal-section { width: 100%; max-width: 720px; }
.portal-section-label {
  font-family: var(--font-sans); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--fg-muted); margin-bottom: var(--sp-3);
}
.portal-pres-grid { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.portal-pres-card {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--r-pill); text-decoration: none;
  color: var(--fg-1); font-family: var(--font-sans); font-size: .95rem; font-weight: 500;
  transition: border-color var(--dur-hover) var(--ease-product),
              background var(--dur-hover),
              transform var(--dur-hover) var(--ease-product);
}
.portal-pres-card:hover {
  border-color: var(--border-strong); background: var(--scrim-subtle);
  color: var(--fg-1); text-decoration: none;
  transform: translateY(-1px);
}
.portal-pres-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--fg-3); }
.portal-pres-name { white-space: nowrap; }
.portal-pres-arrow { font-size: .85rem; color: var(--fg-muted); transition: color var(--dur-hover); }
.portal-pres-card:hover .portal-pres-arrow { color: var(--fg-1); }
.portal-pres-card:hover .portal-pres-icon { color: var(--fg-2); }
