/* ============================================================
   PR Varmeteknik · Bestillings-PWA
   Brand: navy #2E3A5C + grøn #3A9048 (fra logo), Nunito (rounded)
   Mobil-first — designet til én hånd og tommelfinger.
   ============================================================ */

:root {
    --navy: #2E3A5C;
    --navy-deep: #222C48;
    --navy-ink: #1B2338;
    --green: #3A9048;
    --green-dark: #2E7A3B;
    --green-tint: #E8F4EA;
    --bg: #F1F3F7;
    --card: #FFFFFF;
    --line: #E2E6EE;
    --muted: #6B7488;
    --danger: #C6403C;
    --radius: 18px;
    --shadow: 0 2px 10px rgba(34, 44, 72, .08);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Nunito', system-ui, sans-serif;
    color: var(--navy-ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-weight: 900; letter-spacing: -.01em; }

/* ---------- Knapper ---------- */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 28px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .01em;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(58, 144, 72, .35);
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}

.btn-primary:active { transform: scale(.97); box-shadow: 0 2px 6px rgba(58, 144, 72, .3); }
.btn-primary:disabled { opacity: .4; box-shadow: none; cursor: default; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 22px;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--navy);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.btn-ghost {
    border: 0;
    background: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 12px;
    cursor: pointer;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-body {
    background:
        radial-gradient(120% 90% at 50% -10%, #3C4C77 0%, var(--navy) 45%, var(--navy-deep) 100%);
    min-height: 100dvh;
}

.login-scene {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px calc(20px + var(--safe-bottom));
    position: relative;
    overflow: hidden;
}

/* Gulvvarme-slange som baggrundsmotiv */
.coil {
    position: absolute;
    inset: -10% -30% auto auto;
    width: 130%;
    max-width: 640px;
    color: rgba(138, 174, 200, .12);
    pointer-events: none;
}

.coil path {
    stroke-dasharray: 2600;
    stroke-dashoffset: 2600;
    animation: coil-draw 2.8s ease-out .3s forwards;
}

@keyframes coil-draw { to { stroke-dashoffset: 0; } }

.login-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 26px;
    padding: 34px 26px 26px;
    box-shadow: 0 20px 60px rgba(10, 16, 34, .45);
    animation: rise .5s cubic-bezier(.2, .9, .3, 1) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
}

.login-logo {
    display: block;
    width: 190px;
    margin: 0 auto 20px;
}

.login-card h1 {
    margin: 0;
    text-align: center;
    font-size: 26px;
    color: var(--navy);
}

.login-sub {
    margin: 4px 0 24px;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.login-form { display: flex; flex-direction: column; }

.login-form label {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--navy);
    margin: 0 0 6px 4px;
}

.login-form input {
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    padding: 15px 16px;
    margin-bottom: 18px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: #FAFBFD;
    color: var(--navy-ink);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(58, 144, 72, .15);
    background: #fff;
}

.login-error {
    background: #FBEBEA;
    color: var(--danger);
    font-size: 14px;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.login-form .btn-primary { width: 100%; margin-top: 4px; }

.login-hint {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
}

.login-footer {
    position: relative;
    margin-top: 26px;
    color: rgba(255, 255, 255, .55);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
}

/* ============================================================
   BESTILLING
   ============================================================ */

.order-body { padding-bottom: calc(96px + var(--safe-bottom)); }

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: #EDF0F6;
    color: var(--navy);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color .12s, transform .1s;
    touch-action: manipulation;
}

.icon-btn:active { transform: scale(.92); }

.icon-btn.active { background: var(--navy); color: #fff; }

.icon-btn-green { background: var(--green); color: #fff; }
.icon-btn-green:active { background: var(--green-dark); }

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 11px 14px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: #FAFBFD;
    color: var(--navy-ink);
    -webkit-appearance: none;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(58, 144, 72, .15);
}

.filter-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    background: var(--green-tint);
    border-radius: 10px;
    padding: 7px 8px 7px 12px;
}

.filter-chip span {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--green-dark);
}

.filter-chip button {
    border: 0;
    background: #fff;
    color: var(--navy);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(34, 44, 72, .12);
}

.no-hits {
    text-align: center;
    color: var(--muted);
    font-size: 14.5px;
    font-weight: 700;
    padding: 28px 0;
    margin: 0;
}

