/* Shared CRM design system — Sälj + Inköp + Admin. See ARCHITECTURE.md.
   Sidebar shell + blue accent, ported from the design mockups (2026-07). */
:root {
  --bg: #f5f6f8;
  --sidebar: #1e2533;
  --sidebar-text: #a0a8b8;
  --sidebar-active: #4a90d9;
  --card: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --text: #1a1d23;
  --text2: #5a6270;
  --muted: #8a919d;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --border: #e5e7eb;
  --ok: #22c55e; --ok-text: #16a34a; --ok-bg: #f0fdf4;
  --warn: #f59e0b; --warn-text: #d97706; --warn-bg: #fffbeb;
  --radius: 10px; --radius-sm: 6px; --radius-pill: 20px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}

/* ---- LAYOUT ---- */
.layout { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: 220px; background: var(--sidebar); padding: 24px 0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
}
.sidebar-logo { padding: 0 20px 24px; color: #ffffff; font-size: 18px; font-weight: 500; }
.sidebar nav { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: var(--sidebar-text); text-decoration: none; font-size: 14px;
  cursor: pointer; border-left: 3px solid transparent; transition: all .15s; user-select: none;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(74,144,217,0.15); border-left-color: var(--sidebar-active); }
.nav-item .ic { width: 18px; text-align: center; }
.nav-sep { margin: 14px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: #6b7280; }

/* Profilmeny (nås via profil-raden längst ner) — portalbyte + utloggning
   göms här, så utlogg inte råkar klickas. Öppnas uppåt. */
.profile-menu { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); background: #2a3342; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 6px; box-shadow: 0 -10px 34px rgba(0,0,0,.45); display: none; z-index: 70; }
.profile-menu.open { display: block; }
.profile-menu .pm-cap { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: #6b7280; padding: 8px 10px 4px; }
.pm-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--sidebar-text); text-decoration: none; font-size: 13px; }
.pm-item .ic { width: 16px; text-align: center; }
.pm-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.pm-item.active { color: #fff; }
.pm-item.active::after { content: '✓'; margin-left: auto; color: var(--accent); font-size: 12px; }
.pm-div { height: 1px; background: rgba(255,255,255,.1); margin: 6px 4px; }
.pm-item.logout { color: #fca5a5; }
.pm-item.logout:hover { background: rgba(239,68,68,.12); color: #fecaca; }
.sidebar-user {
  position: relative; cursor: pointer; user-select: none;
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user:hover { background: rgba(255,255,255,0.04); }
.sidebar-user .su-meta { min-width: 0; }
.sidebar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none;
}
.sidebar-user .su-name { color: #fff; font-size: 13px; line-height: 1.2; }
.sidebar-user .su-role { color: var(--sidebar-text); font-size: 11px; text-transform: capitalize; }
.sidebar-user .caret { margin-left: auto; color: var(--sidebar-text); font-size: 11px; transition: transform .15s; }
.sidebar-user.open .caret { transform: rotate(180deg); }

/* ---- MAIN ---- */
.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- TOPBAR ---- */
.topbar {
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 16px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.topbar-title .build { font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---- DATAKÄLLA-IKON (ersätter öppen filruta för vanliga roller) ---- */
.util { position: relative; margin-left: auto; }
.ds-btn {
  position: relative; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--text2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ds-btn:hover { background: var(--bg); color: var(--text); }
.ds-btn .hd { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; border: 2px solid #fff; }
.ds-pop {
  position: absolute; right: 0; top: 44px; width: 290px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,0.14);
  padding: 14px 16px; z-index: 60; display: none;
}
.ds-pop.open { display: block; }
.ds-pop h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.ds-pop .ds-sub { font-size: 12px; color: var(--text2); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ds-pop .ds-sub .d { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.ds-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 12.5px; border-top: 1px solid var(--border); }
.ds-row .n { color: var(--text); font-weight: 500; }
.ds-row .m { color: var(--muted); text-align: right; }
.ds-foot { margin-top: 10px; font-size: 12px; color: var(--muted); }
.ds-foot a { color: var(--accent); text-decoration: none; }

/* ---- CONTENT ---- */
.content { padding: 24px 28px; overflow-y: auto; }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }

/* ---- SEARCH ---- */
.search-box {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 16px; background: #fff; outline: none; font-family: inherit;
}
.search-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.count { color: var(--text2); font-size: 13px; margin-bottom: 14px; }

/* ---- TABLE ---- */
.table-scroll { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 16px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td, tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.pri-a { color: var(--text); font-weight: 700; }
.pri-b { color: var(--text2); }
.pri-c { color: var(--muted); }
.supplier { color: #374151; font-weight: 500; }

/* ---- PAGINATION ---- */
.pager, .pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; color: var(--text2); font-size: 13px; flex-wrap: wrap; }
.pager button, .pagination button, .pagination a, .pager span {
  padding: 6px 11px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text2); font-size: 13px; text-decoration: none;
}
.pager button:hover, .pagination button:hover { background: var(--bg); }
.pager .active, .pagination .active, .pager b { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ---- STATES ---- */
.loading { text-align: center; padding: 4rem; color: var(--text2); }
.error { background: #fef2f2; color: #991b1b; padding: 1rem; border-radius: var(--radius-sm); border: 1px solid #fecaca; }

/* ---- AUTH (login / logout) — samma tokens som portalerna ---- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.08); padding: 40px 36px; text-align: center;
}
.auth-logo { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.auth-title { font-size: 18px; font-weight: 600; margin-top: 22px; }
.auth-sub { font-size: 14px; color: var(--text2); margin-top: 6px; line-height: 1.55; }
.auth-actions { margin-top: 28px; }
.btn-accent {
  display: inline-flex; align-items: center; justify-content: center; width: 100%;
  padding: 11px 16px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn-accent:hover { background: var(--accent-hover); }
.auth-foot { margin-top: 22px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: center;
    padding: 10px 14px; overflow-x: auto;
  }
  .sidebar-logo { padding: 0 14px 0 6px; }
  .sidebar nav { display: flex; gap: 2px; }
  .nav-item { padding: 8px 12px; border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav-item.active { border-left: none; border-bottom-color: var(--sidebar-active); }
  .nav-sep { display: none; }
  .sidebar-user { border-top: none; border-left: 1px solid rgba(255,255,255,0.1); margin-left: auto; padding: 6px 14px; }
  .main { margin-left: 0; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .profile-menu { left: auto; right: 8px; bottom: auto; top: calc(100% + 6px); width: 220px; }
}

/* ============================================================================
   AKTIVITETSLOGG (feature/activity-log) — kundkort, logga-form, historik.
   Mobile-first: kundlista → kort, navigering → bottom-nav. WCAG AA-kontrast.
   ============================================================================ */

/* Höjd kontrast: gamla --muted (#8a919d) föll under 4.5:1 på vitt (~2.9:1).
   #6b7280 ≈ 4.6:1 → klarar WCAG AA för normal text, behåller hierarkin. */
:root { --muted: #6b7280; }

/* Klickbara kundrader */
.cust-row { cursor: pointer; }
.open-hint { color: var(--accent-hover); font-size: 12px; font-weight: 600; opacity: 0; }
tbody tr:hover .open-hint { opacity: 1; }

/* Tillbaka-länk */
.back { color: var(--text2); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; cursor: pointer; }
.back:hover { color: var(--accent-hover); }

/* Kundhuvud */
.cust-head { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 20px 22px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cust-avatar { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-light); color: var(--accent-hover); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; flex: none; }
.cust-name { font-size: 20px; font-weight: 700; }
.cust-meta { color: var(--text2); font-size: 13px; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* Grid: form + historik */
.activity-grid { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.act-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 20px; }
.act-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.act-card .sub { color: var(--text2); font-size: 12.5px; margin-bottom: 16px; }

/* Segmenterad typväljare */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.seg button { border: 1px solid var(--border); background: #fff; color: var(--text2); padding: 9px 6px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 5px; transition: all .12s; }
.seg button .em { font-size: 17px; }
.seg button:hover { background: var(--bg); }
.seg button.active[data-type="besok"] { border-color: var(--accent); background: var(--accent-light); color: #1d4ed8; }
.seg button.active[data-type="samtal"] { border-color: var(--ok); background: var(--ok-bg); color: #15803d; }
.seg button.active[data-type="anteckning"] { border-color: var(--warn); background: var(--warn-bg); color: #b45309; }

/* Formulärfält */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.field textarea, .field input { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; font-size: 14px; background: #fff; color: var(--text); outline: none; resize: vertical; }
.field textarea { min-height: 92px; }
.field textarea:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.act-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }

/* Historik-tidslinje */
.hist-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.hist-head h3 { font-size: 15px; font-weight: 700; }
.hist-head .n { color: var(--text2); font-size: 12.5px; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px 44px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 6px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--border); z-index: 1; }
.tl-item[data-type="besok"] .tl-dot { border-color: var(--accent); }
.tl-item[data-type="samtal"] .tl-dot { border-color: var(--ok); }
.tl-item[data-type="anteckning"] .tl-dot { border-color: var(--warn); }
.tl-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.tl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; }
.badge.besok { background: var(--accent-light); color: #1d4ed8; }
.badge.samtal { background: var(--ok-bg); color: #15803d; }
.badge.anteckning { background: var(--warn-bg); color: #b45309; }
.tl-date { font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; }
.tl-by { font-size: 12.5px; color: var(--muted); }
.tl-by::before { content: "· "; }
.tl-note { font-size: 13.5px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }
.followup { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; background: var(--warn-bg); color: #b45309; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.timeline .empty { color: var(--text2); font-size: 13.5px; text-align: center; padding: 40px 20px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }

/* Bottom-nav visas bara på mobil */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  /* Stapla layouten: sidebar (topprad) ovanför innehållet. Utan detta blir
     .layout kvar som flex-row och sidebaren (width:100%) äter hela skärmen. */
  .layout { flex-direction: column; }

  /* Navigering flyttar ner: topp-tabbarna göms, bottom-nav visas.
     Sidebaren blir kvar som topprad (logo + profil/logga ut nås där). */
  .sidebar nav { display: none; }

  /* Profilmenyn får inte klippas av sidebarens overflow. Nav är dold → ingen
     horisontell scroll behövs, så overflow kan vara synlig igen. */
  .sidebar { overflow: visible; }

  /* Prydlig dropdown: högerkant i linje med profilraden, bredd efter innehåll. */
  .profile-menu {
    right: 0; left: auto; top: calc(100% + 8px); bottom: auto;
    width: max-content; min-width: 180px; max-width: 80vw; z-index: 80;
  }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--sidebar); border-top: 1px solid rgba(255,255,255,0.08);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.18);
  }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 12px; color: var(--sidebar-text); font-size: 11px; font-weight: 500; cursor: pointer; user-select: none; text-decoration: none; }
  .bn-item .bn-ic { font-size: 21px; line-height: 1; }
  .bn-item.active { color: #fff; background: rgba(74,144,217,0.18); }
  .content { padding-bottom: 92px; }

  /* Aktivitetsvyn staplas, större tryckytor */
  .activity-grid { grid-template-columns: 1fr; gap: 14px; }
  .cust-head { padding: 16px; }
  .seg button { padding: 11px 6px; }
  .btn-accent { padding: 13px 16px; }
  .field.two { grid-template-columns: 1fr; }

  /* Kundlista → ett kort per kund (tabell är dålig på telefon) */
  #customerResults table, #customerResults thead, #customerResults tbody,
  #customerResults tr, #customerResults td { display: block; }
  #customerResults thead { display: none; }
  #customerResults .table-scroll { background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
  #customerResults tbody tr { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow); margin-bottom: 10px; padding: 12px 14px; }
  #customerResults td { border: none !important; padding: 3px 0; white-space: normal; display: flex; gap: 8px; font-size: 13.5px; }
  #customerResults td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; width: 84px; flex: none; }
  #customerResults td.company { font-size: 16px; margin-bottom: 4px; }
  #customerResults td.company::before { display: none; }
  #customerResults td.cell-open { justify-content: flex-end; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border) !important; }
  #customerResults td.cell-open::before { display: none; }
  #customerResults .open-hint { opacity: 1; font-size: 13px; }
}

/* Miljöbadge — ingen ska någonsin undra vilken miljö den står i.
   dev = grå DEV, staging = orange TEST, prod = ingen badge alls. */
.env-badge { font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: .2rem .5rem; border-radius: 4px; vertical-align: middle; }
.env-badge.env-dev { background: #e5e7eb; color: #374151; }
.env-badge.env-staging { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }

/* Min dag — todos. Mobile first: stor träffyta, checkbox 22px. */
.todo-add { display: flex; gap: 8px; flex-wrap: wrap; }
.todo-add input[type="text"] { flex: 1 1 220px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; min-height: 44px; }
.todo-add input[type="date"] { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; min-height: 44px; }
.todo-add .btn-accent { min-height: 44px; }
.todo-showdone { margin-left: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.todo-list { list-style: none; margin: 10px 0 0; padding: 0; }
.todo-item { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 12px 14px; margin-bottom: 8px; }
.todo-item input[type="checkbox"] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; cursor: pointer; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-title { font-size: 15px; font-weight: 500; }
.todo-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--text2); }
.todo-due.overdue { color: #b91c1c; font-weight: 700; }
.todo-mail { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Mail → todo */
.mail-mock-badge { font-size: 10px; font-weight: 800; letter-spacing: .06em; background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; padding: .15rem .5rem; border-radius: 4px; vertical-align: middle; }
.mail-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; margin-bottom: 10px; }
.mail-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text2); }
.mail-subject { font-size: 15px; font-weight: 600; margin-top: 4px; }
.mail-preview { font-size: 13px; color: var(--text2); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mail-sug { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; color: var(--text2); cursor: pointer; }
.mail-sug input { width: 18px; height: 18px; accent-color: var(--accent); }
.mail-actions { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 40px; }
.mail-done { color: var(--ok-text, #15803d); font-weight: 600; font-size: 13px; }

/* Projekt — navet */
.proj-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.proj-toolbar .btn-accent { margin-left: auto; min-height: 44px; }
.proj-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; margin-bottom: 10px; cursor: pointer; }
.proj-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.proj-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.proj-name { font-size: 15px; font-weight: 700; }
.proj-sub { font-size: 13px; color: var(--text2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.proj-status { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); }
.proj-status.st-ny { background: #eff6ff; color: #2563eb; }
.proj-status.st-offert { background: #fef9c3; color: #a16207; }
.proj-status.st-forhandling { background: #ffedd5; color: #c2410c; }
.proj-status.st-vunnen { background: #dcfce7; color: #15803d; }
.proj-status.st-forlorad { background: #f3f4f6; color: #6b7280; }
.proj-warn { color: #b45309; font-weight: 600; font-size: 12px; }
.proj-missing { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin: 10px 0; }
.proj-statusrow { display: flex; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.proj-statusrow .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.pf-hits { position: relative; }
.pf-hit { padding: 10px 12px; border: 1px solid var(--border); border-top: none; background: var(--card); cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.pf-hit:hover { background: var(--accent-light, #eff6ff); }
.pf-hit.muted { color: var(--muted); cursor: default; }
.pf-chosen { margin-top: 8px; font-size: 14px; background: var(--accent-light, #eff6ff); border-radius: var(--radius-sm); padding: 10px 12px; }
.pf-chosen a { color: var(--accent); cursor: pointer; margin-left: 8px; font-size: 12px; }
.btn-plain { padding: 9px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 44px; }

/* Offert-editor */
.offer-versions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.offer-vbtn { padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 40px; }
.offer-vbtn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light, #eff6ff); }
.offer-head { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.offer-table { width: 100%; font-size: 13px; }
.offer-table th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.offer-table td { padding: 6px 8px; vertical-align: middle; }
.ol-input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.ol-sum { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.ol-del { color: #b91c1c; cursor: pointer; font-weight: 700; padding: 4px 8px; }
.ol-frakt td { background: #fafaf9; }
.offer-totals { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; padding: 10px 4px; font-size: 13px; color: var(--text2); border-top: 2px solid var(--border); margin-top: 6px; }
.offer-totals .ot-net { font-size: 15px; color: var(--text); }
.offer-totals .ot-terms { margin-left: auto; font-size: 12px; }
.offer-addline { margin-top: 10px; }
.offer-addline input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.offer-addline-row { display: flex; gap: 8px; margin-top: 8px; }
.offer-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Min dag — uppföljningar + översikt */
.md-cap { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.md-cap-red { color: #b91c1c; }
.fu-card { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 12px 14px; margin-bottom: 8px; }
.fu-card.overdue { border-left: 4px solid #dc2626; background: #fef2f2; }
.fu-card input[type="checkbox"] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; cursor: pointer; }
.fu-title { font-size: 14px; font-weight: 700; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.fu-date { font-size: 12px; color: var(--muted); font-weight: 500; }
.fu-note { font-size: 13px; color: var(--text2); margin-top: 2px; }
.md-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 6px; }
@media (max-width: 700px) { .md-grid { grid-template-columns: 1fr; } }
.md-mini { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--card-shadow); padding: 10px 12px; margin-bottom: 6px; font-size: 13px; cursor: pointer; flex-wrap: wrap; }
.md-mini .fu-date { margin-left: auto; }

/* KPI-dashboard */
.kpi-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi-tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; }
.kpi-tile .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-tile .value { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-tile .sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.kpi-tile.warn { border-left: 4px solid #dc2626; }
.kpi-tile.warn .value { color: #b91c1c; }
#kpiOffice { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; min-height: 44px; background: var(--card); }

/* Push-CTA i Min dag */
.push-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--accent-light, #eff6ff); border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 12px 14px; font-size: 13px; margin-bottom: 14px; }
.push-ios-hint { font-size: 11px; color: var(--muted); flex-basis: 100%; }
