:root {
      --bg: #f5f6f7;
      --card: #ffffff;
      --ink: #182126;
      --muted: #69747d;
      --line: #d9dee3;
      --accent: #1f4e5f;
      --accent2: #e8f1f4;
      --warm: #d6a15f;
      --warm2: #f8f2ea;
      --blend: #eef3f5;
      --soft: #f7f8f9;
      --warn: #fff2cc;
      --bad: #b42318;
      --good: #227950;
      --radius: 12px;
      --shadow: 0 16px 40px rgba(24,33,38,.08);
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--ink);
      background:
        radial-gradient(circle at 82% 18%, rgba(237,199,170,.32), transparent 260px),
        radial-gradient(circle at 12% 36%, rgba(231,239,232,.58), transparent 280px),
        linear-gradient(180deg, #fbfcfa 0, #f8f5f0 190px, var(--bg) 190px);
    }
    header, main { max-width: 1240px; margin: 0 auto; padding: 24px; }
    header {
      padding: 30px 24px 12px;
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 18px;
    }
    h1 { margin: 0 0 6px; font-size: clamp(30px, 4vw, 42px); letter-spacing: 0; }
    .brand-lockup { display:flex; gap:14px; align-items:center; }
    .brand-mark {
      width:42px;
      height:42px;
      border:2px solid var(--accent);
      border-radius:50%;
      position:relative;
      flex:0 0 auto;
      background:#fff;
      box-shadow: inset 0 0 0 8px #f2f6f0, 0 0 0 7px rgba(242,201,166,.2);
    }
    .brand-mark::before, .brand-mark::after {
      content:"";
      position:absolute;
      left:50%;
      top:50%;
      transform:translate(-50%, -50%);
      background:var(--accent);
    }
    .brand-mark::before { width:16px; height:16px; border-radius:50%; }
    .brand-mark::after { width:30px; height:2px; box-shadow:0 -9px 0 #8ba596, 0 9px 0 var(--warm); opacity:.95; }
    h2 { margin: 0 0 10px; font-size: 19px; letter-spacing: 0; }
    h3 { margin: 18px 0 10px; font-size: 15px; }
    p { line-height: 1.45; }
    .sub, .hint, .status { color: var(--muted); }
    .status { min-height: 20px; }
    .status.status-active {
      display: block;
      margin-top: 10px;
      padding: 10px 12px;
      border: 1px solid #cfd8d4;
      border-radius: 10px;
      background: #f6faf8;
      color: var(--accent);
      font-weight: 650;
    }
    .status.status-error {
      border-color: #e4b4ad;
      background: #fff5f2;
      color: var(--bad);
    }
    .hint { font-size: 14px; margin: 0 0 12px; }
    main { display: grid; gap: 16px; padding-top: 10px; }
    .grid { display: grid; grid-template-columns: minmax(330px, .9fr) minmax(0, 1.35fr); gap: 16px; align-items:start; }
    @media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }
    .card {
      background: rgba(255,255,255,.94);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 18px;
    }
    .work-card { border-radius: 12px; box-shadow: none; }
    .builder-card { grid-column: 1 / -1; }
    .preview-card { background:#fff; border-color:#cfd8d4; padding:0; overflow:hidden; }
    .report-shell {
      background:#fff;
      border-top:1px solid #d2dad6;
      border-radius:0;
      padding:24px;
    }
    textarea {
      width: 100%;
      min-height: 214px;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 14px;
      font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      background: #fff;
      color: var(--ink);
      resize: vertical;
    }
    input, select {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 9px 11px;
      background: white;
      color: var(--ink);
      font: inherit;
    }
    input.map-input { width: 100%; border-radius: 8px; padding: 8px 9px; }
    input.label-input { min-width: 190px; }
    textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63,96,77,.12); }
    .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
    button, .file-label {
      border: 0;
      border-radius: 8px;
      background: var(--accent);
      color: white;
      padding: 10px 16px;
      font-weight: 750;
      cursor: pointer;
      font-size: 14px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    button.secondary, .file-label.secondary { background: var(--accent2); color: var(--accent); }
    button.secondary:hover, .file-label.secondary:hover { background:#d9ebe2; }
    button.warn { background: var(--warn); color: #7a4b00; }
    button.small { padding: 7px 10px; font-size: 12px; }
    input[type=file] { display: none; }
    table { width: 100%; border-collapse: collapse; font-size: 14px; }
    th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
    th { text-align: left; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .06em; background: #f8fafb; }
    .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
    tr.section td { background: linear-gradient(90deg, var(--accent2), var(--blend)); font-weight: 850; color: var(--accent); }
    tr.total td { background: var(--blend); font-weight: 900; border-top: 2px solid var(--accent); }
    tr.empty-row { display:none; }
    tr.account td { color: var(--muted); font-size: 13px; background: #fffdf9; }
    tr.account.not-included td { opacity:.5; text-decoration: line-through; }
    tr.account.not-print-selected { opacity: .55; }
    .print-check { transform: scale(1.1); }
    .print-only-note { color: var(--muted); font-size: 12px; margin-left: 6px; margin-right: 8px; }
    .account-count {
      color: var(--muted);
      font-size: 11px;
      font-weight: 400;
      opacity: .75;
      margin-left: 6px;
      white-space: nowrap;
    }
    .row-actions {
      display:flex;
      flex-direction:column;
      align-items:center;
      gap:3px;
      width:118px;
      margin-left:0;
    }
    .row-action-choice {
      display:inline-flex;
      align-items:center;
      gap:4px;
      border-radius:999px;
      padding:3px 7px;
      font-size:11px;
      background:var(--accent2);
      color:var(--accent);
      cursor:pointer;
      user-select:none;
      width:100%;
      justify-content:flex-start;
    }
    .row-action-choice input { width:12px; height:12px; margin:0; accent-color:var(--accent); }
    .report-row-label {
      display:grid;
      grid-template-columns:minmax(180px, 1fr) 118px;
      align-items:center;
      gap:12px;
    }
    .report-row-name { min-width:0; }
    .tabs { display:flex; gap:6px; flex-wrap:wrap; margin:8px auto 0; max-width:1240px; padding:0 24px; }
    .tab-pill { border:1px solid var(--line); background:#fff; border-radius:8px; padding:7px 10px; font-size:13px; color:var(--ink); text-decoration:none; }
    .tab-pill.primary,
    .tab-pill.active { background:var(--accent); color:#fff; border-color:var(--accent); box-shadow:0 6px 16px rgba(32,60,52,.14); }
    @media screen {
      body.app-tabs .app-view { display:none !important; }
      body.app-tabs .app-view.active-view { display:block !important; }
      body.app-tabs #import.app-view.active-view { display:grid !important; }
      body.app-tabs .report-page-break { display:none !important; }
      body.app-tabs main { padding-top:18px; }
      body.app-tabs .tabs { position:sticky; top:0; z-index:20; background:rgba(246,248,246,.94); backdrop-filter:blur(10px); padding-top:10px; padding-bottom:10px; border-bottom:1px solid rgba(203,213,208,.7); }
    }
    .report-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:12px; }
    .manual-fields { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:12px; margin-top:12px; }
    .manual-fields label { display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted); }
    .customer-home-actions { display:flex; flex-wrap:wrap; gap:10px; margin:16px 0; }
    .customer-latest-card, .customer-empty-card, .customer-home-panel { border:1px solid var(--line); border-radius:12px; background:#fff; padding:18px; margin-top:14px; }
    .customer-latest-card { display:flex; justify-content:space-between; align-items:center; gap:18px; border-left:4px solid var(--accent); }
    .customer-latest-card h3, .customer-home-panel h3 { margin:3px 0 5px; }
    .customer-latest-card p, .customer-empty-card span { margin:0; color:var(--muted); }
    .customer-empty-card { display:flex; flex-direction:column; gap:5px; }
    .compact-toolbar { margin-bottom:8px; }
    .quick-check-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:12px 0; }
    .quick-check-card { border:1px solid var(--line); border-radius:9px; padding:11px; display:flex; flex-direction:column; gap:5px; font-size:13px; }
    .quick-check-card strong { font-size:14px; }
    .quick-check-card span { color:var(--muted); }
    .quick-check-card b { color:var(--ink); }
    @media (max-width:900px) { .quick-check-grid { grid-template-columns:1fr 1fr; } .customer-latest-card { align-items:flex-start; flex-direction:column; } }
    .manual-adjustment-output { margin-top:16px; max-width:560px; border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:10px; padding:12px 14px; background:#fffdf9; }
    .manual-adjustment-line { display:flex; justify-content:space-between; gap:18px; padding:5px 0; }
    .manual-adjustment-line.total { margin-top:5px; padding-top:10px; border-top:1px solid var(--line); font-weight:800; }
    .manual-adjustment-output small { display:block; margin-top:7px; color:var(--muted); }
    .status-box { border:1px solid var(--line); border-radius:10px; padding:14px; background:#fff; }
    .kpi-card:nth-child(2n) { background:linear-gradient(135deg, var(--warm2), #fffaf6); border-color:#efd8c4; }
    .status-box.good { background:#eef8f1; border-color:#b7d8c0; }
    .status-box.bad { background:#fff0ef; border-color:#e5b4af; }
    .status-title { font-size:13px; color:var(--muted); margin-bottom:4px; }
    .status-value { font-size:20px; font-weight:700; color:var(--ink); }
    .report-meta { display:grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap:12px; margin-top:12px; }
    .report-meta label { display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted); }
    .report-header-box { border:1px solid var(--line); border-radius:12px; padding:18px; background:#fff; margin-bottom:2px; box-shadow:var(--shadow); }
    .report-brand-line { color:var(--muted); font-size:11px; font-weight:850; letter-spacing:.08em; text-transform:uppercase; margin-bottom:5px; }
    .report-header-title { font-size:21px; font-weight:850; color:var(--ink); margin-bottom:8px; }
    .report-header-meta { display:grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap:10px; color:var(--muted); font-size:13px; }
    .report-header-meta strong { display:block; color:var(--ink); font-size:14px; margin-top:2px; }
    @media (max-width: 900px) { .report-meta, .report-header-meta { grid-template-columns:1fr 1fr; } }
    @media (max-width: 900px) { .report-grid, .manual-fields { grid-template-columns:1fr 1fr; } }
    @media print { .row-actions, .tabs { display:none !important; } }
    .metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 18px; }
    @media (max-width: 960px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
    .metric { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #f9fbfa; }
    .metric:nth-child(2), .metric:nth-child(4) { background:linear-gradient(135deg, var(--warm2), #fffaf6); border-color:#efd8c4; }
    .metric .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
    .metric .value { margin-top: 6px; font-size: 22px; font-weight: 900; letter-spacing: -.03em; }
    .good { color: var(--good); } .bad { color: var(--bad); }
    .toolbar { display:flex; gap:10px; justify-content:space-between; align-items:center; flex-wrap:wrap; }
    .toolbar-left, .toolbar-right { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
    .pill { background: var(--accent2); color: var(--accent); border-radius:999px; padding:5px 10px; font-size:12px; font-weight:800; }
    .pill.soft { background:var(--warm2); color:#8a4f22; }
    .scroll { overflow:auto; max-height: 360px; border:1px solid var(--line); border-radius:10px; background:#fff; }
    .workflow {
      display:grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap:10px;
      min-width: 420px;
    }
    .workflow-step {
      background:#fff;
      border:1px solid var(--line);
      border-radius:10px;
      padding:10px 12px;
      font-size:13px;
      color:var(--muted);
    }
    .workflow-step strong { display:block; color:var(--ink); font-size:14px; margin-bottom:2px; }
    .account-tools {
      display:grid;
      grid-template-columns: minmax(190px, 1fr) minmax(220px, 1.4fr) auto;
      gap:10px;
      align-items:end;
      margin:14px 0;
    }
    .account-tools label { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:13px; }
    .account-tools input { border-radius:8px; width:100%; }
    .quick-actions { display:flex; gap:8px; flex-wrap:wrap; }
    .quick-actions button { padding:8px 11px; font-size:12px; }
    .table-tools {
      display:flex;
      justify-content:flex-start;
      align-items:center;
      gap:12px;
      margin:2px 0 10px;
    }
    .table-tools-label {
      color:var(--muted);
      font-size:11px;
      font-weight:850;
      letter-spacing:.06em;
      text-transform:uppercase;
    }
    .template-note {
      display:flex;
      justify-content:space-between;
      gap:12px;
      align-items:center;
      background:linear-gradient(135deg, var(--soft), var(--warm2));
      border:1px solid var(--line);
      border-radius:10px;
      padding:12px;
      margin-bottom:12px;
    }
    .template-note strong { display:block; margin-bottom:3px; }
    .option-grid {
      display:grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap:10px;
      margin-top:12px;
    }
    .option-grid label {
      display:flex;
      gap:8px;
      align-items:center;
      border:1px solid var(--line);
      border-radius:10px;
      background:#fff;
      padding:10px 12px;
      font-size:13px;
      color:var(--ink);
    }
    .surface-title {
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:12px;
      padding:16px 18px;
      border-bottom:1px solid var(--line);
      background:linear-gradient(90deg, #fbfcfc, #fff7ef);
    }
    .surface-title h2 { margin:0; }
    .surface-title .toolbar-right { margin-left:auto; }
    .export-control {
      display:flex;
      flex-direction:column;
      gap:4px;
      color:var(--muted);
      font-size:10px;
      font-weight:850;
      letter-spacing:.04em;
      text-transform:uppercase;
    }
    .export-control select {
      min-width:112px;
      padding:7px 9px;
      font-size:12px;
      font-weight:650;
      letter-spacing:0;
      text-transform:none;
      background:#fff;
    }
    .controls-card { background:#fff; border-color:#dde3e8; }
    .compact-note { margin-bottom:0; }
    .secondary-section {
      box-shadow:none;
      background:linear-gradient(180deg, #fbfcfc, #fffaf6);
      border-color:#d8e1da;
    }
    .section-kicker {
      color:var(--muted);
      font-size:12px;
      font-weight:800;
      letter-spacing:.06em;
      text-transform:uppercase;
      margin-bottom:6px;
    }
    @media (max-width: 960px) { .option-grid { grid-template-columns:1fr 1fr; } }
    .report-table-wrap table { font-size:13px; table-layout:auto; }
    .report-page-meta {
      display:none;
      border-bottom:2px solid #cfd8d4;
      margin-bottom:18px;
      padding-bottom:12px;
    }
    .report-page-meta h2 { margin:0 0 8px; font-size:24px; }
    .report-page-meta-grid {
      display:grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap:10px;
      color:var(--muted);
      font-size:12px;
    }
    .report-page-meta-grid strong { display:block; color:var(--ink); font-size:13px; margin-top:2px; }
    #reportTable th { background:linear-gradient(90deg, #fbfcfa, #fff7ef); border-bottom:2px solid #cfd8d4; }
    #reportTable th.amount, #reportTable td.amount { min-width:92px; }
    #reportTable th:first-child, #reportTable td:first-child { min-width:210px; }
    #reportTable tr.section td { padding-top:18px; background:linear-gradient(90deg, var(--accent2), var(--blend)); border-bottom:1px solid #cfd8d4; color:#315c52; }
    #reportTable tr.total td { background:var(--blend); border-top:2px solid #315c52; }
    .report-page-break { display:none; }
    @media (max-width: 960px) {
      header { display:block; }
      .workflow { min-width:0; grid-template-columns:1fr; margin-top:14px; }
      .account-tools { grid-template-columns:1fr; }
    }
    .mapping-table th:nth-child(1) { min-width: 210px; }
    .mapping-table th:nth-child(2), .mapping-table th:nth-child(3) { min-width: 180px; }
    .notice { padding: 12px 14px; background: var(--warn); border:1px solid #efd98f; border-radius:14px; color:#5f4300; margin-top: 12px; display:none; }
    code { background:#fffdf9; border:1px solid var(--line); border-radius:6px; padding:1px 5px; }
    .group-toolbar { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; margin-top:14px; }
    .group-toolbar .row { margin:0; }
    .group-cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(520px, 1fr)); gap:14px; margin-top:16px; }
    .group-card { border:1px solid var(--line); border-radius:8px; background:#fff; padding:14px; overflow:hidden; }
    .group-card.group-total { border-color:#a7b8ac; background:linear-gradient(135deg, #fbfffc, #fff7ef); }
    .group-card-header { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding-bottom:10px; border-bottom:1px solid var(--line); }
    .group-card-title { font-weight:800; color:var(--ink); line-height:1.2; }
    .group-card-meta { color:var(--muted); font-size:12px; margin-top:4px; }
    .group-card-tag { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#2f5f46; font-weight:800; white-space:nowrap; }
    .group-summary { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin:12px 0 8px; }
    .group-kpis { display:grid; grid-template-columns:repeat(5, 1fr); gap:8px; margin:0 0 12px; }
    .group-summary div, .group-kpis div { border:1px solid var(--line); border-radius:8px; padding:8px; background:#fafafa; min-width:0; }
    .group-summary div:nth-child(2), .group-kpis div:nth-child(even) { background:var(--warm2); border-color:#f1ddc9; }
    .group-summary span, .group-kpis span { display:block; color:var(--muted); font-size:11px; }
    .group-summary strong, .group-kpis strong { display:block; color:var(--ink); font-size:13px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .group-table-wrap { overflow:visible; }
    .group-mini-table { width:100%; font-size:11px; table-layout:fixed; }
    .group-mini-table th, .group-mini-table td { padding:6px 5px; vertical-align:top; }
    .group-mini-table th { color:var(--muted); font-size:9px; white-space:normal; }
    .group-mini-table th:first-child, .group-mini-table td:first-child { width:36%; }
    .group-mini-table th:not(:first-child), .group-mini-table td:not(:first-child) { width:12.8%; }
    .group-mini-table td { overflow-wrap:anywhere; }
    .group-mini-table td.amount { white-space:normal; overflow-wrap:normal; word-break:normal; }
    .group-mini-table th { background:linear-gradient(90deg, #fbfcfa, #fff7ef); }
    .group-mini-table tr.section td { color:var(--accent); background:linear-gradient(90deg, var(--accent2), var(--blend)); font-weight:800; }
    .group-mini-table tr.total td { background:var(--blend); border-top:2px solid #202b24; border-bottom:1px solid #202b24; font-weight:900; }
    .group-charts { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin:16px 0; }
    .group-chart { border:1px solid var(--line); border-radius:8px; background:#fff; padding:14px; min-width:0; }
    .group-chart.wide { grid-column:1 / -1; }
    .group-chart-title { color:var(--ink); font-size:13px; font-weight:900; margin-bottom:10px; }
    .bar-chart { display:flex; flex-direction:column; gap:8px; }
    .chart-row { display:grid; grid-template-columns:minmax(96px, 26%) 1fr minmax(58px, auto); gap:8px; align-items:center; font-size:11px; }
    .chart-label { color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .chart-track { position:relative; height:10px; background:#eef3ef; border-radius:99px; overflow:hidden; }
    .chart-bar { height:100%; min-width:1px; background:#315c52; border-radius:99px; }
    .chart-bar.bad { background:#c24132; }
    .chart-value { color:var(--muted); font-weight:800; text-align:right; white-space:nowrap; }
    .margin-chart .chart-track { overflow:visible; background:linear-gradient(90deg, #f4d8d4 0 50%, #e8f2ed 50% 100%); }
    .margin-chart .chart-zero { position:absolute; top:-3px; bottom:-3px; left:50%; width:1px; background:#87968e; }
    .margin-chart .chart-bar { position:absolute; top:0; height:100%; }
    .cost-chart { display:grid; grid-template-columns:repeat(3, 1fr); gap:12px; }
    .cost-chart h4 { margin:0 0 8px; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
    .cost-chart .chart-row { grid-template-columns:minmax(82px, 38%) 1fr minmax(46px, auto); }
    .cost-chart .food .chart-bar { background:#315c52; }
    .cost-chart .personnel .chart-bar { background:#e0a25e; }
    .cost-chart .rent .chart-bar { background:#6e8b7f; }
    .stack-legend { display:flex; flex-wrap:wrap; gap:8px 12px; color:var(--muted); font-size:10px; margin-top:10px; }
    .stack-legend span::before { content:""; display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:4px; vertical-align:-1px; background:var(--legend-color); }
    .stack-legend .food { --legend-color:#315c52; }
    .stack-legend .personnel { --legend-color:#e0a25e; }
    .stack-legend .rent { --legend-color:#6e8b7f; }
    .group-print-heading { display:none; }
    @media print {
      @page {
        margin: 12mm 10mm 15mm;
        @bottom-left {
          content: "Finansrapport by Numberz";
          color: #66736b;
          font-size: 8px;
        }
        @bottom-right {
          content: "Sida " counter(page) " / " counter(pages);
          color: #66736b;
          font-size: 8px;
        }
      }
      header, .input-card, .mapping-card, .accounts-card, .no-print, .print-control-cell { display:none !important; }
      body.app-tabs .app-view,
      #admin,
      #customers,
      #reports,
      #export,
      #import,
      [data-view="setup"] { display:none !important; }
      body.app-tabs .report-header-box,
      body.app-tabs #nyckeltal,
      body.app-tabs #rr,
      body.app-tabs #br,
      body.app-tabs #gruppvy { display:block !important; }
      body.app-tabs #gruppvy { display:none !important; }
      body.app-tabs.print-group-report #gruppvy { display:block !important; }
      * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
      body { background:#fbfcfa; color:#111827; }
      body.group-empty .group-section { display:none !important; }
      body.print-group-only .report-header-box,
      body.print-group-only #nyckeltal,
      body.print-group-only #rr,
      body.print-group-only #br,
      body.print-group-only .report-page-break { display:none !important; }
      body.print-group-only .group-section { break-before:auto; page-break-before:auto; }
      body.print-content-rr #br { display:none !important; }
      body.print-content-br #nyckeltal,
      body.print-content-br #rr,
      body.print-content-br .report-page-break { display:none !important; }
      body.print-content-br #br { break-before:auto; page-break-before:auto; }
      .surface-title { display:none !important; }
      #nyckeltal .pill,
      #br .section-kicker,
      #br .pill { display:none !important; }
      body.print-summary tr.account { display:none !important; }
      body.print-selected tr.account.not-print-selected { display:none !important; }
      main { max-width:none; padding:0; }
      .card, .report-shell, .report-header-box { box-shadow:none; border:0; border-radius:0; padding:0; background:transparent; }
      .report-shell, .group-card, .report-header-box, #br {
        border:1px solid #d6ddd7;
        border-radius:6px;
        padding:6mm;
        background:#fff;
      }
      html, body { font-size:10px; }
      .report-page-break { display:block; break-before:page; page-break-before:always; height:0; }
      #br { break-before:page; page-break-before:always; }
      .report-page-meta { display:block; }
      .metrics { grid-template-columns:repeat(4, 1fr); }
      .metric, .status-box { border-color:#d0d5dd; border-radius:0; }
      .metric { background:#f9fbfa; }
      .metric:nth-child(2), .metric:nth-child(4), .group-summary div:nth-child(2), .group-kpis div:nth-child(even), .kpi-card:nth-child(2n) { background:linear-gradient(135deg, var(--warm2), #fffaf6); border-color:#efd8c4; }
      tr.section td, #reportTable tr.section td, .group-mini-table tr.section td { background:linear-gradient(90deg, var(--accent2), var(--blend)) !important; color:var(--accent) !important; }
      tr.total td, #reportTable tr.total td { background:var(--blend) !important; border-top-color:var(--accent) !important; }
      table { width:100%; max-width:100%; font-size:8.5px; table-layout:fixed; }
      th { font-size:7px; }
      th, td { padding:3.5px 3px; overflow-wrap:anywhere; }
      .amount { white-space:normal; overflow-wrap:normal; word-break:normal; }
      .report-table-wrap { overflow:visible !important; }
      .report-table-wrap table { font-size:8.5px; table-layout:fixed; }
      #reportTable th.amount, #reportTable td.amount { min-width:0; width:10.5%; }
      #reportTable th:first-child, #reportTable td:first-child { min-width:0; width:26%; }
      .report-page-meta h2 { font-size:18px; }
      .report-brand-line { font-size:8px; margin-bottom:3px; }
      .report-page-meta-grid { font-size:9.5px; }
      .report-page-meta-grid strong { font-size:10.5px; }
      .metric { padding:8px 9px; }
      .metric .label { font-size:8.5px; }
      .metric .value { font-size:16px; }
      .account-count, .print-only-note { font-size:8.5px; }
      table { break-inside:auto; page-break-inside:auto; }
      tr { break-inside:avoid; page-break-inside:avoid; }
      tr.section { break-after:avoid; page-break-after:avoid; }
      tr.total { break-before:avoid; page-break-before:avoid; }
      thead { display:table-header-group; }
      .group-section { break-before:page; page-break-before:always; }
      .group-section > .toolbar { display:none; }
      .group-print-heading {
        display:block;
        margin:0 0 8mm;
        padding:7mm;
        border:1px solid #c8d3cc;
        border-radius:6px;
        background:linear-gradient(135deg, #fbfffc, #fff7ef);
      }
      .group-print-brand { color:#66736b; font-size:8px; font-weight:850; letter-spacing:.08em; text-transform:uppercase; margin-bottom:4px; }
      .group-print-title { color:#151b18; font-size:18px; font-weight:900; margin-bottom:2px; }
      .group-print-subtitle { color:#66736b; font-size:9px; font-weight:750; margin-bottom:8px; }
      .group-print-meta {
        display:grid;
        grid-template-columns:repeat(3, minmax(0, 1fr));
        gap:6px;
        color:#66736b;
        font-size:8.5px;
      }
      .group-print-meta strong { display:block; color:#151b18; font-size:9.5px; margin-top:2px; }
      #groupCharts { break-after:page; page-break-after:always; }
      .group-cards { display:block; margin-top:0; }
      .group-card {
        break-inside:avoid;
        page-break-inside:avoid;
        margin:0 0 8mm;
        padding:7mm;
        border-color:#c8d3cc;
        border-radius:6px;
      }
      .group-card.group-total { break-after:page; page-break-after:always; }
      .group-card:not(.group-total) { break-before:auto; page-break-before:auto; }
      .group-card.group-total { min-height:auto; }
      .group-card-header { padding-bottom:10px; }
      .group-card-title { font-size:16px; }
      .group-card-meta, .group-card-tag { font-size:9.5px; }
      .group-summary { gap:6px; margin:10px 0 6px; }
      .group-kpis { gap:6px; margin:0 0 10px; }
      .group-summary div, .group-kpis div { padding:7px; }
      .group-summary span, .group-kpis span { font-size:8.5px; }
      .group-summary strong, .group-kpis strong { font-size:12px; }
      .group-summary div, .group-kpis div { border-color:#d0d5dd; border-radius:0; }
      .group-charts { gap:10px; margin:0 0 8mm; break-inside:avoid; page-break-inside:avoid; }
      .group-chart { padding:10px; border-color:#d0d5dd; border-radius:0; break-inside:avoid; page-break-inside:avoid; }
      .group-chart-title { font-size:10px; margin-bottom:8px; }
      .chart-row, .stack-row { font-size:8.5px; gap:5px; }
      .chart-row { grid-template-columns:minmax(70px, 24%) 1fr minmax(44px, auto); }
      .stack-row { grid-template-columns:minmax(70px, 22%) 1fr minmax(44px, auto); }
      .cost-chart { gap:8px; }
      .cost-chart h4 { font-size:7.5px; }
      .cost-chart .chart-row { grid-template-columns:minmax(54px, 38%) 1fr minmax(34px, auto); }
      .chart-track { height:8px; }
      .stack-track { height:9px; }
      .stack-legend { font-size:7.5px; gap:5px 8px; margin-top:8px; }
      .group-mini-table { font-size:8.7px; }
      .group-mini-table th { font-size:7px; }
      .group-mini-table th, .group-mini-table td { padding:4px 3px; }
      body.print-group-compact .group-cards {
        display:grid;
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap:6mm;
      }
      body.print-group-compact .group-card {
        margin:0;
        padding:4mm;
      }
      body.print-group-compact .group-card.group-total {
        grid-column:1 / -1;
        break-after:page;
        page-break-after:always;
      }
      body.print-group-compact .group-card-title { font-size:12px; }
      body.print-group-compact .group-card-meta,
      body.print-group-compact .group-card-tag { font-size:8.5px; }
      body.print-group-compact .group-summary { gap:5px; margin:8px 0 5px; }
      body.print-group-compact .group-kpis { gap:5px; margin:0 0 8px; }
      body.print-group-compact .group-summary div, body.print-group-compact .group-kpis div { padding:5px; }
      body.print-group-compact .group-summary span, body.print-group-compact .group-kpis span { font-size:8px; }
      body.print-group-compact .group-summary strong, body.print-group-compact .group-kpis strong { font-size:10px; }
      body.print-group-compact .group-charts { display:block; }
      body.print-group-compact .group-chart { margin-bottom:8px; }
      body.print-group-compact .group-mini-table { font-size:7.4px; }
      body.print-group-compact .group-mini-table th { font-size:6.4px; }
      body.print-group-compact .group-mini-table th,
      body.print-group-compact .group-mini-table td { padding:3px 2px; }
    }
  
    /* Finansrapport visual identity refresh */
    body {
      background:
        linear-gradient(180deg, #f8fafb 0, #f1f4f6 240px, var(--bg) 240px) !important;
    }
    header {
      align-items:center;
      border-bottom:1px solid rgba(217,222,227,.9);
      padding-bottom:18px;
    }
    h1 { font-size:clamp(28px, 3.3vw, 38px); font-weight:850; }
    .brand-mark {
      width:44px;
      height:44px;
      border:1px solid #b8c7ce;
      border-radius:12px;
      background:linear-gradient(135deg, #ffffff 0%, #edf4f6 100%);
      box-shadow:0 12px 28px rgba(31,78,95,.12);
    }
    .brand-mark::before {
      width:18px;
      height:22px;
      border-radius:4px 4px 10px 4px;
      background:transparent;
      border-left:5px solid var(--accent);
      border-top:5px solid var(--accent);
      border-bottom:5px solid var(--warm);
      transform:translate(-48%, -50%) rotate(0deg);
    }
    .brand-mark::after {
      width:13px;
      height:13px;
      border-radius:50%;
      background:var(--warm);
      box-shadow:none;
      left:67%;
      top:34%;
      opacity:1;
    }
    .workflow {
      gap:0;
      border:1px solid var(--line);
      border-radius:10px;
      overflow:hidden;
      background:#fff;
      box-shadow:0 10px 28px rgba(24,33,38,.06);
    }
    .workflow-step {
      border:0;
      border-left:1px solid var(--line);
      border-radius:0;
      background:#fff;
      padding:11px 14px;
    }
    .workflow-step:first-child { border-left:0; }
    .tabs {
      background:#fff;
      border:1px solid var(--line);
      border-radius:12px;
      padding:8px !important;
      box-shadow:0 12px 32px rgba(24,33,38,.06);
    }
    .tab-pill {
      border:0;
      border-radius:7px;
      background:transparent;
      color:#42515a;
      font-weight:750;
      padding:9px 12px;
    }
    .tab-pill.primary,
    .tab-pill.active {
      background:var(--accent2);
      color:var(--accent);
      box-shadow:none;
    }
    @media screen {
      body.app-tabs .tabs {
        top:10px;
        background:rgba(255,255,255,.94);
        border:1px solid var(--line);
        backdrop-filter:blur(12px);
      }
    }
    .card,
    .report-header-box,
    .group-card,
    .group-chart {
      border-radius:8px;
      border-color:#d8e0e4;
      box-shadow:0 14px 38px rgba(24,33,38,.065);
    }
    .work-card { border-left:4px solid var(--accent); }
    .preview-card, .report-shell { border-color:#d8e0e4; }
    button, .file-label { border-radius:7px; background:#1f4e5f; }
    button.secondary, .file-label.secondary, .pill { background:#edf3f5; color:#1f4e5f; }
    button.secondary:hover, .file-label.secondary:hover { background:#dfeaec; }
    .metric,
    .status-box,
    .group-summary div,
    .group-kpis div {
      border-radius:6px;
      background:#fbfcfd;
      border-color:#d8e0e4;
    }
    .metric:nth-child(2),
    .metric:nth-child(4),
    .group-summary div:nth-child(2),
    .group-kpis div:nth-child(even),
    .kpi-card:nth-child(2n) {
      background:#f8f2ea;
      border-color:#ead7bf;
    }
    th { background:#f4f7f8; color:#5f6d75; }
    tr.section td,
    .group-mini-table tr.section td {
      background:linear-gradient(90deg, #e8f1f4, #f4f7f8);
      color:#1f4e5f;
    }
    tr.total td,
    .group-mini-table tr.total td {
      background:#eef3f5;
      border-top-color:#1f4e5f;
    }
    .report-brand-line,
    .group-print-brand,
    .section-kicker,
    .table-tools-label {
      color:#5b6a72;
      letter-spacing:.09em;
    }
    .chart-track { background:#edf2f4; }
    .chart-bar, .cost-chart .food .chart-bar { background:#1f4e5f; }
    .cost-chart .personnel .chart-bar { background:#d6a15f; }
    .cost-chart .rent .chart-bar { background:#718c91; }
    .stack-legend .food { --legend-color:#1f4e5f; }
    .stack-legend .personnel { --legend-color:#d6a15f; }
    .stack-legend .rent { --legend-color:#718c91; }
    @media print {
      @page {
        @bottom-left { content:"Finansrapport by Numberz"; color:#69747d; }
      }
      body { background:#ffffff !important; }
      .metric:nth-child(2), .metric:nth-child(4), .group-summary div:nth-child(2), .group-kpis div:nth-child(even), .kpi-card:nth-child(2n) {
        background:#f8f2ea !important;
        border-color:#ead7bf !important;
      }
      tr.section td, #reportTable tr.section td, .group-mini-table tr.section td {
        background:linear-gradient(90deg, #e8f1f4, #f4f7f8) !important;
        color:#1f4e5f !important;
      }
      tr.total td, #reportTable tr.total td, .group-mini-table tr.total td {
        background:#eef3f5 !important;
        border-top-color:#1f4e5f !important;
      }
      .group-print-heading {
        background:linear-gradient(135deg, #ffffff, #f8f2ea) !important;
        border-color:#d8e0e4 !important;
      }
      .group-card, .report-shell, .report-header-box, #br { border-color:#d8e0e4 !important; }
    }
  
    /* Structural redesign: sidebar workspace */
    @media screen and (min-width: 1060px) {
      body.app-tabs {
        background:#f3f5f7 !important;
        min-height:100vh;
      }
      body.app-tabs .app-sidebar {
        position:fixed;
        inset:18px auto 18px 18px;
        width:244px;
        max-width:none;
        margin:0;
        padding:14px !important;
        display:flex;
        flex-direction:column;
        gap:7px;
        border-radius:16px;
        background:#162b34;
        border:1px solid rgba(255,255,255,.08);
        box-shadow:0 24px 60px rgba(18,36,43,.18);
        z-index:50;
      }
      body.app-tabs .tabs::before { content:none; }
      .nav-brand {
        display:flex;
        align-items:center;
        gap:12px;
        padding:10px 8px 18px;
        margin-bottom:8px;
        border-bottom:1px solid rgba(255,255,255,.12);
        color:#fff;
      }
      .nav-brand .brand-mark {
        width:38px;
        height:38px;
        border-radius:10px;
        border-color:rgba(255,255,255,.22);
        box-shadow:none;
      }
      .nav-brand strong { display:block; font-size:15px; letter-spacing:0; }
      .nav-brand span { display:block; color:#aebec5; font-size:12px; margin-top:1px; }
      .tab-pill {
        width:100%;
        display:grid;
        grid-template-columns:30px 1fr;
        gap:9px;
        align-items:center;
        color:#cbd7dc;
        border-radius:10px;
        padding:10px 10px;
      }
      .tab-pill small { display:block; color:#8fa2ab; font-size:11px; margin-top:2px; font-weight:650; }
      .active-customer-box {
        margin:0 0 10px;
        padding:12px 10px;
        border:1px solid rgba(255,255,255,.12);
        border-radius:12px;
        background:rgba(255,255,255,.05);
        color:#d8e3e7;
      }
      .active-customer-box span { display:block; color:#8fa2ab; font-size:10px; font-weight:850; letter-spacing:.08em; text-transform:uppercase; margin-bottom:5px; }
      .active-customer-box strong { display:block; color:#fff; font-size:13px; line-height:1.25; }
      .active-customer-box small { display:block; color:#aebec5; font-size:11px; margin-top:3px; }
      .tab-pill.locked { opacity:.42; }
      .tab-pill.locked small::after { content:' · välj kund'; }
      .nav-index {
        color:#78909a;
        font-size:11px;
        font-weight:850;
        letter-spacing:.08em;
      }
      .tab-pill.primary,
      .tab-pill.active {
        background:#f7fafb;
        color:#17323b;
      }
      .tab-pill.primary small,
      .tab-pill.active small { color:#5f727b; }
      .tab-pill.primary .nav-index,
      .tab-pill.active .nav-index { color:#d39b55; }
      .nav-foot {
        margin-top:auto;
        padding:12px 8px 4px;
        color:#8fa2ab;
        font-size:11px;
        border-top:1px solid rgba(255,255,255,.1);
      }
      header.app-topbar,
      body.app-tabs main {
        margin-left:286px;
        max-width:none;
        width:auto;
      }
      header.app-topbar {
        min-height:112px;
        margin-right:24px;
        padding:24px 0 14px;
        display:grid;
        grid-template-columns:minmax(0, 1fr) minmax(520px, .88fr);
        align-items:end;
        gap:22px;
        border:0;
      }
      header.app-topbar h1 {
        font-size:30px;
        margin:2px 0 4px;
      }
      header.app-topbar .sub { margin:0; max-width:620px; }
      header.app-topbar .workflow {
        border-radius:14px;
        box-shadow:0 16px 44px rgba(24,33,38,.08);
      }
      body.app-tabs main {
        padding:0 24px 32px 0;
        display:block;
      }
      body.app-tabs .app-view.active-view {
        animation: viewIn .18s ease-out;
      }
      @keyframes viewIn {
        from { opacity:.55; transform:translateY(6px); }
        to { opacity:1; transform:none; }
      }
      body.app-tabs #import.app-view.active-view {
        grid-template-columns:minmax(360px, .75fr) minmax(0, 1.25fr);
      }
      body.app-tabs .card,
      body.app-tabs .report-header-box {
        border-radius:14px;
      }
      body.app-tabs .work-card {
        border-left:0;
        border-top:4px solid var(--accent);
      }
      body.app-tabs .preview-card {
        background:#f8fafb;
        border:0;
        box-shadow:none;
      }
      body.app-tabs .surface-title {
        border:1px solid var(--line);
        border-radius:14px 14px 0 0;
        background:#fff;
        margin:0;
      }
      body.app-tabs .report-shell {
        border:1px solid var(--line);
        border-top:0;
        border-radius:0 0 14px 14px;
      }
      body.app-tabs .group-section,
      body.app-tabs #nyckeltal,
      body.app-tabs #br,
      body.app-tabs .controls-card {
        max-width:1180px;
      }
    }

    @media screen and (max-width: 1059px) {
      .nav-brand,
      .nav-foot,
      .nav-index,
      .tab-pill small { display:none; }
      header.app-topbar { display:block; }
    }
  
    /* Supabase portal layer */
    .auth-status { display:flex; align-items:center; gap:10px; margin-top:10px; color:var(--muted); font-size:13px; }
    .auth-gate { max-width:960px; margin:34px auto; padding:0 24px; }
    .auth-panel { display:grid; grid-template-columns:minmax(0, 1fr) minmax(320px, 420px); gap:22px; align-items:center; background:#fff; border:1px solid var(--line); border-radius:16px; padding:26px; box-shadow:var(--shadow); }
    .auth-form { display:grid; gap:12px; }
    .auth-form label { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:13px; }
    body.auth-signed-in #authGate { display:none !important; }
    body.auth-signed-out .app-sidebar,
    body.auth-signed-out main,
    body.auth-signed-out .workflow,
    body.auth-signed-out #signOutButton { display:none !important; }
    body.auth-signed-out header.app-topbar { margin-left:auto; margin-right:auto; max-width:960px; padding:34px 24px 0; }
    body.auth-signed-out header.app-topbar h1 { font-size:34px; }
    .cloud-action { white-space:nowrap; }
    .period-library { display:grid; gap:12px; margin-top:14px; }
    .period-folder { border:1px solid var(--line); border-radius:8px; background:#fff; overflow:hidden; }
    .period-folder-header { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:12px 14px; background:linear-gradient(90deg, var(--accent2), #fffaf5); border-bottom:1px solid var(--line); }
    .period-folder-title { font-weight:900; color:var(--ink); }
    .period-folder-meta { color:var(--muted); font-size:12px; font-weight:750; }
    .period-report-row { display:grid; grid-template-columns:minmax(180px, 1fr) minmax(120px, .6fr) minmax(130px, .6fr) auto; gap:12px; align-items:center; padding:10px 14px; border-bottom:1px solid var(--line); }
    .period-report-row:last-child { border-bottom:0; }
    .period-report-name { font-weight:800; color:var(--ink); }
    .period-report-sub { color:var(--muted); font-size:12px; margin-top:2px; }
    @media (max-width:760px) { .period-report-row { grid-template-columns:1fr; } }
    @media (max-width:760px) { .auth-panel { grid-template-columns:1fr; } }
    @media print { .auth-gate, .auth-status { display:none !important; } }
  
    /* Role based portal controls */
    body:not(.role-admin) [data-admin-only] { display:none !important; }
    .access-grid { display:grid; grid-template-columns:minmax(220px, 1fr) minmax(220px, 1fr) minmax(160px, .5fr) auto; gap:10px; align-items:end; }
    .access-grid label { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:13px; }
    @media (max-width:900px) { .access-grid { grid-template-columns:1fr; } }
    .invite-customer-picker { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:13px; }
    .invite-customer-checklist { display:grid; grid-template-columns:repeat(2, minmax(160px, 1fr)); gap:6px 12px; max-height:132px; overflow:auto; padding:9px; border:1px solid var(--line); border-radius:8px; background:#fff; }
    .invite-customer-checklist label { display:block; color:var(--ink); font-size:13px; }
    @media (max-width:900px) { .invite-customer-checklist { grid-template-columns:1fr; } }



dialog.password-dialog:not([open]) { display:none; }
dialog.password-dialog[open] { width:min(440px, calc(100vw - 32px)); display:grid; grid-template-columns:1fr; gap:14px; align-items:stretch; padding:26px; border:0; border-radius:16px; box-shadow:0 24px 70px rgba(0,0,0,.28); }
.password-dialog::backdrop { background:rgba(10,20,30,.46); }
.password-dialog label { display:flex; flex-direction:column; gap:6px; margin:0; color:var(--muted); font-size:13px; }
.password-dialog .row { margin:0; }
.password-dialog .status { min-height:0; }
