* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


/* ==========================================
   DESIGNSYSTEM – BUILDORA
========================================== */
/* Alla färger, typsnitt, avstånd, hörn och
   skuggor finns här. Använd variablerna –
   skriv inga färger direkt i reglerna nedan
   eller i JavaScript.

   Identitet: loggans färgglada gradient
   (gul → orange → röd) på huvudknappar,
   kortkanter och rubriker. Färgerna är
   uppmätta i loggan. */

:root {

    /* Varumärke */
    --brand-gradient: linear-gradient(90deg, #FDA00A 0%, #F4511A 55%, #EC0A2C 100%);

    /* Huvudfärg (från loggan) */
    --color-primary: #F14110;
    --color-primary-hover: #CF3409;
    --color-primary-soft: #FFF2EB;
    --color-primary-border: #F5C4A6;
    --shadow-primary: 0 4px 14px rgba(241, 65, 16, 0.18);
    --shadow-primary-hover: 0 6px 18px rgba(241, 65, 16, 0.26);

    /* Text */
    --color-text: #171717;
    --color-text-muted: #52606D;
    --color-text-subtle: #616E7C;
    --color-text-inverse: #FFFFFF;

    /* Ytor och linjer */
    --color-bg: #F5F6F8;
    --color-surface: #FFFFFF;
    --color-surface-alt: #F8F9FA;
    --color-border: #E4E7EB;
    --color-border-strong: #CBD2D9;
    --color-overlay: rgba(31, 41, 51, 0.45);

    /* Status */
    --color-success: #1F7A3D;
    --color-success-bg: #E9F6EE;
    --color-warning: #8A5A00;
    --color-warning-bg: #FFF6DD;
    --color-warning-border: #E0A100;
    --color-danger: #B42318;
    --color-danger-bg: #FDECEA;
    --color-danger-border: #F2B8B5;
    --color-info: #1D4F91;
    --color-info-bg: #E8F0FB;
    --color-neutral: #52606D;
    --color-neutral-bg: #EEF0F3;
    --color-ai: #5B3CC4;
    --color-ai-bg: #F0EBFD;
    --color-ai-border: #DDD6F5;

    /* Typsnitt */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --font-brand: "Montserrat", var(--font-sans);
    --heading-font: var(--font-sans);

    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 22px;
    --text-2xl: 28px;
    --text-3xl: 34px;

    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Avstånd */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    /* Hörn */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    /* Skuggor */
    --shadow-sm: 0 1px 2px rgba(31, 41, 51, 0.06);
    --shadow-md: 0 4px 16px rgba(31, 41, 51, 0.08);
    --shadow-lg: 0 12px 32px rgba(31, 41, 51, 0.14);

    /* Fokus och tryckytor */
    --focus-ring: 0 0 0 3px rgba(241, 65, 16, 0.35);
    --focus-ring-danger: 0 0 0 3px rgba(180, 35, 24, 0.25);
    --focus-ring-soft: 0 0 0 3px rgba(241, 65, 16, 0.2);
    --tap-size: 44px;

    /* Gamla namn – pekar på de nya */
    --brand: var(--color-primary);
    --brand-dark: var(--color-primary-hover);
    --brand-light: var(--color-primary-soft);
    --ink: var(--color-text);
}

/* Tunn gradientlinje överst på sidan */
body::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--brand-gradient);
}

h1,
h2,
h3,
h4 {
    font-family: var(--heading-font);
    font-weight: var(--weight-bold);
    letter-spacing: -0.2px;
    color: var(--color-text);
}

h1 { font-size: var(--text-3xl); line-height: 1.2; }
h2 { font-size: var(--text-xl); line-height: 1.3; }
h3 { font-size: var(--text-lg); line-height: 1.35; }
h4 { font-size: var(--text-base); }

a {
    color: var(--color-primary);
}

/* Synlig fokus för tangentbord överallt */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Belopp linjerar (lika breda siffror) */
.amount,
td,
.offer-price-row,
.invoice-total-box strong {
    font-variant-numeric: tabular-nums;
}

/* Text med loggans gradient */
.brand-gradient-text,
.logo-name,
.login-name {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);

    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;

    -webkit-font-smoothing: antialiased;
}

/* Stora, svaga gradientlinjer i bakgrunden.
   Ligger fast bakom allt innehåll. */
body::before,
body::after {
    content: "";

    position: fixed;
    z-index: -1;

    width: 160vmax;
    height: 22vmax;

    background: var(--brand-gradient);
    border-radius: 999px;

    filter: blur(40px);
    pointer-events: none;
}

body::before {
    top: 8vh;
    left: -30vmax;

    opacity: 0.05;
    transform: rotate(-18deg);
}

body::after {
    bottom: -4vh;
    right: -40vmax;

    height: 16vmax;

    opacity: 0.035;
    transform: rotate(-18deg);
}

header {
    height: 64px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 0 40px;

    /* Behövs för att loggan ska kunna centreras */
    position: relative;
}

/* Loggan ligger mitt i sidhuvudet,
   oberoende av hamburgare och logga ut-knapp */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;

    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo-symbol {
    display: block;
    height: 38px;
    width: auto;
}

.logo-name {
    font-family: var(--font-brand);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.header-button {
    width: auto;
    min-height: var(--tap-size);

    margin-top: 0;
    padding: 0 var(--space-4);

    font-size: var(--text-sm);
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 70px 20px;
}


/* ==========================================
   HERO
========================================== */

.hero {
    text-align: center;
    margin-bottom: 45px;
}

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: var(--space-4);

    /* Gradienten följer texten, inte hela bredden */
    display: inline-block;
    padding-bottom: 4px;
}

