* { box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }
body { background: #f0f2f5; margin: 0; padding: 20px; }
.container { max-width: 1400px; margin: 0 auto; }
.header {
    background: linear-gradient(135deg, #1e466e 0%, #0f2e4a 100%);
    border-radius: 20px;
    padding: 22px 30px;
    margin-bottom: 30px;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
/* Två rader med samma vänster- och högerkant: rubrik | märke, år | konsult */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.header-left { display: flex; flex-direction: column; gap: 5px; }
.year-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.15);
    padding: 5px 15px;
    border-radius: 30px;
}
.year-selector select {
    padding: 5px 10px;
    border-radius: 20px;
    border: none;
    background: white;
}
.year-selector .locked-badge {
    background: #ffc107;
    color: #1e466e;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
}
.year-selector .active-badge {
    background: #28a745;
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
}
.btn-sm {
    margin: 0;                 /* ingen margin-top från den globala button-regeln */
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
}
.btn-warning { background: #ffc107; color: #1e466e; }
.btn-danger { background: #dc3545; color: white; }
.btn-success { background: #28a745; color: white; }
.btn-primary { background: #1e466e; color: white; }
.btn-secondary { background: #6c757d; color: white; }
h1 { margin: 0; font-size: 1.7rem; }
.subtitle { margin: 5px 0 0; opacity: 0.8; font-size: 0.85rem; }
.model-badge {
    background: #ffc107;
    color: #1e466e;
    padding: 8px 16px;
    border-radius: 40px;
    font-weight: bold;
    font-size: 0.9rem;
}
.user-card {
    background: rgba(255,255,255,0.15);
    padding: 10px 20px;
    border-radius: 40px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}
select {
    padding: 8px 16px;
    border-radius: 30px;
    border: none;
    font-weight: 500;
    cursor: pointer;
}
.role-badge {
    background: #ffc107;
    color: #1e466e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}
.rate-badge {
    background: #e8f5e9;
    color: #2b7e3a;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}
/* Korten fyller alltid hela bredden, även på sista raden (5 i rad, annars 3 + 2 eller 2 + 2 + 1) */
.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}
.cards > .card { flex: 1 1 230px; min-width: 0; }
.card {
    background: white;
    border-radius: 20px;
    padding: 18px 20px;
    border-left: 4px solid #1e466e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.card h3 { margin: 0 0 6px; font-size: 0.75rem; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.card .value { font-size: 1.6rem; font-weight: 700; color: #1e466e; }
.card .small { font-size: 0.7rem; color: #888; margin-top: 4px; }
.positive { color: #2b7e3a; }
.negative { color: #c0392b; }
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tab {
    background: white;
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    color: #555;
}
.tab.active {
    background: #1e466e;
    color: white;
}
.panel {
    background: white;
    border-radius: 20px;
    padding: 20px;
    overflow-x: auto;
}
.panel h3 { margin-top: 0; color: #1e466e; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
th {
    text-align: left;
    background: #f8fafd;
    padding: 12px 8px;
    border-bottom: 2px solid #e2e8f0;
}
td {
    padding: 10px 8px;
    border-bottom: 1px solid #edf2f7;
}
input {
    width: 85px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #ccc;
    text-align: right;
}
.input-plan { background: #fff8e7; }
.input-outcome { background: #e8f5e9; }
.input-price { background: #e3f0ff; }
button {
    background: #1e466e;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 15px;
}
button:hover { background: #0f2e4a; }
.btn-secondary { background: #6c757d !important; }
.btn-secondary:hover { background: #5a6268 !important; }
.btn-success { background: #28a745 !important; }
.btn-success:hover { background: #1e7e34 !important; }
.btn-danger { background: #dc3545 !important; }
.btn-danger:hover { background: #c82333 !important; }
.btn-warning { background: #ffc107 !important; color: #1e466e !important; }
.btn-warning:hover { background: #e0a800 !important; }
.status {
    background: #d4edda;
    color: #155724;
    padding: 8px 16px;
    border-radius: 40px;
    display: inline-block;
    margin-left: 15px;
}
.footer {
    text-align: center;
    font-size: 0.7rem;
    color: #777;
    margin-top: 30px;
}
.normal-time { color: #666; font-size: 0.7rem; }
.legend {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ccc;
}
.legend-color.plan { background: #fff8e7; }
.legend-color.outcome { background: #e8f5e9; }
.legend-color.price { background: #e3f0ff; }
.total-row {
    background: #e8f0fe !important;
    font-weight: bold;
    border-top: 2px solid #1e466e;
}
.total-row td { padding: 12px 8px; }
/* Resultat och saldo: fet, blå om positivt, rött om negativt (samma på alla sidor) */
.result-positive, .res-pos { color: #1565c0; font-weight: bold; }
.result-negative, .res-neg { color: #c62828; font-weight: bold; }
.locked-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 15px;
    color: #856404;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   Inloggning och roller
   ============================================ */

/* Visas bara för administratör, ekonom och marknad (servern kontrollerar ändå behörigheten) */
body:not(.role-admin):not(.role-ekonom):not(.role-marknad) .staff-only { display: none !important; }

.session-bar {
    max-width: 1400px;
    margin: 0 auto 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #1e466e;
}
.session-app {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #1e466e;
    text-decoration: none;
}
.session-app .logo { height: 34px; width: auto; display: block; }
.session-app span { border-left: 2px solid #cfd8e3; padding-left: 12px; }
.login-logo { display: block; height: 52px; width: auto; margin: 0 auto 4px; }
.session-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.session-name { font-weight: 600; }
.session-role {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #1e466e;
}
.session-role.role-admin { background: #1e466e; color: white; }
.session-role.role-ekonom { background: #d4edda; color: #1e7e34; }
.session-role.role-marknad { background: #fde2e4; color: #9d174d; }
.session-role.role-anvandare { background: #e3f0ff; color: #1e466e; }
.session-role.role-gast { background: #fff3cd; color: #856404; }
.session-logout { margin: 0; display: inline-flex; }
.session-link,
button.session-link {
    background: none !important;
    border: none;
    padding: 0;
    margin: 0;                 /* knappar har annars margin-top från den globala button-regeln */
    color: #1e466e;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.4;
    text-decoration: underline;
    cursor: pointer;
}

/* Formulärfält som inte är sifferceller i tabeller */
.login-card input,
.password-dialog input,
.form-grid input,
.form-grid select,
.guest-form input {
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    font-size: 0.9rem;
}
.form-message { min-height: 1.2em; font-size: 0.85rem; color: #c0392b; margin: 8px 0 0; }

.login-page { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card {
    background: white;
    border-radius: 20px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-card h1 { color: #1e466e; text-align: center; }
.login-subtitle { margin: -8px 0 6px; text-align: center; color: #666; font-size: 0.9rem; }
.login-card label,
.password-dialog label,
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; font-weight: 600; color: #444; }
.login-card button { padding: 11px; font-size: 0.95rem; margin-top: 6px; }
.login-error {
    background: #fdecea;
    color: #c0392b;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0;
    font-size: 0.85rem;
}

.password-dialog {
    border: none;
    border-radius: 20px;
    padding: 24px;
    width: min(380px, 92vw);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.password-dialog::backdrop { background: rgba(15, 46, 74, 0.4); }
.password-dialog form { display: flex; flex-direction: column; gap: 12px; }
.password-dialog h3 { margin: 0 0 4px; color: #1e466e; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================
   Administration
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
}
.admin-table td input,
.admin-table td select { width: 100%; text-align: left; }
.admin-table .inactive td { opacity: 0.5; }
.muted { color: #888; font-size: 0.75rem; }

/* ============================================
   Gästens testkalkyl
   ============================================ */
.guest-intro { color: white; }
.guest-intro p { margin: 6px 0 0; opacity: 0.85; font-size: 0.9rem; max-width: 760px; }
.guest-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 20px;
    align-items: start;
}
.guest-layout > * { min-width: 0; }   /* breda tabeller scrollar i sin panel i stället för att trycka ut sidan */
@media (max-width: 900px) { .guest-layout { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
    body { padding: 12px; }
    .header { padding: 18px 20px; }
    .guest-intro h1 { font-size: 1.3rem; }
}
.guest-form { display: flex; flex-direction: column; gap: 12px; }
.guest-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: #444; }
.guest-form small { font-weight: 400; color: #888; }
.guest-form fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.guest-form legend { font-weight: 700; color: #1e466e; margin-bottom: 4px; }
.guest-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.highlight-row td { background: #e8f0fe; font-weight: 700; }

/* ============================================
   Tidrapport från Kleer (Uppföljning)
   ============================================ */
button.time-link {
    background: #e3f0ff !important;
    color: #1e466e;
    margin: 0;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}
button.time-link:hover { background: #cfe3ff !important; }
.time-dialog {
    border: none;
    border-radius: 20px;
    padding: 24px;
    width: min(900px, 94vw);
    max-height: 88vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.time-dialog::backdrop { background: rgba(15, 46, 74, 0.4); }
.time-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.time-dialog-head h3 { margin: 0; color: #1e466e; }
.time-dialog-head button { margin: 0; }
.time-dialog h4 { color: #1e466e; margin: 20px 0 6px; }
#timeDialogBody { overflow-x: auto; }
.time-table { margin-top: 12px; }
.time-table .num { text-align: right; white-space: nowrap; }
.cat { padding: 2px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 600; background: #e2e8f0; white-space: nowrap; }
.cat-extern { background: #d4edda; color: #1e7e34; }
.cat-intern { background: #e3f0ff; color: #1e466e; }
.cat-utan-uppdrag { background: #fff3cd; color: #856404; }
.cat-frånvaro { background: #fdecea; color: #c0392b; }
.cat-tillägg { background: #f3e8ff; color: #6b21a8; }

/* Översikt – alla konsulter */
.ov-table td.num, .ov-table th.num { text-align: right; white-space: nowrap; }
.ov-table th.sortable { cursor: pointer; user-select: none; }
.ov-table th.sortable:hover { text-decoration: underline; }
a.consultant-link { color: #1e466e; font-weight: 600; text-decoration: none; }
a.consultant-link:hover { text-decoration: underline; }

/* Växel Budget / Justerad budget */
.mode-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.mode-toggle button {
    margin: 0; padding: 6px 16px; border-radius: 20px; border: 1px solid #1e466e;
    background: white; color: #1e466e; font-weight: 600; font-size: 0.8rem; cursor: pointer;
}
.mode-toggle button.active { background: #1e466e; color: white; }
.mode-toggle button:disabled { opacity: 0.4; cursor: not-allowed; }
.price-table .price-effective { font-weight: 600; color: #1e466e; }

/* Justerad budget */
.adjust-list, .adjust-editor { margin-bottom: 16px; }
.adjust-list td.num, .adjust-list th.num { text-align: right; white-space: nowrap; }
.adjust-editor input::placeholder { color: #aab4c0; }
.adjust-buttons { display: flex; gap: 8px; align-items: center; margin: 8px 0 16px; }
.adjust-buttons button { margin: 0; }

/* Graf: omsättning per månad */
.cards > .chart-buttons { flex: 0 0 96px; display: flex; flex-direction: column; gap: 10px; }
.chart-buttons > .chart-button {
    flex: 1 1 0; margin: 0; border: none; border-radius: 16px; background: white; cursor: pointer; padding: 6px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-left: 4px solid #1e466e;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 1.3rem; color: #1e466e;
}
.chart-buttons > .chart-button span { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #666; }
.chart-buttons > .chart-button:hover { background: #eef4ff; }
.chart-dialog { width: min(960px, 96vw); }
.revenue-chart { width: 100%; height: auto; display: block; margin: 8px 0 16px; }
.revenue-chart .grid { stroke: #e6eaf0; stroke-width: 1; }
.revenue-chart .axis { font-size: 12px; fill: #666; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.85rem; }
.legend-item i, .legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.forecast-box { background: #f4f8ff; border-left: 4px solid #1e466e; border-radius: 10px; padding: 10px 14px; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 4px; }
.forecast-box .muted { font-size: 0.8rem; }

/* Internpriser (administration) */
.rates-year { margin: 8px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rates-table td.num, .rates-table th.num { text-align: right; white-space: nowrap; }
.rates-table td input { width: auto; text-align: right; }
.rates-decision { display: flex; gap: 12px; align-items: flex-end; margin-top: 12px; flex-wrap: wrap; }
.rates-decision label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: #444; flex: 1 1 320px; }
.rates-decision input { text-align: left; padding: 8px 10px; width: 100%; }
.rates-decision button { margin: 0; }
.rates-decision label.wide { flex: 2 1 320px; }
.decision-card { border: 1px solid #e2e8f0; border-left: 4px solid #c96f0e; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; background: #fffdf8; }
.decision-card.decided { border-left-color: #2b7e3a; background: #f7fcf8; }
.decision-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.decision-actions { display: flex; gap: 8px; margin-top: 10px; }
.decision-actions button { margin: 0; }
.badge { padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.badge-ok { background: #d4edda; color: #1e7e34; }
.badge-wait { background: #fff3cd; color: #856404; }

/* Uppdrag: fast pris och licenser */
.unit-table td.num, .unit-table th.num { text-align: right; white-space: nowrap; }
.license-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0; }
.license-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: #444; }
.license-form label.wide { flex: 1 1 260px; }
.license-form input { text-align: left; padding: 8px 10px; width: 100%; }
.license-form button { margin: 0; }

.role-summary { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; font-size: 0.85rem; }

/* Enhet 1 – bolagets budget */
.unit-toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.unit-toolbar .spacer { flex: 1; }
.unit-toolbar button { margin: 0; }
.unit-check { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; }
.unit-check input { width: auto; }
.unit-scroll { overflow-x: auto; max-height: calc(100vh - 140px); overflow-y: auto; border: 1px solid #e6eaf0; border-radius: 10px; }
.container-wide .unit-budget td input { width: 100%; min-width: 70px; }
.container-wide .unit-budget td input.comment { min-width: 200px; }
.unit-budget { border-collapse: separate; border-spacing: 0; font-size: 0.8rem; min-width: 100%; }
.unit-budget th { position: sticky; top: 0; background: #f0f2f5; z-index: 2; white-space: nowrap; }
.unit-budget td, .unit-budget th { padding: 4px 6px; border-bottom: 1px solid #eef1f5; }
.unit-budget td.num, .unit-budget th.num { text-align: right; white-space: nowrap; }
.unit-budget td input { width: 86px; padding: 3px 5px; font-size: 0.8rem; text-align: right; }
.unit-budget td input.comment { width: 200px; text-align: left; }
.unit-budget .sticky { position: sticky; left: 0; background: white; z-index: 1; }
.unit-budget .sticky2 { position: sticky; left: 52px; background: white; z-index: 1; min-width: 220px; }
.unit-budget th.sticky, .unit-budget th.sticky2 { z-index: 3; background: #f0f2f5; }
.unit-budget .group-row td { background: #e8eef7; color: #1e466e; padding-top: 10px; }
.unit-budget .subtotal-row td { background: #f7f9fc; font-weight: 600; }
.unit-budget .subtotal-row .sticky, .unit-budget .subtotal-row .sticky2 { background: #f7f9fc; }
.unit-budget .total-row td, .unit-budget .total-row .sticky, .unit-budget .total-row .sticky2 { background: #dfe7f3; }
.unit-budget tr.dirty td { background: #fff8e1; }
.unit-budget .nowrap { white-space: nowrap; }

.unit-budget td.cell-changed input { background: #fde2e4; border-color: #d62828; font-weight: 600; }
.unit-budget.mode-adjusted input::placeholder { color: #aab4c0; }

.unit-budget tr.row-done td { background: #f1f8f2; color: #4a6b50; }
.unit-budget tr.row-done .sticky, .unit-budget tr.row-done .sticky2 { background: #f1f8f2; }
.unit-budget td.center { text-align: center; }
.unit-budget .done-check { width: auto; }

/* Enhet 1 – budget (månadsuppställning) */
.ub-table .ub-label { min-width: 280px; max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ub-table .mstart { border-left: 2px solid #d5dde8; }
.ub-table th.month-head { text-align: center; }
.ub-table th.month-done { background: #e3f1e6; }
.ub-table td.actual { font-weight: 600; color: #1e466e; }
.ub-table .ub-group td { color: #1e466e; font-style: italic; padding-top: 8px; }
.ub-table .ub-group .sticky, .ub-table .group-row .sticky { background: #e8eef7; }
.ub-table .ub-group .sticky { background: white; }
.ub-table thead tr:nth-child(2) th { top: 26px; }
.ub-table tr.ub-sub td { font-style: italic; color: #5b6b7d; font-size: 0.75rem; }
.ub-table tr.ub-sub td.ub-label { padding-left: 22px; }
/* Varannan månad svagt tonad – läggs ovanpå radens egen bakgrund */
.ub-table td.m-alt, .ub-table th.m-alt { background-image: linear-gradient(rgba(30, 70, 110, 0.045), rgba(30, 70, 110, 0.045)); }
/* Hovra över en månad: månadens kolumner lyfts fram */
.ub-table td.m-hl, .ub-table th.m-hl { background-image: linear-gradient(rgba(255, 193, 7, 0.22), rgba(255, 193, 7, 0.22)); }
.ub-table th.m-hl.month-head { box-shadow: inset 0 -2px 0 #e0a800; }
.ub-table th.month-head { cursor: default; }
/* Enhet 1 – kostnadsbudget: hovra över en kolumnrubrik lyfter fram kolumnen */
.unit-budget td.m-hl, .unit-budget th.m-hl { background-image: linear-gradient(rgba(255, 193, 7, 0.22), rgba(255, 193, 7, 0.22)); }
.unit-budget th.m-hl { box-shadow: inset 0 -2px 0 #e0a800; }
.unit-budget td.m-hl:not(.cell-changed) input { background-color: #fff6d6; }
.unit-budget tr.row-memo td { color: #7a8794; font-style: italic; }
.ub-table tr.adj-row td { background: #fffbea; }
.ub-table tr.adj-row .sticky { background: #fffbea; }
.ub-table td input.adj-comment { width: 120px; text-align: left; }
.ub-table tr.ub-detail td { font-size: 0.72rem; color: #6b7785; }
.ub-table tr.ub-detail td.ub-label { padding-left: 40px; }
/* Enhet 1 – budget: resultatraden fet, blå = positiv, röd = negativ */
.ub-table tr.result-row td { font-weight: 700; font-size: 0.85rem; }
.ub-table tr.result-row td.res-pos { color: #1565c0; }
.ub-table tr.result-row td.res-neg { color: #c62828; }
/* Enhet 1 – kostnadsbudget: resultatkortet fet, blå = positivt, rött = negativt */
.card .res-pos { color: #1565c0; font-weight: 700; }
.card .res-neg { color: #c62828; font-weight: 700; }
/* Översikt: resultat och saldo fet, blå = positivt, rött = negativt */
.ov-table td.res-pos { color: #1565c0; font-weight: 700; }
.ov-table td.res-neg { color: #c62828; font-weight: 700; }
/* Uppföljning: Totalt konsult (knapp) i resultatfärg */
button.time-link.res-pos { color: #1565c0; }
button.time-link.res-neg { color: #c62828; }
.lock-hint { background: #fff8e1; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 0.85rem; }
/* Enhet 1 – budget: sammanställningskolumnerna (helår) tonade och avgränsade mot månaderna */
.ub-table td.sum-col, .ub-table th.sum-col { background-image: linear-gradient(rgba(30, 70, 110, 0.07), rgba(30, 70, 110, 0.07)); }
.ub-table th.sum-col { background-color: #dfe7f1; }
.ub-table .sum-last { border-right: 3px solid #9fb3c8; }
.revenue-chart .zero { stroke: #5b6b7d; stroke-width: 1.5; }
/* Menyraden: kugghjul för inställningar och konto som initialer (som Google) */
.session-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px;
    color: #1e466e; text-decoration: none; transition: background 0.15s; }
.session-icon:hover, .session-icon.active { background: #e3f0ff; }
.account-menu { position: relative; display: inline-flex; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: none; margin: 0; padding: 0; cursor: pointer;
    background: #1e466e; color: white; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.5px;
    display: inline-flex; align-items: center; justify-content: center; }
.avatar:hover { box-shadow: 0 0 0 3px #cfe3ff; }
.avatar.role-ekonom { background: #1e7e34; }
.avatar.role-marknad { background: #9d174d; }
.avatar.role-anvandare { background: #2f6fb3; }
.avatar.role-gast { background: #856404; }
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; cursor: default; }
.avatar-lg:hover { box-shadow: none; }
.account-dropdown { position: absolute; right: 0; top: 46px; z-index: 50; min-width: 230px; background: white;
    border: 1px solid #e0e6ee; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); padding: 8px; }
.account-dropdown:not([hidden]) { display: flex; flex-direction: column; gap: 2px; }
.account-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; border-bottom: 1px solid #eef1f5; margin-bottom: 4px; }
.account-item { display: block; width: 100%; text-align: left; background: none; color: #1e466e; border: none; margin: 0;
    padding: 8px 10px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; }
.account-item:hover { background: #f0f5fb; }
.session-icon-img { width: 46px; height: 46px; border-radius: 12px; }
.session-icon-img img { display: block; }
/* Enhet 1 – budget: fyra grafknappar i ett 2 × 2-rutnät (omsättning och resultat) */
.cards > .chart-buttons.chart-buttons-grid { flex: 0 0 202px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Uppdatera från Kleer (menyraden) */
button.session-icon.kleer-refresh { border: none; background: none; padding: 0; margin: 0; cursor: pointer; }
button.session-icon.kleer-refresh:hover { background: #e3f0ff; }
button.session-icon.kleer-refresh.spinning svg { animation: kleer-spin 1s linear infinite; }
@keyframes kleer-spin { to { transform: rotate(360deg); } }
/* Uppdatera från Kleer: förhandsvisning av skillnaderna */
.kleer-dialog { max-width: 900px; width: 92vw; }
.kleer-dialog .kleer-diff { max-height: 50vh; overflow-y: auto; border: 1px solid #e6eaf0; border-radius: 8px; }
.kleer-dialog .dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
/* Dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.dash-card { background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); overflow: hidden; padding: 0 16px 14px; }
.dash-card h3 { margin: 0 -16px 10px; padding: 9px 16px; background: #1e466e; color: white; font-size: 0.85rem; font-weight: 600; }
.dash-sub { color: #555; font-size: 0.85rem; margin-bottom: 6px; }
.dash-tall { grid-row: span 2; }
.dash-wide2 { grid-column: span 2; }
.dash-wide3 { grid-column: span 3; }
.dash-svg { width: 100%; height: auto; display: block; }
.dash-svg .grid { stroke: #e6eaf0; stroke-width: 1; }
.dash-svg .axis { font-size: 11px; fill: #667; }
.dash-gauge { max-width: 300px; margin: 0 auto; }
.dash-big { font-size: 38px; font-weight: 700; fill: #1b1b1b; }
.dash-small { font-size: 14px; fill: #444; color: #444; }
.dash-kpi { text-align: center; padding: 26px 0 10px; }
.dash-kpi-big { font-size: 2.2rem; font-weight: 700; color: #1b1b1b; }
.dash-kpi-delta { font-size: 1rem; font-weight: 600; margin-left: 6px; }
.dash-kpi .dash-small { margin-top: 14px; }
.dash-legend { display: flex; gap: 16px; justify-content: center; font-size: 0.8rem; margin-bottom: 4px; }
.dash-legend i, .dash-pie-row i { display: inline-block; width: 22px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.dash-pie { max-width: 300px; margin: 0 auto; }
.dash-pie-legend { margin-top: 10px; font-size: 0.8rem; }
.dash-pie-row { display: grid; grid-template-columns: 28px 1fr auto 44px; gap: 6px; align-items: center; padding: 3px 0; border-bottom: 1px solid #f0f2f5; }
.dash-pie-row b, .dash-pie-row span.muted { text-align: right; }
.dash-pie-total { border-bottom: none; font-weight: 600; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-wide3 { grid-column: span 2; } }
.dash-pie-pct { font-size: 15px; font-weight: 700; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 3px; pointer-events: none; }
/* Enhet 1 – budget: grafknapparna på en egen rad under korten, grupperade per ämne */
.chart-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 20px; }
.chart-group { display: flex; align-items: stretch; gap: 8px; background: white; border-radius: 12px; padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); }
.chart-group-label { align-self: center; font-weight: 600; color: #1e466e; font-size: 0.85rem; margin-right: 4px; }
.chart-group > .chart-button { width: 96px; padding: 8px 6px; }
.chart-group > .chart-button { margin: 0; border: none; border-radius: 12px; background: #f5f8fc; cursor: pointer;
    border-left: 4px solid #1e466e; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 1.2rem; color: #1e466e; }
.chart-group > .chart-button span { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #666; }
.chart-group > .chart-button:hover { background: #eef4ff; }
.dash-rows { margin: 6px 0 10px; font-size: 0.85rem; }
.dash-row { display: grid; grid-template-columns: 1fr 80px 80px; gap: 6px; padding: 4px 0; border-bottom: 1px solid #f0f2f5; }
.dash-row b, .dash-row span:not(:first-child) { text-align: right; }
.dash-row-head { color: #888; font-size: 0.72rem; border-bottom: none; }
.dash-row-total { font-weight: 600; border-bottom: none; border-top: 2px solid #dfe5ee; }
.dash-note { font-size: 0.75rem; color: #777; margin: 6px 0 0; }
/* Dashboard: tre hela rader – nyckeltal, grafer per månad, fördelningar (cirkeldiagram med listan bredvid) */
.dash-grid { grid-template-areas: "rev fc occ pot" "bars bars line line" "cust cust comp comp"; align-items: start; }
.dash-grid > .dash-card { height: 100%; box-sizing: border-box; }
.dash-pie-wrap { display: flex; gap: 18px; align-items: center; }
.dash-pie-wrap > .dash-pie { flex: 0 0 240px; max-width: 240px; margin: 0; }
.dash-pie-wrap > .dash-pie-legend { flex: 1 1 auto; margin-top: 0; min-width: 0; }
#kCompany > .dash-rows { margin: 0 0 12px; }
#kCompany .dash-row { grid-template-columns: 1fr 110px 110px; }
#kCompany .dash-pie-wrap > .dash-pie { flex-basis: 200px; max-width: 200px; }
@media (max-width: 1200px) {
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "rev fc" "occ pot" "bars bars" "line line" "cust cust" "comp comp"; }
}
@media (max-width: 700px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rev" "fc" "occ" "pot" "bars" "line" "cust" "comp"; }
    .dash-pie-wrap { display: block; }
    .dash-pie-wrap > .dash-pie { max-width: 260px; margin: 0 auto; }
}
/* Hjälpsidan */
.help-page { max-width: 900px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 0.9rem; }
.help-toc a { color: #1e466e; }
.help-section { scroll-margin-top: 20px; line-height: 1.55; }
.help-section h2 { margin-top: 0; color: #1e466e; font-size: 1.2rem; }
.help-section h3 { font-size: 1rem; margin: 16px 0 6px; }
.help-section dt { font-weight: 600; margin-top: 10px; }
.help-section dd { margin: 2px 0 0 0; color: #333; }
.help-section .res-pos, .help-section .res-neg { font-weight: 700; }
.help-toc .help-back { font-weight: 600; margin-right: 12px; }
.help-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.help-table td, .help-table th { padding: 6px 8px; border-bottom: 1px solid #eef1f5; vertical-align: middle; text-align: left; }
.help-table img { width: 32px; height: 32px; display: block; }
.help-table .help-emoji { font-size: 1.5rem; text-align: center; }
.help-grid td:not(:first-child), .help-grid th:not(:first-child) { text-align: center; width: 90px; }
.help-grid th { background: #f0f2f5; font-size: 0.8rem; }
.admin-table input.needs-password { border-color: #e0a800; background: #fff8e1; }
/* Sidfot */
.site-footer { text-align: right; font-size: 0.72rem; color: #9aa3ad; padding: 18px 24px 14px; letter-spacing: 0.3px; white-space: nowrap; }
/* Bonus */
.bonus-rules { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 0.85rem; }
.bonus-case { border: 1px solid #e6eaf0; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.bonus-case-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.bonus-badge { display: inline-block; background: #e3f0ff; color: #1e466e; border-radius: 10px; padding: 1px 8px; font-size: 0.72rem; margin-left: 4px; }
.bonus-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.bonus-table th, .bonus-table td { padding: 5px 8px; border-bottom: 1px solid #f0f2f5; }
.bonus-table th { background: #f5f7fa; font-weight: 600; }
.bonus-table td.num, .bonus-table th.num { text-align: right; white-space: nowrap; }
.bonus-table input[type=checkbox] { width: auto; margin: 0; }
.bonus-paid-row td { color: #666; }
.bonus-dialog { max-width: 640px; width: 92vw; }
.bonus-form { display: grid; gap: 10px; }
.bonus-form label { display: grid; gap: 4px; font-size: 0.85rem; }
.bonus-checks { display: flex; flex-wrap: wrap; gap: 14px; }
.bonus-checks label { display: flex; align-items: center; gap: 6px; }
.bonus-checks input { width: auto; margin: 0; }
.bonus-parts { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.bonus-parts td, .bonus-parts th { padding: 4px; text-align: left; }
.bonus-parts input[type=number] { width: 70px; }
.bonus-dialog .dialog-buttons { display: flex; gap: 10px; margin-top: 14px; }
.bonus-dialog .spacer { flex: 1; }
/* Kort med 2 × 2 grafknappar: korten får vara smalare så att knapparna ryms på samma rad */
.cards:has(.chart-buttons-grid) > .card { flex-basis: 160px; }

/* Inloggning steg 2: kod på mejl och ihågkomna enheter */
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-info { background: #eaf3fc; color: #1e466e; border-radius: 10px; padding: 10px 12px; margin: 0; font-size: 0.85rem; }
.login-card .login-code-input { font-size: 1.5rem; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
.login-card label.login-remember { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 0.85rem; }
.login-card .login-remember input { width: auto; }
.login-hint { margin: -8px 0 0 26px; color: #888; font-size: 0.75rem; }
.login-secondary { flex-direction: row !important; justify-content: space-between; align-items: center; gap: 8px; }
.login-card .link-button { background: none; border: none; color: #1e466e; text-decoration: underline; padding: 0; margin: 0;
    font-size: 0.8rem; cursor: pointer; box-shadow: none; }
.login-secondary a { font-size: 0.8rem; color: #888; }
.device-list { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.device-list td { padding: 8px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.device-list .device-current { color: #2b7e3a; font-weight: 600; }
