:root {
    --ink: #25252b;
    --ink-soft: #65656f;
    --forest: #b9002e;
    --forest-deep: #920024;
    --forest-soft: #fff0f3;
    --paper: #f5f5f6;
    --surface: #ffffff;
    --sand: #b9002e;
    --sand-soft: #fff0f3;
    --border: #e4e4e7;
    --border-strong: #ccccd2;
    --success: #287a5b;
    --success-bg: #e5f3ec;
    --danger: #d9534f;
    --danger-bg: #fbe9e7;
    --warning: #a76316;
    --warning-bg: #fff2de;
    --blue: #4f7fa3;
    --violet: #6c5a8e;
    --shadow: 0 16px 40px rgba(25, 48, 48, .07);
    --shadow-soft: 0 6px 20px rgba(25, 48, 48, .06);
    --radius: 15px;
    --sidebar-width: 218px;
    font-family: Aptos, "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
}

/* Vagtplan: scoped table geometry, shared ERP colors and form controls. */
.shift-section { margin-top: 20px; }
.shift-table { min-width: 990px; font-size: 13px; }
.shift-table th, .shift-table td { min-width: 95px; vertical-align: top; padding: 12px 8px; }
.shift-table th[scope="row"] { min-width: 160px; text-transform: none; letter-spacing: normal; }
.shift-editor th[scope="row"] { text-transform: none; letter-spacing: normal; }
.shift-table small, .shift-editor small { display: block; margin-top: 5px; color: var(--ink-soft); }
.shift-table .shift-off { background: var(--paper); color: var(--ink-soft); }
.shift-editor { min-width: 850px; }
.shift-editor input[type="time"] { min-width: 115px; }
.shift-editor input[type="number"] { width: 100px; }
.shift-leave-dialog { max-width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; color: var(--ink); background: var(--surface); }
.shift-leave-dialog::backdrop { background: rgba(0,0,0,.45); }