.hero p {
    font-size: var(--text-lg);
    color: var(--color-text-muted);

    max-width: 650px;
    margin: 0 auto;
}

/* Startsidan – det första man ser efter inloggning */
.start-page {
    min-height: calc(100vh - 72px - 160px);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    margin-bottom: 0;
}

.start-button {
    width: auto;

    margin-top: 34px;
    padding: 18px 42px;

    font-size: 18px;
}


/* ==========================================
   KORT
========================================== */

.offer-box,
.result {
    background: var(--color-surface);

    padding: var(--space-8);

    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-sm);

    margin-bottom: var(--space-6);
}

.offer-box h2,
.result h2 {
    margin-bottom: 10px;
}

.offer-box h3,
.result h3 {
    margin-top: 28px;
    margin-bottom: 18px;
}

.settings-info {
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}


/* ==========================================
   FORMULÄR
========================================== */

label {
    display: block;

    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);

    margin-top: var(--space-5);
    margin-bottom: var(--space-2);
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;

    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);

    padding: var(--space-3) 14px;

    font-family: inherit;
    font-size: var(--text-base);
    color: var(--color-text);

    background: var(--color-surface);

    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-subtle);
}

input[type="file"] {
    padding: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

input[type="file"]::file-selector-button {
    min-height: 36px;

    margin-right: var(--space-3);
    padding: 0 var(--space-4);

    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);

    background: var(--color-surface-alt);
    color: var(--color-text);

    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);

    cursor: pointer;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--color-text-subtle);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

textarea {
    min-height: 200px;
    resize: vertical;
}

/* Kortare textrutor */
.textarea-short {
    min-height: 90px;
}

.textarea-medium {
    min-height: 180px;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.input-with-unit input {
    flex: 1;
    min-width: 0;
}

.input-with-unit span {
    min-width: 55px;
    color: var(--color-text-muted);
}

.field-help {
    margin-top: var(--space-2);

    color: var(--color-text-subtle);
    font-size: var(--text-sm);
}

/* Fel direkt vid fältet */
.input-invalid,
.input-error {
    border-color: var(--color-danger) !important;
}

.input-invalid:focus,
.input-error:focus {
    box-shadow: var(--focus-ring-danger) !important;
}

.field-error-message {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);

    margin-top: var(--space-2);

    color: var(--color-danger);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.field-error-message::before {
    content: "!";

    flex: 0 0 18px;
    height: 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--color-danger);
    color: var(--color-text-inverse);

    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
}

/* Små hjälptexter i etiketter */
.label-hint {
    font-weight: var(--weight-normal);
    color: var(--color-text-subtle);
}

.text-warning {
    color: var(--color-warning);
    font-weight: var(--weight-medium);
}


/* ==========================================
   LOGOTYP
========================================== */

.logo-preview-container {
    margin-top: 18px;

    padding: 18px;

    border: 1px solid var(--color-border);
    border-radius: 10px;

    background: var(--color-surface-alt);
}

.logo-preview {
    display: block;

    max-width: 240px;
    max-height: 120px;

    object-fit: contain;
}

.remove-logo-button {
    width: auto;

    margin-top: 15px;
    padding: 10px 14px;

    font-size: 14px;
}


/* ==========================================
   KNAPPAR
========================================== */

/* Primär (standard): en per vy
   Sekundär: .secondary-button
   Ta bort:  .danger-button
   Tillbaka: .back-button
   Länk:     .link-button */

button {
    width: 100%;
    min-height: 48px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);

    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-5);

    border: none;
    border-radius: var(--radius-md);

    background: var(--brand-gradient);
    color: var(--color-text-inverse);

    font-family: inherit;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: 1.2;

    cursor: pointer;

    box-shadow: var(--shadow-primary);

    transition:
        filter 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
}

button:hover {
    filter: brightness(0.93);
    box-shadow: var(--shadow-primary-hover);
}

button:disabled {
    opacity: 0.6;
    cursor: default;
}

button:disabled:hover {
    filter: none;
    box-shadow: var(--shadow-primary);
}

button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.secondary-button,
.remove-logo-button {
    background:
        linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        var(--brand-gradient) border-box;
    color: var(--color-text);

    border: 2px solid transparent;

    box-shadow: none;
}

.secondary-button:hover,
.remove-logo-button:hover,
.secondary-button:disabled:hover {
    background:
        linear-gradient(var(--color-primary-soft), var(--color-primary-soft)) padding-box,
        var(--brand-gradient) border-box;
    color: var(--color-text);

    filter: none;
    box-shadow: none;
}

.danger-button {
    background: var(--color-surface);
    color: var(--color-danger);

    border: 1px solid var(--color-danger-border);

    box-shadow: none;
}

.danger-button:hover,
.danger-button:disabled:hover {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
    color: var(--color-danger);

    filter: none;
    box-shadow: none;
}

/* "← Tillbaka" – diskret, överst i detaljvyer */
.back-button {
    width: auto;
    min-height: var(--tap-size);

    margin: 0 0 var(--space-4);
    padding: 0 var(--space-2) 0 0;

    background: none;
    border: none;
    color: var(--color-text-muted);

    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);

    box-shadow: none;
}

.back-button:hover {
    background: none;
    border: none;
    color: var(--color-primary);

    filter: none;
    box-shadow: none;
}

.customer-offer-button {
    margin-top: 35px;
    font-size: 17px;
}

