/* ============================================================
   Driva Prosjektoppfølging — "Stille flyt"
   Delt design-system for de nye prosjektoppfølgingssidene:
   driva-tasks.html, driva-gantt.html, driva-my-tasks.html,
   driva-project-status.html, driva-notifications.html
   samt prosjektdetalj-fanene i driva-dashboard.html.

   Bevisst nordisk/editorial retning — egen visuell sone i Driva,
   atskilt fra det mørke RK-temaet (styles.css) med vilje.
   Kilde: Docs/new design/design_handoff_driva_prosjektoppfolging/_shared/
   ============================================================ */

.sf-scope {
  /* PALETT — "Papir" */
  --bg: #FAFAF7;
  --paper: #FFFFFF;
  --ink: #1A1D1A;
  --ink-muted: #6B6E68;
  --ink-faint: #A5A69F;
  --line: #E5E4DF;
  --line-strong: #D4D2CB;
  --hover: #F2F0EA;
  --accent: #2D5D4F;      /* mose */
  --accent-soft: #E8EDE9;
  --signal: #B8482E;      /* rust */
  --signal-soft: #F5E4DE;
  --sol: #C9A961;         /* matt gull */
  --sol-soft: #F4EBD5;
  --blue: #395C7A;        /* dus stål */
  --blue-soft: #E4EAEF;

  --font-serif: 'Fraunces', 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 14px;
  --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 28px; --fs-3xl: 40px; --fs-4xl: 56px;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px;

  --density: 1;
  --row-h: calc(36px * var(--density));
  --pad-y: calc(10px * var(--density));

  --r-1: 2px; --r-2: 4px; --r-3: 6px; --r-4: 8px;

  --shadow-sm: 0 1px 0 rgba(26, 29, 26, 0.04);
  --shadow-md: 0 1px 3px rgba(26, 29, 26, 0.06), 0 4px 12px rgba(26, 29, 26, 0.04);
  --shadow-lg: 0 4px 16px rgba(26, 29, 26, 0.08), 0 12px 40px rgba(26, 29, 26, 0.06);

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 180ms;

  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  min-height: 100vh;
}

.sf-scope * { box-sizing: border-box; }
.sf-scope h1, .sf-scope h2, .sf-scope h3, .sf-scope h4 { margin: 0; font-weight: 400; letter-spacing: -0.01em; }
.sf-scope p { margin: 0; }
.sf-scope button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
.sf-scope a { color: inherit; text-decoration: none; }

.sf-scope .serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.02em; }
.sf-scope .mono { font-family: var(--font-mono); font-feature-settings: 'ss01'; letter-spacing: -0.01em; }
.sf-scope .tabular { font-variant-numeric: tabular-nums; }
.sf-scope .eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-muted);
}
.sf-scope .muted { color: var(--ink-muted); }
.sf-scope .faint { color: var(--ink-faint); }
.sf-scope ::selection { background: var(--accent); color: white; }
.sf-scope ::-webkit-scrollbar { width: 10px; height: 10px; }
.sf-scope ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; }
.sf-scope ::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
.sf-scope ::-webkit-scrollbar-track { background: transparent; }

