/* Vendium – gemensam stil. Samma formspråk som FeatureFlow. */
:root {
  --brand: #1a0a2e;
  --brand-light: #2d0050;
  --acc: #f5a500;
  --green: #1D9E75;
  --purple: #534AB7;
  --red: #d44;
  --blue: #2d7dd2;
  --violet: #7c3aed;
  --muted: #5a4870;
  --bg: #f0edf5;
  --light: #f8f6fc;
  --text: #1a0a2e;
  --line: #e4dfec;
  --white: #fff;
  --radius: 14px;
  --topbar-h: 56px;
  --side-w: 248px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 2rem; font-weight: 500; margin: .25rem 0; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.inline { display: inline; }
.ico { flex-shrink: 0; vertical-align: -3px; }
.ico.ok { color: var(--green); }
.dot { vertical-align: 0; flex-shrink: 0; }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--acc); color: var(--brand); font-weight: 700; font-size: .95rem;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.role-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #cbbfe0; border: 1px solid #4a3566; border-radius: 999px; padding: 1px 8px; }
.icon-btn { background: none; border: 0; color: #cbbfe0; padding: 6px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: #fff; background: var(--brand-light); }
.menu-toggle { display: none; background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; }

/* ---------- Skal och sidomeny ---------- */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--side-w); flex-shrink: 0; background: var(--white); border-right: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  display: flex; flex-direction: column; padding: 14px 10px;
}
.nav, .nav-sub { list-style: none; margin: 0; padding: 0; }
.nav > li { margin-bottom: 2px; }
.nav-single a, .nav-group-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--text); font: 600 .9rem var(--font); background: none; border: 0; cursor: pointer; text-align: left;
}
.nav-single a:hover, .nav-group-btn:hover { background: var(--light); text-decoration: none; }
.nav-single.active a { background: var(--bg); color: var(--brand-light); }
.nav-single .ico, .nav-group-btn .ico { color: var(--muted); }
.nav-group-btn .chev { margin-left: auto; transition: transform .15s; }
.nav-group.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 6px 30px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: .88rem; border-left: 2px solid transparent;
}
.nav-sub a:hover { background: var(--light); color: var(--text); text-decoration: none; }
.nav-sub li.active a { color: var(--brand-light); font-weight: 600; background: var(--bg); border-left-color: var(--acc); }
.soon { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: #a597ba; }
.nav-foot { margin-top: auto; padding: 12px; font-size: .75rem; color: #a597ba; font-family: var(--mono); }

.main { flex: 1; min-width: 0; padding: 24px 28px 48px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.page-actions { display: flex; gap: 8px; }

/* ---------- Kort ---------- */
.card {
  background: var(--white); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
  border: 1px solid var(--line); border-left: 4px solid var(--line);
}
.card-acc { border-left-color: var(--acc); }
.card-green { border-left-color: var(--green); }
.card-purple { border-left-color: var(--purple); }
.card-blue { border-left-color: var(--blue); }
.card-red { border-left-color: var(--red); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head .section-label { margin: 0; }
.section-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 12px; }
.card.empty { text-align: center; padding: 48px 24px; }
.empty-ico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--bg); color: var(--muted); margin-bottom: 12px; }
.card.empty p { max-width: 520px; margin-left: auto; margin-right: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2 + *, .grid-3 + * { margin-top: 16px; }
.foot-note { font-size: .78rem; color: var(--muted); margin: 10px 0 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--light); color: var(--muted); }
.status-list li.done { color: var(--text); }
.status-list li.done .ico { color: var(--green); }
.status-ok { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 600; }
.status-ok .mono { color: var(--text); font-weight: 400; }

/* ---------- Meddelanden ---------- */
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px;
  font-size: .9rem; background: var(--light); border: 1px solid var(--line);
}
.flash .ico { margin-top: 2px; }
.flash-ok { background: #e8f6f1; border-color: #bfe6d8; color: #0f6b4f; }
.flash-error { background: #fdeceC; border-color: #f3c4c4; color: #a12626; }
.flash-warn { background: #fff6e0; border-color: #f7dc9c; color: #7a5200; }
.flash-info { background: #eaf2fb; border-color: #c4dbf3; color: #1d5a9c; }

/* ---------- Formulär ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.form-row { margin-top: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; }
input, select, textarea {
  font: inherit; font-size: .95rem; color: var(--text); background: var(--white);
  border: 1px solid #d6cfe2; border-radius: 9px; padding: 9px 12px; min-height: 40px; width: 100%;
}
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--purple); }
input[type=color] { padding: 3px; height: 40px; width: 64px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--purple); outline-offset: 1px; border-color: var(--purple);
}
.code-input { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .25em; max-width: 220px; }
.secret { background: var(--light); border: 1px dashed #cfc5de; border-radius: 9px; padding: 10px 12px; font-size: 1rem; letter-spacing: .05em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .9rem var(--font); padding: 9px 16px; min-height: 40px; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); white-space: nowrap;
}
.btn:hover { background: var(--brand-light); text-decoration: none; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--white); color: var(--brand); border-color: #d6cfe2; }
.btn-ghost:hover { background: var(--light); }
.btn-danger { background: var(--white); color: var(--red); border-color: #f0c2c2; }
.btn-danger:hover { background: #fdeceC; }
.btn-small { padding: 5px 10px; min-height: 32px; font-size: .82rem; }

/* ---------- Tabeller ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--light); vertical-align: middle; }
.table tbody tr:hover { background: #fbfaff; }
.table .row-muted td { color: #a597ba; }
.table.sortable th { cursor: pointer; user-select: none; }
.table.sortable th[aria-sort=ascending]::after { content: ' ↑'; }
.table.sortable th[aria-sort=descending]::after { content: ' ↓'; }
.table select { min-height: 32px; padding: 4px 8px; font-size: .85rem; width: auto; }
.table-search { max-width: 240px; min-height: 34px; padding: 6px 10px; }
.perm-table td:first-child { min-width: 280px; }
.account-form { display: flex; gap: 6px; align-items: center; }
.account-form input { min-height: 32px; padding: 4px 8px; font-size: .85rem; min-width: 200px; }
.account-form select { width: auto; }

.pill { display: inline-block; font-size: .7rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); margin-left: 4px; text-transform: uppercase; letter-spacing: .04em; font-family: var(--font); }
.pill-green { background: #e3f4ee; color: var(--green); }
.pill-red { background: #fbe6e6; color: var(--red); }
.pill-acc { background: #fff1d1; color: #8a5d00; }

.row-menu { position: relative; display: inline-block; }
.row-menu summary { list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 230px; text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px rgba(26, 10, 46, .12);
}
.row-menu-list a, .row-menu-list button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; border: 0; background: none;
  font: 500 .86rem var(--font); color: var(--text); cursor: pointer;
}
.row-menu-list a:hover, .row-menu-list button:hover { background: var(--light); text-decoration: none; }
.row-menu-list button.danger { color: var(--red); }

/* ---------- 2FA ---------- */
.twofa-setup { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.steps { padding-left: 20px; margin: 0 0 14px; }
.steps li { margin-bottom: 6px; }
.qr { width: 220px; height: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.qr svg { width: 100%; height: 100%; display: block; }
.codes { columns: 2; padding-left: 28px; font-size: 1.05rem; margin: 0 0 14px; }
.codes li { padding: 2px 0; }
details.help { margin-top: 18px; font-size: .88rem; }
details.help summary { cursor: pointer; color: var(--purple); font-weight: 600; }
details.help p { margin: 8px 0 0; color: var(--muted); }

/* ---------- Inloggningssidor ---------- */
body.auth { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-light) 100%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 410px; background: var(--white); border-radius: 18px; padding: 30px 30px 24px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.3rem; }
.auth-links { text-align: center; margin: 16px 0 0; font-size: .88rem; }
.auth-note { color: #b9a9d3; font-size: .78rem; margin-top: 18px; }

/* ---------- Varning om utloggning ---------- */
.idle-warn { position: fixed; inset: 0; background: rgba(26, 10, 46, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.idle-box { background: var(--white); border-radius: var(--radius); padding: 24px; max-width: 380px; border-left: 4px solid var(--acc); }
.idle-box strong { display: block; font-size: 1.05rem; margin-bottom: 6px; }
#idle-left { font-family: var(--mono); }

/* ---------- Mobil ---------- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .menu-toggle { display: grid; }
  .role-tag { display: none; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 25; transform: translateX(-100%);
    transition: transform .2s; box-shadow: 0 0 40px rgba(26, 10, 46, .25); width: 280px;
  }
  body.nav-open .sidebar { transform: none; }
  .main { padding: 18px 16px 40px; }
  .grid-2, .grid-form, .twofa-setup { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .qr { margin: 0 auto; }
  .codes { columns: 1; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dd { margin-bottom: 8px; }
  .table-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Filter, chips och massåtgärder (Avtal m.fl.) ---------- */
.pill-blue { background: #e4eefa; color: var(--blue); }
.pill-purple { background: #ebe9f8; color: var(--purple); }
.filter-card { display: flex; flex-direction: column; gap: 14px; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; align-items: end; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.filter-bar input, .filter-bar select { min-height: 36px; padding: 6px 10px; font-size: .9rem; }
.filter-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-foot .spacer { flex: 1; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip > span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; border: 1px solid #d6cfe2; background: var(--white); font-size: .84rem; font-weight: 600; color: var(--muted); }
.chip > span .mono { font-weight: 400; opacity: .75; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--purple); outline-offset: 1px; }
.table th.num, .table td.num { text-align: right; }
.table td.sel, .table th.sel { width: 28px; padding-right: 0; }
.table .row-dim td { color: #8a7ca0; }
.table td.warn { color: var(--red); }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.actions form { margin: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.bulk-bar {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; border-radius: 12px; padding: 10px 14px;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar select, .bulk-bar input { width: auto; min-height: 34px; padding: 5px 10px; font-size: .85rem; }
.bulk-bar .btn { background: var(--acc); border-color: var(--acc); color: var(--brand); }

/* ---------- Flikar (Integrationer m.fl.) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; white-space: nowrap;
  font-weight: 600; font-size: .92rem; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--brand); text-decoration: none; }
.tabs a[aria-current=page] { color: var(--brand); border-bottom-color: var(--acc); }
.tab-mark { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: .7rem; font-weight: 700; background: var(--bg); color: var(--muted); }
.tab-mark-acc { background: #fff1d1; color: #8a5d00; }
.tab-mark-red { background: #fbe6e6; color: var(--red); }
.jump { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 14px; font-size: .88rem; }
.jump a { color: var(--muted); font-weight: 600; }
.jump a:hover { color: var(--purple); }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.source-grid > .card { margin-bottom: 0; display: flex; flex-direction: column; }
.source-card .btn { align-self: flex-start; margin-top: auto; }
.source-card .big { font-size: 1.6rem; }
.source-planned { background: var(--light); border-style: dashed; }
.issue-list { margin: 0 0 12px; padding-left: 18px; font-size: .86rem; }
.issue-list li { margin-bottom: 2px; }
[id] { scroll-margin-top: calc(var(--topbar-h) + 12px); }

/* Gamla portalen (migrering) */
.legacy-h { font-size: .95rem; margin: 18px 0 8px; }
.legacy-names summary { cursor: pointer; list-style: revert; }
.legacy-names summary .legacy-h { display: inline; }
.legacy-kv { grid-template-columns: minmax(0, 260px) 1fr; }
.legacy-kv dt { overflow-wrap: anywhere; }

/* Storlekar i procent för diagram (CSP tillåter inga style-attribut): ph = höjd, pw = bredd, pb = botten */
.ph-0{height:0%} .ph-1{height:1%} .ph-2{height:2%} .ph-3{height:3%} .ph-4{height:4%} .ph-5{height:5%} .ph-6{height:6%} .ph-7{height:7%} .ph-8{height:8%} .ph-9{height:9%} .ph-10{height:10%} .ph-11{height:11%} .ph-12{height:12%} .ph-13{height:13%} .ph-14{height:14%} .ph-15{height:15%} .ph-16{height:16%} .ph-17{height:17%} .ph-18{height:18%} .ph-19{height:19%} .ph-20{height:20%} .ph-21{height:21%} .ph-22{height:22%} .ph-23{height:23%} .ph-24{height:24%} .ph-25{height:25%} .ph-26{height:26%} .ph-27{height:27%} .ph-28{height:28%} .ph-29{height:29%} .ph-30{height:30%} .ph-31{height:31%} .ph-32{height:32%} .ph-33{height:33%} .ph-34{height:34%} .ph-35{height:35%} .ph-36{height:36%} .ph-37{height:37%} .ph-38{height:38%} .ph-39{height:39%} .ph-40{height:40%} .ph-41{height:41%} .ph-42{height:42%} .ph-43{height:43%} .ph-44{height:44%} .ph-45{height:45%} .ph-46{height:46%} .ph-47{height:47%} .ph-48{height:48%} .ph-49{height:49%} .ph-50{height:50%} .ph-51{height:51%} .ph-52{height:52%} .ph-53{height:53%} .ph-54{height:54%} .ph-55{height:55%} .ph-56{height:56%} .ph-57{height:57%} .ph-58{height:58%} .ph-59{height:59%} .ph-60{height:60%} .ph-61{height:61%} .ph-62{height:62%} .ph-63{height:63%} .ph-64{height:64%} .ph-65{height:65%} .ph-66{height:66%} .ph-67{height:67%} .ph-68{height:68%} .ph-69{height:69%} .ph-70{height:70%} .ph-71{height:71%} .ph-72{height:72%} .ph-73{height:73%} .ph-74{height:74%} .ph-75{height:75%} .ph-76{height:76%} .ph-77{height:77%} .ph-78{height:78%} .ph-79{height:79%} .ph-80{height:80%} .ph-81{height:81%} .ph-82{height:82%} .ph-83{height:83%} .ph-84{height:84%} .ph-85{height:85%} .ph-86{height:86%} .ph-87{height:87%} .ph-88{height:88%} .ph-89{height:89%} .ph-90{height:90%} .ph-91{height:91%} .ph-92{height:92%} .ph-93{height:93%} .ph-94{height:94%} .ph-95{height:95%} .ph-96{height:96%} .ph-97{height:97%} .ph-98{height:98%} .ph-99{height:99%} .ph-100{height:100%}
.pw-0{width:0%} .pw-1{width:1%} .pw-2{width:2%} .pw-3{width:3%} .pw-4{width:4%} .pw-5{width:5%} .pw-6{width:6%} .pw-7{width:7%} .pw-8{width:8%} .pw-9{width:9%} .pw-10{width:10%} .pw-11{width:11%} .pw-12{width:12%} .pw-13{width:13%} .pw-14{width:14%} .pw-15{width:15%} .pw-16{width:16%} .pw-17{width:17%} .pw-18{width:18%} .pw-19{width:19%} .pw-20{width:20%} .pw-21{width:21%} .pw-22{width:22%} .pw-23{width:23%} .pw-24{width:24%} .pw-25{width:25%} .pw-26{width:26%} .pw-27{width:27%} .pw-28{width:28%} .pw-29{width:29%} .pw-30{width:30%} .pw-31{width:31%} .pw-32{width:32%} .pw-33{width:33%} .pw-34{width:34%} .pw-35{width:35%} .pw-36{width:36%} .pw-37{width:37%} .pw-38{width:38%} .pw-39{width:39%} .pw-40{width:40%} .pw-41{width:41%} .pw-42{width:42%} .pw-43{width:43%} .pw-44{width:44%} .pw-45{width:45%} .pw-46{width:46%} .pw-47{width:47%} .pw-48{width:48%} .pw-49{width:49%} .pw-50{width:50%} .pw-51{width:51%} .pw-52{width:52%} .pw-53{width:53%} .pw-54{width:54%} .pw-55{width:55%} .pw-56{width:56%} .pw-57{width:57%} .pw-58{width:58%} .pw-59{width:59%} .pw-60{width:60%} .pw-61{width:61%} .pw-62{width:62%} .pw-63{width:63%} .pw-64{width:64%} .pw-65{width:65%} .pw-66{width:66%} .pw-67{width:67%} .pw-68{width:68%} .pw-69{width:69%} .pw-70{width:70%} .pw-71{width:71%} .pw-72{width:72%} .pw-73{width:73%} .pw-74{width:74%} .pw-75{width:75%} .pw-76{width:76%} .pw-77{width:77%} .pw-78{width:78%} .pw-79{width:79%} .pw-80{width:80%} .pw-81{width:81%} .pw-82{width:82%} .pw-83{width:83%} .pw-84{width:84%} .pw-85{width:85%} .pw-86{width:86%} .pw-87{width:87%} .pw-88{width:88%} .pw-89{width:89%} .pw-90{width:90%} .pw-91{width:91%} .pw-92{width:92%} .pw-93{width:93%} .pw-94{width:94%} .pw-95{width:95%} .pw-96{width:96%} .pw-97{width:97%} .pw-98{width:98%} .pw-99{width:99%} .pw-100{width:100%}
.pb-0{bottom:0%} .pb-1{bottom:1%} .pb-2{bottom:2%} .pb-3{bottom:3%} .pb-4{bottom:4%} .pb-5{bottom:5%} .pb-6{bottom:6%} .pb-7{bottom:7%} .pb-8{bottom:8%} .pb-9{bottom:9%} .pb-10{bottom:10%} .pb-11{bottom:11%} .pb-12{bottom:12%} .pb-13{bottom:13%} .pb-14{bottom:14%} .pb-15{bottom:15%} .pb-16{bottom:16%} .pb-17{bottom:17%} .pb-18{bottom:18%} .pb-19{bottom:19%} .pb-20{bottom:20%} .pb-21{bottom:21%} .pb-22{bottom:22%} .pb-23{bottom:23%} .pb-24{bottom:24%} .pb-25{bottom:25%} .pb-26{bottom:26%} .pb-27{bottom:27%} .pb-28{bottom:28%} .pb-29{bottom:29%} .pb-30{bottom:30%} .pb-31{bottom:31%} .pb-32{bottom:32%} .pb-33{bottom:33%} .pb-34{bottom:34%} .pb-35{bottom:35%} .pb-36{bottom:36%} .pb-37{bottom:37%} .pb-38{bottom:38%} .pb-39{bottom:39%} .pb-40{bottom:40%} .pb-41{bottom:41%} .pb-42{bottom:42%} .pb-43{bottom:43%} .pb-44{bottom:44%} .pb-45{bottom:45%} .pb-46{bottom:46%} .pb-47{bottom:47%} .pb-48{bottom:48%} .pb-49{bottom:49%} .pb-50{bottom:50%} .pb-51{bottom:51%} .pb-52{bottom:52%} .pb-53{bottom:53%} .pb-54{bottom:54%} .pb-55{bottom:55%} .pb-56{bottom:56%} .pb-57{bottom:57%} .pb-58{bottom:58%} .pb-59{bottom:59%} .pb-60{bottom:60%} .pb-61{bottom:61%} .pb-62{bottom:62%} .pb-63{bottom:63%} .pb-64{bottom:64%} .pb-65{bottom:65%} .pb-66{bottom:66%} .pb-67{bottom:67%} .pb-68{bottom:68%} .pb-69{bottom:69%} .pb-70{bottom:70%} .pb-71{bottom:71%} .pb-72{bottom:72%} .pb-73{bottom:73%} .pb-74{bottom:74%} .pb-75{bottom:75%} .pb-76{bottom:76%} .pb-77{bottom:77%} .pb-78{bottom:78%} .pb-79{bottom:79%} .pb-80{bottom:80%} .pb-81{bottom:81%} .pb-82{bottom:82%} .pb-83{bottom:83%} .pb-84{bottom:84%} .pb-85{bottom:85%} .pb-86{bottom:86%} .pb-87{bottom:87%} .pb-88{bottom:88%} .pb-89{bottom:89%} .pb-90{bottom:90%} .pb-91{bottom:91%} .pb-92{bottom:92%} .pb-93{bottom:93%} .pb-94{bottom:94%} .pb-95{bottom:95%} .pb-96{bottom:96%} .pb-97{bottom:97%} .pb-98{bottom:98%} .pb-99{bottom:99%} .pb-100{bottom:100%}

.mt-14 { margin-top: 14px; }

/* ---------- Nyckeltal ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
a.stat:hover { text-decoration: none; background: #fbfaff; }
.stat-acc { border-left-color: var(--acc); }
.stat-warn { border-left-color: var(--red); }
.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat-val { font-size: 1.55rem; font-weight: 500; line-height: 1.25; }
.stat-sub { font-size: .8rem; color: var(--muted); }

/* ---------- Diagram (DN-stil: rubrik = slutsats, direktetiketter, en färg) ---------- */
.chart-title { font-size: 1.05rem; margin: 0 0 2px; }
.chart-sub { font-size: .85rem; color: var(--muted); margin: 0 0 14px; }
.colchart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: end; }
.col { display: flex; flex-direction: column; align-items: stretch; color: var(--text); border-radius: 8px; padding: 4px 2px; min-width: 0; }
a.col:hover { background: var(--light); text-decoration: none; }
.col-sel { background: var(--bg); }
.col-val { position: absolute; left: 50%; transform: translate(-50%, -3px); padding: 0 3px; background: var(--white); border-radius: 3px;
  font-size: .78rem; white-space: nowrap; z-index: 2; }
a.col:hover .col-val, .col-sel .col-val { background: transparent; }
.col-plot { position: relative; height: 170px; border-bottom: 1px solid #cfc6dc; margin: 22px 6px 0; }
.col-bar { position: absolute; left: 0; right: 0; bottom: 0; background: var(--purple); border-radius: 4px 4px 0 0; }
.col-bar.ph-0 { display: none; }
.col-other .col-bar { background: #b9b0c9; }
.col-target { position: absolute; left: -4px; right: -4px; height: 0; border-top: 2px dashed var(--brand); z-index: 1; }
.col-label { font-size: .8rem; font-weight: 600; text-align: center; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-sub { font-size: .74rem; color: var(--muted); text-align: center; }
.legend-target { display: inline-block; width: 18px; border-top: 2px dashed var(--brand); vertical-align: middle; margin-right: 4px; }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; color: var(--text); font-size: .88rem; }
a.hbar:hover { background: var(--light); text-decoration: none; }
.hbar-sel { background: var(--bg); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; position: relative; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--purple); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-val { font-size: .82rem; white-space: nowrap; }
.table tr.row-sel td { background: var(--bg); }
.settings-inline summary { cursor: pointer; margin: 0; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 12px; }
.inline-form label { max-width: 220px; }
@media (max-width: 768px) {
  .colchart { overflow-x: auto; grid-auto-columns: minmax(64px, 1fr); padding-bottom: 4px; }
  .col-plot { height: 130px; }
  .hbar { grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 6px; }
}
.fw-normal { font-weight: 400; }

.table-deals { min-width: 1080px; }
.table-deals td:first-child { min-width: 240px; }
.table-deals td.num, .table-deals td.mono { white-space: nowrap; }
.stat-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Forecast ---------- */
.fc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fc-monthnav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fc-monthnav strong { font-size: 1.05rem; min-width: 130px; text-align: center; }
.fc-people { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-person { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; border: 1px solid #d6cfe2;
  background: var(--white); font-size: .85rem; font-weight: 600; color: var(--muted); }
.fc-person:hover { text-decoration: none; background: var(--light); }
.fc-person-done { color: var(--text); }
.fc-person-sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.fc-person-sel .muted, .fc-person-sel .ico.ok { color: #fff; }
.fc-intro { color: var(--muted); font-size: .9rem; max-width: 820px; }
.fc-table { min-width: 640px; }
.fc-table td { vertical-align: middle; }
.fc-prob { min-width: 190px; min-height: 36px; padding: 5px 10px; font-size: .88rem; }
.fc-prob.fc-p-high { border-color: var(--green); background: #f1faf6; }
.fc-prob.fc-p-mid { border-color: var(--acc); background: #fffaf0; }
.fc-prob.fc-p-low { border-color: var(--red); background: #fff6f6; }
.fc-share { display: inline-grid; grid-template-columns: 70px auto; gap: 8px; align-items: center; }
.fc-share .hbar-track { height: 6px; background: var(--light); border-radius: 3px; }
.fc-deals-row td { padding-top: 0; border-bottom: 1px solid var(--light); }
.fc-deals-row details summary { cursor: pointer; color: var(--purple); }
.fc-deals { list-style: none; margin: 6px 0 4px; padding: 0 0 0 4px; font-size: .84rem; }
.fc-deals li { padding: 3px 0; border-bottom: 1px dashed var(--light); }
.fc-deals .warn { color: var(--red); }
.fc-deal-mrr { float: right; }
.fc-ref-head td { border-top: 1px dashed var(--line); padding-top: 10px; }
.fc-goal { display: grid; grid-template-columns: auto minmax(120px, 1fr) 56px; gap: 12px; align-items: center; margin-top: 12px; }
.fc-goal-track { height: 10px; background: var(--light); border-radius: 5px; overflow: hidden; }
.fc-goal-track .hbar-fill { background: var(--acc); border-radius: 5px; }
.fc-goal-track .hbar-fill.fc-goal-met { background: var(--green); }
.fc-goal-pct { text-align: right; }
.hit-good { color: var(--green); }
.hit-ok { color: #a06a00; }
.hit-bad { color: var(--red); }
.col-fc { position: absolute; left: -2px; right: -2px; height: 0; border-top: 3px solid var(--acc); z-index: 1; }
.col-fc-latest { border-top-style: dashed; }
.legend-fc { display: inline-block; width: 18px; border-top: 3px solid var(--acc); vertical-align: middle; }
.col-current .col-bar { background: #8e86d0; }
.fc-vtabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.fc-vtabs a { padding: 3px 12px; border-radius: 999px; border: 1px solid #d6cfe2; font-size: .84rem; font-weight: 600; color: var(--muted); }
.fc-vtabs a:hover { text-decoration: none; background: var(--light); }
.fc-vtabs a[aria-current=page] { background: var(--brand); border-color: var(--brand); color: #fff; }
.fc-detail { min-width: 760px; }
.fc-person-row td { background: var(--light); border-top: 1px solid var(--line); }
.fc-indent { padding-left: 26px !important; }
.fc-subtotal td { border-bottom: 1px solid var(--line); font-size: .86rem; }
.fc-grand td { background: var(--brand); color: #fff; }
.fc-grand td.hit-good, .fc-grand td.hit-ok, .fc-grand td.hit-bad { background: var(--brand); }
.fc-grand .hit-good { color: #7fe0bd; } .fc-grand .hit-ok { color: var(--acc); } .fc-grand .hit-bad { color: #ff9a9a; }
@media (max-width: 768px) {
  .fc-goal { grid-template-columns: 1fr 56px; }
  .fc-goal > .small { grid-column: 1 / -1; }
  .fc-prob { min-width: 150px; }
}
.fc-goal-track .hbar-fill.pw-0, .fc-share .hbar-fill.pw-0 { min-width: 0; }

/* ---------- Prognoskontroll (Pipeline) ---------- */
.pill-strong { background: var(--red); color: #fff; }
.hc-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.hc-grid > .table-wrap { max-width: 760px; }
.hc-matrix th, .hc-matrix td { padding-left: 8px; padding-right: 8px; }
.hc-matrix .hc-hz { font-weight: 600; white-space: nowrap; }
.hc-matrix td a { font-weight: 600; }
.hc-matrix .hc-zero { color: #c4bcd2; }
.hc-matrix .hc-overdue a, .hc-matrix .hc-action a { color: var(--red); }
.hc-matrix .hc-watch a { color: #8a5d00; }
.hc-matrix .hc-ok a { color: var(--green); }
.hc-focus .card-head { margin-bottom: 6px; }
.hc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; align-items: start; }
.hc-item { border: 1px solid var(--line); border-left: 4px solid var(--acc); border-radius: 10px; padding: 10px 12px; background: var(--white); }
.hc-item-action, .hc-item-overdue { border-left-color: var(--red); }
.hc-item-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.hc-item-head .pill { margin-left: 0; }
.hc-why { margin: 6px 0 2px; font-size: .88rem; }
.hc-todo { margin: 0; font-size: .86rem; color: var(--brand); }
.hc-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 8px; }
.hc-cell { min-width: 230px; max-width: 340px; }
.hc-cell .pill { margin-left: 0; }
.hc-cell > span:not(.pill) { display: block; margin-top: 3px; }
.hc-reason { color: var(--text); line-height: 1.35; }
.hc-confirm { margin-top: 4px; }
.hc-confirm summary { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--purple); list-style: none; }
.hc-confirm summary::-webkit-details-marker { display: none; }
.hc-confirm[open] { background: var(--light); border-radius: 10px; padding: 8px 10px; width: 100%; }
.hc-confirm .form { gap: 8px; margin-top: 6px; }
.hc-confirm .form p { margin: 0; }
.hc-rules fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; margin: 0; }
.hc-rules legend { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 4px; }
@media (max-width: 768px) { .hc-list { grid-template-columns: 1fr; } .hc-cell { min-width: 200px; } }
.hc-rules fieldset label { justify-content: flex-end; }