.pdf-button {
    margin-bottom: 30px;
}


/* ==========================================
   ÖVRIGT
========================================== */

hr {
    border: 0;
    border-top: 1px solid var(--color-border);

    margin: 30px 0;
}

.job-box {
    margin-top: 30px;
}

.result p {
    margin: 9px 0;
}

.ai-review {
    padding-bottom: 10px;
}

.profit-good {
    margin-top: 20px !important;

    padding: 15px;

    background: var(--color-success-bg);
    border-radius: 8px;
}

.profit-warning {
    margin-top: 20px !important;

    padding: 15px;

    background: var(--color-warning-bg);
    border-radius: 8px;
}

.hidden {
    display: none !important;
}

/* Egen klass för flikarna, så att den inte
   krockar med .hidden på t.ex. #result */
.tab-hidden {
    display: none !important;
}


/* ==========================================
   FLIKAR
========================================== */

/* Flikknappar (i menyn) och filterknappar */
.tab-button {
    width: auto;
    min-height: var(--tap-size);

    margin-top: 0;
    padding: 0 var(--space-4);

    background: var(--color-surface);
    color: var(--color-text);

    border: 1px solid var(--color-border-strong);

    font-size: var(--text-sm);
    font-weight: var(--weight-medium);

    box-shadow: none;
}

.tab-button:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-border-strong);
    color: var(--color-text);

    filter: none;
    box-shadow: none;
}

.tab-button.active,
.tab-button.active:hover {
    background: var(--brand-gradient);
    color: var(--color-text-inverse);

    border-color: transparent;
}


/* ==========================================
   MENY (HAMBURGARE)
========================================== */

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.menu-button {
    position: relative;

    width: 44px;
    height: 44px;

    margin-top: 0;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tre streck */
.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;

    width: 20px;
    height: 2px;

    border-radius: 2px;

    background: var(--color-surface);
}

.menu-icon {
    position: relative;
}

.menu-icon::before,
.menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.menu-icon::before {
    top: -6px;
}

.menu-icon::after {
    top: 6px;
}

/* Prick för förfallna fakturor */
.menu-alert {
    position: absolute;
    top: -3px;
    right: -3px;

    width: 13px;
    height: 13px;

    border: 2px solid var(--color-surface);
    border-radius: 50%;

    background: var(--color-danger);
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;

    background: var(--color-overlay);
}

.side-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;

    width: 290px;
    max-width: 85vw;

    padding: 22px 18px;

    overflow-y: auto;

    background: var(--color-surface);
    border-top: 4px solid var(--color-primary);

    box-shadow: var(--shadow-lg);

    transform: translateX(-105%);
    visibility: hidden;

    transition:
        transform 0.22s ease,
        visibility 0.22s;
}

.side-menu.open {
    transform: translateX(0);
    visibility: visible;
}

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 22px;
}

.close-menu-button {
    width: 38px;
    height: 38px;

    margin-top: 0;
    padding: 0;

    background: var(--color-surface);
    color: var(--color-text-muted);

    border: 1px solid var(--color-border);

    font-size: 16px;

    box-shadow: none;
}

.close-menu-button:hover {
    background: var(--color-surface-alt);
    filter: none;
    box-shadow: none;
}

.side-menu .tab-button {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;

    margin-top: 6px;
    padding: 14px 16px;

    border: none;
    border-radius: 10px;

    text-align: left;
    font-size: 16px;
}


/* ==========================================
   STATUS
========================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 3px 10px;

    border-radius: var(--radius-pill);

    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;

    background: var(--color-neutral-bg);
    color: var(--color-neutral);
}

/* Prick framför texten – syns även utan färgseende */
.status-badge::before {
    content: "";

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: currentColor;
}