.header-logo { height: 34px; width: auto; }

.header-right { display: flex; align-items: center; gap: 4px; }

.user-chip {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--green-tint);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 999px;
}

.logout-form { display: inline; }

.order-main { padding: 18px 14px 0; max-width: 640px; margin: 0 auto; }

.order-intro h1 { margin: 0; font-size: 24px; color: var(--navy); }

.order-intro p { margin: 2px 0 16px; color: var(--muted); font-size: 14.5px; font-weight: 600; }

.product-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--card);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 12px 12px 12px 14px;
    box-shadow: var(--shadow);
    transition: border-color .15s, background-color .15s;
}

.product-row.flash {
    animation: flash-row 1.6s ease-out;
}

@keyframes flash-row {
    0%, 55% { border-color: var(--green); box-shadow: 0 0 0 5px rgba(58, 144, 72, .25); }
    100% { box-shadow: var(--shadow); }
}

.product-row.has-qty {
    border-color: var(--green);
    background: linear-gradient(0deg, rgba(58, 144, 72, .05), rgba(58, 144, 72, .05)), #fff;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.item-no {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--navy);
    background: #EDF0F6;
    border-radius: 6px;
    padding: 2px 8px;
    width: fit-content;
}

.product-row.has-qty .item-no { background: var(--green-tint); color: var(--green-dark); }

.item-desc {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--navy-ink);
}

/* Stepper — 44px+ touch-mål */
.stepper {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.step-btn {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: #EDF0F6;
    color: var(--navy);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s, transform .1s;
    touch-action: manipulation;
}

.step-btn:active { transform: scale(.92); background: #DDE3EE; }

.product-row.has-qty .step-plus { background: var(--green); color: #fff; }
.product-row.has-qty .step-plus:active { background: var(--green-dark); }

.qty-input {
    width: 52px;
    height: 44px;
    border: 0;
    background: none;
    text-align: center;
    font-family: inherit;
    font-size: 18px;
    font-weight: 900;
    color: var(--navy-ink);
    -moz-appearance: textfield;
    appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.qty-input:focus { outline: 2px solid var(--green); border-radius: 8px; }

/* ---------- Sticky send-bar ---------- */

.send-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px calc(14px + var(--safe-bottom));
    background: var(--navy);
    box-shadow: 0 -6px 24px rgba(20, 27, 48, .25);
}

.send-summary { display: flex; flex-direction: column; line-height: 1.25; }

.send-count { color: #fff; font-size: 16px; font-weight: 800; }

.send-pieces { color: rgba(255, 255, 255, .65); font-size: 12.5px; font-weight: 600; }

.btn-send { flex-shrink: 0; }

/* ---------- Bottom sheet: sagsnr. ---------- */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(20, 27, 48, .55);
    opacity: 0;
    transition: opacity .22s ease;
}

.sheet-backdrop.open { opacity: 1; }

.case-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 10px 22px calc(22px + var(--safe-bottom));
    transform: translateY(105%);
    transition: transform .22s cubic-bezier(.2, .9, .3, 1);
    max-width: 640px;
    margin: 0 auto;
}

.case-sheet.open { transform: none; }

.sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 3px;
    background: var(--line);
    margin: 4px auto 14px;
}

.case-sheet h2 { margin: 0 0 4px; font-size: 21px; color: var(--navy); }

.sheet-summary { margin: 0 0 16px; color: var(--muted); font-size: 14px; font-weight: 700; }

.case-sheet label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--navy);
    margin: 0 0 6px 4px;
}

.case-sheet input {
    width: 100%;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    padding: 15px 16px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: #FAFBFD;
    color: var(--navy-ink);
}

.case-sheet input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(58, 144, 72, .15);
}

.sheet-error {
    color: var(--danger);
    font-size: 14px;
    font-weight: 700;
    margin-top: 8px;
}

.sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.sheet-actions .btn-secondary { flex: 1; }
.sheet-actions .btn-primary { flex: 1.6; }

/* ---------- Kamera-scanner ---------- */

.scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--navy-deep);
    display: flex;
    flex-direction: column;
}

.scan-overlay video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-frame {
    position: absolute;
    top: 32%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(78vw, 340px);
    height: 150px;
    border-radius: 18px;
    box-shadow: 0 0 0 200vmax rgba(20, 27, 48, .45);
    outline: 3px solid var(--green);
}

