/* ============================================================
   Booking-Overview – grundtema
   ============================================================ */
:root {
    --green: #1f7a45;
    --green-dark: #165c34;
    --green-light: #e6f3ea;
    --blue: #2f80c3;
    --blue-light: #e5f0fa;
    --orange: #f0a020;
    --orange-light: #fff4e0;
    --gray: #8a9097;
    --gray-light: #eceef0;
    --red: #d64541;
    --text: #1d2228;
    --muted: #6b737c;
    --border: #d8dde2;
    --bg: #f5f6f7;
    --panel: #ffffff;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 2px 10px rgba(0, 0, 0, .05);
    --hour-line: 2px;
    --hour-color: #7d858d;
    --surface-2: #f6f7f8;
    --surface-3: #e3e6e9;
    --hover: #f1f4f7;
    --border-soft: #eceef0;
    --border-strong: #c3c9cf;
    color-scheme: light;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 500; margin: 4px 0 12px; }
h2 { font-size: 18px; font-weight: 500; margin: 4px 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 8px 0 6px; }
code { background: var(--gray-light); padding: 1px 4px; border-radius: 3px; font-size: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.upper { text-transform: uppercase; }
.link { color: var(--blue); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.spacer { flex: 1; }
.center { justify-content: center; }
.page-pad { padding: 24px; }

/* ---------------- Toppmeny ---------------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 28px; height: 56px; padding: 0 20px;
    background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; max-width: 160px; object-fit: contain; }
.main-tabs { display: flex; gap: 4px; height: 100%; }
.main-tab {
    display: flex; align-items: center; padding: 0 14px; color: var(--muted); font-size: 15px;
    border-bottom: 3px solid transparent; height: 100%;
}
.main-tab:hover { color: var(--text); text-decoration: none; }
.main-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--green); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.topbar-user form { margin: 0; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: #f6e7b4; color: #6b5200;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
}
.btn-link-light { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.btn-link-light:hover { color: var(--text); text-decoration: underline; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------------- Knappar och fält ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 14px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
    border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
    font-family: inherit; line-height: 1.3;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b33532; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; padding: 4px 0; font-size: 14px; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted); padding: 4px 6px; border-radius: 4px; }
.icon-btn:hover { background: var(--gray-light); color: var(--text); }

.input {
    width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    font-size: 14px; font-family: inherit; background: var(--panel); color: var(--text);
}
.input:focus { outline: 2px solid rgba(47, 128, 195, .35); border-color: var(--blue); }
.input:disabled, .input[readonly] { background: var(--surface-2); }
.input.big { padding: 11px 14px; font-size: 16px; }
.input-small { width: auto; min-width: 140px; padding: 5px 8px; }
textarea.input { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span:first-child { font-size: 13px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check-col { display: flex; flex-direction: column; gap: 4px; }
.check-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row { display: flex; gap: 14px; align-items: center; margin: 6px 0 12px; flex-wrap: wrap; }
.radio-col { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; }
.input-suffix { display: flex; align-items: center; }
.input-suffix .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-suffix span { border: 1px solid var(--border-strong); border-left: 0; padding: 7px 10px; background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 14px; align-items: start; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.seg button { border: none; background: none; padding: 6px 14px; cursor: pointer; font-size: 14px; font-family: inherit; color: var(--text); border-radius: 6px; }
.seg button:hover:not(.on) { background: var(--hover); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--green); color: #fff; font-weight: 600; }
.seg.center { display: flex; width: fit-content; margin: 16px auto; }
.field > .seg { align-self: flex-start; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin: 10px 0; border: 1px solid; }
.alert-error { background: #fdecea; border-color: #f3b8b5; color: #8d1f1b; }
.alert-warn { background: var(--orange-light); border-color: #f5cf87; color: #6b4600; }
.alert-ok { background: var(--green-light); border-color: #a9d7b9; color: #14532d; }
.alert-info { background: var(--blue-light); border-color: #a9c9e8; color: #174a73; }

.tag { display: inline-block; padding: 1px 7px; border: 1px solid var(--border); border-radius: 3px; font-size: 12px; margin: 0 3px 2px 0; background: var(--panel); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; background: var(--gray-light); font-size: 12px; }
.pill { display: inline-block; padding: 0 8px; border: 1px solid #c58ad6; color: #8a3ea3; border-radius: 10px; font-size: 11px; }
.warn-icon { color: var(--orange); }
.ok-icon { color: var(--green); font-weight: 700; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th { text-align: left; font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.table.compact th, .table.compact td { padding: 5px 8px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table tr.inactive td { color: var(--gray); }
.table tr.sub td { color: var(--muted); font-size: 13px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 8px 0; }
.kv-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv-grid > div > span:first-child { display: block; color: var(--muted); font-size: 13px; }
.kv-grid .span-3 { grid-column: span 3; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

/* ---------------- Inloggning ---------------- */
.empty-layout { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); }
.login-card { width: 380px; background: var(--panel); padding: 28px; border-radius: 10px; box-shadow: var(--shadow); }
.login-brand { text-align: center; margin-bottom: 16px; }
.login-brand img { max-height: 60px; max-width: 240px; }
.login-brand h1 { font-size: 20px; margin-top: 10px; }

/* ---------------- Laddning / fel ---------------- */
.loading-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.loading-box { background: var(--panel); padding: 28px 60px; border-radius: 8px; text-align: center; box-shadow: var(--shadow); }
.spinner { width: 42px; height: 42px; margin: 0 auto 10px; border: 4px solid var(--green-light); border-top-color: var(--green); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 20px; background: #ffe9a6; z-index: 2000; box-shadow: 0 -1px 3px rgba(0,0,0,.2); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ---------------- Modal ---------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 28, .45); display: flex; align-items: flex-start; justify-content: center; padding-top: 7vh; z-index: 500; }
.modal-box { background: var(--panel); border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.25); max-height: 86vh; display: flex; flex-direction: column; width: 92vw; }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 920px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px 10px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-sub { color: var(--muted); margin-top: 2px; }
.modal-body { padding: 14px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.char-count { text-align: right; color: var(--muted); font-size: 12px; }

/* ---------------- Sidolayout ---------------- */
.side-layout { display: flex; flex: 1; min-height: 0; }
.side-nav { width: 220px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.side-nav a { padding: 13px 18px; color: var(--text); border-bottom: 1px solid var(--border-soft); border-left: 4px solid transparent; font-size: 15px; }
.side-nav a:hover { background: var(--hover); text-decoration: none; }
.side-nav a.on { border-left-color: var(--green); background: var(--surface-2); font-weight: 600; }
.ao-nav a { display: flex; flex-direction: column; }
.ao-nav a span { color: var(--muted); font-size: 13px; font-weight: 400; }
.side-content { flex: 1; padding: 18px 24px 80px; min-width: 0; }

.sub-header { display: flex; justify-content: space-between; align-items: flex-end; padding: 10px 20px 0; background: linear-gradient(180deg, var(--surface-3), var(--surface-3)); border-bottom: 1px solid var(--border); }
.sub-tabs { display: flex; gap: 4px; }
.sub-tab { padding: 9px 22px; background: var(--surface-3); border: 1px solid var(--border-strong); border-bottom: none; border-radius: 4px 4px 0 0; color: var(--text); cursor: pointer; font-size: 14px; font-family: inherit; }
.sub-tab:hover { text-decoration: none; background: var(--hover); }
.sub-tab.on { background: var(--panel); border-top: 3px solid var(--green); }
.sub-tab .close { margin-left: 10px; color: var(--muted); }
.sub-tab.add { background: var(--surface-2); }
.search-box { display: flex; gap: 0; position: relative; margin-bottom: 8px; }
.search-box .input { width: 220px; border-radius: var(--radius) 0 0 var(--radius); }
.search-box .btn { border-radius: 0 var(--radius) var(--radius) 0; }
.search-pop { position: absolute; top: 100%; right: 0; width: 380px; max-height: 420px; overflow: auto; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 60; padding: 6px; border-radius: var(--radius); }
.search-hit { display: block; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.search-hit:hover { background: var(--hover); text-decoration: none; }

.ao-bar { display: flex; align-items: center; gap: 16px; padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }

/* ---------------- Kort ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.card-label { color: var(--muted); font-size: 13px; margin-top: 8px; }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.card-top { display: flex; gap: 14px; }
.planned { background: var(--green-light); padding: 6px 10px; border-radius: 4px; }
.empty-box { background: var(--panel); border: 1px dashed var(--border); padding: 24px; text-align: center; border-radius: var(--radius); }

/* ---------------- Jobb ---------------- */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; margin-top: 14px; }
.job-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.job-card.locked { opacity: .92; }
.job-head { display: flex; justify-content: space-between; padding: 12px 16px 2px; }
.job-head h3 { margin: 0 0 2px; font-size: 17px; }
.job-card > .link-btn { padding: 4px 16px 8px; }
.job-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border-soft); }
.job-line:nth-child(odd) { background: var(--surface-2); }
.locked-bar { background: #6b737c; color: #fff; text-align: center; padding: 4px; font-size: 13px; }
.job-add { padding: 10px 16px 14px; border-top: 1px solid var(--border-soft); }
.split { display: grid; grid-template-columns: 360px 1fr; border: 1px solid var(--border); border-radius: var(--radius); min-height: 300px; }
.content-split { min-height: 380px; }
.hit-list { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--border); max-height: 440px; overflow: auto; }
.hit-list li { padding: 6px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit-list li:hover { background: var(--hover); }
.hit-list li.on { background: #2f6fb3; color: #fff; }
.hit-list li.on .tag { color: var(--text); }
.hit-detail { padding: 12px 16px; background: var(--surface-2); }
.type-icon { width: 18px; display: inline-block; }
.details { margin: 6px 0; padding-left: 18px; color: var(--muted); }
.empty-hits { padding: 20px; text-align: center; }
.pick-list { list-style: none; padding: 0; margin: 6px 0; border: 1px solid var(--border); border-radius: var(--radius); max-height: 220px; overflow: auto; }
.pick-list li { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.pick-list li:hover { background: var(--hover); }
.owner-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--green-light); border-radius: var(--radius); width: fit-content; }
.split-btn { position: relative; display: inline-flex; }
.split-btn .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.split-btn .btn:nth-child(2) { border-radius: 0 var(--radius) var(--radius) 0; border-left: 1px solid rgba(255,255,255,.4); padding: 7px 10px; }
.split-menu { position: absolute; bottom: 110%; right: 0; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); }
.split-menu button { display: block; padding: 9px 14px; background: none; border: none; cursor: pointer; white-space: nowrap; font-family: inherit; }
.split-menu button:hover { background: var(--hover); }

.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.note-field { display: flex; flex-direction: column; gap: 4px; }
.note-head { display: flex; justify-content: space-between; font-size: 13px; }

/* ---------------- Händelser (tidslinje) ---------------- */
.timeline { position: relative; padding-left: 40px; max-width: 900px; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 10px; bottom: 0; width: 3px; background: var(--surface-3); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-dot { position: absolute; left: -36px; top: 14px; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--green); background: var(--panel); }
.tl-dot.filled { background: var(--green); }
.tl-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.tl-card.small-card { padding: 10px 16px; }
.tl-card h2 { margin-top: 0; }
.totals-box { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.totals-box > div { display: flex; justify-content: space-between; padding: 2px 0; }
.totals-box .big { font-size: 17px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }

/* ---------------- Historik ---------------- */
.history { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.history-head, .history-row { display: grid; grid-template-columns: 160px 120px 130px 110px 1fr 30px; gap: 10px; padding: 12px 16px; }
.history-head { color: var(--muted); border-bottom: 1px solid var(--border); }
.history-row { border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.history-row:hover { background: var(--hover); }
.history-detail { padding: 8px 16px 14px 40px; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }

/* ---------------- Artiklar ---------------- */
.stepper { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.stepper button { width: 28px; border: none; background: var(--surface-2); cursor: pointer; font-size: 16px; }
.stepper span { min-width: 44px; text-align: center; padding: 3px 6px; background: #fdecec; }
.stepper.disabled span { background: var(--surface-2); }
.sticky-actions { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--border); padding: 10px 0; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------- Kunder & fordon ---------------- */
.hero-search { background: linear-gradient(90deg, #f3e9ea, #9aa4ad 70%, #3a434c); padding: 30px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.search-wrap { display: flex; gap: 8px; width: min(680px, 95%); }
.hero-actions { display: flex; gap: 8px; }
.page-narrow { max-width: 1100px; margin: 0 auto; padding: 20px; width: 100%; }
.result-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.result-row { display: flex; align-items: center; gap: 18px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.result-row:hover { background: var(--hover); text-decoration: none; }
.result-row .icon { width: 22px; }
.back-link { display: inline-block; margin-bottom: 10px; font-size: 15px; }
.vehicle-head h1 { margin-bottom: 0; }
.logo-row { display: flex; gap: 20px; align-items: center; }
.logo-preview { height: 60px; max-width: 240px; object-fit: contain; border: 1px solid var(--border); padding: 6px; border-radius: var(--radius); background: var(--panel); }

/* ============================================================
   Bokning / kalender
   ============================================================ */
.cal-page { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--panel); }
.cal-toolbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-range { min-width: 190px; text-align: center; font-weight: 600; }
.cal-search { margin-left: auto; display: flex; gap: 8px; align-items: center; position: relative; }
.cal-search .input { width: 260px; }
.cal-search .search-box { margin-bottom: 0; }
.cal-main { display: flex; flex: 1; min-height: 0; position: relative; }
.cal-area { flex: 1; overflow: auto; min-width: 0; padding: 0 0 20px; height: calc(100vh - 215px); min-height: 420px; }
.selected-resources { display: flex; gap: 18px; padding: 10px 16px; min-height: 40px; align-items: center; flex-wrap: wrap; }
/* Plats för den orange resursträd-fliken när panelen är stängd */
.cal-area.panel-closed .selected-resources { padding-left: 84px; }
.sel-res { display: inline-flex; gap: 6px; align-items: center; }
.res-code { display: inline-block; min-width: 30px; padding: 1px 5px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 3px; font-size: 12px; text-align: center; font-weight: 600; }

/* Veckoremsa */
.week-strip { display: flex; gap: 10px; flex: 1 1 auto; min-width: 0; max-width: 980px; }
.week {
    flex: 1 1 0; min-width: 150px; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 6px;
    border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--panel);
    font-family: inherit; color: var(--text); text-align: left; box-shadow: var(--shadow);
    transition: border-color .12s, transform .12s;
}
.week:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.week.active { border: 2px solid var(--green); background: var(--green-light); padding: 7px 9px 5px; }
.week-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.week-no { font-size: 15px; font-weight: 700; }
.week-range { font-size: 12px; color: var(--muted); white-space: nowrap; }
.week.active .week-no { color: var(--green-dark); }
.week.now .week-no::after { content: " • nu"; font-size: 11px; font-weight: 600; color: var(--blue); }
.week-bars { display: flex; gap: 5px; height: 58px; }
.wbar-col { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wbar { flex: 1; background: var(--surface-2); position: relative; display: flex; align-items: flex-end; border-radius: 4px; overflow: hidden; }
.wbar.off { background: repeating-linear-gradient(45deg, var(--surface-3) 0 4px, var(--surface-2) 4px 8px); }
.wbar.today { outline: 2px solid var(--blue); outline-offset: -2px; }
.wbar-fill { width: 100%; background: var(--blue); border-radius: 4px 4px 0 0; transition: height .2s; }
.wbar span { position: absolute; bottom: 3px; width: 100%; text-align: center; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.6); }
.wday { font-size: 11px; text-align: center; color: var(--muted); line-height: 1; }
@media (max-width: 1400px) { .week { min-width: 120px; } .week-range { display: none; } }

/* Resursträd */
.res-panel-tab { position: absolute; left: 0; top: 0; z-index: 30; display: flex; gap: 6px; align-items: center; background: var(--orange); border: none; padding: 6px 10px; cursor: pointer; border-radius: 0 0 6px 0; font-size: 14px; }
.res-panel { width: 300px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease; }
.res-panel.floating { position: absolute; left: 0; top: 0; bottom: 0; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
.res-panel-backdrop { position: absolute; inset: 0; z-index: 35; background: transparent; }
.res-panel-head { display: flex; align-items: center; gap: 6px; background: var(--orange); padding: 4px 8px; font-weight: 600; }
.res-panel-head .icon-btn { color: #3a2a00; }
.res-panel-head .pin { opacity: .55; transform: rotate(45deg); }
.res-panel-head .pin.on { opacity: 1; transform: none; }
.res-panel-body { overflow: auto; flex: 1; padding: 8px 0; }
.tree-box { max-height: 60vh; overflow: auto; background: #f6f3f1; padding: 8px 0; border-radius: var(--radius); }
.tree { list-style: none; margin: 0; padding: 0; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 6px; cursor: default; position: relative; }
.tree-row:hover { background: var(--hover); }
.tree-row.selected { background: #9cc69f; }
.tree-row.inactive { color: var(--muted); }
.tree-row.inactive .res-code { background: var(--surface-3); color: var(--muted); }
.tree-toggle { background: none; border: none; cursor: pointer; width: 18px; color: var(--green); font-size: 14px; padding: 0; }
.tree-toggle-space { width: 18px; display: inline-block; }
.tree-label { cursor: pointer; flex: 1; }
.tree-label.group { font-weight: 600; }
.tree-addremove { display: none; border: 1px solid var(--green); background: var(--panel); color: var(--green); width: 22px; height: 22px; border-radius: 3px; cursor: pointer; font-weight: 700; padding: 0; line-height: 1; }
.tree-row:hover .tree-addremove { display: inline-block; }

/* Kolumnvy */
.col-view { display: flex; padding: 0 16px 0 0; min-width: fit-content; }
.time-axis { width: 40px; flex-shrink: 0; position: sticky; left: 0; background: var(--panel); z-index: 5; }
.day-head-spacer { height: 64px; }
.time-body { position: relative; }
.time-label { position: absolute; right: 6px; transform: translateY(-50%); font-size: 13px; color: var(--text); font-weight: 600; }
.res-group { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.res-group.multi { border-left: 4px solid #6b737c; }
.res-group-title { padding: 4px 8px; background: var(--surface-2); font-weight: 600; }
.res-days { display: flex; flex: 1; }
.day-col { flex: 1; min-width: 150px; border-left: 1px solid var(--border-strong); }
.day-head { height: 64px; padding: 6px 8px; background: var(--surface-3); color: var(--text); display: flex; flex-direction: column; justify-content: space-between; }
.day-head.today { background: #1d4f8c; color: #fff; }
.day-title { display: flex; justify-content: space-between; font-size: 15px; }
.cap-bar { position: relative; height: 22px; background: var(--panel); border: 1px solid var(--border-strong); }
.cap-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #5b9bd5; }
.cap-bar span { position: relative; display: block; text-align: center; font-size: 13px; line-height: 20px; color: var(--text); }
.cap-bar.full .cap-fill { background: #2d9e3a; }
.cap-bar.off { background: var(--surface-3); }
.day-body { position: relative; background: var(--panel); overflow: hidden; }
.day-col.off .day-body { background: var(--surface-3); }
.hour-band { position: absolute; left: 0; right: 0; }
.hour-band.zebra { background: rgba(47, 128, 195, .045); }
.hour-line { position: absolute; left: 0; right: 0; border-top: var(--hour-line) solid var(--hour-color); z-index: 1; pointer-events: none; }
.half-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border-strong); z-index: 1; pointer-events: none; }
.break-band { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #c7ccd1, #c7ccd1 4px, #d3d7db 4px, #d3d7db 8px); opacity: .8; z-index: 1; pointer-events: none; }
.offhours { position: absolute; left: 0; right: 0; background: rgba(120, 128, 136, .18); z-index: 1; pointer-events: none; }
.dayoff-block { position: absolute; inset: 0; background: rgba(150, 156, 162, .45); padding: 8px; z-index: 2; pointer-events: none; }
.slot-cell { position: absolute; left: 0; right: 0; z-index: 3; }
.slot-cell:hover { background: rgba(47, 128, 195, .08); }
.slot-cell.dropzone { background: rgba(31, 122, 69, .04); }
.slot-cell.dropzone:hover { background: rgba(31, 122, 69, .25); outline: 1px dashed var(--green); }
.free-slot { position: absolute; left: 3px; right: 3px; border: 2px dashed var(--green); z-index: 4; cursor: pointer; display: flex; justify-content: center; padding-top: 8px; font-weight: 600; }
.free-slot:hover { background: rgba(31, 122, 69, .08); }
.proposal-block { position: absolute; left: 3px; right: 3px; background: rgba(150, 220, 150, .75); border: 2px dashed var(--green); z-index: 6; text-align: center; padding-top: 4px; pointer-events: none; }
.now-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 7; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }

.cal-block {
    position: absolute; background: var(--panel); border: 3px solid var(--blue); border-radius: 2px; z-index: 5;
    padding: 2px 4px 14px; font-size: 11px; overflow: hidden; cursor: pointer; line-height: 1.3;
}
.cal-block:hover { box-shadow: 0 2px 8px rgba(0,0,0,.25); z-index: 8; }
.cal-block.selected { background: #1d5f9e; color: #fff; }
.cal-block.selected .t-end, .cal-block.selected .t-start { color: #fff; }
.cal-block.c-blue { border-color: var(--blue); }
.cal-block.c-green { border-color: #2d9e3a; }
.cal-block.c-orange { border-color: var(--orange); }
.cal-block.c-gray { border-color: var(--border-strong); border-width: 2px; background: var(--surface-2); }
.cal-block.c-done { border-color: #8a8f96; border-width: 2px; background: #d9dbde; }
.blk-head { display: flex; justify-content: space-between; gap: 4px; }
.blk-head strong { font-size: 12px; }
.blk-times { white-space: nowrap; }
.t-start { color: #2d9e3a; }
.t-end { color: var(--red); }
.blk-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-meta { color: var(--text); }
.cal-block.selected .blk-meta { color: #fff; }
.blk-notes { margin-top: 3px; font-size: 10.5px; color: var(--text); }
.cal-block.selected .blk-notes { color: #fff; }
.blk-tags span { display: inline-block; border: 1px solid var(--border-strong); padding: 0 4px; margin-right: 3px; font-size: 10px; }
.blk-res { position: absolute; right: 3px; bottom: 1px; font-weight: 700; font-size: 11px; }
.blk-checked { position: absolute; right: 2px; top: 2px; background: #2d9e3a; color: #fff; padding: 0 2px; font-size: 11px; }

/* Resursvy */
.timeline-view { display: flex; margin: 0 16px; border: 1px solid var(--border); }
.tl-resources { width: 260px; flex-shrink: 0; background: var(--surface-3); }
.tl-res-head { height: 44px; display: flex; align-items: center; padding: 0 10px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tl-res { padding: 8px 10px; border-bottom: 1px solid var(--border-strong); min-height: 54px; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.tl-scroll { overflow-x: auto; flex: 1; }
.tl-inner { position: relative; }
.tl-hours { height: 44px; position: relative; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tl-date { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); font-weight: 600; font-size: 13px; }
.tl-hour { position: absolute; bottom: 4px; transform: translateX(-50%); font-weight: 600; }
.tl-row { position: relative; border-bottom: 1px solid var(--border-strong); min-height: 54px; }
.tl-row.off { background: var(--surface-3); }
.tl-vline { position: absolute; top: 0; bottom: 0; border-left: var(--hour-line) solid var(--hour-color); pointer-events: none; z-index: 1; }
.tl-break { position: absolute; top: 0; bottom: 0; background: rgba(160, 166, 172, .45); pointer-events: none; z-index: 1; }
.tl-off { position: absolute; top: 0; bottom: 0; background: rgba(120, 128, 136, .18); pointer-events: none; z-index: 1; }
.tl-dayoff { position: absolute; inset: 0; background: rgba(150, 156, 162, .45); padding: 6px 10px; z-index: 2; pointer-events: none; }
.tl-cell { position: absolute; top: 0; bottom: 0; z-index: 3; }
.tl-cell:hover { background: rgba(47, 128, 195, .08); }
.tl-cell.dropzone:hover { background: rgba(31, 122, 69, .25); }
.tl-block { padding: 2px 4px; }
.now-vline { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--red); z-index: 7; pointer-events: none; }
.timeline-view .proposal-block { right: auto; }

/* Bokningspanel */
.booking-panel { width: 460px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; height: calc(100vh - 215px); min-height: 420px; max-height: none; align-self: flex-start; position: sticky; top: 0; }
.bp-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-3); font-size: 15px; }
.bp-body { overflow: auto; flex: 1 1 auto; min-height: 0; }
.bp-section { padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel); margin-bottom: 6px; }
.bp-section h3 { margin: 0 0 8px; }
.bp-section.propose { background: #fdf8e8; }
.bp-foot { flex-shrink: 0; display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--panel); }
.readonly-box { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); min-height: 32px; white-space: pre-wrap; }
.period-chip { display: inline-block; min-width: 46px; text-align: center; background: #5b9bd5; color: #fff; padding: 3px 6px; border-radius: 2px; font-weight: 600; }
.period-chip.light { background: #9cc3e6; }
.propose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.period-drag { display: inline-block; min-width: 110px; text-align: center; font-size: 20px; font-weight: 700; color: #fff; background: #2f80c3; padding: 6px 14px; margin: 6px 0; cursor: grab; border: 2px solid #1d5f9e; user-select: none; }
.period-drag:active { cursor: grabbing; }
.extra-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 8px; align-items: center; }
.assigned { border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0; }
.assigned-head { background: var(--surface-2); padding: 6px 10px; font-size: 13px; color: var(--muted); }
.assigned-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-top: 1px solid var(--border-soft); font-size: 13px; }

/* Vistelse-tidslinje (inlämning/hämtning) */
.stay { padding: 30px 0 4px 90px; position: relative; }
.stay-label { position: absolute; left: 0; top: 34px; font-size: 12px; width: 86px; }
.stay-track { position: relative; height: 26px; border: 1px solid var(--border-strong); background: var(--panel); }
.stay-block { position: absolute; top: 0; bottom: 0; background: #5b9bd5; color: #fff; font-size: 12px; text-align: center; line-height: 24px; overflow: hidden; }
.stay-pin { position: absolute; top: -30px; bottom: -4px; width: 3px; }
.stay-pin span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); color: #fff; border-radius: 50%; width: 38px; height: 26px; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.stay-pin.in { background: #2d9e3a; }
.stay-pin.in span { background: #2d9e3a; }
.stay-pin.out { background: #f26522; }
.stay-pin.out span { background: #f26522; width: auto; padding: 0 6px; border-radius: 12px; }
.stay-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ============================================================
   Utskrifter
   ============================================================ */
.print-toolbar { position: sticky; top: 0; display: flex; gap: 8px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--border); z-index: 10; }
.print-options { max-width: 820px; margin: 10px auto; }
.print-page { background: #e6e8ea; padding: 20px 0 40px; min-height: 100vh; }
.doc {
    width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; padding: 18mm 16mm 14mm 20mm;
    box-shadow: 0 2px 12px rgba(0,0,0,.2); position: relative; font-size: 11.5pt; color: #000; display: flex; flex-direction: column;
}
.doc-barcode { position: absolute; left: 6mm; top: 110mm; writing-mode: vertical-rl; font-family: "Libre Barcode 39", monospace; letter-spacing: 2px; font-size: 9pt; color: #444; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; }
.doc-logo { max-height: 22mm; max-width: 80mm; object-fit: contain; }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 14pt; font-weight: 700; margin: 0 0 6px; }
.doc-kv td { padding: 1px 6px; }
.doc-kv td:first-child { font-weight: 600; }
.doc-kv td:last-child { text-align: right; }
.doc-kv.right { margin-left: auto; }
.doc-rule { border: none; border-top: 3px solid #888; margin: 8px 0; }
.doc hr { border: none; border-top: 1px solid #555; margin: 10px 0; }
.doc-info { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
.doc-info b { display: block; margin-top: 2px; }
.doc-address { padding-top: 2px; }
.doc-vehicle { display: flex; justify-content: space-between; gap: 20px; }
.dv-left { max-width: 55%; }
.doc-job { margin: 6px 0; }
.doc-lines { width: 100%; border-collapse: collapse; margin-top: 4px; }
.doc-lines th { text-align: left; font-style: italic; font-weight: 700; padding: 2px 4px; }
.doc-lines td { padding: 1px 4px; }
.doc-lines th:not(:first-child), .doc-lines td:not(:first-child) { text-align: right; }
.doc-lines.blank td { border-bottom: 1px solid #555; height: 22px; }
.doc-sum { display: flex; justify-content: flex-end; gap: 60px; margin-top: 6px; }
.doc-totals { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; }
.doc-terms .greeting { margin-top: 16px; }
.doc-totals .to-pay td { font-weight: 700; text-decoration: underline; padding-top: 8px; }
.doc-footer { margin-top: auto; border-top: 1px solid #333; padding-top: 6px; font-size: 8.5pt; }
.doc-footer-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.sign-line { margin-top: 40px; font-style: italic; }

@media print {
    @page { size: A4; margin: 0; }
    html, body { background: #fff; }
    .no-print, .print-toolbar, .topbar { display: none !important; }
    .print-page { padding: 0; background: #fff; }
    .doc { box-shadow: none; margin: 0; break-after: page; }
    .doc:last-child { break-after: auto; }
}
/* Flera dokumentsidor på skärmen får luft emellan */
.doc + .doc { margin-top: 20px; }

/* ============================================================
   Mörkt tema – aktiveras med <html data-theme="dark">
   Utskrifter (faktura m.m.) behåller vitt papper.
   ============================================================ */
:root[data-theme="dark"] {
    color-scheme: dark;
    --green: #2e9a5b;
    --green-dark: #3db06d;
    --green-light: #173826;
    --blue: #5aa2e0;
    --blue-light: #16304a;
    --orange: #e0961c;
    --orange-light: #3a2c12;
    --gray: #8b939b;
    --gray-light: #2a3038;
    --red: #e5605c;
    --text: #e4e8ec;
    --muted: #9aa4ae;
    --border: #353c45;
    --border-soft: #2b3139;
    --border-strong: #46505b;
    --bg: #14181d;
    --panel: #1c2128;
    --surface-2: #222830;
    --surface-3: #2c333c;
    --hover: #262d36;
    --hour-color: #8a949e;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .35);
}
:root[data-theme="dark"] .alert-error { background: #3a1a1a; border-color: #6e2b2b; color: #f3b8b5; }
:root[data-theme="dark"] .alert-warn { border-color: #6b5222; color: #f5cf87; }
:root[data-theme="dark"] .alert-ok { border-color: #2c5e3d; color: #a9d7b9; }
:root[data-theme="dark"] .alert-info { border-color: #2b4f73; color: #a9c9e8; }
:root[data-theme="dark"] .avatar { background: #4a3f1a; color: #f6e7b4; }
:root[data-theme="dark"] .stepper span { background: #3a1f1f; }
:root[data-theme="dark"] .tree-box { background: var(--surface-2); }
:root[data-theme="dark"] .tree-row.selected { background: #2f5a35; }
:root[data-theme="dark"] .day-head { background: #3a424c; color: var(--text); }
:root[data-theme="dark"] .day-head.today { background: #1d4f8c; color: #fff; }
:root[data-theme="dark"] .cap-bar { background: var(--surface-2); border-color: var(--border-strong); }
:root[data-theme="dark"] .cap-bar span { color: var(--text); }
:root[data-theme="dark"] .tl-resources { background: var(--surface-3); }
:root[data-theme="dark"] .bp-section.propose { background: #332c16; }
:root[data-theme="dark"] .cal-block.c-gray { background: var(--surface-3); }
:root[data-theme="dark"] .cal-block.c-done { background: #4a4f56; border-color: #9aa0a8; }
:root[data-theme="dark"] .blk-meta, :root[data-theme="dark"] .blk-notes { color: var(--muted); }
:root[data-theme="dark"] .proposal-block { background: rgba(46, 154, 91, .85); color: #fff; }
:root[data-theme="dark"] .break-band { background: repeating-linear-gradient(45deg, #2c333c, #2c333c 4px, #353c45 4px, #353c45 8px); }
:root[data-theme="dark"] .dayoff-block, :root[data-theme="dark"] .tl-dayoff { background: rgba(80, 88, 96, .55); }
:root[data-theme="dark"] .hero-search { background: linear-gradient(90deg, #2a2226, #2c333c 70%, #14181d); }
:root[data-theme="dark"] .empty-layout { background: linear-gradient(135deg, #14181d, #1c2128); }
:root[data-theme="dark"] .pill { border-color: #8a5a9a; color: #d9a8e8; }
:root[data-theme="dark"] .res-panel-head .icon-btn { color: #1c1404; }
:root[data-theme="dark"] .print-toolbar { background: var(--panel); }
:root[data-theme="dark"] .print-page { background: var(--bg); }
:root[data-theme="dark"] img.logo-preview, :root[data-theme="dark"] .brand img { background: #f5f6f7; border-radius: 4px; padding: 2px; }

/* ---------------- Temaväljare ---------------- */
.theme-toggle {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2);
    color: var(--text); cursor: pointer; font-family: inherit; font-size: 13px;
}
.theme-toggle:hover { background: var(--hover); }

/* ---------------- Kundtyp och formulärsektioner ---------------- */
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.type-option {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left;
    border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel);
    color: var(--text); cursor: pointer; font-family: inherit; font-size: 14px;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.type-option:hover { background: var(--hover); }
.type-option strong { display: block; font-weight: 600; }
.type-option small { display: block; color: var(--muted); font-size: 12px; }
.type-option .type-icon {
    width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-3); font-size: 17px; flex-shrink: 0;
}
.type-option.on { border-color: var(--green); background: var(--green-light); box-shadow: inset 0 0 0 1px var(--green); }
.type-option.on .type-icon { background: var(--green); }
.form-section { border: none; border-top: 1px solid var(--border); margin: 0 0 6px; padding: 8px 0 0; }
.form-section legend { padding: 0 8px 0 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Datum + tid i samma fält (bokningspanelen) */
.dt-pair { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; width: 100%; }
.dt-pair .input { min-width: 0; }

/* Antal + summa i "Sök och lägg till innehåll" */
.qty-row { display: flex; align-items: flex-end; gap: 24px; margin-top: 8px; }
.qty-total { display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; }
.qty-total strong { font-size: 18px; }

/* Filterrad ovanför listor */
.filter-bar { margin: 6px 0 16px; gap: 12px; }
.filter-bar select.input { max-width: 260px; }

.ao-notice { margin: 10px 20px 0; }

.sticky-actions { align-items: center; }
.sticky-hint { margin-right: auto; padding-left: 4px; }

/* Hopfällbara sektioner i bokningspanelen */
.bp-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; border-radius: 4px; margin: -4px -6px 8px; padding: 4px 6px; }
.bp-toggle:hover { background: var(--hover); }
.bp-caret { display: inline-block; width: 12px; color: var(--muted); }
.bp-section.collapsed > :not(h3):not(.row-between) { display: none; }
.bp-section.collapsed > .row-between > :not(h3) { display: none; }
.bp-section.collapsed .bp-toggle { margin-bottom: -4px; }

/* Hela dygnet: dagrubriker och tidsaxelns hörn ligger kvar överst när man scrollar */
.col-view .day-head { position: sticky; top: 0; z-index: 7; }
.col-view .day-head-spacer { position: sticky; top: 0; z-index: 8; background: var(--panel); }
.selected-resources { position: sticky; left: 0; }

/* Flytta bokningar med dra-och-släpp */
.cal-block.movable { cursor: grab; }
.cal-block.movable:active { cursor: grabbing; }
.cal-block > * { pointer-events: none; }          /* offset mäts mot själva blocket */
.cal-block.passthrough { pointer-events: none; opacity: .55; } /* släpp går igenom till rutnätet */

/* Ombokning – nuvarande tid med ✕ */
.booked-time { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 10px; background: var(--panel); }
.booked-time.released { border-style: dashed; }
.struck { text-decoration: line-through; color: var(--muted); }

/* Under dragning får lediga-tider-rutorna inte fånga släppet */
.free-slot.passthrough { pointer-events: none; }
.proposal-block { z-index: 9; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

.side-nav a.attention { color: var(--orange); font-weight: 600; }

/* Arbetsorder → bokning (chip i arbetsorderraden) */
.ao-divider { width: 1px; height: 22px; background: var(--border); }
.booking-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 16px;
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 13px;
    transition: background .15s, border-color .15s, transform .1s;
}
.booking-chip:hover { text-decoration: none; background: var(--hover); transform: translateY(-1px); }
.booking-chip .chip-icon { font-size: 14px; }
.booking-chip .chip-number { font-weight: 600; }
.booking-chip .chip-action { color: var(--muted); font-weight: 600; }
.booking-chip:hover .chip-action { color: var(--text); }
.booking-chip .res-code { font-size: 11px; min-width: 0; }
.booking-chip.planned { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.booking-chip.received { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.booking-chip.done { border-color: #8a8f96; box-shadow: inset 3px 0 0 #8a8f96; }
.booking-chip.unbooked { border-style: dashed; border-color: var(--orange); }
.booking-chip.unbooked .chip-action { color: var(--orange); }

/* Flera öppna arbetsordrar som flikar */
.sub-tabs { align-items: flex-end; min-width: 0; }
.ao-tabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; flex: 0 1 auto; scrollbar-width: thin; }
.ao-tabs .sub-tab { white-space: nowrap; padding: 9px 14px 9px 18px; }
.sub-tab .close { border-radius: 3px; padding: 0 3px; }
.sub-tab .close:hover { background: var(--hover); color: var(--red); }
/* Stängkryss syns på aktiv flik och när man hovrar över en flik */
.ao-tabs .sub-tab .close { visibility: hidden; }
.ao-tabs .sub-tab.on .close, .ao-tabs .sub-tab:hover .close { visibility: visible; }

/* "⋯"-menyn efter flikarna med "Stäng alla flikar" */
.tab-menu { position: relative; align-self: center; }
.tab-menu-btn {
    width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-strong);
    background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px; line-height: 1;
}
.tab-menu-btn:hover, .tab-menu-btn[aria-expanded="true"] { background: var(--hover); }
.tab-menu-backdrop { position: fixed; inset: 0; z-index: 59; }
.tab-menu-pop {
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 60;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 4px; min-width: 170px;
}
.tab-menu-pop button { display: block; width: 100%; text-align: left; padding: 9px 14px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 14px; color: var(--text); border-radius: 4px; }
.tab-menu-pop button:hover { background: var(--hover); }
.tab-menu-pop button.danger { color: var(--red); }

/* Kundsök med personnummer → kundnummer */
.lookup-box { margin-bottom: 4px; }
.lookup-box .input { flex: 1; width: auto; }
.identity-hit {
    display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 12px;
    padding: 12px 16px; border: 1px solid var(--green); border-radius: var(--radius); background: var(--green-light);
}
.identity-number { font-size: 18px; margin: 2px 0; }

/* ---------------- Serviceprotokoll ---------------- */
.sp-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; color: var(--muted); }
.sp-summary a { font-weight: 600; }
.sp-complete { color: var(--green); font-weight: 600; }
.sp-job { margin-top: 24px; scroll-margin-top: 80px; }
.sp-section { margin: 20px 0 8px; }
.sp-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); margin-bottom: 14px; }
.sp-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px minmax(200px, 40%); align-items: center; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--border-soft); }
.sp-row:first-child { border-top: none; }
.sp-row:hover { background: var(--hover); }
.sp-text { cursor: pointer; }
.sp-row.done .sp-text { color: var(--muted); }
.sp-check {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--panel);
    cursor: pointer; color: #fff; font-weight: 700; font-size: 13px; line-height: 1; padding: 0;
}
.sp-row.done .sp-check { background: var(--green); border-color: var(--green); }
.sp-check:disabled { cursor: default; opacity: .7; }
.sp-comment { padding: 5px 8px; }
.sp-remarks { margin-top: 20px; max-width: 760px; }
.sp-remarks textarea { margin: 6px 0 4px; }

/* Utskrift */
.sp-print-job { display: flex; gap: 40px; margin: 14px 0 8px; }
.sp-print-section { margin: 16px 0 6px; }
.sp-print-list { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
.sp-print-list td { padding: 2px 0; vertical-align: top; }
.sp-print-box { width: 30mm; text-align: center; }
.sp-print-box .box { display: inline-block; width: 13px; height: 13px; border: 1px solid #333; line-height: 12px; font-size: 11px; text-align: center; }
.sp-print-comment { font-style: italic; color: #444; font-size: 9.5pt; }
.sp-print-remarks, .sp-print-sign, .sp-print-warranty { margin: 18px 0; }
.sp-print-remarks .line, .sp-print-sign .line { border-bottom: 1px solid #555; min-height: 22px; margin-top: 4px; }
.sp-print-sign .line { max-width: 70%; }
.sp-print-warranty p { margin: 4px 0; }

/* ---------------- Inställningar → Serviceprotokoll ---------------- */
.tpl-list { border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0 12px; }
.tpl-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-top: 1px solid var(--border-soft); min-height: 44px; }
.tpl-row:first-child { border-top: none; }
.tpl-row:hover { background: var(--hover); }
.tpl-row.inactive .tpl-text { color: var(--muted); text-decoration: line-through; }
.tpl-row > .input { flex: 1; }
.tpl-move { display: inline-flex; flex-direction: column; }
.tpl-move .icon-btn { padding: 0 4px; font-size: 10px; line-height: 1.2; }
.tpl-text { flex: 1; cursor: text; }
.tpl-actions { display: inline-flex; align-items: center; gap: 8px; }
.tpl-row .switch { font-size: 12px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.icon-btn.danger:hover { color: var(--red); }
.tpl-add .input { flex: 1; width: auto; }
tr.inactive td { color: var(--muted); }
.code-chip, .word-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; margin: 2px 4px 2px 0;
    border-radius: 12px; font-size: 12px; border: 1px solid var(--blue); background: var(--blue-light);
}
.word-chip { border-color: var(--border-strong); background: var(--surface-2); font-style: italic; }
.code-chip.unknown { border-color: var(--orange); background: var(--orange-light); }
.chip-list { display: flex; flex-wrap: wrap; margin-top: 6px; }
.chip-x { border: none; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; }
.chip-x:hover { color: var(--red); }
.tpl-preview { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--green); background: var(--surface-2); border-radius: 4px; }

/* Verkstadens flikrad: Hem och "Ny arbetsorder" står fast, arbetsorderflikarna scrollar */
.sub-header { gap: 16px; }
.sub-header .sub-tabs { flex: 1; min-width: 0; }
.sub-header .search-box { flex-shrink: 0; }
.sub-tab.add { flex-shrink: 0; border-style: dashed; color: var(--green); font-weight: 600; background: var(--panel); }
.sub-tab.add:hover { background: var(--green-light); }
.sub-tabs > .sub-tab:first-child { flex-shrink: 0; }
.ao-tabs { mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.ao-tabs:not(:hover) { scrollbar-width: none; }

/* Formulärrad: fält och knappar på samma baslinje och lika höga */
.form-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.form-row .field { margin: 0; }
.form-row .input, .form-row .btn, .form-row .input-suffix span { height: 38px; }
.form-row .input-suffix span { display: inline-flex; align-items: center; }
.form-row-spacer { flex: 1; }
.w-220 { width: 220px; }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--hover); border-color: var(--border); }

/* Returplock */
.btn-group { display: inline-flex; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.action-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.doc .neg { font-weight: 600; }
.doc-note { font-size: 10pt; margin-top: 10px; }

.sub-tab .tab-sub { margin-left: 6px; font-size: 11px; color: var(--muted); }

/* ---------------- Min översikt: bokningskort ---------------- */
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.bk-card {
    --accent: var(--blue);
    display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 12px 18px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
    border-left: 4px solid var(--accent); transition: transform .12s, box-shadow .12s;
}
.bk-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.bk-card.s-received { --accent: var(--green); }
.bk-card.s-planned { --accent: var(--blue); }
.bk-card.s-noao { --accent: var(--orange); }
.bk-head { display: flex; justify-content: space-between; align-items: flex-start; }
.bk-time { display: flex; flex-direction: column; line-height: 1.1; }
.bk-clock { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.bk-day { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.bk-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bk-status {
    padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600;
    color: var(--accent); border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.bk-ao { font-size: 12px; color: var(--muted); }
.bk-vehicle { display: flex; align-items: center; gap: 12px; }
.plate {
    display: inline-flex; align-items: stretch; border: 2px solid #1d2228; border-radius: 4px; overflow: hidden;
    background: #fff; color: #111; font-weight: 700; font-size: 17px; letter-spacing: 1.5px; font-family: "Segoe UI", Arial, sans-serif;
    padding-right: 8px; white-space: nowrap;
}
.plate-eu { background: #1f4fa3; color: #ffd400; font-size: 10px; padding: 0 4px; margin-right: 7px; display: flex; align-items: flex-end; padding-bottom: 2px; letter-spacing: 0; }
.bk-model { line-height: 1.3; }
.bk-job { padding: 7px 10px; background: var(--surface-2); border-radius: 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 12px; color: var(--muted); }
.bk-flag { padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border-strong); color: var(--text); }
.bk-flag.warn { border-color: var(--orange); color: var(--orange); }
.bk-customer { display: flex; flex-direction: column; gap: 2px; font-size: 13px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.bk-name { font-weight: 600; font-size: 14px; }
.bk-customer a { color: var(--text); }
.bk-customer a:hover { color: var(--blue); }
.bk-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-actions { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* AO-specifikation: Nr och Benämning vänsterställda, siffror högerställda */
.doc-lines.spec th:nth-child(2), .doc-lines.spec td:nth-child(2) { text-align: left; }

/* ---------------- Fakturaöversikt ---------------- */
.inv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.inv-kpi {
    display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer; font-family: inherit;
    padding: 14px 18px; border: 1px solid var(--border); border-left: 5px solid var(--orange);
    border-radius: var(--radius); background: var(--panel); color: var(--text); box-shadow: var(--shadow);
    transition: transform .1s, border-color .1s;
}
.inv-kpi:hover { transform: translateY(-1px); }
.inv-kpi.danger { border-left-color: var(--red); }
.inv-kpi.ok { border-left-color: var(--green); }
.inv-kpi.on { border-color: var(--border-strong); outline: 2px solid var(--blue); outline-offset: -1px; }
.kpi-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--muted); }
.inv-kpi.danger .kpi-value { color: var(--red); }
.inv-table td { vertical-align: top; }
.inv-table tr.inv-overdue td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.inv-table tr.inv-credited td { color: var(--muted); }
.inv-table tr.inv-credited a { text-decoration: line-through; }
.inv-table tfoot td { border-top: 2px solid var(--border-strong); padding-top: 10px; }
.inv-actions { text-align: right; }
.inv-actions .tab-menu { display: inline-block; vertical-align: middle; }
.tab-menu-pop.right { left: auto; right: 0; transform: none; }
.tab-menu-pop .menu-link { display: block; padding: 9px 14px; color: var(--text); text-decoration: none; font-size: 14px; border-radius: 4px; }
.tab-menu-pop .menu-link:hover { background: var(--hover); }
.doc-type { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-top: 3px; background: var(--blue-light); color: var(--blue); }
.doc-type.t-cashnote { background: var(--green-light); color: var(--green-dark); }
.doc-type.t-creditnote { background: var(--gray-light); color: var(--gray); }
.pill-status { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill-status.s-unpaid { background: var(--orange-light); color: var(--orange); }
.pill-status.s-overdue { background: var(--red); color: #fff; }
.pill-status.s-paid { background: var(--green-light); color: var(--green-dark); }
.pill-status.s-credit { background: var(--gray-light); color: var(--gray); }
.txt-danger { color: var(--red); font-weight: 600; }
.txt-warn { color: var(--orange); font-weight: 600; }
.pay-amount { display: flex; flex-direction: column; align-items: center; padding: 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--surface-2); }
.pay-amount strong { font-size: 30px; font-variant-numeric: tabular-nums; }
ol.steps { margin: 8px 0 0 18px; padding: 0; }
ol.steps li { margin: 4px 0; }
.wo-invoice-btn { display: inline-flex; align-items: center; gap: 8px; }
.print-stamp { display: inline-block; border: 3px solid currentColor; color: #b00; font-weight: 800; letter-spacing: .1em; padding: 4px 12px; transform: rotate(-4deg); margin: 6px 0; }
.print-stamp.paid { color: #1a7f37; }

/* ---------------- Bokningspanel: tidskort ---------------- */
.bp-section.propose { display: flex; flex-direction: column; gap: 10px; }
.slot-card {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
    padding: 10px 12px; background: var(--panel); border: 1px solid var(--border);
    border-left: 4px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow);
}
.slot-card.proposal { border-left-color: var(--green); }
.slot-card.released { border-style: dashed; border-left-style: solid; border-left-color: var(--gray); opacity: .75; }
.slot-card.empty { grid-template-columns: 1fr; border-left-color: var(--orange); }
.slot-date {
    display: flex; flex-direction: column; align-items: center; justify-content: center; width: 50px;
    border-radius: 8px; background: var(--surface-2); padding: 4px 0; line-height: 1.1;
    font-size: 11px; text-transform: uppercase; color: var(--muted);
}
.slot-date strong { font-size: 22px; color: var(--text); }
.slot-card.proposal .slot-date { background: var(--green-light); }
.slot-card.booked:not(.released) .slot-date { background: var(--blue-light); }
.slot-main { min-width: 0; }
.slot-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.slot-time { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-dur { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.slot-res { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-res .avatar { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 10px; font-weight: 700; }
.slot-action { align-self: center; white-space: nowrap; }
.slot-hint { font-size: 12px; color: var(--muted); margin-top: -4px; }
.slot-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.propose .period-drag {
    display: inline-flex; align-items: center; gap: 10px; min-width: 0; margin: 0; padding: 8px 14px;
    font-size: 15px; border-radius: 8px; border: none; background: var(--blue); box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.period-drag .grip { opacity: .7; font-size: 16px; }
.period-drag .drag-dur { font-size: 12px; font-weight: 500; opacity: .85; }
.stepper { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.stepper button { border: none; background: var(--surface-2); width: 32px; font-size: 16px; cursor: pointer; color: var(--text); }
.stepper button:hover { background: var(--hover); }
.stepper input { width: 64px; border: none; text-align: center; font: inherit; background: transparent; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.slot-search .inline { margin-top: 6px; }
@media (max-width: 480px) { .slot-card { grid-template-columns: auto 1fr; } .slot-action { grid-column: 1 / -1; } }

.period-compare { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.period-compare strong { color: var(--text); }
.period-compare .arrow { opacity: .6; }
.period-compare .diff { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--gray-light); color: var(--gray); }
.period-compare .diff.plus { background: var(--orange-light); color: var(--orange); }
.period-compare .diff.minus { background: var(--blue-light); color: var(--blue); }

/* Bokningskort – större storlek (läsbart på avstånd i verkstaden) */
.bk-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; }
.bk-card { gap: 16px; padding: 20px 22px 18px 24px; border-left-width: 6px; border-radius: 14px; }
.bk-clock { font-size: 36px; }
.bk-day { font-size: 14px; }
.bk-status { font-size: 14px; padding: 4px 14px; border-radius: 14px; }
.bk-ao { font-size: 14px; }
.bk-vehicle { gap: 16px; }
.bk-vehicle .plate { font-size: 24px; letter-spacing: 2px; border-width: 2.5px; padding-right: 10px; }
.bk-vehicle .plate-eu { font-size: 12px; padding: 0 5px 3px; margin-right: 9px; }
.bk-model { font-size: 17px; }
.bk-model .muted, .bk-model small { font-size: 14px; }
.bk-job { font-size: 16px; padding: 10px 14px; border-radius: 8px; }
.bk-meta { font-size: 14px; gap: 10px 16px; }
.bk-flag { font-size: 13px; padding: 2px 10px; }
.bk-customer { font-size: 15px; gap: 5px; padding-top: 14px; }
.bk-name { font-size: 18px; }
.bk-actions .btn { font-size: 15px; padding: 9px 18px; }
.bk-actions a:not(.btn), .bk-actions .link-btn { font-size: 15px; }
@media (max-width: 480px) { .bk-grid { grid-template-columns: 1fr; } }

.slot-same { font-size: 12px; color: var(--muted); white-space: nowrap; padding: 0 6px; }

/* Stabil layout när perioderna ändras (inget hoppar i sidled) */
.slot-card { grid-template-columns: auto 1fr 132px; }
.slot-card.empty { grid-template-columns: 1fr; }
.slot-action, .slot-same { justify-self: end; }
.slot-card .slot-action.btn { width: 132px; justify-content: center; text-align: center; }
.slot-time, .slot-dur, .propose .period-drag, .stepper input { font-variant-numeric: tabular-nums; }
.propose .period-drag { width: 190px; justify-content: flex-start; }
.period-drag .drag-dur { margin-left: auto; }
@media (max-width: 480px) { .slot-card { grid-template-columns: auto 1fr; } .slot-card .slot-action.btn { width: 100%; } }

.inv-actions .tab-menu-pop { text-align: left; min-width: 210px; }
.tab-menu-pop .menu-link, .tab-menu-pop button { display: flex; align-items: center; gap: 10px; text-align: left; white-space: nowrap; }
.tab-menu-pop .mi { width: 18px; text-align: center; flex: none; }
.tab-menu-pop hr { border: none; border-top: 1px solid var(--border-soft); margin: 4px 0; }

.user-chip {
    display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; white-space: nowrap;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip.on { border-color: var(--blue); background: var(--blue-light); }
.user-chip .avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 10px; font-weight: 700; }
.user-select { width: auto; min-width: 180px; }

/* Handläggare i arbetsorderns huvud */
.handler-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 4px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; white-space: nowrap;
}
.handler-chip.mine { border-color: var(--green); background: var(--green-light); }
.handler-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-left: 8px; }
.handler-chip .avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; }
.handler-chip.mine .avatar { background: var(--green); }
.handler-chip .you { font-size: 11px; font-weight: 700; color: var(--green-dark); background: var(--panel); border-radius: 999px; padding: 0 7px; }
.link-btn.small { font-size: 13px; }

/* Fakturadokument på arbetsorderns händelser */
.form-actions { flex-wrap: wrap; row-gap: 8px; }
.wo-docs { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; align-items: flex-start; }
.wo-docs-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.wo-doc {
    display: grid; grid-template-columns: 24px minmax(180px, auto) 110px auto 24px; align-items: center; gap: 10px;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
    color: var(--text); text-decoration: none; width: 100%; max-width: 560px;
}
.wo-doc:hover { border-color: var(--border-strong); background: var(--hover); }
.wo-doc.current { border-left: 4px solid var(--green); }
.wo-doc.old { opacity: .75; font-size: 13px; }
.wo-doc .doc-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.wo-doc .doc-go { opacity: .5; text-align: right; }

/* Webbokningar */
.web-card .bk-actions { gap: 8px; }
.web-card.past { --accent: var(--red); }
.web-card.past .bk-day { color: var(--red); font-weight: 600; }
.web-source { font-weight: 600; }
.web-note { font-size: 15px; padding: 8px 12px; border-left: 3px solid var(--border-strong); color: var(--muted); font-style: italic; }
.web-missing { color: var(--orange); font-size: 14px; }

/* Meddela kund */
.msg-to { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.msg-to-item { padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.msg-to-item.missing { color: var(--orange); border-color: var(--orange); background: var(--orange-light); }
.msg-text { width: 100%; min-height: 48vh; resize: vertical; font-size: 16px; line-height: 1.6; padding: 14px 16px; font-family: inherit; }
.msg-foot-info { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.msg-copied { color: var(--green); font-weight: 700; }

.invoice-blocker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.invoice-blocker .btn { margin-left: auto; }

/* ---------------- Responsivt ---------------- */
@media (max-width: 900px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
    .side-nav { width: 170px; }
    .booking-panel { position: fixed; right: 0; top: 56px; bottom: 0; max-height: none; z-index: 45; width: min(460px, 100vw); }
    .job-grid { grid-template-columns: 1fr; }
    .split { grid-template-columns: 1fr; }
}