.status-sent {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.status-in_progress {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.status-accepted,
.status-done,
.status-paid {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-rejected,
.status-overdue {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}


/* ==========================================
   KUNDOFFERT
========================================== */

.customer-offer {
    margin-top: 30px;
}

.offer-document {
    background: var(--color-surface);

    padding: 55px;

    border-radius: 10px;

    box-shadow:
        0 12px 40px
        rgba(31, 41, 51, 0.08);
}

.offer-header {
    display: flex;

    justify-content: space-between;
    align-items: flex-start;

    gap: 40px;
}

.offer-company {
    flex: 1;
}

.offer-logo {
    display: block;

    max-width: 230px;
    max-height: 100px;

    object-fit: contain;

    margin-bottom: 18px;
}

.offer-company-name {
    font-size: 25px;
    font-weight: 800;

    margin-bottom: 12px;
}

.offer-header p {
    color: var(--color-text-muted);
    margin: 3px 0;
}

.offer-title {
    min-width: 220px;
    text-align: right;
}

.offer-title h1 {
    font-size: 34px;
    letter-spacing: 2px;

    margin-bottom: 15px;
}

.offer-customer {
    margin: 35px 0;
}

.offer-customer h3 {
    margin-bottom: 10px;
}

.offer-project {
    margin: 35px 0;
}

.offer-project h2 {
    margin-bottom: 12px;
}

.offer-project p {
    color: var(--color-text-muted);
    max-width: 650px;
}

.offer-prices {
    margin-top: 40px;
}

.offer-prices h3 {
    margin-bottom: 15px;
}

.offer-price-row {
    display: flex;
    justify-content: space-between;

    gap: 20px;

    padding: 12px 0;

    border-bottom: 1px solid var(--color-border);
}

.offer-price-row span:last-child,
.offer-price-row strong {
    text-align: right;
}

.offer-total-row {
    margin-top: 8px;
    border-top: 2px solid var(--color-text);
}

.offer-final-price {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-top: 20px;
    padding: 20px;

    background: var(--color-neutral-bg);

    border-radius: 8px;

    font-size: 22px;
}

.offer-final-price strong {
    font-size: 26px;
}

.offer-note {
    margin-top: 18px;

    font-size: 14px;
    color: var(--color-text-muted);
}

.offer-terms {
    margin-top: 45px;
}

.offer-terms h3 {
    margin-bottom: 10px;
}

.offer-footer {
    margin-top: 50px;

    padding-top: 20px;

    border-top: 1px solid var(--color-border);

    font-size: 14px;
    color: var(--color-text-muted);
}

.offer-actions {
    margin-top: 20px;
}


/* ==========================================
   MOBIL
========================================== */

@media (max-width: 650px) {

    header {
        padding: 0 20px;
    }

    main {
        padding: 40px 15px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .offer-box,
    .result {
        padding: 22px;
    }

    .offer-document {
        padding: 25px;
    }

    .offer-header {
        flex-direction: column;
    }

    .offer-title {
        min-width: 0;
        text-align: left;
    }

    .offer-final-price {
        font-size: 18px;
    }

    .offer-final-price strong {
        font-size: 21px;
    }
}


/* ==========================================
   FOOTER
========================================== */

footer {
    text-align: center;
    padding: 40px;
    color: var(--color-text-subtle);
}


/* ==========================================
   PDF / UTSKRIFT
========================================== */

@media print {

    body::before,
    body::after {
        display: none;
    }

    @page {
        size: A4;
        margin: 14mm;
    }

    body {
        background: var(--color-surface);
    }

    body > header,
    body > footer {
        display: none !important;
    }

    main {
        max-width: none;

        margin: 0;
        padding: 0;
    }

    main > section:not(#customerOffer) {
        display: none !important;
    }

    #customerOffer {
        display: block !important;

        margin: 0;
        padding: 0;
    }

    .offer-document {
        padding: 0;

        box-shadow: none;
        border-radius: 0;
    }

    .offer-actions {
        display: none !important;
    }

    .offer-header {
        break-inside: avoid;
    }

    .offer-price-row,
    .offer-final-price {
        break-inside: avoid;
    }

    .offer-final-price {
        background: var(--color-neutral-bg) !important;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .offer-logo {
        max-width: 200px;
        max-height: 85px;
    }
}

/* ==========================================
   ARBETSORDER
========================================== */

.list-item {
    cursor: pointer;
}

.small-button {
    width: auto;
    min-height: var(--tap-size);

    margin-top: var(--space-3);
    padding: 0 var(--space-4);

    font-size: var(--text-sm);
}

.work-order-item {
    margin-top: 14px;

    padding: 14px;

    border: 1px solid var(--color-border);
    border-radius: 10px;

    background: var(--color-surface-alt);
}

.work-order-item label {
    margin-top: 0;
}

.extra-item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    margin-top: 10px;
}

.extra-item-grid label {
    font-size: 13px;
    margin: 0 0 4px;
}

.table-scroll {
    overflow-x: auto;
}

.compare-table {
    width: 100%;
    min-width: 480px;

    border-collapse: collapse;

    margin-top: 10px;
}

.compare-table th,
.compare-table td {
    padding: 10px 8px;

    border-bottom: 1px solid var(--color-border);

    text-align: right;
}

.compare-table th:first-child,
.compare-table td:first-child {
    text-align: left;
}

.compare-table thead th {
    font-size: 13px;
    color: var(--color-text-muted);
}

.compare-table .total-row td {
    font-weight: 700;
    border-top: 2px solid var(--color-text);
}

.diff-positive {
    color: var(--color-success);
}

.diff-negative {
    color: var(--color-danger);
}

@media (max-width: 650px) {

    .extra-item-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================
   FAKTURA
========================================== */

.invoice-summary {
    min-width: 0;
}

.invoice-summary td:last-child {
    white-space: nowrap;
}

.invoice-checklist {
    margin-top: 20px !important;

    padding: 15px;

    background: var(--color-warning-bg);
    border-radius: 8px;
}

.invoice-checklist ul {
    margin: 8px 0 0 20px;
}

.invoice-actions button {
    margin-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;

    font-weight: 650;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}


/* ==========================================
   FAKTURALISTA
========================================== */

.invoice-totals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    margin-top: 24px;
}

.invoice-total-box {
    display: flex;
    flex-direction: column;

    padding: 16px;

    border-radius: 10px;

    background: var(--color-neutral-bg);
}

.invoice-total-box span {
    color: var(--color-text-muted);
    font-size: 14px;
}

.invoice-total-box strong {
    font-size: 22px;
}

.invoice-total-box small {
    color: var(--color-text-subtle);
}

.invoice-total-overdue {
    background: var(--color-danger-bg);
}

.invoice-total-overdue strong {
    color: var(--color-danger);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin: 20px 0 10px;
}

.filter-chip {
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
}

.filter-chip-alert:not(.active) {
    border-color: var(--color-danger-border);
    color: var(--color-danger);
}

.invoice-group-title {
    margin-top: 30px !important;

    color: var(--color-text-muted);
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.due-overdue {
    color: var(--color-danger);
    font-weight: 650;
}

.due-soon {
    color: var(--color-warning);
    font-weight: 650;
}

.tab-badge {
    display: inline-block;

    min-width: 20px;
    margin-left: 6px;
    padding: 1px 6px;

    border-radius: 999px;

    background: var(--color-danger);
    color: var(--color-text-inverse);

    font-size: 12px;
    text-align: center;
}

@media (max-width: 650px) {

    .invoice-totals {
        grid-template-columns: 1fr;
    }
}


/* ==========================================
   PRISLISTA
========================================== */

.link-button {
    display: inline;
    width: auto;

    margin: 0;
    padding: 0;

    border: none;
    background: none;

    color: var(--color-primary);
    font-size: inherit;
    font-weight: var(--weight-semibold);
    text-decoration: underline;
    min-height: 0;
}

.link-button,
.link-button:hover {
    box-shadow: none;
    filter: none;
}

.link-button:hover {
    background: none;
    border: none;
    color: var(--color-primary-hover);

    filter: none;
    box-shadow: none;
}

.price-item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;

    margin-top: 10px;
}

.price-item-grid label {
    font-size: 13px;
    margin: 0 0 4px;
}

.price-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.price-item-inactive {
    opacity: 0.6;
}

@media (max-width: 650px) {

    .price-item-grid {
        grid-template-columns: 1fr;
    }
}

.ai-badge {
    display: inline-block;

    padding: 1px 8px;

    border-radius: 999px;

    background: var(--color-ai-bg);
    color: var(--color-ai);

    font-size: 12px;
    font-weight: 650;
    vertical-align: middle;
}

.price-suggestions {
    margin-top: 28px;
    padding: 18px;

    border: 1px solid var(--color-ai-border);
    border-radius: 12px;

    background: var(--color-ai-bg);
}

.price-suggestions h3 {
    margin-top: 0 !important;
}


.status-credited {
    background: var(--color-border);
    color: var(--color-text-subtle);
    text-decoration: line-through;
}

.status-credit {
    background: var(--color-ai-bg);
    color: var(--color-ai);
}


/* ==========================================
   E-POST OCH RÖST
========================================== */

.email-dialog {
    margin-top: 20px;
    padding: 18px;

    border: 1px solid var(--color-border-strong);
    border-radius: 12px;

    background: var(--color-surface-alt);
}

.email-dialog h3 {
    margin-top: 0 !important;
}

#voiceInput {
    margin-top: 12px;
}

#voiceInput.listening {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: var(--color-text-inverse);
}

.server-warning {
    padding: 14px 20px;

    background: var(--color-danger);
    color: var(--color-text-inverse);

    text-align: center;
}

.server-warning a {
    color: var(--color-text-inverse);
    font-weight: 700;
}



/* ==========================================
   INLOGGNING
========================================== */

.login-box {
    position: relative;
    overflow: hidden;

    max-width: 460px;
    margin: 0 auto;
}

/* Gradientkant överst på kortet */
.login-box::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    height: 5px;

    background: var(--brand-gradient);
}