.scan-frame::after {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    top: 50%;
    height: 2px;
    background: rgba(58, 144, 72, .9);
    animation: scanline 1.6s ease-in-out infinite alternate;
}

@keyframes scanline {
    from { transform: translateY(-52px); }
    to   { transform: translateY(52px); }
}

.scan-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 20px calc(24px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: linear-gradient(180deg, transparent, rgba(20, 27, 48, .85) 40%);
}

.scan-hint {
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

.scan-cancel { width: 100%; max-width: 340px; border: 0; }

/* ============================================================
   KVITTERING
   ============================================================ */

.receipt-body {
    background:
        radial-gradient(120% 90% at 50% -10%, #3C4C77 0%, var(--navy) 45%, var(--navy-deep) 100%);
    min-height: 100dvh;
}

.receipt-main {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(48px, env(safe-area-inset-top, 0px)) 18px calc(28px + var(--safe-bottom));
    max-width: 560px;
    margin: 0 auto;
}

.check-wrap { width: 96px; height: 96px; }

.check-svg { width: 100%; height: 100%; }

.check-circle {
    stroke: var(--green);
    fill: var(--green);
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
    transform: rotate(-90deg);
    transform-origin: center;
    animation: draw .6s ease-out forwards;
}

.check-mark {
    stroke: #fff;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: draw .4s ease-out .55s forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.receipt-main h1 {
    color: #fff;
    font-size: 26px;
    margin: 18px 0 0;
    animation: rise .5s .3s both;
}

.receipt-sub {
    color: rgba(255, 255, 255, .7);
    font-size: 15px;
    font-weight: 600;
    margin: 6px 0 24px;
    text-align: center;
    animation: rise .5s .4s both;
}

.receipt-card {
    width: 100%;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(10, 16, 34, .45);
    animation: rise .5s .5s both;
}

.receipt-meta {
    display: flex;
    gap: 20px;
    padding: 18px 20px;
    background: var(--green-tint);
    border-bottom: 1px solid var(--line);
}

.receipt-meta > div { display: flex; flex-direction: column; }

.meta-label {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--green-dark);
}

.meta-value { font-size: 17px; font-weight: 900; color: var(--navy); }

.receipt-lines {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    max-height: 42dvh;
    overflow-y: auto;
}

.receipt-lines li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid #F0F2F7;
}

.receipt-lines li:last-child { border-bottom: 0; }

.line-desc { font-size: 13.5px; font-weight: 700; line-height: 1.25; }

.line-qty { font-size: 14px; font-weight: 900; color: var(--green-dark); white-space: nowrap; }

.btn-new-order { width: 100%; margin-top: 22px; animation: rise .5s .65s both; }

/* ---------- Større skærme (tablet/desktop preview) ---------- */

@media (min-width: 700px) {
    .order-main { padding-top: 26px; }
    .send-bar { padding-left: calc(50% - 306px); padding-right: calc(50% - 306px); }
}

/* ============================================================
   NYHEDER / CHANGELOG
   ============================================================ */

.changelog-body {
    background:
        radial-gradient(120% 90% at 50% -10%, #3C4C77 0%, var(--navy) 45%, var(--navy-deep) 100%);
    min-height: 100dvh;
}

.changelog-main {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(48px, env(safe-area-inset-top, 0px)) 18px calc(28px + var(--safe-bottom));
    max-width: 560px;
    margin: 0 auto;
}

.changelog-main h1 {
    color: #fff;
    font-size: 26px;
    margin: 0;
}

.changelog-sub {
    color: rgba(255, 255, 255, .7);
    font-size: 15px;
    font-weight: 600;
    margin: 6px 0 24px;
    text-align: center;
}

.changelog-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.changelog-card {
    width: 100%;
    background: #fff;
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: 0 18px 50px rgba(10, 16, 34, .45);
}

.changelog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.changelog-version {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--green-dark);
    background: var(--green-tint);
    padding: 4px 10px;
    border-radius: 999px;
}

.changelog-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.changelog-card h2 {
    margin: 0 0 10px;
    font-size: 19px;
    color: var(--navy);
}

.changelog-changes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.changelog-changes li {
    position: relative;
    padding-left: 22px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--navy-ink);
}

.changelog-changes li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
}

.btn-changelog-back { width: 100%; margin-top: 22px; }