/* Offentlig leveringssporing */
.tracking-body { margin: 0; min-height: 100vh; background: #f5f5f6; color: #25252b; }
.tracking-header { min-height: 76px; padding: 0 28px; background: #242428; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tracking-login { color: #fff; text-decoration: none; font-weight: 700; font-size: .9rem; }
.tracking-shell { width: min(820px, calc(100% - 32px)); margin: 42px auto 80px; display: grid; gap: 22px; }
.tracking-card { background: #fff; border: 1px solid #e4e4e7; border-radius: 18px; padding: clamp(22px, 5vw, 38px); box-shadow: 0 15px 42px rgba(24,49,51,.08); }
.tracking-card h1 { margin: 8px 0; font-size: clamp(2rem, 6vw, 3rem); }
.tracking-card h2 { margin: 6px 0 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.tracking-form { margin-top: 26px; }
.tracking-form label { display: block; margin-bottom: 8px; font-weight: 700; }
.tracking-form > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.tracking-form input { min-width: 0; text-transform: uppercase; }
.tracking-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.tracking-facts { margin: 26px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: #e4e4e7; border: 1px solid #e4e4e7; border-radius: 12px; overflow: hidden; }
.tracking-facts div { padding: 15px; background: #fafafa; }
.tracking-facts dt { color: #65656f; font-size: .78rem; margin-bottom: 5px; }
.tracking-facts dd { margin: 0; font-weight: 700; }
.tracking-timeline { display: grid; gap: 0; margin-top: 28px; }
.tracking-timeline article { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 12px; min-height: 66px; }
.tracking-timeline article::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: -8px; width: 2px; background: #dce4e1; }
.tracking-timeline article:last-child::before { display: none; }
.tracking-timeline article > span { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: #9aacaa; border: 3px solid #e8eeec; z-index: 1; }
.tracking-timeline article.current > span { background: #b9002e; border-color: #fff0f3; }
.tracking-timeline strong, .tracking-timeline time { display: block; }
.tracking-timeline time { color: #65656f; font-size: .82rem; margin-top: 3px; }
.tracking-note { margin: 20px 0 0; padding: 16px; border-left: 4px solid #b9002e; background: #fafafa; }

@media (max-width: 620px) {
    .tracking-header { padding: 0 16px; }
    .tracking-login { font-size: .78rem; }
    .tracking-shell { margin-top: 22px; }
    .tracking-form > div { grid-template-columns: 1fr; }
    .tracking-result-head { display: grid; }
    .tracking-facts { grid-template-columns: 1fr; }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, strong { letter-spacing: -.015em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(185, 0, 46, .45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--forest); color: white; font-size: 14px; font-weight: 800; letter-spacing: -.04em; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 15px; line-height: 1.1; }
.brand small { color: var(--ink-soft); font-size: 10px; letter-spacing: .025em; }
.brand-light { color: white; }
.brand-light .brand-mark { color: var(--forest); background: var(--sand); }
.brand-light small { color: rgba(255,255,255,.55); }

.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: #9c0027; font-size: 11px; font-weight: 750; letter-spacing: .095em; line-height: 1.4; text-transform: uppercase; }
.eyebrow-light { color: rgba(255,255,255,.72); }
.dot { width: 6px; height: 6px; border-radius: 999px; background: var(--sand); box-shadow: 0 0 0 4px rgba(185,0,46,.12); }
.back-link { display: inline-flex; margin-bottom: 13px; color: var(--ink-soft); font-size: 13px; font-weight: 650; }
.back-link:hover { color: var(--forest); }

/* Authentication */
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(460px, 1.06fr) minmax(430px, .94fr); }
.auth-story { position: relative; display: flex; min-height: 100vh; flex-direction: column; overflow: hidden; padding: 42px clamp(42px, 6vw, 86px); color: white; background: #242428; }
.auth-story::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom right, black, transparent 72%); pointer-events: none; }
.story-glow { position: absolute; width: 520px; height: 520px; right: -230px; top: 15%; border-radius: 50%; border: 1px solid rgba(185,0,46,.18); box-shadow: 0 0 0 70px rgba(185,0,46,.025), 0 0 0 145px rgba(185,0,46,.02); }
.auth-story .brand, .story-copy, .story-footer { position: relative; z-index: 1; }
.story-copy { max-width: 620px; margin: auto 0; padding: 75px 0; }
.story-copy h1 { max-width: 600px; margin: 19px 0 22px; font-size: clamp(42px, 4.5vw, 66px); font-weight: 650; line-height: 1.04; letter-spacing: -.052em; }
.story-copy > p { max-width: 560px; margin-bottom: 0; color: rgba(255,255,255,.63); font-size: 16px; line-height: 1.75; }
.story-stats { display: grid; max-width: 480px; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 38px; }
.story-stats article { display: grid; grid-template-columns: 38px 1fr; gap: 2px 11px; align-items: center; padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.055); }
.stat-symbol { display: grid; grid-row: span 2; place-items: center; width: 35px; height: 35px; border-radius: 10px; color: var(--forest); background: var(--sand); font-weight: 800; }
.story-stats strong { font-size: 13px; }
.story-stats small { color: rgba(255,255,255,.48); font-size: 10px; }
.story-footer { margin: 0; color: rgba(255,255,255,.4); font-size: 11px; letter-spacing: .04em; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px clamp(28px, 7vw, 92px); background: #ffffff; }
.auth-card-wrap { width: 100%; max-width: 430px; }
.auth-mobile-brand { display: none; margin-bottom: 44px; }
.auth-heading { margin-bottom: 30px; }
.auth-heading h2 { margin: 8px 0 11px; font-size: clamp(34px, 4vw, 43px); font-weight: 680; line-height: 1.08; letter-spacing: -.045em; }
.auth-heading p { margin-bottom: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.security-note { display: flex; gap: 11px; align-items: flex-start; margin-top: 26px; padding: 14px; border: 1px solid #dce3dd; border-radius: 12px; color: var(--ink-soft); background: #f5f5f6; font-size: 11px; line-height: 1.55; }
.security-note > span { display: grid; flex: 0 0 auto; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: white; background: var(--success); font-size: 11px; }
.security-note p { margin: 1px 0 0; }
.error-state { max-width: 480px; text-align: center; }
.error-code { display: inline-flex; margin-bottom: 14px; color: var(--sand); font-size: 60px; font-weight: 800; letter-spacing: -.06em; }
.error-state h1 { margin-bottom: 10px; font-size: 30px; }
.error-state p { margin-bottom: 25px; color: var(--ink-soft); line-height: 1.6; }

/* Forms and controls */
.stack-form { display: grid; gap: 19px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label, .label-row label { color: var(--ink); font-size: 12px; font-weight: 720; }
.field small { color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.field input, .field select, .filter-bar input, .filter-bar select, select { width: 100%; height: 44px; min-width: 0; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.field input::placeholder, .filter-bar input::placeholder { color: #98a3a2; }
.field input:focus, .field select:focus, .filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: #b9002e; box-shadow: 0 0 0 3px rgba(185,0,46,.09); }
.label-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.label-row a { color: var(--forest); font-size: 11px; font-weight: 720; }
.password-field { position: relative; }
.password-field input { padding-right: 55px; }
.password-field button { position: absolute; top: 50%; right: 8px; padding: 5px 7px; border: 0; color: var(--ink-soft); background: transparent; transform: translateY(-50%); font-size: 10px; font-weight: 750; cursor: pointer; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 750; line-height: 1; cursor: pointer; transition: transform .12s, background .15s, border-color .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { color: white; background: var(--forest); box-shadow: 0 6px 16px rgba(185,0,46,.15); }
.button-primary:hover { background: var(--forest-deep); }
.button-secondary { border-color: var(--border-strong); color: var(--forest); background: white; }
.button-secondary:hover, .button-ghost:hover { border-color: #abb9b5; background: #fafafa; }
.button-ghost { border-color: transparent; color: var(--ink-soft); background: transparent; }
.button-danger { border-color: #e4b8b3; color: var(--danger); background: var(--danger-bg); }
.button-small { min-height: 32px; padding: 0 11px; font-size: 11px; }
.button-block { width: 100%; }
.text-button { padding: 4px 0; border: 0; color: var(--forest); background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.form-actions { display: flex; gap: 9px; margin-top: 5px; }
.form-grid { display: grid; gap: 18px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-span { grid-column: 1 / -1; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--forest); }
.check-row > span { display: grid; gap: 3px; }
.check-row strong { font-size: 12px; }
.check-row small { color: var(--ink-soft); font-size: 10px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 18px; align-items: start; }
.form-main { display: grid; gap: 18px; min-width: 0; }
.form-section, .permission-section { padding: 23px; }
.new-customer-fields { min-width: 0; margin: 4px 0 8px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: #fafafa; }
.new-customer-fields legend { padding: 0 8px; color: var(--forest); font-size: 12px; font-weight: 750; }
.section-heading { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 22px; }
.section-number { display: grid; flex: 0 0 auto; place-items: center; width: 35px; height: 35px; border-radius: 10px; color: var(--forest); background: var(--forest-soft); font-size: 10px; font-weight: 800; }
.section-heading h2, .permission-heading h2 { margin: 1px 0 4px; font-size: 17px; }
.section-heading p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.sticky-card { position: sticky; top: 88px; padding: 20px; }
.sticky-card h2 { margin-bottom: 7px; font-size: 17px; }
.sticky-card > p { margin-bottom: 18px; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.sticky-card .button + .button { margin-top: 7px; }
.sticky-card hr { height: 1px; margin: 20px 0; border: 0; background: var(--border); }
.mini-facts { display: grid; gap: 10px; margin: 0; }
.mini-facts div { display: flex; justify-content: space-between; gap: 15px; font-size: 10px; }
.mini-facts dt { color: var(--ink-soft); }
.mini-facts dd { margin: 0; font-weight: 700; text-align: right; }
.mini-warning { margin: 0 0 16px; padding: 10px; border-radius: 9px; color: var(--warning); background: var(--warning-bg); font-size: 10px; line-height: 1.5; }

/* App shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 24px 18px 18px; color: white; background: #242428; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 0 7px 26px; }
.icon-button.sidebar-close { display: none; }
.main-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; overflow-y: auto; padding: 4px; }
.nav-label { margin: 20px 11px 6px; color: rgba(255,255,255,.32); font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 7px 10px; border-radius: 10px; color: rgba(255,255,255,.62); font-size: 12px; font-weight: 620; transition: color .15s, background .15s; }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: white; background: rgba(255,255,255,.095); box-shadow: inset 3px 0 0 var(--sand); }
.nav-icon { display: grid; flex: 0 0 auto; place-items: center; width: 23px; height: 23px; font-size: 17px; line-height: 1; }
.sidebar-user { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 14px 9px 4px; border-top: 1px solid rgba(255,255,255,.09); }
.user-copy { display: grid; gap: 2px; min-width: 0; }
.user-copy strong, .user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { color: rgba(255,255,255,.9); font-size: 11px; }
.user-copy small { color: rgba(255,255,255,.4); font-size: 9px; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--forest); background: var(--sand-soft); font-size: 10px; font-weight: 800; }
.avatar-small { width: 31px; height: 31px; }
.avatar-large { width: 48px; height: 48px; border-radius: 13px; font-size: 13px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 9px; color: var(--ink); background: white; cursor: pointer; }
.icon-button-dark { border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.62); background: rgba(255,255,255,.05); }
.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; height: 68px; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3.5vw, 46px); border-bottom: 1px solid var(--border); background: rgba(246,244,239,.92); backdrop-filter: blur(14px); }
.mobile-menu-button { display: none; }
.topbar-title { display: grid; gap: 1px; }
.topbar-title strong { font-size: 14px; }
.topbar-kicker { color: var(--ink-soft); font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.department-pill { padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; color: var(--ink-soft); background: rgba(255,255,255,.65); font-size: 10px; font-weight: 680; }
.page-content { width: 100%; max-width: 1540px; margin: 0 auto; padding: 34px clamp(20px, 3.5vw, 46px) 60px; }
.sidebar-backdrop { display: none; }

/* Pages */
.page-heading { display: flex; justify-content: space-between; gap: 28px; align-items: flex-end; margin-bottom: 25px; }
.page-heading h1 { margin: 5px 0 7px; font-size: clamp(28px, 3.4vw, 38px); font-weight: 680; line-height: 1.12; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.card-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; padding: 22px 22px 15px; }
.card-head h2 { margin: 3px 0 0; font-size: 18px; }
.narrow-card { max-width: 650px; padding: 24px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { display: flex; gap: 14px; align-items: flex-start; padding: 17px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.metric-card > div { display: grid; min-width: 0; }
.metric-card small { color: var(--ink-soft); font-size: 9px; font-weight: 650; }
.metric-card strong { margin: 4px 0 1px; font-size: 26px; line-height: 1; }
.metric-card div > span { overflow: hidden; color: #869190; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.metric-icon { display: grid; flex: 0 0 auto; place-items: center; width: 37px; height: 37px; border-radius: 11px; font-size: 16px; font-weight: 800; }
.metric-green { color: var(--success); background: var(--success-bg); }
.metric-blue { color: var(--blue); background: #e8f1f7; }
.metric-amber { color: var(--warning); background: var(--warning-bg); }
.metric-violet { color: var(--violet); background: #efeaf6; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 18px; }
.module-list { display: grid; gap: 1px; padding: 0 10px 12px; }
.module-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 12px; border-top: 1px solid #ecece7; }
.module-row:first-child { border-top: 0; }
.module-symbol, .role-symbol { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--forest); background: var(--forest-soft); font-size: 11px; font-weight: 850; }
.module-row > div { display: grid; gap: 3px; }
.module-row strong { font-size: 12px; }
.module-row small { color: var(--ink-soft); font-size: 10px; }
.phase-tag { padding: 5px 8px; border-radius: 999px; color: #7b653b; background: var(--sand-soft); font-size: 9px; font-weight: 750; }
.account-card { overflow: hidden; }
.profile-summary { display: flex; gap: 12px; align-items: center; padding: 5px 22px 19px; }
.profile-summary > div { display: grid; gap: 3px; min-width: 0; }
.profile-summary strong { font-size: 13px; }
.profile-summary small { overflow: hidden; color: var(--ink-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.profile-facts { display: grid; margin: 0; padding: 0 22px 17px; }
.profile-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid #ecece7; font-size: 10px; }
.profile-facts dt { color: var(--ink-soft); }
.profile-facts dd { margin: 0; font-weight: 720; text-align: right; }
.account-card > .button { width: auto; margin: 0 22px 22px; }
.status-badge, .soft-tag, .phase-tag { display: inline-flex; align-items: center; width: fit-content; white-space: nowrap; }
.status-badge { gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; }
.status-badge > span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-active, .status-ready { color: var(--success); background: var(--success-bg); }
.status-inactive { color: var(--danger); background: var(--danger-bg); }
.soft-tag { padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--ink-soft); background: #fafafa; font-size: 10px; font-weight: 680; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-bar { display: grid; grid-template-columns: minmax(200px, 1fr) 170px auto; gap: 9px; padding: 16px; border-bottom: 1px solid var(--border); }
.filter-bar input, .filter-bar select { height: 39px; font-size: 11px; }
.search-field { position: relative; }
.search-field > span { position: absolute; z-index: 1; top: 50%; left: 12px; color: var(--ink-soft); transform: translateY(-50%); }
.search-field input { padding-left: 33px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: #778482; background: #fafafa; font-size: 10px; font-weight: 780; letter-spacing: .065em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid #ecece7; color: var(--ink-soft); font-size: 12px; line-height: 1.45; vertical-align: middle; }
tbody tr:hover { background: #fcfcfa; }
.person-cell { display: flex; gap: 10px; align-items: center; min-width: 215px; }
.person-cell > span:last-child { display: grid; gap: 3px; min-width: 0; }
.person-cell strong { color: var(--ink); font-size: 13px; }
.person-cell small, .table-secondary { color: #788684; font-size: 10px; }
.table-primary, .table-secondary { display: block; }
.table-primary { color: var(--ink); font-size: 12px; font-weight: 650; }
.table-secondary { margin-top: 2px; }
.table-actions { text-align: right; }
.empty-state { display: grid; justify-items: center; padding: 50px 25px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 45px; height: 45px; margin-bottom: 13px; border-radius: 13px; color: var(--forest); background: var(--forest-soft); font-size: 18px; }
.empty-state h3 { margin-bottom: 6px; font-size: 15px; }
.empty-state p { max-width: 380px; margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; cursor: pointer; transition: border-color .15s, background .15s; }
.choice-card input, .permission-row input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.choice-check { display: grid; flex: 0 0 auto; place-items: center; width: 21px; height: 21px; border: 1px solid var(--border-strong); border-radius: 6px; color: transparent; background: white; font-size: 10px; font-weight: 900; }
.choice-card:has(input:checked), .permission-row:has(input:checked) { border-color: #7fa39c; background: #f3f8f6; }
.choice-card input:checked + .choice-check, .permission-row input:checked + .choice-check { border-color: var(--forest); color: white; background: var(--forest); }
.choice-card > span:last-child { display: grid; gap: 3px; }
.choice-card strong { font-size: 11px; }
.choice-card small { color: var(--ink-soft); font-size: 9px; line-height: 1.45; }
.department-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.simple-check { display: inline-flex; gap: 7px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; font-size: 10px; font-weight: 680; cursor: pointer; }
.simple-check:has(input:checked) { border-color: #7fa39c; background: #f3f8f6; }
.simple-check input { accent-color: var(--forest); }
.danger-zone { display: flex; justify-content: space-between; gap: 25px; align-items: center; margin-top: 18px; padding: 20px; border-color: #e7cbc6; }
.danger-zone h2 { margin: 3px 0 5px; font-size: 17px; }
.danger-zone p { margin: 0; color: var(--ink-soft); font-size: 10px; }
.danger-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.role-card { display: flex; min-height: 275px; flex-direction: column; padding: 18px; }
.role-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.role-card h2 { margin: 20px 0 7px; font-size: 17px; }
.role-card > p { min-height: 47px; margin-bottom: 17px; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.role-metrics { display: flex; gap: 25px; margin-top: auto; padding: 14px 0; border-top: 1px solid #ecece7; }
.role-metrics span { display: grid; gap: 2px; }
.role-metrics strong { font-size: 15px; }
.role-metrics small { color: var(--ink-soft); font-size: 8px; text-transform: uppercase; }
.info-banner { display: flex; gap: 12px; align-items: flex-start; margin-top: 17px; padding: 15px; border: 1px solid #f0ccd5; border-radius: 12px; color: var(--forest); background: #fff0f3; }
.info-banner > span { display: grid; flex: 0 0 auto; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: white; background: var(--forest); font-size: 11px; font-weight: 800; }
.info-banner strong { font-size: 11px; }
.info-banner p { margin: 3px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.permission-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.permission-list { display: grid; gap: 7px; }
.permission-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: flex-start; padding: 11px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.permission-row > span:last-child { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 15px; }
.permission-row strong { font-size: 11px; }
.permission-row small { grid-column: 1; color: var(--ink-soft); font-size: 9px; line-height: 1.45; }
.permission-row code { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 4px 6px; border-radius: 5px; color: #677573; background: #f0f2ef; font: 8px "Cascadia Code", Consolas, monospace; }
.audit-list { display: grid; }
.audit-row { border-top: 1px solid #ecece7; }
.audit-row:first-child { border-top: 0; }
.audit-row summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 14px 17px; list-style: none; cursor: pointer; }
.audit-row summary::-webkit-details-marker { display: none; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sand); box-shadow: 0 0 0 4px var(--sand-soft); }
.audit-main { display: grid; gap: 3px; }
.audit-main strong { font-size: 11px; }
.audit-main small, .audit-row time { color: var(--ink-soft); font-size: 9px; }
.chevron { color: var(--ink-soft); transition: transform .15s; }
.audit-row[open] .chevron { transform: rotate(180deg); }
.audit-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 17px 16px 37px; }
.audit-detail > div { min-width: 0; }
.audit-detail span { display: block; margin-bottom: 5px; color: var(--ink-soft); font-size: 8px; font-weight: 750; text-transform: uppercase; }
.audit-detail pre { min-height: 56px; max-height: 220px; margin: 0; overflow: auto; padding: 10px; border-radius: 8px; color: #435250; background: #f4f5f2; font: 8px/1.5 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; }
.section-spacer { margin-top: 18px; }

/* CRM and workflow modules */
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-card { margin-bottom: 16px; padding: 15px; }
.filter-row { display: flex; gap: 10px; align-items: end; }
.filter-row .field { min-width: 170px; }
.filter-row .filter-grow { flex: 1 1 320px; }
.filter-row .button { min-height: 40px; }
.table-card { overflow: hidden; }
.table-card.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }
.table-scroll { width: 100%; overflow-x: auto; }
.table-scroll td strong, .table-scroll td small { display: block; }
.table-scroll td strong { color: var(--ink); font-size: 13px; }
.table-scroll td small { margin-top: 4px; color: #788684; font-size: 10px; line-height: 1.4; }
.clickable-row { cursor: pointer; }
.clickable-row:focus { outline: 2px solid var(--forest); outline-offset: -2px; }
.row-overdue { background: #fff8f6; }
.pagination { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); color: var(--ink-soft); font-size: 10px; }
.pagination > div { display: flex; gap: 6px; }
.stack-checks { display: grid; gap: 7px; }
.compact-choice-grid { display: flex; flex-wrap: wrap; gap: 7px; max-height: 220px; overflow: auto; padding: 2px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .55fr); gap: 18px; align-items: start; }
.detail-main, .detail-aside { display: grid; gap: 18px; }
.detail-aside { position: sticky; top: 86px; }
.detail-facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 25px; margin: 0; padding: 0 22px 22px; }
.detail-facts div { display: flex; justify-content: space-between; gap: 15px; padding: 12px 0; border-top: 1px solid #ecece7; font-size: 12px; line-height: 1.45; }
.detail-facts dt { color: var(--ink-soft); }
.detail-facts dd { margin: 0; color: var(--ink); font-weight: 680; text-align: right; }
.prose { margin: 0; padding: 0 22px 22px; color: var(--ink-soft); font-size: 11px; line-height: 1.7; }
.task-description { color: #45454d; font-size: 14px; line-height: 1.75; }
.two-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.timeline { display: grid; padding: 0 22px 20px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 14px minmax(0,1fr); gap: 10px; padding: 0 0 20px; }
.timeline-item::before { position: absolute; top: 9px; bottom: -3px; left: 5px; width: 1px; background: var(--border); content: ''; }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 4px; border: 3px solid var(--surface); border-radius: 50%; background: var(--sand); box-shadow: 0 0 0 1px var(--border-strong); }
.timeline-head { display: flex; justify-content: space-between; gap: 14px; }
.timeline-head strong { font-size: 12px; }
.timeline-head time, .timeline-item small { color: var(--ink-soft); font-size: 10px; }
.timeline-item p { margin: 5px 0 3px; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.empty-state.compact { padding: 28px 20px; }
.file-list { display: grid; padding: 0 18px 14px; }
.file-list a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 4px; border-top: 1px solid #ecece7; }
.file-list a:first-child { border-top: 0; }
.file-list strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-list small { flex: 0 0 auto; color: var(--ink-soft); font-size: 10px; }
.upload-form { display: grid; gap: 8px; padding: 0 18px 18px; }
.upload-form input[type="file"] { max-width: 100%; padding: 8px; font-size: 9px; }
.clipboard-upload { display: grid; gap: 5px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: 10px; background: #fafafa; text-align: center; }
.clipboard-upload:focus, .clipboard-upload:focus-within { outline: 3px solid rgba(185, 0, 46, .28); border-color: #b9002e; }
.clipboard-upload small { color: var(--ink-soft); font-size: 10px; }
.clipboard-upload.is-uploading { opacity: .65; pointer-events: none; }
.muted { margin: 0; padding: 0 18px 15px; color: var(--ink-soft); font-size: 10px; }
.priority { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 760; }
.priority-low { color: #55706b; background: #edf2f0; }
.priority-normal { color: #315f7a; background: #e8f1f7; }
.priority-high { color: var(--warning); background: var(--warning-bg); }
.priority-urgent { color: var(--danger); background: var(--danger-bg); }
.status-warning { color: var(--warning); background: var(--warning-bg); }
.status-danger { color: var(--danger); background: var(--danger-bg); }
.status-info { color: var(--blue); background: #e8f1f7; }
.text-danger { color: var(--danger) !important; }
.checklist-list { display: grid; padding: 0 18px 18px; }
.checklist-item { border-top: 1px solid #ecece7; }
.checklist-item:first-child { border-top: 0; }
.checklist-item button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 11px 3px; border: 0; color: var(--ink); background: transparent; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.checklist-item button > span { display: grid; flex: 0 0 auto; width: 20px; height: 20px; place-items: center; border: 1px solid var(--border-strong); border-radius: 6px; color: white; }
.checklist-item.done button { color: var(--ink-soft); text-decoration: line-through; }
.checklist-item.done button > span { border-color: var(--success); background: var(--success); text-decoration: none; }
.comment-list { display: grid; padding: 0 20px; }
.comment-list article { padding: 13px 2px; border-top: 1px solid #ecece7; }
.comment-list article > div { display: flex; justify-content: space-between; gap: 12px; }
.comment-list strong { font-size: 13px; }
.comment-list time { color: var(--ink-soft); font-size: 11px; }
.comment-list p { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.inline-comment { display: grid; gap: 8px; padding: 15px 20px 20px; }
.inline-comment textarea { font-size: 14px; line-height: 1.55; }
.inline-comment .button { justify-self: start; }
.notification-list { display: grid; }
.notification-row { border-top: 1px solid #ecece7; }
.notification-row:first-child { border-top: 0; }
.notification-row button { display: grid; width: 100%; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 15px 18px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.notification-row button > span:nth-child(2) { display: grid; gap: 3px; }
.notification-row strong { font-size: 12px; }
.notification-row small, .notification-row time { color: var(--ink-soft); font-size: 10px; }
.notification-dot { width: 8px; height: 8px; border-radius: 50%; background: #c7cfcc; }
.notification-row.unread { background: #fff0f3; }
.notification-row.unread .notification-dot { background: var(--forest); box-shadow: 0 0 0 4px var(--forest-soft); }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, .35fr) auto; gap: 12px; align-items: end; padding: 16px; }
.align-right { text-align: right; }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.offer-item { display: grid; gap: 17px; margin-bottom: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 13px; background: #ffffff; }
.offer-item-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.offer-item-head h3 { margin: 3px 0 0; font-size: 15px; }
.button-danger { border-color: #e7cbc6; color: var(--danger); background: var(--danger-bg); }
.button-small { min-height: 31px; padding: 6px 10px; font-size: 10px; }
.is-hidden { display: none !important; }
.sofa-fields { padding: 15px; border-radius: 11px; background: var(--forest-soft); }
.subsection-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.subsection-title strong { font-size: 11px; }
.subsection-title small { color: var(--ink-soft); font-size: 9px; }
.offer-price-grid { display: grid; grid-template-columns: .55fr 1fr 1fr 1fr .65fr 1fr; gap: 10px; align-items: start; }
.compound-field { display: flex; min-height: 40px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 9px; background: white; }
.compound-field input, .compound-field select { min-width: 0; border: 0; border-radius: 0; }
.compound-field select, .compound-field span { display: grid; width: 60px; place-items: center; border-left: 1px solid var(--border); color: var(--ink-soft); background: #fafafa; }
.item-calculation { display: grid; gap: 3px; align-content: center; min-height: 44px; margin-top: 21px; padding: 6px 10px; border-radius: 9px; color: white; background: var(--forest); }
.item-calculation small { font-size: 8px; opacity: .75; }
.item-calculation strong { font-size: 11px; }
.offer-summary-items { display: grid; padding: 0 20px 18px; }
.offer-summary-items article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 15px; padding: 17px 0; border-top: 1px solid var(--border); }
.offer-summary-items article:first-child { border-top: 0; }
.offer-summary-items h3 { margin: 3px 0; font-size: 14px; }
.offer-summary-items article > p, .offer-summary-items article > .spec-grid { grid-column: 1 / -1; }
.offer-summary-items p { margin: 0; color: var(--ink-soft); font-size: 10px; }
.spec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 7px 0 0; }
.spec-grid div { padding: 8px; border-radius: 8px; background: #f5f5f6; }
.spec-grid dt { color: var(--ink-soft); font-size: 8px; text-transform: uppercase; }
.spec-grid dd { margin: 3px 0 0; font-size: 10px; font-weight: 670; }
.totals { display: grid; gap: 8px; padding: 15px 20px 20px; border-top: 1px solid var(--border); }
.totals div { display: flex; justify-content: space-between; gap: 20px; color: var(--ink-soft); font-size: 10px; }
.totals .grand-total { padding-top: 10px; border-top: 1px solid var(--border); color: var(--ink); font-size: 15px; }
.timeline article { display: grid; grid-template-columns: 15px minmax(0, 1fr); gap: 9px; padding: 12px 0; border-top: 1px solid var(--border); }
.timeline article:first-child { border-top: 0; }
.timeline article p { margin: 4px 0; color: var(--ink-soft); font-size: 10px; }
.follow-up-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.follow-up-form input, .follow-up-form select { min-width: 0; }
.inline-form { display: flex; gap: 10px; align-items: end; padding: 15px 20px 20px; border-top: 1px solid var(--border); }
.inline-form .field { flex: 1; }
.compact-list { display: grid; padding: 0 18px 16px; }
.compact-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.compact-list > div:first-child { border-top: 0; }
.compact-list strong { font-size: 10px; }
.compact-list small { color: var(--ink-soft); font-size: 9px; }
.calendar-nav, .view-switch { display: flex; gap: 7px; }
.view-switch { padding: 11px; }
.view-switch a { padding: 8px 14px; border-radius: 8px; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.view-switch a.active { color: white; background: var(--forest); }
.calendar-list { overflow: hidden; }
.calendar-list > h2 { margin: 0; padding: 15px 18px 7px; color: var(--ink-soft); background: #fafafa; font-size: 10px; text-transform: uppercase; }
.calendar-event { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--border); border-left: 4px solid var(--sand); color: var(--ink); }
.calendar-event time { color: var(--forest); font-size: 11px; font-weight: 750; }
.calendar-event > span:nth-child(2) { display: grid; gap: 3px; }
.calendar-event strong { font-size: 12px; }
.calendar-event small { color: var(--ink-soft); font-size: 10px; }
.calendar-event.event-task { border-left-color: var(--blue); }
.calendar-event.event-sales_follow_up { border-left-color: var(--sand); }
.warning-stack { display: grid; gap: 7px; margin-bottom: 16px; }
.warning-stack .alert { margin: 0; }
.workflow-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.workflow-metrics .metric-card { color: var(--ink); }
.metric-red { color: var(--danger); background: var(--danger-bg); }
.compact-list a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); color: var(--ink); }
.delivery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.delivery-card { display: grid; gap: 14px; padding: 17px; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.delivery-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(17, 47, 47, .09); }
.delivery-card-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.delivery-card h2 { margin: 4px 0; font-size: 15px; }
.delivery-card p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.date-tile { display: grid; width: 48px; height: 51px; place-content: center; border-radius: 10px; color: var(--forest); background: var(--forest-soft); text-align: center; }
.date-tile strong { font-size: 17px; }
.date-tile small { font-size: 7px; text-transform: uppercase; }
.delivery-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0; }
.delivery-card dl div { display: grid; gap: 3px; padding: 8px; border-radius: 8px; background: #f5f5f6; }
.delivery-card dt { color: var(--ink-soft); font-size: 7px; text-transform: uppercase; }
.delivery-card dd { margin: 0; overflow: hidden; font-size: 11px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.driver-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.driver-actions .button { min-height: 48px; }
.signature-fields, .failed-fields { display: grid; gap: 9px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: #fafafa; }
[data-signature-canvas] { display: block; width: 100%; height: 150px; border: 1px dashed var(--border-strong); border-radius: 8px; background: white; touch-action: none; }
.attachment-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 0 18px 16px; }
.attachment-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: #fafafa; }
.attachment-card img, .attachment-preview-image { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: var(--forest-soft); }
.attachment-image { cursor: zoom-in; }
.attachment-meta { display: grid; gap: 3px; padding: 9px; }
.attachment-meta strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta small, .attachment-meta time { color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.attachment-file { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.attachment-file-icon { display: grid; width: 42px; height: 52px; margin-left: 9px; place-items: center; border-radius: 8px; color: var(--forest); background: var(--forest-soft); font-size: 9px; font-weight: 800; }
.upload-help { color: var(--ink-soft); font-size: 9px; line-height: 1.45; }
.image-lightbox[hidden] { display: none; }
.image-lightbox { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 28px; background: rgba(7, 25, 26, .82); backdrop-filter: blur(5px); }
.image-lightbox-dialog { position: relative; display: grid; width: min(1120px, 100%); max-height: calc(100vh - 56px); overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; background: #fafafa; box-shadow: 0 28px 80px rgba(0,0,0,.38); }
.image-lightbox-stage { display: grid; min-height: 240px; max-height: calc(100vh - 135px); place-items: center; padding: 18px; background: #242428; cursor: zoom-out; }
.image-lightbox-stage img { display: block; width: auto; max-width: 100%; height: auto; max-height: calc(100vh - 171px); object-fit: contain; cursor: default; }
.image-lightbox-close { position: absolute; z-index: 1; top: 12px; right: 12px; display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: white; background: rgba(8,30,31,.78); box-shadow: 0 4px 18px rgba(0,0,0,.25); font-size: 26px; line-height: 1; cursor: pointer; }
.image-lightbox-close:hover { background: var(--forest); }
.image-lightbox-caption { display: flex; min-width: 0; gap: 16px; align-items: center; justify-content: space-between; padding: 13px 16px; }
.image-lightbox-caption strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
body.image-lightbox-open { overflow: hidden; }
.receipt-proof { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, .6fr); gap: 18px; align-items: center; padding: 0 22px 22px; }
.receipt-proof img { display: block; width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: white; }
.receipt-proof dl { display: grid; gap: 10px; margin: 0; }
.receipt-proof dl div { display: grid; gap: 3px; padding: 10px; border-radius: 9px; background: #f5f5f6; }
.receipt-proof dt { color: var(--ink-soft); font-size: 9px; }
.receipt-proof dd { margin: 0; font-size: 12px; font-weight: 700; }
.task-status-form { padding: 15px; }
.offer-status-form, .offer-send-actions { padding: 0 18px 18px; }
.offer-send-actions { display: grid; gap: 9px; }
.offer-send-actions small { color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.card-inner-form { padding: 0 18px 18px; }
.dispatch-list { display: grid; padding: 0 18px 18px; }
.dispatch-list article { display: grid; gap: 4px; padding: 11px 0; border-top: 1px solid var(--border); }
.dispatch-list article:first-child { border-top: 0; padding-top: 0; }
.dispatch-list article > div { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.dispatch-list strong { font-size: 12px; }
.dispatch-list small, .dispatch-list time { color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.dispatch-help { margin: -5px 18px 18px; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.text-warning { color: var(--warning) !important; }
.warehouse-form { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 8px; align-items: end; margin-top: 5px; padding: 12px; border-radius: 10px; background: #f5f5f6; }

/* Feedback */
.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid transparent; border-radius: 10px; font-size: 11px; font-weight: 650; line-height: 1.5; }
.alert-success { border-color: #c4e2d3; color: var(--success); background: var(--success-bg); }
.alert-error { border-color: #ecc4c0; color: var(--danger); background: var(--danger-bg); }
.alert-warning { border-color: #efd9ac; color: var(--warning); background: var(--warning-bg); }

@media (max-width: 1500px) {
    .workflow-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workflow-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .role-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .auth-shell { display: block; }
    .auth-story { display: none; }
    .auth-panel { min-height: 100vh; }
    .auth-mobile-brand { display: inline-flex; }
    .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(16,47,49,.2); }
    .sidebar.open { transform: translateX(0); }
    .icon-button.sidebar-close { display: grid; border-color: rgba(255,255,255,.12); color: rgba(255,255,255,.82); background: rgba(255,255,255,.05); }
    .icon-button.sidebar-close:hover { border-color: rgba(255,255,255,.22); color: white; background: rgba(255,255,255,.1); }
    .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(12,31,32,.42); backdrop-filter: blur(2px); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .workspace { margin-left: 0; }
    .topbar { gap: 12px; }
    .mobile-menu-button { display: grid; }
    .topbar-title { margin-right: auto; }
    .form-layout { grid-template-columns: 1fr; }
    .form-aside { order: -1; }
    .sticky-card { position: static; }
    .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-aside { position: static; }
    .offer-price-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .delivery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .warehouse-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .page-content { padding-top: 25px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
    .page-heading .button { width: 100%; }
    .metric-grid, .dashboard-grid { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr; }
    .filter-bar .button { width: 100%; }
    .role-grid { grid-template-columns: 1fr; }
    .role-card { min-height: 0; }
    .choice-grid, .two-columns { grid-template-columns: 1fr; }
    .field-span { grid-column: auto; }
    .danger-zone { align-items: stretch; flex-direction: column; }
    .danger-actions, .danger-actions form, .danger-actions .button { width: 100%; }
    .permission-row > span:last-child { grid-template-columns: 1fr; }
    .permission-row code { grid-column: 1; grid-row: auto; width: fit-content; margin-top: 4px; }
    .audit-row summary { grid-template-columns: auto minmax(0,1fr) auto; }
    .audit-row time { display: none; }
    .audit-detail { grid-template-columns: 1fr; padding-left: 17px; }
    .department-pill { display: none; }
    .filter-row { align-items: stretch; flex-direction: column; }
    .filter-row .field { min-width: 0; }
    .two-card-grid, .detail-facts { grid-template-columns: 1fr; }
    .three-columns, .offer-price-grid, .spec-grid { grid-template-columns: 1fr; }
    .item-calculation { margin-top: 0; }
    .follow-up-form, .inline-form { display: grid; grid-template-columns: 1fr; }
    .delivery-grid, .driver-actions { grid-template-columns: 1fr; }
    .attachment-gallery, .receipt-proof { grid-template-columns: 1fr; }
    .warehouse-form { grid-template-columns: 1fr; }
    .button-row { width: 100%; }
    .button-row .button { width: 100%; }
}

@media (max-width: 480px) {
    .auth-panel { align-items: flex-start; padding: 28px 20px; }
    .auth-mobile-brand { margin-bottom: 60px; }
    .auth-heading h2 { font-size: 34px; }
    .topbar { height: 62px; padding: 0 15px; }
    .topbar-title strong { font-size: 12px; }
    .page-content { padding-right: 15px; padding-left: 15px; }
    .form-section, .permission-section, .narrow-card { padding: 17px; }
    .card-head { padding: 18px 17px 12px; }
    .metric-card { padding: 14px; }
    .module-row { grid-template-columns: auto minmax(0,1fr); }
    .module-row .phase-tag { grid-column: 2; }
    .form-actions { flex-direction: column; }
    .form-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Dashboard 2026: handlingsorienteret overblik */
.topbar { height: 76px; gap: 22px; background: rgba(247,246,242,.96); }
.topbar-title { flex: 0 0 auto; min-width: 112px; }
.global-search { position: relative; display: flex; flex: 1 1 560px; max-width: 610px; align-items: center; margin: 0 auto; }
.global-search > span { position: absolute; left: 15px; color: #71817e; font-size: 21px; pointer-events: none; }
.global-search input { width: 100%; height: 44px; padding: 0 70px 0 44px; border: 1px solid #d8dcd7; border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.92); font-size: 14px; box-shadow: 0 2px 8px rgba(185,0,46,.025); }
.global-search input:focus { outline: none; border-color: #b9002e; box-shadow: 0 0 0 3px rgba(185,0,46,.09); }
.global-search input::placeholder { color: #879592; }
.global-search kbd { position: absolute; right: 12px; padding: 4px 7px; border: 1px solid #dfe2de; border-radius: 6px; color: #7e8b89; background: #fafafa; font: 10px/1 "Segoe UI", sans-serif; }
.topbar-actions { position: relative; gap: 8px; }
.topbar-icon-button { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--border); border-radius: 11px; color: var(--forest); background: white; font-size: 21px; }
.topbar-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-icon-button:hover { border-color: #b8c5c1; background: #f9fbf9; }
.topbar-icon-button b { position: absolute; top: -5px; right: -5px; display: grid; min-width: 19px; height: 19px; padding: 0 5px; place-items: center; border: 2px solid var(--paper); border-radius: 999px; color: white; background: var(--danger); font-size: 9px; line-height: 1; }
.topbar-menu { position: relative; }
.topbar-menu > summary { list-style: none; cursor: pointer; }
.topbar-menu > summary::-webkit-details-marker { display: none; }
.topbar-menu[open] > summary { outline: 3px solid rgba(243,166,74,.22); outline-offset: 2px; }
.quick-create-menu > summary { min-height: 42px; padding: 0 17px; font-size: 13px; }
.profile-trigger { display: flex; min-width: 142px; height: 44px; gap: 9px; align-items: center; padding: 4px 9px 4px 5px; border: 1px solid var(--border); border-radius: 12px; background: white; }
.profile-trigger-copy { display: grid; flex: 1; gap: 1px; text-align: left; }
.profile-trigger-copy strong { font-size: 12px; }
.profile-trigger-copy small { color: var(--ink-soft); font-size: 9px; }
.topbar-popover { position: absolute; z-index: 60; top: calc(100% + 10px); right: 0; width: 310px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: 0 20px 50px rgba(16,47,44,.15); }
.popover-heading { display: block; padding: 14px 15px 8px; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.topbar-popover > a, .topbar-popover form button { display: grid; width: 100%; grid-template-columns: 34px minmax(0,1fr); gap: 11px; align-items: center; padding: 11px 15px; border: 0; color: var(--ink); background: white; text-align: left; cursor: pointer; }
.topbar-popover > a:hover, .topbar-popover form button:hover { background: #fafafa; }
.topbar-popover > a > span:first-child, .topbar-popover form button > span:first-child { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--forest); background: var(--forest-soft); font-size: 11px; font-weight: 800; }
.topbar-popover a > span:nth-child(2), .topbar-popover button > span:nth-child(2) { display: grid; gap: 2px; }
.topbar-popover strong { font-size: 12px; }
.topbar-popover small { color: var(--ink-soft); font-size: 10px; line-height: 1.35; }
.profile-popover-head { display: flex; gap: 11px; align-items: center; padding: 16px; border-bottom: 1px solid #eceeea; }
.profile-popover-head > span:last-child { display: grid; min-width: 0; gap: 2px; }
.profile-popover-head strong, .profile-popover-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-popover form { border-top: 1px solid #eceeea; }

.dashboard-page-content { max-width: 1600px; padding-top: 38px; }
.dashboard-hero { display: flex; justify-content: space-between; gap: 28px; align-items: flex-end; margin-bottom: 35px; }
.dashboard-hero h1 { margin: 8px 0 7px; font-size: clamp(34px, 3.4vw, 50px); font-weight: 680; line-height: 1.03; letter-spacing: -.05em; }
.dashboard-hero p { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.5; }
.dashboard-section { margin-bottom: 30px; }
.dashboard-section-head, .dashboard-panel-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; }
.dashboard-section-head { margin-bottom: 14px; }
.dashboard-section-head h2, .dashboard-panel-head h2 { margin: 4px 0 0; font-size: 22px; line-height: 1.2; }
.dashboard-section-note { color: var(--ink-soft); font-size: 13px; }
.attention-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.attention-card { position: relative; display: grid; min-height: 178px; grid-template-columns: auto minmax(0,1fr); gap: 14px; align-content: start; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: white; box-shadow: 0 5px 18px rgba(185,0,46,.045); transition: border-color .15s, transform .15s; }
.attention-card:hover { transform: translateY(-2px); border-color: #bbc8c4; }
.attention-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; font-size: 18px; font-weight: 800; }
.attention-copy { display: grid; min-width: 0; }
.attention-copy small { color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.attention-copy strong { margin: 4px 0 7px; font-size: 34px; line-height: 1; }
.attention-copy > span { color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.attention-action { grid-column: 1 / -1; align-self: end; margin-top: auto; padding-top: 14px; border-top: 1px solid #eceeea; color: var(--forest); font-size: 12px; font-weight: 750; }
.attention-danger .attention-icon { color: var(--danger); background: var(--danger-bg); }
.attention-warning .attention-icon { color: var(--warning); background: var(--warning-bg); }
.attention-info .attention-icon { color: var(--blue); background: #eaf1f6; }
.dashboard-calm-state { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border: 1px solid #e4e4e7; border-radius: 15px; background: var(--forest-soft); }
.dashboard-calm-state > span, .dashboard-empty > span { display: grid; flex: 0 0 auto; width: 40px; height: 40px; place-items: center; border-radius: 11px; color: var(--success); background: white; font-size: 16px; font-weight: 800; }
.dashboard-calm-state strong, .dashboard-empty strong { font-size: 14px; }
.dashboard-calm-state p, .dashboard-empty p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.dashboard-primary-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr); gap: 18px; margin-bottom: 30px; align-items: start; }
.dashboard-panel { overflow: hidden; box-shadow: 0 5px 20px rgba(185,0,46,.045); }
.dashboard-panel-head { padding: 22px 22px 17px; border-bottom: 1px solid #eceeea; }
.dashboard-text-link { color: var(--forest); font-size: 12px; font-weight: 750; white-space: nowrap; }
.dashboard-text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.dashboard-task-list, .dashboard-delivery-list, .dashboard-activity-list { display: grid; }
.dashboard-task-row { display: grid; min-height: 76px; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 13px; align-items: center; padding: 13px 20px; border-top: 1px solid #eef0ec; }
.dashboard-task-row:first-child { border-top: 0; }
.dashboard-task-row:hover, .dashboard-delivery-row:hover, .dashboard-activity-row:hover { background: #fafafa; }
.task-priority-dot { width: 9px; height: 9px; border-radius: 50%; background: #aab4b1; box-shadow: 0 0 0 5px #f1f3f0; }
.priority-dot-high, .priority-dot-urgent { background: var(--danger); box-shadow: 0 0 0 5px var(--danger-bg); }
.priority-dot-normal { background: var(--sand); box-shadow: 0 0 0 5px var(--sand-soft); }
.dashboard-task-main { display: grid; min-width: 0; gap: 4px; }
.dashboard-task-main strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-task-main small { overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-task-deadline { display: grid; min-width: 116px; justify-items: end; gap: 5px; }
.dashboard-task-deadline > small { color: var(--ink-soft); font-size: 10px; }
.dashboard-badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 780; white-space: nowrap; }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-info { color: var(--blue); background: #eaf1f6; }
.badge-neutral { color: #6f7d7a; background: #eff1ee; }
.task-complete-button, .task-open-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #ced8d3; border-radius: 9px; color: var(--forest); background: white; font-size: 13px; font-weight: 800; cursor: pointer; }
.task-complete-button:hover, .task-open-button:hover { border-color: var(--success); color: white; background: var(--success); }
.dashboard-empty { display: flex; min-height: 250px; gap: 13px; align-items: center; justify-content: center; padding: 30px; text-align: left; }
.dashboard-empty.compact { min-height: 155px; }
.dashboard-delivery-row { display: grid; min-height: 91px; grid-template-columns: 64px minmax(0,1fr) minmax(115px,.55fr) auto; gap: 12px; align-items: center; padding: 14px 20px; border-top: 1px solid #eef0ec; }
.dashboard-delivery-row:first-child { border-top: 0; }
.delivery-time, .delivery-copy, .delivery-status { display: grid; gap: 4px; }
.delivery-time strong { font-size: 17px; }
.delivery-time small, .delivery-copy small { color: var(--ink-soft); font-size: 10px; line-height: 1.35; }
.delivery-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-status > span:first-child { color: var(--ink-soft); font-size: 10px; line-height: 1.3; text-align: right; }
.delivery-progress { display: block; height: 5px; overflow: hidden; border-radius: 999px; background: #e7ebe8; }
.delivery-progress i { display: block; height: 100%; border-radius: inherit; background: var(--forest); }
.dashboard-panel-button { margin: 0 20px 20px; }
.system-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.system-metric-card { display: grid; min-height: 116px; grid-template-columns: auto minmax(0,1fr); gap: 13px; align-items: start; padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: white; }
.system-metric-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; font-size: 15px; font-weight: 800; }
.system-metric-card > span:last-child { display: grid; gap: 2px; }
.system-metric-card small { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.system-metric-card strong { font-size: 28px; line-height: 1.1; }
.system-metric-card > span:last-child > span { color: var(--ink-soft); font-size: 10px; }
.metric-tone-success .system-metric-icon { color: var(--success); background: var(--forest-soft); }
.metric-tone-info .system-metric-icon { color: var(--blue); background: #eaf1f6; }
.metric-tone-warning .system-metric-icon { color: var(--warning); background: var(--warning-bg); }
.metric-tone-danger .system-metric-icon { color: var(--danger); background: var(--danger-bg); }
.metric-tone-neutral .system-metric-icon { color: #72807d; background: #eff1ee; }
.dashboard-activity-row { display: grid; min-height: 68px; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 13px; align-items: center; padding: 12px 22px; border-top: 1px solid #eef0ec; }
.dashboard-activity-row:first-child { border-top: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--forest); box-shadow: 0 0 0 5px var(--forest-soft); }
.dashboard-activity-row > span:nth-child(2) { display: grid; gap: 3px; }
.dashboard-activity-row > span:nth-child(2) strong { font-size: 13px; }
.dashboard-activity-row > span:nth-child(2) small { color: var(--ink-soft); font-size: 10px; }
.activity-meta { display: grid; min-width: 155px; gap: 3px; text-align: right; }
.activity-meta strong { font-size: 11px; }
.activity-meta time { color: var(--ink-soft); font-size: 10px; }

.search-page-heading { margin-bottom: 18px; }
.search-page-form { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; margin-bottom: 22px; padding: 13px; }
.search-page-form > span { padding-left: 5px; color: var(--ink-soft); font-size: 22px; }
.search-page-form input { height: 45px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 15px; }
.search-result-count { color: var(--ink-soft); font-size: 13px; }
.search-result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; align-items: start; }
.search-result-group { overflow: hidden; }
.search-result-list { display: grid; }
.search-result-list > a { display: grid; min-height: 67px; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 11px 16px; border-top: 1px solid #eceeea; }
.search-result-list > a:hover { background: #fafafa; }
.search-result-list > a > span:nth-child(2) { display: grid; min-width: 0; gap: 3px; }
.search-result-list strong, .search-result-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-list strong { font-size: 12px; }
.search-result-list small { color: var(--ink-soft); font-size: 10px; }
.search-result-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: var(--forest); background: var(--forest-soft); font-size: 11px; font-weight: 800; }
.search-empty { min-height: 280px; }

@media (max-width: 1320px) {
    .attention-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dashboard-primary-grid { grid-template-columns: minmax(0,1.2fr) minmax(340px,.8fr); }
    .system-metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .profile-trigger-copy { display: none; }
    .profile-trigger { min-width: 0; }
}

@media (max-width: 1050px) {
    .topbar { gap: 10px; }
    .topbar-title { display: none; }
    .global-search { margin-left: 0; }
    .dashboard-primary-grid { grid-template-columns: 1fr; }
    .search-result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .topbar { height: auto; min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
    .global-search { order: 3; flex-basis: 100%; max-width: none; }
    .global-search input { height: 42px; }
    .global-search kbd { display: none; }
    .topbar-actions { margin-left: auto; }
    .quick-create-menu > summary { width: 42px; padding: 0; font-size: 0; }
    .quick-create-menu > summary span { font-size: 18px; }
    .topbar-popover { position: fixed; top: 126px; right: 15px; left: 15px; width: auto; max-height: calc(100vh - 145px); overflow-y: auto; }
    .dashboard-page-content { padding-top: 26px; }
    .dashboard-hero { margin-bottom: 28px; }
    .dashboard-hero h1 { font-size: 36px; }
    .dashboard-hero p { font-size: 15px; }
    .attention-grid, .system-metric-grid { grid-template-columns: 1fr; }
    .attention-card { min-height: 164px; }
    .dashboard-task-row { grid-template-columns: auto minmax(0,1fr) auto; }
    .dashboard-task-deadline { grid-column: 2; grid-row: 2; justify-items: start; grid-template-columns: auto auto; align-items: center; }
    .dashboard-task-row > form, .task-open-button { grid-column: 3; grid-row: 1 / span 2; }
    .dashboard-delivery-row { grid-template-columns: 54px minmax(0,1fr) auto; }
    .delivery-status { grid-column: 2; }
    .delivery-status > span:first-child { text-align: left; }
    .dashboard-activity-row { grid-template-columns: auto minmax(0,1fr) auto; }
    .activity-meta { grid-column: 2; min-width: 0; text-align: left; }
    .dashboard-section-head { align-items: flex-start; flex-direction: column; gap: 5px; }
    .search-page-form { grid-template-columns: auto minmax(0,1fr); }
    .search-page-form .button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 430px) {
    .topbar-icon-button { width: 40px; height: 40px; }
    .dashboard-hero h1 { font-size: 32px; }
    .dashboard-panel-head { align-items: flex-start; }
    .dashboard-panel-head h2 { font-size: 19px; }
    .dashboard-text-link { font-size: 11px; }
    .dashboard-task-row, .dashboard-delivery-row, .dashboard-activity-row { padding-right: 15px; padding-left: 15px; }
    .dashboard-delivery-row { grid-template-columns: 47px minmax(0,1fr) auto; }
}

/* Referencejustering: kompakt XL Møbler-arbejdsflade */
.sidebar { padding: 23px 13px 17px; }
.sidebar-head { padding: 0 11px 28px; }
.sidebar-wordmark { display: flex; align-items: center; gap: 7px; color: white; }
.sidebar-wordmark strong { font-size: 30px; font-weight: 820; letter-spacing: -.07em; line-height: 1; }
.sidebar-wordmark span { margin-top: 2px; font-size: 11px; font-weight: 850; letter-spacing: .19em; }
.main-nav { gap: 2px; padding: 2px 0; }
.nav-label { margin: 18px 12px 7px; }
.nav-item { min-height: 45px; gap: 9px; padding: 7px 11px; border-radius: 10px; font-size: 13px; }
.nav-icon { width: 25px; font-size: 18px; }
.sidebar-settings {
    flex: 0 0 auto;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid rgba(255,255,255,.2);
    border-radius: 0;
}
.sidebar-settings.active { border-radius: 10px; }

.dashboard-topbar {
    height: 96px;
    gap: clamp(18px,2.5vw,42px);
    border-bottom: 0;
    background: rgba(247,246,242,.97);
}
.dashboard-topbar-greeting { display: grid; flex: 0 1 420px; min-width: 275px; gap: 5px; }
.dashboard-topbar-greeting h1 {
    margin: 0;
    font-size: clamp(25px,2vw,34px);
    font-weight: 750;
    line-height: 1.05;
    letter-spacing: -.04em;
}
.dashboard-topbar-greeting p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.dashboard-topbar .global-search { flex-basis: 330px; max-width: 355px; margin-left: auto; }
.dashboard-topbar .topbar-actions { margin-left: 0; }
.dashboard-page-content { max-width: 1680px; padding-top: 8px; }
.dashboard-section { margin-bottom: 18px; }
.dashboard-section-head { margin-bottom: 12px; }
.dashboard-section-head h2,
.dashboard-panel-head h2 { margin: 0; font-size: 19px; font-weight: 760; }

.attention-grid { grid-template-columns: repeat(auto-fit,minmax(295px,1fr)); gap: 14px; }
.attention-card {
    min-height: 126px;
    grid-template-columns: 54px 44px minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    align-content: center;
    padding: 20px;
    box-shadow: none;
}
.attention-icon { width: 50px; height: 50px; border-radius: 50%; font-size: 21px; }
.attention-value {
    align-self: start;
    margin-top: 7px;
    color: var(--danger);
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.04em;
}
.attention-copy { align-content: center; gap: 5px; }
.attention-copy strong { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.2; }
.attention-copy small { color: var(--ink-soft); font-size: 12px; font-weight: 500; line-height: 1.35; }
.attention-action {
    grid-column: 4;
    align-self: center;
    min-width: 104px;
    margin: 0 0 0 8px;
    padding: 12px 15px;
    border: 0;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    text-align: center;
}
.attention-danger { border-color: #efc6c3; background: #fff5f4; }
.attention-warning { border-color: #efd5ae; background: #fff8ee; }
.attention-info { border-color: #cadce8; background: #f3f8fb; }
.attention-danger .attention-action { background: #d83e43; }
.attention-warning .attention-action { background: #ee972f; }
.attention-info .attention-action { background: var(--blue); }
.attention-warning .attention-value { color: #b76308; }
.attention-info .attention-value { color: var(--blue); }

.dashboard-primary-grid {
    grid-template-columns: minmax(0,1.08fr) minmax(380px,.92fr);
    gap: 16px;
    margin-bottom: 18px;
}
.dashboard-panel { box-shadow: 0 5px 20px rgba(185,0,46,.035); }
.task-panel,
.delivery-panel { min-height: 390px; }
.dashboard-panel-head { min-height: 60px; align-items: center; padding: 17px 21px; }
.dashboard-text-link { font-size: 12px; }
.dashboard-task-row {
    min-height: 88px;
    grid-template-columns: 30px minmax(0,1fr) 112px 106px;
    gap: 14px;
    padding: 14px 21px;
}
.task-check-button {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    padding: 0;
    border: 1px solid #aeb9b6;
    border-radius: 5px;
    background: white;
    cursor: pointer;
}
.task-check-button:hover { border-color: var(--success); background: var(--forest-soft); }
.task-check-button:hover::after { content: '✓'; color: var(--success); font-size: 13px; font-weight: 850; }
.task-check-button.is-disabled { cursor: default; opacity: .55; }
.dashboard-task-main strong { font-size: 14px; }
.dashboard-task-main small { font-size: 12px; line-height: 1.45; }
.dashboard-task-deadline { min-width: 108px; justify-items: start; }
.dashboard-task-deadline > small { font-size: 11px; }
.dashboard-badge { padding: 6px 10px; font-size: 10px; }
.task-row-action {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid #aeb9b6;
    border-radius: 8px;
    color: var(--ink);
    background: white;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}
.task-row-action:hover { border-color: var(--forest); background: #fafafa; }
.dashboard-delivery-row {
    min-height: 82px;
    grid-template-columns: 58px minmax(0,1fr) minmax(82px,auto) 112px;
    gap: 12px;
    padding: 12px 21px;
}
.delivery-time strong { font-size: 14px; }
.delivery-time small,
.delivery-copy small { font-size: 10px; }
.delivery-copy strong { font-size: 13px; }
.dashboard-delivery-row > .dashboard-badge {
    justify-self: center;
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delivery-steps { display: flex; align-items: center; justify-content: flex-end; }
.delivery-steps i {
    display: grid;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    place-items: center;
    border: 1px solid #9ba9a5;
    border-radius: 50%;
    color: transparent;
    background: white;
    font: 9px/1 sans-serif;
}
.delivery-steps b { display: block; width: 22px; height: 2px; background: #c9cecc; }
.delivery-steps i.is-done { border-color: var(--forest); color: white; background: var(--forest); }
.delivery-steps b.is-done { background: var(--forest); }
.dashboard-panel-button { min-width: 280px; margin-top: 10px; }

.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: minmax(0,1.8fr) minmax(340px,1fr);
    gap: 16px;
    align-items: stretch;
}
.dashboard-secondary-grid.single-column { grid-template-columns: 1fr; }
.system-metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.system-metric-card { min-height: 154px; align-content: center; align-items: center; padding: 20px; }
.system-metric-icon { width: 54px; height: 54px; border-radius: 11px; font-size: 22px; }
.system-metric-card > span:last-child { gap: 3px; }
.system-metric-card strong { font-size: 31px; }
.system-metric-card small { color: var(--ink); font-size: 11px; }
.system-metric-card > span:last-child > span { font-size: 10px; line-height: 1.35; }
.activity-panel { min-height: 154px; }
.activity-panel .dashboard-panel-head { min-height: 50px; padding-top: 13px; padding-bottom: 10px; }
.dashboard-activity-row {
    min-height: 36px;
    grid-template-columns: 94px 8px minmax(0,1fr) auto;
    gap: 10px;
    padding: 6px 18px;
    border-top: 0;
}
.dashboard-activity-row > span:nth-child(3) {
    display: grid;
    grid-template-columns: minmax(0,auto) minmax(0,1fr);
    gap: 6px;
    align-items: baseline;
}
.dashboard-activity-row > span:nth-child(3) strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-activity-row > span:nth-child(3) small {
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-meta { min-width: 0; text-align: left; }
.activity-meta time { font-size: 10px; }
.activity-dot { width: 7px; height: 7px; box-shadow: none; }

@media (max-width: 1380px) {
    .dashboard-topbar-greeting { flex-basis: 330px; }
    .dashboard-topbar .global-search { max-width: 320px; }
    .attention-card { grid-template-columns: 48px 38px minmax(0,1fr) auto; padding: 17px; }
    .attention-icon { width: 44px; height: 44px; }
    .attention-value { font-size: 32px; }
    .attention-action { min-width: 92px; padding-right: 10px; padding-left: 10px; }
    .dashboard-secondary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1120px) {
    .dashboard-topbar-greeting { flex-basis: 285px; min-width: 240px; }
    .dashboard-topbar-greeting h1 { font-size: 25px; }
    .dashboard-topbar .profile-menu { display: none; }
    .dashboard-primary-grid { grid-template-columns: 1fr; }
    .task-panel,
    .delivery-panel { min-height: 0; }
}

@media (max-width: 720px) {
    .dashboard-topbar { position: relative; height: auto; min-height: 0; padding-top: 10px; }
    .dashboard-topbar-greeting { order: 4; flex: 1 0 100%; min-width: 0; padding: 11px 0 3px; }
    .dashboard-topbar-greeting h1 { font-size: 28px; }
    .dashboard-topbar-greeting p { font-size: 14px; }
    .dashboard-topbar .global-search { max-width: none; }
    .dashboard-page-content { padding-top: 14px; }
    .attention-grid { grid-template-columns: 1fr; }
    .attention-card { grid-template-columns: 48px 38px minmax(0,1fr); min-height: 132px; }
    .attention-action { grid-column: 2/-1; justify-self: start; min-width: 118px; margin: 2px 0 0; }
    .dashboard-task-row { grid-template-columns: 28px minmax(0,1fr) auto; }
    .dashboard-task-row > form,
    .dashboard-task-row > .task-check-button { grid-column: 1; grid-row: 1/span 2; }
    .dashboard-task-main { grid-column: 2; grid-row: 1; }
    .dashboard-task-deadline {
        grid-column: 2;
        grid-row: 2;
        grid-template-columns: auto auto;
        align-items: center;
    }
    .task-row-action { grid-column: 3; grid-row: 1/span 2; padding: 0 9px; }
    .dashboard-delivery-row { grid-template-columns: 52px minmax(0,1fr) auto; }
    .dashboard-delivery-row > .dashboard-badge { grid-column: 2; justify-self: start; }
    .delivery-steps { grid-column: 3; grid-row: 1/span 2; }
    .system-metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .dashboard-secondary-grid { grid-template-columns: 1fr; }
    .dashboard-activity-row { grid-template-columns: 84px 7px minmax(0,1fr) auto; }
    .dashboard-topbar .topbar-popover { top: 176px; max-height: calc(100vh - 195px); }
}

@media (max-width: 440px) {
    .sidebar-wordmark strong { font-size: 27px; }
    .system-metric-grid { grid-template-columns: 1fr; }
    .system-metric-card { min-height: 112px; }
    .dashboard-activity-row { grid-template-columns: 80px 7px minmax(0,1fr); }
    .dashboard-activity-row > span:last-child { display: none; }
}

/* Chaufføropgaver */
.delivery-index-heading,
.delivery-form-heading,
.delivery-detail-heading { align-items: flex-end; }
.delivery-index-heading > .button { flex: 0 0 auto; }
.delivery-filter-bar { grid-template-columns: repeat(2, minmax(220px,1fr)) auto; }
.delivery-filter-bar .button { min-height: 43px; }
.delivery-card-description {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.delivery-create-summary { gap: 14px; }
.delivery-create-summary > h2 { margin: 2px 0 0; }
.delivery-create-summary > p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.booking-mail-choice {
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    gap: 10px;
    align-items: start;
    padding: 13px;
    border: 1px solid #cbdcd5;
    border-radius: 11px;
    background: var(--forest-soft);
    cursor: pointer;
}
.booking-mail-choice input { margin-top: 3px; accent-color: var(--forest); }
.booking-mail-choice > span { display: grid; gap: 3px; }
.booking-mail-choice strong { font-size: 13px; }
.booking-mail-choice small { color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.delivery-wait-note {
    display: grid;
    gap: 4px;
    padding: 13px;
    border-left: 4px solid var(--sand);
    border-radius: 8px;
    background: #fff8eb;
}
.delivery-wait-note strong { font-size: 13px; }
.delivery-wait-note span { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.field-checkbox { align-content: end; }
.field-checkbox .check-row { min-height: 43px; }
.driver-task-brief > p {
    margin: 0;
    padding: 0 22px 22px;
    color: #45454d;
    font-size: 15px;
    line-height: 1.7;
}
.driver-internal-note {
    display: grid;
    gap: 5px;
    margin: 0 22px 22px;
    padding: 14px;
    border-left: 4px solid var(--sand);
    border-radius: 8px;
    background: #fff8eb;
}
.driver-internal-note strong { font-size: 13px; }
.driver-internal-note span { color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.driver-page .detail-aside > .card > p { padding: 0 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.driver-page .upload-help,
.driver-page .clipboard-upload small { font-size: 12px; }
.driver-page .upload-form input[type="file"] { font-size: 12px; }

@media (max-width: 900px) {
    .delivery-filter-bar { grid-template-columns: 1fr 1fr; }
    .delivery-filter-bar .button { grid-column: 1/-1; }
}

@media (max-width: 720px) {
    .delivery-index-heading,
    .delivery-form-heading,
    .delivery-detail-heading { align-items: stretch; }
    .delivery-index-heading > .button { width: 100%; }
    .delivery-filter-bar { grid-template-columns: 1fr; }
    .delivery-filter-bar .button { grid-column: auto; }
    .delivery-detail-heading .status-badge { align-self: flex-start; }
    .driver-actions { grid-template-columns: 1fr; }
}


/* XL Møbler identity: original artwork, charcoal surfaces and red actions. */
.brand-logo { display: block; width: 240px; max-width: 100%; height: auto; object-fit: contain; }
.sidebar-wordmark { min-width: 0; flex: 1; }
.sidebar-wordmark .brand-logo { width: 170px; }
.brand-icon { display: block; width: 44px; height: auto; flex: 0 0 44px; }
.tracking-header .brand-logo { width: min(210px, 45vw); }
.nav-item.active { background: rgba(185,0,46,.22); box-shadow: inset 3px 0 0 #e52552; }
.nav-label { color: rgba(255,255,255,.65); }
.stat-symbol { color: white; }
.story-copy > p, .story-stats small, .story-footer { color: rgba(255,255,255,.75); }
.metric-tone-success .system-metric-icon, .dashboard-calm-state { background: var(--success-bg); }
.delivery-progress i, .delivery-steps b.is-done { background: var(--success); }
.delivery-steps i.is-done { background: var(--success); border-color: var(--success); }

.route-panel { padding: 24px; margin-bottom: 18px; min-width: 0; }
.arrival-source { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; font-size: 12px; padding: 16px; background: var(--bg); }
.warehouse-list-panel { overflow: hidden; margin-bottom: 24px; }
.warehouse-list-summary { padding: 16px 12px; background: #eaf2f8; color: #19344b; font-size: 16px; font-weight: 700; }
.warehouse-list { width: 100%; min-width: 1100px; border-collapse: collapse; color: #14272d; font-size: 14px; }
.warehouse-list th { background: #2f75b5; color: white; text-align: left; padding: 13px 7px; white-space: nowrap; }
.warehouse-list td { padding: 5px 7px; vertical-align: top; overflow-wrap: anywhere; }
.warehouse-list tbody tr:nth-child(odd) { background: #c0e6f3; }
.warehouse-list tbody tr:nth-child(even) { background: #f6fafc; }
.warehouse-list td:nth-child(1), .warehouse-list td:nth-child(8) { text-align: right; }
.warehouse-list td:nth-child(5) { min-width: 170px; }
.warehouse-list td:nth-child(9) { min-width: 170px; }
.warehouse-list td:nth-child(10) { min-width: 240px; }
.warehouse-list .warehouse-payment-pending { color: #a02323; font-weight: 700; min-width: 130px; }
.warehouse-list a { text-decoration: underline; font-weight: 700; }
.arrival-editor > summary { cursor: pointer; font-weight: 700; }
.arrival-editor[open] > summary { margin-bottom: 20px; }
.route-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.route-overview-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.route-stat-grid h2 { margin: 12px 0 0; font-size: 32px; }
.route-map { width: 100%; height: 430px; border: 0; border-radius: 12px; }
.route-map-panel { margin: 16px 0; }
.route-map-panel summary { cursor: pointer; padding: 10px 0; font-weight: 700; }
.route-stop-notes { border-top: 1px solid var(--border); padding: 12px 0; overflow-wrap: anywhere; }
@media(max-width:900px) { .route-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .route-overview-grid { grid-template-columns: 1fr; } }
@media(max-width:480px) { .route-stat-grid { grid-template-columns: 1fr; } .route-map { height: 320px; } }
.route-panel p { line-height: 1.6; }
.route-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.route-stop-heading, .route-list-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 15px; align-items: center; }
.route-list-row { padding: 18px 0; border-bottom: 1px solid var(--border); }
.route-panel .field label { display: grid; gap: 8px; font-size: 14px; }
.route-panel .field small { font-size: 13px; }
.route-panel .route-multiselect { height: auto; min-height: 130px; padding: 8px; }
.route-panel .table-scroll td { vertical-align: top; font-size: 14px; line-height: 1.6; min-width: 110px; overflow-wrap: anywhere; }
.route-panel .table-scroll td:nth-child(4) { min-width: 240px; }
@media (max-width: 640px) { .route-panel { padding: 16px; } .route-panel .two-columns { grid-template-columns: 1fr; } }
:root .address-results { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.35rem; }
:root .address-results:empty { display: none; }
:root .address-results .button { text-align: left; white-space: normal; justify-content: flex-start; }