.login-brand {
    text-align: center;
    margin: 8px 0 28px;
}

.login-symbol {
    display: block;

    width: 120px;
    height: auto;

    margin: 0 auto 14px;
}

.login-name {
    font-family: var(--heading-font);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.login-slogan {
    margin-top: 4px;

    color: var(--color-text-muted);
    font-size: 14px;
    letter-spacing: 1.5px;
}

.login-box h1 {
    font-size: 22px;
}


/* ==========================================
   SIDHUVUD PÅ MOBIL
========================================== */

@media (max-width: 650px) {

    .logo-symbol {
        height: 30px;
    }

    .logo-name {
        font-size: 18px;
    }
}

/* På smala mobiler får bara symbolen plats
   i mitten utan att krocka med knapparna */
@media (max-width: 420px) {

    header .logo-name {
        display: none;
    }
}


/* ==========================================
   PLATSKONTROLL
========================================== */

.site-check {
    margin-top: 24px;

    padding: 18px;

    border: 1px solid var(--color-border);
    border-left: 4px solid var(--brand);
    border-radius: 10px;

    background: var(--color-surface-alt);
}

.site-check-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 10px;
}

.site-check-header h3 {
    margin: 0;
}

.site-check-header .small-button {
    margin-top: 0;
}

.site-check-address {
    margin-top: 10px;

    color: var(--color-text-muted);
    font-size: 14px;
}

.site-facts {
    margin-top: 12px;

    border-top: 1px solid var(--color-border);
}

.site-fact {
    display: flex;
    justify-content: space-between;

    gap: 16px;

    padding: 9px 0;

    border-bottom: 1px solid var(--color-border);

    font-size: 14px;
}

.site-fact span {
    color: var(--color-text-muted);
}

.site-fact strong {
    font-weight: 600;
    text-align: right;
}

.site-fact a {
    color: var(--brand);
}

.site-check-loading {
    margin-top: 12px;

    color: var(--color-text-muted);
}

.site-check-error {
    margin-top: 12px;

    padding: 12px 14px;

    border-radius: 8px;

    background: var(--color-warning-bg);
}

.site-check-source {
    margin-top: 10px;

    color: var(--color-text-subtle);
    font-size: 11px;
}

@media (max-width: 650px) {

    .site-fact {
        flex-direction: column;

        gap: 2px;
    }

    .site-fact strong {
        text-align: left;
    }
}

.site-requirements-title {
    margin-top: 20px;

    font-size: 15px;
}

.site-requirements {
    display: grid;

    gap: 10px;

    margin-top: 10px;
}

.site-requirement {
    padding: 13px 14px;

    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border-strong);
    border-radius: 8px;

    background: var(--color-surface);
}

