:root {
    --bg:          #1e1e1e;
    --surface:     #282828;
    --surface-2:   #333333;
    --surface-3:   #3d3d3d;
    --border:      rgba(255, 255, 255, 0.09);
    --text:        #e8e8e8;
    --muted:       #9aa0a6;
    --accent:      #f5a623;
    --accent-dim:  rgba(245, 166, 35, 0.15);
    --radius:      14px;
    --radius-sm:   9px;
    --dep-default: #9aa5b1;
}

[data-dep="Elektra"]       { --dep: #f4c430; }
[data-dep="Sanitair"]      { --dep: #3ba7e8; }
[data-dep="Verf"]          { --dep: #c07bf0; }
[data-dep="Ijzerwaren"]    { --dep: #9aa5b1; }
[data-dep="Hout en bouw"]  { --dep: #7cc36a; }

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

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.45;
    min-height: 100vh;
    padding: 0 16px calc(env(safe-area-inset-bottom) + 32px);
    -webkit-font-smoothing: antialiased;
}

.topbar {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 4px 12px;
    text-align: center;
}

.title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.subtitle {
    color: var(--muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

.finder {
    max-width: 720px;
    margin: 0 auto;
}

.search-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px 0;
    background:
        linear-gradient(to bottom, var(--bg) 70%, rgba(30, 30, 30, 0));
}

.search-input {
    width: 100%;
    height: 54px;
    padding: 0 46px 0 18px;
    font-size: 1.1rem;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    background: var(--surface-2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.clear-btn:hover { color: var(--text); }
.clear-btn[hidden] { display: none; }


.status {
    min-height: 20px;
    padding: 2px 4px 8px;
    color: var(--muted);
    font-size: 0.85rem;
}


.results {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.result-name {
    font-size: 1.08rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.result-name mark {
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 3px;
    padding: 0 1px;
}

.locs {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.loc {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 7px 10px;
    background-color: var(--surface-2);
    border-radius: var(--radius-sm);
    font-size: 0.98rem;
}

.loc.is-primary {
    background-color: var(--accent-dim);
    box-shadow: inset 0 0 0 1px rgba(245, 166, 35, 0.35);
}

.dep-dot {
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: var(--dep, var(--dep-default));
}

.loc-name {
    font-weight: 600;
}

.dep-name {
    color: var(--muted);
    font-size: 0.85rem;
}

.tag-primary,
.tag-alt {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.tag-primary {
    color: #1e1e1e;
    background-color: var(--accent);
}

.tag-alt {
    color: var(--muted);
    background-color: var(--surface-3);
}


.empty {
    padding: 40px 8px;
    text-align: center;
    color: var(--muted);
}

.empty .muted {
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.75;
}

.datawarn {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background-color: rgba(220, 80, 60, 0.12);
    border: 1px solid rgba(220, 80, 60, 0.35);
    color: #f0b6ac;
    font-size: 0.9rem;
}

.datawarn code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 4px;
}


@media (min-width: 640px) {
    .title    { font-size: 1.9rem; }
    .topbar   { padding-top: 40px; }
}

@media (hover: none) {
    .clear-btn:hover { color: var(--muted); }
}


.topbar {
    position: relative;
}

.back-link {
    position: absolute;
    top: 30px;
    left: 4px;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
}

.back-link:hover {
    color: var(--text);
    background-color: var(--surface-2);
}

.home {
    max-width: 720px;
    margin: 0 auto;
    padding-top: 8px;
}

.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background-color: var(--surface-2);
}

.card:active {
    transform: translateY(0);
}

.card.is-disabled {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.card-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background-color: var(--accent-dim);
    border-radius: var(--radius-sm);
}

.card.is-disabled .card-icon {
    color: var(--muted);
    background-color: var(--surface-3);
}

.card-icon svg {
    width: 24px;
    height: 24px;
}

.card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card-desc {
    color: var(--muted);
    font-size: 0.9rem;
}

.card-arrow {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 1.3rem;
    transition: transform 0.12s ease, color 0.12s ease;
}

.card:hover .card-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

.badge-soon {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--muted);
    background-color: var(--surface-3);
}

@media (min-width: 640px) {
    .cards {
        grid-template-columns: 1fr 1fr;
    }
    .back-link { top: 42px; }
}

.userbar {
    text-align: right;
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.userbar a { color: var(--accent); text-decoration: none; }
.userbar a:hover { text-decoration: underline; }

.muted { color: var(--muted); }

.admin {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
}

.admin .panel { margin-bottom: 0; }

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.hint { font-weight: 400; opacity: 0.8; }

.field-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    font-size: 1rem;
    color: var(--text);
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

select.field-input { appearance: auto; -webkit-appearance: auto; }

textarea.field-input {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.85rem;
    resize: vertical;
}

.field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.checkbox input { width: 18px; height: 18px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background-color: var(--surface-3); }

.btn-primary {
    color: #1e1e1e;
    background-color: var(--accent);
    border-color: transparent;
}

.btn-primary:hover { background-color: var(--accent); filter: brightness(1.06); }

.btn-danger {
    color: #f0b6ac;
    background-color: rgba(220, 80, 60, 0.15);
    border-color: rgba(220, 80, 60, 0.4);
}

.btn-danger:hover { background-color: rgba(220, 80, 60, 0.25); }

.btn-small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.alert-success {
    color: #c4e6b6;
    background-color: rgba(124, 195, 106, 0.14);
    border: 1px solid rgba(124, 195, 106, 0.4);
}

.alert-error {
    color: #f0b6ac;
    background-color: rgba(220, 80, 60, 0.14);
    border: 1px solid rgba(220, 80, 60, 0.4);
}

.alert code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 4px;
}


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

.usertable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.usertable th,
.usertable td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}

.usertable th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.field-inline {
    min-height: 36px;
    width: auto;
    max-width: 150px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.5);
}
.modal h3 { margin: 0 0 6px; font-size: 1.1rem; }
.modal .field { margin-top: 12px; }
.modal-desc { color: var(--muted); font-size: 0.9rem; margin: 0; }
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.tag-primary,
.tag-alt { display: inline-block; }

.badge-admin {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 999px;
    color: #1e1e1e;
    background-color: var(--accent);
}

.header-btn {
    margin-top: 14px;
}

.panel-muted {
    text-align: center;
}

.panel-muted .field-label {
    margin-bottom: 10px;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background-color: #dc5038;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    padding: 7px 14px;
    border-radius: 999px;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.chip:hover { color: var(--text); }

.chip-active {
    background-color: var(--accent);
    border-color: transparent;
    color: #1e1e1e;
    font-weight: 600;
}

.tag-danger,
.tag-info {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
}

.tag-danger { color: #f0b6ac; background-color: rgba(220, 80, 60, 0.2); }
.tag-info   { color: #bcdffb; background-color: rgba(59, 167, 232, 0.2); }

.deflist {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 18px;
    font-size: 0.95rem;
    align-items: center;
}

.deflist dt { color: var(--muted); }
.deflist dd { margin: 0; }

.plain-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
}

.plain-list li {
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.plain-list li:last-child { border-bottom: none; }

.article-body {
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.6;
}

.kaart-wrap {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    line-height: 0;
}

#kaart {
    display: block;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: #efeee9;
    cursor: crosshair;
    touch-action: none;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.loc-list {
    display: flex;
    flex-direction: column;
}

.loc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.loc-row:last-child { border-bottom: none; }

.loc-swatch {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.loc-code {
    font-weight: 600;
    min-width: 90px;
}

.loc-meta {
    color: var(--muted);
    font-size: 0.85rem;
    margin-right: auto;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px;
    background-color: var(--surface-2);
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-num { font-size: 1.7rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--muted); }

.dup-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.dup-row:last-child { border-bottom: none; }
.dup-name { font-weight: 600; min-width: 160px; }
.dup-choices { display: flex; flex-wrap: wrap; gap: 8px 16px; flex: 1 1 auto; }
.dup-choice { display: inline-flex; align-items: center; gap: 6px; font-size: 0.92rem; }

.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-item {
    padding: 4px 10px;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem;
}

.aisle-details {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
}
.aisle-details summary { cursor: pointer; font-weight: 600; }
.aisle-details summary .muted { font-weight: 400; }

.rawjson {
    margin-top: 10px;
    max-height: 340px;
    overflow: auto;
    padding: 12px;
    background-color: #16181c;
    border-radius: var(--radius-sm);
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.8rem;
    white-space: pre;
}

.barchart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label {
    flex: 0 0 130px;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-track {
    flex: 1 1 auto;
    height: 16px;
    background-color: var(--surface-2);
    border-radius: 8px;
    overflow: hidden;
}
.bar-fill { display: block; height: 100%; border-radius: 8px; min-width: 2px; }
.bar-num { flex: 0 0 auto; width: 36px; text-align: right; font-size: 0.85rem; color: var(--muted); }

.name-group {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.name-group:last-child { border-bottom: none; }
.name-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.name-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.pad-head { margin: 14px 0 8px; }
.pad-head-name { font-weight: 700; font-size: 1.05rem; }
.pad-list { display: flex; flex-direction: column; }
.pad-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
}
.pad-item:nth-child(odd) { background-color: var(--surface-2); }
.pad-item-name { font-weight: 600; }
.pad-item-extra { margin-left: auto; font-size: 0.85rem; white-space: nowrap; }

.scan-reader {
    width: 100%;
    max-width: 480px;
    margin: 12px auto 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}
.scan-reader video { display: block; width: 100%; height: auto; }