/* ============ APP CHROME ============ */
.sf-scope .sf-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; background: var(--bg); }
.sf-scope .sidebar {
  background: var(--bg); border-right: 1px solid var(--line); padding: var(--s-6) 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sf-scope .brand { padding: 0 var(--s-6) var(--s-6); display: flex; align-items: baseline; gap: var(--s-2); }
.sf-scope .brand-mark { font-family: var(--font-serif); font-size: 22px; letter-spacing: -0.03em; }
.sf-scope .brand-mark::after {
  content: ""; display: inline-block; width: 6px; height: 6px; background: var(--accent);
  border-radius: 50%; margin-left: 4px; vertical-align: middle; margin-bottom: 3px;
}
.sf-scope .brand-sub {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.sf-scope .orgpicker {
  display: flex; align-items: center; gap: 10px; margin: 0 var(--s-4) var(--s-4);
  padding: 8px 10px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-3); cursor: pointer; text-decoration: none;
}
.sf-scope .orgpicker:hover { background: var(--hover); }
.sf-scope .nav-section { padding: var(--s-4) var(--s-4) var(--s-2); }
.sf-scope .nav-section-label {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-faint); padding: 0 var(--s-3) var(--s-2);
}
.sf-scope .nav-item {
  display: flex; align-items: center; gap: var(--s-3); padding: 7px var(--s-3);
  font-size: var(--fs-md); color: var(--ink); border-radius: var(--r-2); cursor: pointer;
  position: relative; transition: background var(--dur) var(--ease); text-decoration: none;
}
.sf-scope .nav-item:hover { background: var(--hover); }
.sf-scope .nav-item.active { background: var(--paper); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.sf-scope .nav-item.active::before {
  content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 2px;
  background: var(--accent); border-radius: 2px;
}
.sf-scope .nav-item .badge { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-muted); }
.sf-scope .nav-icon { width: 14px; height: 14px; color: var(--ink-muted); flex-shrink: 0; }
.sf-scope .main { min-width: 0; display: flex; flex-direction: column; }

/* ============ TOPPBAR ============ */
.sf-scope .topbar {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-8);
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.sf-scope .crumb { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md); color: var(--ink-muted); }
.sf-scope .crumb .sep { color: var(--ink-faint); }
.sf-scope .crumb .now { color: var(--ink); }
.sf-scope .topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.sf-scope .search {
  display: flex; align-items: center; gap: var(--s-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r-2); padding: 6px 10px;
  width: 240px; font-size: var(--fs-sm); color: var(--ink-muted);
}
.sf-scope .search .kbd {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
  padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px;
}
.sf-scope .avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 10px;
  font-weight: 500; font-family: var(--font-mono);
}
.sf-scope .avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.sf-scope .avatar.lg { width: 32px; height: 32px; font-size: 12px; }

/* ============ KNAPPER ============ */
.sf-scope .btn {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 7px var(--s-3);
  font-size: var(--fs-md); border-radius: var(--r-2); border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); transition: all var(--dur) var(--ease); white-space: nowrap;
}
.sf-scope .btn:hover { border-color: var(--line-strong); background: var(--hover); }
.sf-scope .btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sf-scope .btn.primary:hover { background: #2C302C; }
.sf-scope .btn.accent { background: var(--accent); color: white; border-color: var(--accent); }
.sf-scope .btn.ghost { border-color: transparent; background: transparent; }
.sf-scope .btn.ghost:hover { background: var(--hover); }
.sf-scope .btn.sm { padding: 4px 10px; font-size: var(--fs-sm); }
.sf-scope .btn.icon { padding: 6px; }
.sf-scope .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ SAKS-PRIMITIVET ============ */
.sf-scope .case-id {
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-muted); letter-spacing: 0.02em;
  padding: 1px 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; white-space: nowrap;
}
.sf-scope .case-id.oppg { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.sf-scope .case-id.sak { color: var(--blue); border-color: var(--blue-soft); background: var(--blue-soft); }
.sf-scope .case-id.feil { color: var(--signal); border-color: var(--signal-soft); background: var(--signal-soft); }
.sf-scope .case-id.styre { color: var(--ink); }

/* ============ STATUS ============ */
.sf-scope .status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sf-scope .status-dot.todo { background: var(--line-strong); }
.sf-scope .status-dot.progress { background: var(--sol); }
.sf-scope .status-dot.blocked { background: var(--signal); }
.sf-scope .status-dot.done { background: var(--accent); }
.sf-scope .pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; font-size: var(--fs-xs);
  border-radius: 20px; background: var(--bg); color: var(--ink-muted); border: 1px solid var(--line); white-space: nowrap;
}
.sf-scope .pill.progress { color: var(--sol); background: var(--sol-soft); border-color: transparent; }
.sf-scope .pill.done { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.sf-scope .pill.blocked { color: var(--signal); background: var(--signal-soft); border-color: transparent; }

/* ============ PRIORITET ============ */
.sf-scope .prio { font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 7px; border-radius: 3px; white-space: nowrap; }
.sf-scope .prio.hoy { background: var(--signal-soft); color: var(--signal); }
.sf-scope .prio.med { color: var(--ink-muted); border: 1px solid var(--line); }
.sf-scope .prio.lav { color: var(--ink-faint); }

/* ============ KORT ============ */
.sf-scope .card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-3); }
.sf-scope .card-header { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--s-3); }
.sf-scope .card-title { font-family: var(--font-serif); font-size: var(--fs-lg); letter-spacing: -0.01em; }
.sf-scope .card-body { padding: var(--s-5); }