.site-requirement p {
    margin-top: 6px;

    color: var(--color-text-muted);
    font-size: 14px;
}

.site-requirement-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 6px 12px;
}

.site-status {
    padding: 2px 10px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.site-status-behovs {
    border-left-color: var(--color-primary);
}

.site-status-behovs .site-status {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.site-status-kanske {
    border-left-color: var(--color-warning-border);
}

.site-status-kanske .site-status {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.site-status-behovs_inte {
    border-left-color: var(--color-success);
}

.site-status-behovs_inte .site-status {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.site-contact {
    font-size: 13px !important;
}

.site-contact a {
    color: var(--brand);
}

.site-disclaimer {
    margin-top: 14px;

    padding: 10px 12px;

    border-radius: 8px;

    background: var(--color-bg);
    color: var(--color-text);

    font-size: 13px;
    font-weight: 600;
}

.site-reassess {
    margin-top: 10px;

    font-size: 13px;
}

.site-done {
    display: inline-flex;
    align-items: center;

    gap: 8px;

    margin-top: 10px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.site-done input {
    width: 18px;
    height: 18px;

    margin: 0;

    accent-color: var(--brand);
}

.site-cost {
    margin-top: 12px;

    padding-top: 12px;

    border-top: 1px dashed var(--color-border);
}

.site-cost label {
    margin-top: 0;

    font-size: 14px;
}

.site-cost-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 10px;

    margin-top: 6px;
}

.site-cost-row .input-with-unit {
    flex: 1 1 220px;

    margin: 0;
}

.site-cost-row .small-button {
    margin-top: 0;
}

.site-cost-added {
    color: var(--color-success);

    font-size: 14px;
    font-weight: 600;
}

.site-cost-added .link-button {
    margin-left: 6px;

    font-size: 13px;
}

.input-error {
    border-color: var(--color-primary) !important;

    box-shadow: var(--focus-ring-soft);
}


/* ==========================================
   KORT I LISTOR (OFFERTER, ARBETSORDRAR, FAKTUROR)
========================================== */
/* Varje post är ett eget kort med loggans
   gradient som kant. */

.saved-offer,
.saved-work-order,
.saved-invoice {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);

    border: 2px solid transparent;
    border-radius: var(--radius-lg);

    background:
        linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        var(--brand-gradient) border-box;

    box-shadow: var(--shadow-sm);

    cursor: pointer;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.saved-offer:hover,
.saved-work-order:hover,
.saved-invoice:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.saved-offer:focus-visible,
.saved-work-order:focus-visible,
.saved-invoice:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.list-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: var(--space-3);
}

.offer-box .list-card-title,
.list-card-title {
    margin: 0;

    font-size: var(--text-lg);
}

.list-card-sub {
    margin-top: 2px;

    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.list-card-facts {
    display: grid;

    /* Alla uppgifter på en rad, beloppet sist */
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);

    gap: var(--space-3) var(--space-4);

    margin-top: var(--space-4);
    padding-top: var(--space-3);

    border-top: 1px solid var(--color-border);
}

.list-card-facts dt {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.list-card-facts dd {
    margin-top: 2px;

    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    overflow-wrap: anywhere;
}

/* Beloppet står till höger och linjerar */
.list-card-facts .list-card-amount {
    text-align: right;
}

.list-card-facts .list-card-amount dd {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 650px) {

    .saved-offer,
    .saved-work-order,
    .saved-invoice {
        padding: var(--space-4);
    }

    .list-card-facts {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .list-card-facts .list-card-amount {
        grid-column: 1 / -1;

        display: flex;
        align-items: baseline;
        justify-content: space-between;

        padding-top: var(--space-3);

        border-top: 1px solid var(--color-border);

        text-align: left;
    }
}


/* ==========================================
   FÖRETAGSPROFIL – UTFÄLLBARA DELAR
========================================== */

.settings-section {
    margin-top: var(--space-3);

    border: 2px solid transparent;
    border-radius: var(--radius-lg);

    background:
        linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        var(--brand-gradient) border-box;

    overflow: hidden;
}

.settings-section summary {
    position: relative;

    display: flex;
    flex-direction: column;
    justify-content: center;

    min-height: 64px;

    padding: var(--space-3) 56px var(--space-3) var(--space-5);

    cursor: pointer;
    list-style: none;

    transition: background-color 0.15s ease;
}

.settings-section summary::-webkit-details-marker {
    display: none;
}

.settings-section summary:hover {
    background: var(--color-primary-soft);
}

.settings-section summary:focus-visible {
    outline: none;
    box-shadow: inset var(--focus-ring);
}

/* Pil till höger som vänder sig när delen är öppen */
.settings-section summary::after {
    content: "";

    position: absolute;
    right: var(--space-5);
    top: 50%;

    width: 10px;
    height: 10px;

    border-right: 2px solid var(--color-primary);
    border-bottom: 2px solid var(--color-primary);

    transform: translateY(-70%) rotate(45deg);

    transition: transform 0.2s ease;
}

.settings-section[open] summary::after {
    transform: translateY(-30%) rotate(-135deg);
}

.settings-section[open] summary {
    border-bottom: 1px solid var(--color-border);
}

.settings-section-title {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: var(--color-text);
}

.settings-section-sub {
    margin-top: 2px;

    color: var(--color-text-subtle);
    font-size: var(--text-sm);
}

.settings-section-body {
    padding: var(--space-2) var(--space-5) var(--space-5);
}

.settings-section-body > label:first-child,
.settings-section-body > .field-help:first-child {
    margin-top: var(--space-3);
}

.settings-save {
    margin: var(--space-5) 0 var(--space-6);
}

@media (max-width: 650px) {

    .settings-section summary {
        padding-left: var(--space-4);
    }

    .settings-section-body {
        padding: var(--space-2) var(--space-4) var(--space-4);
    }
}


/* ==========================================
   SORTERA OCH UPPDATERA (OVANFÖR LISTOR)
========================================== */

.list-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: var(--space-3);

    margin-top: var(--space-4);
}

.list-sort {
    flex: 1 1 220px;
    max-width: 280px;
}

.list-sort label {
    margin-top: 0;
}

.list-toolbar .small-button {
    margin-top: 0;
    min-height: 48px;
}

@media (max-width: 650px) {

    .list-sort {
        max-width: none;
    }

    .list-toolbar .small-button {
        flex: 1 1 100%;
    }
}


/* ==========================================
   PRISLISTA – SAMMA RAM SOM OFFERTERNA
========================================== */

.price-item {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);

    border: 2px solid transparent;
    border-radius: var(--radius-lg);

    background:
        linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        var(--brand-gradient) border-box;

    box-shadow: var(--shadow-sm);
}

@media (max-width: 650px) {

    .price-item {
        padding: var(--space-4);
    }
}


/* ==========================================
   MENY – LOGGA, AVDELARE OCH LOGGA UT
========================================== */

.side-menu-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.side-menu-symbol {
    height: 28px;
    width: auto;
}

.side-menu .logo-name {
    font-size: var(--text-lg);
}

.side-menu-divider {
    height: 1px;
    margin: var(--space-3) var(--space-2);
    background: var(--color-border);
}

.side-menu-logout {
    justify-content: flex-start;

    width: 100%;

    margin-top: var(--space-6);
    padding: 0 var(--space-4);

    background: none;
    color: var(--color-text-muted);

    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);

    font-size: var(--text-base);
    font-weight: var(--weight-semibold);

    box-shadow: none;
}

.side-menu-logout:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    filter: none;
    box-shadow: none;
}


/* ==========================================
   DATOR: FAST SIDOMENY TILL VÄNSTER
========================================== */

@media (min-width: 1024px) {

    body.logged-in {
        padding-left: 260px;
    }

    /* Menyn är alltid framme */
    body.logged-in .side-menu {
        width: 260px;
        max-width: none;

        padding: var(--space-5) var(--space-4);

        border-top: none;
        border-right: 1px solid var(--color-border);

        box-shadow: none;

        transform: none;
        visibility: visible;
        transition: none;

        display: flex;
        flex-direction: column;
    }

    body.logged-in .close-menu-button,
    body.logged-in .menu-overlay {
        display: none !important;
    }

    /* Loggan och logga ut finns i menyn */
    body.logged-in > header {
        display: none;
    }

    body.logged-in .side-menu-logout {
        margin-top: auto;
    }

    body.logged-in main {
        max-width: 960px;
        padding-top: var(--space-10);
    }

    .bottom-nav {
        display: none !important;
    }
}


/* ==========================================
   MOBIL: MENYRAD I BOTTEN
========================================== */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;

    display: grid;
    grid-template-columns: repeat(5, 1fr);

    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));

    background: var(--color-surface);
    border-top: 1px solid var(--color-border);

    box-shadow: 0 -4px 16px rgba(31, 41, 51, 0.06);
}

