:root {
    --ink: #172026;
    --muted: #64707a;
    --line: #d9e0e5;
    --surface: #ffffff;
    --page: #f4f6f7;
    --blue: #1c6dd0;
    --green: #207a48;
    --amber: #a86400;
    --red: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); font-family: Arial, Helvetica, sans-serif; }
body { overflow-x: hidden; }
.page a:not(.button):not(.status), .page a:not(.button):not(.status):visited { color: var(--ink); }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: #172026; color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-head, .topbar-tools { display: contents; }
.brand, .brand:visited { color: #fff; flex: 0 0 160px; font-size: 22px; font-weight: 700; text-decoration: none; }
.brand { order: 0; }
.site-nav { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 8px; justify-content: center; order: 1; }
.site-nav a, .site-nav a:visited { color: #e8eef2; padding: 8px 10px; text-decoration: none; border-radius: 6px; }
.site-nav a:hover { background: rgba(255,255,255,.14); }
.global-search { flex: 0 0 42px; height: 38px; position: relative; z-index: 11; }
.global-search { order: 2; }
.global-search::before { color: #fff; content: "\1F50D"; font-size: 17px; left: 12px; pointer-events: none; position: absolute; top: 9px; z-index: 1; }
.global-search input { background: rgba(255,255,255,.12); border-color: transparent; color: transparent; min-height: 38px; padding-left: 36px; position: absolute; right: 0; top: 0; transition: background .18s ease, color .18s ease, width .18s ease; width: 42px; }
.global-search:hover input, .global-search:focus-within input { width: 280px; }
.global-search:hover input, .global-search:focus-within input { background: #fff; border-color: #b8c3cc; color: var(--ink); }
.global-search input::placeholder { color: transparent; }
.global-search:hover input::placeholder, .global-search:focus-within input::placeholder { color: var(--muted); }
.global-search-results { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 32px rgba(23,32,38,.22); display: none; left: auto; max-height: 360px; overflow: auto; padding: 6px; position: absolute; right: 0; top: calc(100% + 6px); width: 280px; z-index: 45; }
.global-search-results.is-open { display: block; }
.global-search-results a, .global-search-results a:visited { border-radius: 6px; color: var(--ink); display: block; padding: 8px; text-decoration: none; }
.global-search-results a:hover { background: #eef3f7; }
.global-search-results strong { display: block; font-size: 14px; }
.global-search-results span, .search-empty { color: var(--muted); display: block; font-size: 12px; padding-top: 2px; }
.search-empty { padding: 8px; }
.user-menu { flex: 0 0 auto; position: relative; }
.user-menu { order: 3; }
.mobile-nav-button { display: none; }
.gear-button { background: rgba(255,255,255,.12); border-radius: 999px; font-size: 18px; min-height: 38px; padding: 7px 10px; }
.gear-button:hover { background: rgba(255,255,255,.22); }
.user-menu-panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 32px rgba(23,32,38,.22); display: none; min-width: 170px; padding: 6px; position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; }
.user-menu:not(.is-open) .user-menu-panel { display: none !important; }
.user-menu.is-open .user-menu-panel { display: block; }
.user-menu-panel a, .user-menu-panel a:visited { border-radius: 6px; color: var(--ink); display: block; padding: 9px; text-decoration: none; }
.user-menu-panel a:hover { background: #eef3f7; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1 { margin: 0 0 18px; font-size: 30px; }
h2 { margin: 0 0 12px; font-size: 20px; }
.page-links a, .page-links a:visited { color: var(--ink); }
.title-button { background: transparent; color: var(--ink); font-size: inherit; font-weight: 700; min-height: 0; padding: 0; text-align: left; }
.title-button:hover { color: var(--blue); text-decoration: underline; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tabs a, .tabs a:visited { background: #e9eef2; border-radius: 6px; color: var(--ink); padding: 9px 12px; text-decoration: none; }
.tabs a.is-active, .tabs a.is-active:visited { background: var(--blue); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.metric { font-size: 34px; font-weight: 700; margin-top: 6px; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
tr[data-row-href], tr[data-row-modal] { cursor: pointer; }
tr[data-row-href]:hover td, tr[data-row-modal]:hover td { background: #eef3f7; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #e9eef2; }
.sort-link, .sort-link:visited { color: var(--ink); text-decoration: none; }
.sort-link:hover { text-decoration: underline; }
.equipment-preview { color: var(--muted); font-size: 12px; line-height: 1.35; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.button, .button:visited, button, input[type=submit] { display: inline-block; border: 0; border-radius: 6px; background: var(--blue); color: #fff; min-height: 40px; padding: 9px 12px; font-size: 15px; line-height: 1.2; text-decoration: none; cursor: pointer; touch-action: manipulation; }
.button.secondary, button.secondary { background: #4d5b66; }
.button.danger-button, button.danger-button, input[type=submit].danger-button { background: var(--red); }
.small-button { min-height: 34px; padding: 6px 9px; font-size: 13px; margin-top: 5px; }
.quiet-button { background: #eef3f7; color: var(--ink); min-height: 30px; padding: 5px 8px; }
.quiet-button:hover { background: #dfe7ed; }
.row-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions .button, .row-actions .small-button, .row-actions .inline-form { margin-top: 0; }
.row-actions .button, .row-actions button { align-items: center; display: inline-flex; justify-content: center; }
.row-action-menu { position: relative; }
.row-action-toggle { align-items: center; background: #4d5b66; display: inline-flex; font-size: 18px; justify-content: center; min-height: 34px; padding: 5px 8px; }
.row-action-menu > .row-actions { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(23,32,38,.18); display: none; min-width: 124px; padding: 6px; position: absolute; right: 0; top: calc(100% + 5px); z-index: 30; }
.row-action-menu.is-open > .row-actions { display: flex; flex-direction: column; }
.row-action-menu .small-button { font-size: 12px; min-height: 32px; padding: 6px 8px; width: 100%; }
.button.subhire-button, button.subhire-button { background: #006d77; }
.button.subhire-button:hover, button.subhire-button:hover { background: #005862; }
.status { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 13px; font-weight: 700; }
.status.available, .status.confirmed, .status.completed, .status.resolved, .status.received, .status.finalized, .status.exported, .status.invoiced, .status.connected, .status.sent, .status.paid { color: #fff; background: var(--green); }
.status.warning, .status.draft, .status.needed, .status.requested, .status.ready, .status.draftcreated, .status.planned, .status.notready { color: #fff; background: var(--amber); }
.status.cancelled,
.status.canceled,
.status.inactive { color: #fff; background: #4d5b66; }
.status.fault, .status.workshop, .status.critical, .status.faultreported, .status.awaitingparts { color: #fff; background: var(--red); }
.status.error { color: #fff; background: var(--red); }
.status-line { margin: 0 0 16px; }
.status-picker { display: inline-block; margin-left: 6px; position: relative; vertical-align: middle; }
.status-button { border: 0; cursor: pointer; min-height: 0; padding: 3px 8px; }
.status-popover { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(23,32,38,.18); display: none; left: 0; min-width: 150px; padding: 6px; position: absolute; top: calc(100% + 6px); z-index: 12; }
.status-popover.is-open { display: block; }
.status-popover form { display: block; }
.status-option { background: transparent; border-radius: 6px; color: var(--ink); display: block; font-size: 14px; min-height: 34px; padding: 7px 9px; text-align: left; width: 100%; }
.status-option:hover { background: #eef3f7; }
.status-option:disabled { color: var(--muted); cursor: default; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.form-grid p { position: relative; }
label { display: block; font-weight: 700; margin-bottom: 6px; }
label input[type=checkbox] { margin: 0 7px 0 0; min-height: 0; width: auto; vertical-align: middle; }
input, select, textarea { width: 100%; border: 1px solid #b8c3cc; border-radius: 6px; min-height: 42px; padding: 9px; font: inherit; }
textarea { min-height: 84px; }
.room-picker { position: relative; }
.room-picker > label { display: block; font-weight: 700; margin-bottom: 6px; }
.room-picker-toggle { background: #fff; border: 1px solid #b8c3cc; color: var(--ink); display: flex; justify-content: space-between; min-height: 42px; overflow: hidden; text-align: left; width: 100%; }
.room-picker-toggle::after { color: var(--muted); content: "v"; flex: 0 0 auto; padding-left: 8px; }
.room-picker-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-picker-menu { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(23,32,38,.18); display: none; left: 0; margin-top: 5px; max-height: 360px; overflow: auto; padding: 8px; position: absolute; right: 0; z-index: 35; }
.room-picker.is-open .room-picker-menu { display: block; }
.room-picker-options { margin: 8px 0; }
.room-choice { align-items: center; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; margin: 0; padding: 8px; }
.room-choice:hover { background: #eef3f7; }
.room-choice input { flex: 0 0 auto; min-height: 0; width: auto; }
.room-choice span { font-weight: 400; }
.category-suggest { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(23,32,38,.16); display: none; margin-top: 4px; max-height: 180px; overflow: auto; padding: 5px; position: absolute; width: min(320px, 100%); z-index: 30; }
.category-suggest.is-open { display: block; }
.category-suggest button { background: transparent; border-radius: 6px; color: var(--ink); display: block; min-height: 32px; padding: 6px 8px; text-align: left; width: 100%; }
.category-suggest button:hover { background: #eef3f7; }
.product-picker { border: 1px solid var(--line); border-radius: 8px; max-height: 310px; overflow: auto; padding: 6px; }
.product-choice { align-items: center; border-radius: 6px; cursor: pointer; display: flex; gap: 10px; margin: 0; padding: 9px; position: relative; }
.product-choice:hover { background: #eef3f7; }
.product-choice input {
    appearance: none;
    border: 0;
    height: 0;
    margin: 0;
    min-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 0;
}
.product-choice:has(input:checked) { background: #e6f0fb; outline: 2px solid rgba(28,109,208,.25); }
.product-choice:has(input:checked)::after { color: var(--blue); content: "Valgt"; font-size: 12px; font-weight: 700; margin-left: auto; }
.notice { border-left: 5px solid var(--amber); background: #fff7e8; padding: 12px; margin-bottom: 14px; }
.danger-row td { background: #ffe9e7; border-bottom-color: #f1aaa4; }
.money-good { color: var(--green); font-weight: 700; }
.money-bad { color: var(--red); font-weight: 700; }
.coverage-pill { align-items: center; border-radius: 999px; color: #fff; display: inline-flex; font-size: 12px; font-weight: 700; gap: 5px; min-height: 24px; padding: 3px 8px; white-space: nowrap; }
.coverage-good { background: var(--green); }
.coverage-pending { background: var(--amber); }
.coverage-bad { background: var(--red); }
.booking-total-summary { display: none; }
.danger-note { background: #ffe9e7; border-left: 5px solid var(--red); color: var(--red); font-weight: 700; margin-bottom: 14px; padding: 12px; }
.inline-form { display: inline; }
.link-button { display: inline; background: transparent; color: var(--red); padding: 0 0 0 6px; font-size: 13px; text-decoration: underline; }
.compact-form { min-width: 260px; max-width: 380px; }
.wide { grid-column: 1 / -1; }
summary { cursor: pointer; color: var(--blue); font-weight: 700; }
.modal-backdrop { align-items: center; background: rgba(23,32,38,.54); bottom: 0; display: none; justify-content: center; left: 0; padding: 24px; position: fixed; right: 0; top: 0; z-index: 20; }
.modal-backdrop.is-open { display: flex; }
.modal-window { background: #fff; border-radius: 8px; box-shadow: 0 18px 48px rgba(0,0,0,.28); max-height: 90vh; max-width: 760px; overflow: auto; padding: 18px; width: min(760px, 100%); }
.modal-header { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; margin: -4px 0 14px; padding-bottom: 10px; }
.modal-close { background: #4d5b66; padding: 6px 10px; }
.history-block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.history-block h3 { font-size: 16px; margin: 0 0 10px; }
.history-entry { font-size: 13px; line-height: 1.35; margin: 0 0 7px; }
.history-block p { margin: 0 0 7px; }
.history-more { margin-top: 4px; }
.history-more summary { color: var(--muted); font-size: 13px; }
.report-preview-surface { background: #fff; border: 1px solid var(--line); box-shadow: inset 0 0 0 1px rgba(0,0,0,.02); height: 297mm; margin: 8px auto 0; max-height: 720px; max-width: 100%; overflow: hidden; position: relative; transform-origin: top left; width: 210mm; }
.report-preview-element { border: 1px dashed rgba(47,111,47,.35); box-sizing: border-box; line-height: 1.25; overflow: hidden; padding: 1.5mm; position: absolute; white-space: pre-wrap; }
.report-preview-qr { align-items: center; background: repeating-linear-gradient(45deg,#111 0 3px,#fff 3px 6px); color: transparent; display: flex; justify-content: center; }
.report-preview-table { background: #f5f7f8; border-style: solid; }
.report-preview-line { border: 0; border-top: 2px solid currentColor; height: 0 !important; padding: 0; }
@media (max-width: 720px) {
    body { font-size: 16px; }
    .topbar { align-items: stretch; flex-direction: column; gap: 8px; max-width: 100vw; overflow: visible; padding: 10px 12px; }
    .topbar-head { align-items: center; display: flex; justify-content: space-between; min-height: 38px; }
    .topbar-tools { align-items: center; display: flex; gap: 8px; }
    .brand { flex: 1 1 auto; flex-basis: auto; font-size: 20px; min-width: 0; order: initial; }
    .site-nav { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 32px rgba(23,32,38,.22); display: none; flex: 0 0 auto; flex-direction: column; flex-wrap: nowrap; gap: 2px; justify-content: flex-start; margin: 0; max-width: calc(100vw - 24px); min-width: 190px; order: initial; overflow: visible; padding: 6px; position: absolute; right: 12px; top: calc(100% + 6px); width: min(260px, calc(100vw - 24px)); z-index: 44; }
    .site-nav.is-open { display: flex; }
    .site-nav a, .site-nav a:visited { background: transparent; color: var(--ink); flex: 0 0 auto; font-size: 15px; min-height: 38px; min-width: 0; padding: 10px 11px; text-align: left; white-space: normal; }
    .site-nav a:hover { background: #eef3f7; }
    .global-search { flex: 1 1 auto; height: 42px; order: initial; width: auto; }
    .global-search input, .global-search:hover input, .global-search:focus-within input { background: #fff; border-color: #b8c3cc; color: var(--ink); position: static; width: 100%; }
    .global-search input::placeholder { color: var(--muted); }
    .global-search-results { left: 0; right: 0; width: auto; }
    .mobile-nav-button { align-items: center; background: rgba(255,255,255,.12); display: inline-flex; flex: 0 0 46px; font-size: 24px; justify-content: center; min-height: 42px; padding: 6px 10px; }
    .mobile-nav-button:hover { background: rgba(255,255,255,.22); }
    .user-menu { flex: 0 0 auto; order: initial; position: relative; right: auto; top: auto; }
    .user-menu-panel { display: none; right: 0; }
    .user-menu:not(.is-open) .user-menu-panel { display: none !important; }
    .user-menu.is-open .user-menu-panel { display: block !important; }
    .topbar span { color: #cfd9df; font-size: 14px; }
    .page { padding: 12px; }
    h1 { font-size: 24px; margin-bottom: 12px; }
    h2 { font-size: 18px; }
    .grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 12px; }
    .card { border-radius: 6px; margin-bottom: 10px; padding: 12px; }
    .metric { font-size: 28px; }
    .actions { gap: 8px; margin: 10px 0; }
    .actions .button, .actions button, .actions input[type=submit] { flex: 1 1 auto; }
    .button, button, input[type=submit] { min-height: 44px; padding: 11px 13px; }
    .small-button { min-height: 40px; padding: 9px 10px; }
    table { display: block; font-size: 14px; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    th, td { padding: 9px 8px; min-width: 110px; }
    td:first-child, th:first-child { min-width: 150px; }
    .overview-bookings-table, .booking-equipment-table, .booking-subhire-table, .capacity-table { display: table; font-size: 12px; table-layout: fixed; }
    .overview-bookings-table th, .overview-bookings-table td, .booking-equipment-table th, .booking-equipment-table td, .booking-subhire-table th, .booking-subhire-table td, .capacity-table th, .capacity-table td { min-width: 0; overflow-wrap: anywhere; padding: 6px 5px; }
    .customer-bookings-table, .customer-equipment-table { display: table; font-size: 12px; table-layout: fixed; }
    .customer-bookings-table th, .customer-bookings-table td, .customer-equipment-table th, .customer-equipment-table td { min-width: 0; overflow-wrap: anywhere; padding: 6px 5px; }
    .overview-bookings-table th:nth-child(4), .overview-bookings-table td:nth-child(4),
    .overview-bookings-table th:nth-child(5), .overview-bookings-table td:nth-child(5),
    .overview-bookings-table th:nth-child(6), .overview-bookings-table td:nth-child(6),
    .overview-bookings-table th:nth-child(7), .overview-bookings-table td:nth-child(7) { display: none; }
    .overview-bookings-table th:first-child, .overview-bookings-table td:first-child { width: 25%; }
    .overview-bookings-table th:nth-child(2), .overview-bookings-table td:nth-child(2) { width: 40%; }
    .booking-equipment-table th:nth-child(3), .booking-equipment-table td:nth-child(3),
    .booking-equipment-table th:nth-child(4), .booking-equipment-table td:nth-child(4),
    .booking-equipment-table th:nth-child(5), .booking-equipment-table td:nth-child(5),
    .booking-equipment-table th:nth-child(6), .booking-equipment-table td:nth-child(6),
    .booking-equipment-table th:nth-child(8), .booking-equipment-table td:nth-child(8),
    .booking-equipment-table th:nth-child(9), .booking-equipment-table td:nth-child(9) { display: none; }
    .booking-equipment-table th:first-child, .booking-equipment-table td:first-child { width: 40%; }
    .booking-equipment-table th:nth-child(2), .booking-equipment-table td:nth-child(2) { width: 14%; }
    .booking-equipment-table th:nth-child(7), .booking-equipment-table td:nth-child(7) { width: 16%; }
    .booking-equipment-table th:nth-child(10), .booking-equipment-table td:nth-child(10) { width: 18%; }
    .booking-equipment-table th:nth-child(11), .booking-equipment-table td:nth-child(11) { width: 12%; }
    .booking-subhire-table th:nth-child(4), .booking-subhire-table td:nth-child(4),
    .booking-subhire-table th:nth-child(6), .booking-subhire-table td:nth-child(6) { display: none; }
    .booking-subhire-table th:first-child, .booking-subhire-table td:first-child { width: 34%; }
    .booking-subhire-table th:nth-child(2), .booking-subhire-table td:nth-child(2) { width: 13%; }
    .booking-subhire-table th:nth-child(3), .booking-subhire-table td:nth-child(3) { width: 32%; }
    .booking-subhire-table th:nth-child(5), .booking-subhire-table td:nth-child(5) { width: 21%; }
    .coverage-pill { border-radius: 999px; justify-content: center; min-height: 28px; min-width: 28px; padding: 4px; }
    .coverage-text { display: none; }
    .row-action-menu { display: inline-block; }
    .booking-total-row { display: none; }
    .booking-total-summary { background: #eef3f7; border: 1px solid var(--line); border-radius: 6px; display: grid; font-size: 13px; gap: 4px; margin-top: 8px; padding: 8px; }
    .capacity-table th:nth-child(2), .capacity-table td:nth-child(2) { display: none; }
    .capacity-table th:first-child, .capacity-table td:first-child { width: 38%; }
    .customer-bookings-table th:nth-child(4), .customer-bookings-table td:nth-child(4),
    .customer-bookings-table th:nth-child(5), .customer-bookings-table td:nth-child(5),
    .customer-bookings-table th:nth-child(6), .customer-bookings-table td:nth-child(6) { display: none; }
    .customer-bookings-table th:first-child, .customer-bookings-table td:first-child { width: 24%; }
    .customer-bookings-table th:nth-child(2), .customer-bookings-table td:nth-child(2) { width: 38%; }
    .customer-equipment-table th:nth-child(2), .customer-equipment-table td:nth-child(2),
    .customer-equipment-table th:nth-child(5), .customer-equipment-table td:nth-child(5),
    .customer-equipment-table th:nth-child(8), .customer-equipment-table td:nth-child(8) { display: none; }
    .customer-equipment-table th:first-child, .customer-equipment-table td:first-child { width: 25%; }
    .customer-equipment-table th:nth-child(3), .customer-equipment-table td:nth-child(3) { width: 31%; }
    .form-grid { grid-template-columns: 1fr; gap: 8px; }
    .compact-form { max-width: none; min-width: 0; width: 100%; }
    .inline-form { display: inline-block; margin-top: 4px; }
    .link-button { min-height: 34px; padding: 4px 0 4px 6px; }
    .modal-backdrop { align-items: flex-start; padding: 0; }
    .modal-window { border-radius: 0; box-shadow: none; max-height: 100vh; min-height: 100vh; padding: 14px; width: 100%; }
    .modal-header { position: sticky; top: -14px; z-index: 1; background: #fff; margin: -14px -14px 12px; padding: 12px 14px; }
    .modal-header h2 { margin: 0; padding-right: 8px; }
    .modal-close { flex: 0 0 auto; min-height: 40px; }
    .status { font-size: 12px; }
    .report-preview-surface { height: 420px; width: 100%; }
}