/* ============ TIDSAKSLINJAL ============ */
.sf-scope .timerail { position: relative; padding: var(--s-4) var(--s-8); background: var(--paper); border-bottom: 1px solid var(--line); }
.sf-scope .timerail-track { position: relative; height: 24px; }
.sf-scope .timerail-axis { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-strong); }
.sf-scope .timerail-tick { position: absolute; top: 50%; width: 1px; height: 5px; background: var(--line-strong); transform: translateY(-2px); }
.sf-scope .timerail-label {
  position: absolute; top: 0; font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.05em; transform: translateX(-50%);
}
.sf-scope .timerail-now { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--signal); }
.sf-scope .timerail-now::before { content: ""; position: absolute; top: -2px; left: -3px; width: 7px; height: 7px; background: var(--signal); border-radius: 50%; }
.sf-scope .timerail-now::after { content: "NÅ"; position: absolute; bottom: -14px; left: 4px; font-family: var(--font-mono); font-size: 9px; color: var(--signal); letter-spacing: 0.1em; }
.sf-scope .timerail-milestone { position: absolute; top: 50%; transform: translate(-50%, 4px); width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--ink); }
.sf-scope .timerail-milestone.done { border-bottom-color: var(--accent); }
.sf-scope .timerail-milestone.upcoming { border-bottom-color: var(--ink-muted); }

/* ============ TABELLER ============ */
.sf-scope .tbl { width: 100%; border-collapse: collapse; }
.sf-scope .tbl th {
  text-align: left; padding: var(--s-3) var(--s-4); font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); font-weight: 400;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.sf-scope .tbl td { padding: var(--pad-y) var(--s-4); border-bottom: 1px solid var(--line); font-size: var(--fs-md); vertical-align: middle; }
.sf-scope .tbl tr:hover td { background: var(--hover); }
.sf-scope .tbl tr:last-child td { border-bottom: 0; }

/* ============ METRIKKER ============ */
.sf-scope .metric { display: flex; flex-direction: column; gap: 2px; }
.sf-scope .metric-label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); }
.sf-scope .metric-value { font-family: var(--font-serif); font-size: var(--fs-2xl); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sf-scope .metric-delta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-muted); }
.sf-scope .metric-delta.pos { color: var(--accent); }
.sf-scope .metric-delta.neg { color: var(--signal); }
.sf-scope .metric-delta.warn { color: var(--sol); }

/* ============ PAGE STRUCTURE ============ */
.sf-scope .page-head { padding: var(--s-6) var(--s-8) var(--s-4); background: var(--bg); }
.sf-scope .page-title { font-family: var(--font-serif); font-size: var(--fs-3xl); letter-spacing: -0.03em; line-height: 1.05; }
.sf-scope .page-content { padding: var(--s-6) var(--s-8); }

.sf-scope .row { display: flex; align-items: center; gap: var(--s-3); }
.sf-scope .col { display: flex; flex-direction: column; gap: var(--s-3); }
.sf-scope .grow { flex: 1; }
.sf-scope .divider { height: 1px; background: var(--line); margin: var(--s-4) 0; }
.sf-scope .vdiv { width: 1px; background: var(--line); align-self: stretch; }

/* ============ RESPONSIVT ============ */
@media (max-width: 900px) {
  .sf-scope .sf-shell { grid-template-columns: 1fr; }
  .sf-scope .sidebar { display: none; }
}