.bottom-nav-item {
    position: relative;

    flex-direction: column;
    gap: 2px;

    width: 100%;
    min-height: 56px;

    margin: 0;
    padding: 4px 2px;

    background: none;
    color: var(--color-text-muted);

    border: none;
    border-radius: var(--radius-md);

    font-size: 11px;
    font-weight: var(--weight-semibold);
    line-height: 1.1;

    box-shadow: none;
}

.bottom-nav-item:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    filter: none;
    box-shadow: none;
}

.bottom-nav-item.active,
.bottom-nav-item.active:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.bottom-nav-icon svg {
    width: 24px;
    height: 24px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* "Nytt jobb" i mitten sticker ut */
.bottom-nav-new .bottom-nav-icon {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-top: -16px;

    border-radius: 50%;

    background: var(--brand-gradient);
    color: var(--color-text-inverse);

    box-shadow: var(--shadow-primary);
}

.bottom-nav-new.active,
.bottom-nav-new.active:hover {
    background: none;
    color: var(--color-primary);
}

.bottom-alert,
.bottom-nav-alert {
    top: 6px;
    right: calc(50% - 18px);
}

@media (max-width: 1023px) {

    /* Hamburgare och logga ut ersätts av menyraden */
    body.logged-in .menu-button,
    body.logged-in #logoutButton {
        display: none;
    }

    /* Plats för menyraden längst ner */
    body.logged-in main {
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }

    body.logged-in footer {
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }
}


/* ==========================================
   ÖVERSIKT
========================================== */

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: var(--space-5);

    padding: var(--space-8);

    border: 2px solid transparent;
    border-radius: var(--radius-lg);

    background:
        linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        var(--brand-gradient) border-box;

    box-shadow: var(--shadow-sm);
}

.dashboard-eyebrow {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.dashboard-hero h1 {
    margin-top: var(--space-1);

    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: 1.2;

    display: inline-block;
    padding-bottom: 2px;
}

.dashboard-hero-text {
    margin-top: var(--space-2);

    max-width: 460px;

    color: var(--color-text-muted);
}

.dashboard-hero .start-button {
    width: auto;
    min-height: 56px;

    margin: 0;
    padding: 0 var(--space-8);

    font-size: var(--text-lg);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: var(--space-3);

    margin-top: var(--space-5);
}

.dashboard-card {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--space-1);

    min-height: 120px;

    margin: 0;
    padding: var(--space-4);

    background: var(--color-surface);
    color: var(--color-text);

    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-border-strong);
    border-radius: var(--radius-lg);

    text-align: left;

    box-shadow: var(--shadow-sm);
}

.dashboard-card:hover {
    filter: none;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.dashboard-card-info { border-top-color: var(--color-info); }
.dashboard-card-warning { border-top-color: var(--color-warning-border); }
.dashboard-card-neutral { border-top-color: var(--color-primary); }
.dashboard-card-danger { border-top-color: var(--color-danger); }
.dashboard-card-success { border-top-color: var(--color-success); }

.dashboard-card-label {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.dashboard-card-value {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
}

.dashboard-card-danger .dashboard-card-value {
    color: var(--color-danger);
}

.dashboard-card-detail {
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
}

/* Platshållare medan siffrorna hämtas */
.dashboard-card-loading {
    background:
        linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-neutral-bg) 50%, var(--color-surface-alt) 75%);
    background-size: 200% 100%;

    animation: dashboard-shimmer 1.2s ease-in-out infinite;
}

@keyframes dashboard-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.dashboard-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    margin-top: var(--space-8);
}

.dashboard-section-header .link-button {
    font-size: var(--text-sm);
}

.empty-state {
    margin-top: var(--space-4);
    padding: var(--space-6);

    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);

    background: var(--color-surface);

    text-align: center;
}

.empty-state-title {
    font-weight: var(--weight-bold);
}

.empty-state-text {
    margin-top: var(--space-1);
    color: var(--color-text-muted);
}

@media (max-width: 900px) {

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {

    .dashboard-hero {
        padding: var(--space-5);
    }

    .dashboard-hero h1 {
        font-size: var(--text-xl);
    }

    .dashboard-hero .start-button {
        width: 100%;
    }

    .dashboard-card {
        min-height: 108px;
    }

    .dashboard-card-value {
        font-size: var(--text-lg);
    }
}


/* ==========================================
   KEDJAN OFFERT → ARBETSORDER → FAKTURA
========================================== */

.job-chain {
    margin: var(--space-4) 0 var(--space-6);
}

.job-chain-loading {
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
}

.job-chain-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: var(--space-2);

    list-style: none;
}

.job-step {
    position: relative;
}

/* Pil mellan stegen */
.job-step + .job-step::before {
    content: "→";

    position: absolute;
    left: -9px;
    top: 50%;
    z-index: 1;

    transform: translate(-50%, -50%);

    color: var(--color-text-subtle);
    font-weight: var(--weight-bold);
}

.job-step-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 4px;

    width: 100%;
    height: 100%;
    min-height: 88px;

    margin: 0;
    padding: var(--space-3);

    background: var(--color-surface);
    color: var(--color-text);

    /* Lika tjock ram på alla steg så texten linjerar */
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);

    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    text-align: left;

    box-shadow: none;
}

button.job-step-link:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary-border);
    filter: none;
    box-shadow: none;
}

.job-step.is-current .job-step-link {
    border: 2px solid transparent;

    background:
        linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        var(--brand-gradient) border-box;
}

.job-step.is-empty .job-step-link {
    border-style: dashed;
    background: var(--color-surface-alt);
}

.job-step-label {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.job-step-number {
    font-weight: var(--weight-semibold);
}

.job-step.is-empty .job-step-number {
    color: var(--color-text-subtle);
    font-weight: var(--weight-normal);
}

@media (max-width: 650px) {

    .job-chain-steps {
        grid-template-columns: 1fr;
    }

    .job-step + .job-step::before {
        content: "↓";
        left: var(--space-5);
        top: -6px;
    }

    .job-step-link {
        min-height: 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-2);
    }

    .job-step-label {
        flex-basis: 100%;
    }
}


/* ==========================================
   DETALJVY: DÖLJ LISTANS RUBRIK OCH VERKTYG
========================================== */
/* När en offert, arbetsorder eller faktura är
   öppen syns bara "← Tillbaka" och posten. */

section:has(.saved-offer-detail) > h2,
section:has(.saved-offer-detail) > p,
section:has(.saved-offer-detail) > .list-toolbar {
    display: none;
}

.saved-offer-detail > h2 {
    margin-top: 0;
}

/* Tryckytor minst 44 px */
.close-menu-button {
    width: var(--tap-size);
    height: var(--tap-size);
}

.dashboard-section-header .link-button {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-size);
}


/* ==========================================
   SKAPA KONTO
========================================== */

.login-switch {
    margin-top: 20px;

    color: #555;
    text-align: center;
}

.login-switch .link-button {
    margin-left: 4px;
}

#welcomeBox {
    margin-bottom: 22px;
}



/* ==========================================
   LÄNKAR TILL STARTSIDAN
========================================== */
/* Appen (/app/) och startsidan (/) hänger
   ihop: samma logga, färger och typsnitt,
   och länkar åt båda hållen. */

.back-to-site {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.back-to-site:hover {
    color: var(--color-primary);
}

.side-menu-site-link {
    display: block;

    margin-top: 10px;
    padding: 12px 16px;

    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
}

.side-menu-site-link:hover {
    color: var(--color-primary);
}

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
}

.footer-links a {
    color: var(--color-text-muted);
    font-weight: 600;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--color-primary);
}
