/* Staff-UI stilmall — inkluderar responsive layout för surfplatta/mobil
 * via @media-queries nedan. */

:root {
    --bg: #fff;
    --fg: #1a1a1a;
    --accent: #0058a3;
    --muted: #666;
    --border: #d4d4d4;
}

@media (max-width: 768px) {
    body { font-size: 0.95rem; }
    main { padding: 1rem; }
    table.items { font-size: 0.9rem; }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
}

header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent);
    text-decoration: none;
}

nav a {
    margin-right: 1rem;
    color: var(--fg);
    text-decoration: none;
}

nav a:hover, nav a:focus {
    text-decoration: underline;
}

.tenant {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.9rem;
}

main {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem;
}

h1 { margin-top: 0; }

.panel {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: #fafafa;
}

.panel h2 { margin-top: 0; }

form label {
    display: block;
    margin: 0.5rem 0 0.25rem;
    font-weight: 500;
}

form input, form button {
    font: inherit;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

form input { width: 100%; max-width: 28rem; }

form button {
    margin-top: 0.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

form button:hover { filter: brightness(1.1); }

.muted { color: var(--muted); }
.error { color: #a40000; background: #fdeaea; padding: 0.5rem 0.75rem; border-radius: 4px; }
.ok    { color: #1b5e20; background: #e7f5e9; padding: 0.5rem 0.75rem; border-radius: 4px; }
.warning { color: #8a5a00; }

.quick-links { list-style: none; padding: 0; }
.quick-links li { margin: 0.5rem 0; }

.patron-card {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    background: #fff;
    margin-top: 0.5rem;
}

.patron-card h3 { margin: 0 0 0.5rem; }
.patron-card dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.25rem 1rem; margin: 0; }
.patron-card dt { font-weight: 600; color: var(--muted); }
.patron-card dd { margin: 0; }

.results { list-style: none; padding: 0; }
.results li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.results code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; }

.bib-meta { display: grid; grid-template-columns: 10rem 1fr; gap: 0.25rem 1rem; }
.bib-meta dt { font-weight: 600; color: var(--muted); }
.bib-meta dd { margin: 0; }

.items { border-collapse: collapse; width: 100%; }
.items th, .items td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.items th { background: #f3f3f3; }

/* admin/security */
.status-ok { color: #0a6b0a; font-weight: 600; }
.status-warn { color: #a06400; font-weight: 600; }
.status-error { color: #a40000; font-weight: 600; }
.sev-1 { background: #a40000; color: #fff; padding: 0.1rem 0.4rem; border-radius: 3px; }
.sev-2 { background: #c87000; color: #fff; padding: 0.1rem 0.4rem; border-radius: 3px; }
.sev-3 { background: #6e6e6e; color: #fff; padding: 0.1rem 0.4rem; border-radius: 3px; }
.filters { display: flex; gap: 1rem; align-items: end; margin-bottom: 1rem; flex-wrap: wrap; }
.filters label { display: flex; flex-direction: column; gap: 0.2rem; }

/* ─── Dark mode ────────────────────────────────────────────────── */

[data-theme="dark"] {
    --bg: #1a1a1a;
    --fg: #e8e8e8;
    --accent: #4a9eff;
    --accent-bg: #1a2e44;
    --muted: #9a9a9a;
    --border: #3a3a3a;
}
[data-theme="dark"] body { background: var(--bg); color: var(--fg); }
[data-theme="dark"] header {
    background: #0d2847;
    color: #fff;
    border-bottom-color: #1a3a5e;
}
[data-theme="dark"] section.panel,
[data-theme="dark"] .panel {
    background: #232323;
    border-color: var(--border);
}
[data-theme="dark"] th { background: #2a2a2a; color: var(--fg); }
[data-theme="dark"] td { border-color: var(--border); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #2a2a2a;
    color: var(--fg);
    border: 1px solid var(--border);
}
[data-theme="dark"] a { color: var(--accent); }
[data-theme="dark"] nav a { color: #fff; }
[data-theme="dark"] .muted { color: var(--muted); }
[data-theme="dark"] .items th { background: #2a2a2a; }

#theme-toggle {
    margin-left: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#theme-toggle:hover { background: var(--accent-bg); }
[data-theme="dark"] #theme-toggle {
    border-color: rgba(255,255,255,0.35);
    color: #fff;
}
[data-theme="dark"] #theme-toggle:hover { background: rgba(255,255,255,0.15); }

/* ─── Staff-UI dark-mode nav-fixar ─────────────────────────────── */

[data-theme="dark"] header nav .menu > summary,
[data-theme="dark"] header nav a.top {
    color: #e8e8e8 !important;
}
[data-theme="dark"] header nav .menu > summary:hover,
[data-theme="dark"] header nav a.top:hover,
[data-theme="dark"] header nav a.top:focus {
    background: #1a3a5e;
    color: #fff !important;
}
[data-theme="dark"] header nav .menu[open] > summary {
    background: var(--accent);
    color: #fff !important;
}
[data-theme="dark"] header nav .menu .submenu {
    background: #2a2a2a;
    color: #e8e8e8;
    border-color: var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}
[data-theme="dark"] header nav .menu .submenu a {
    color: #e8e8e8;
}
[data-theme="dark"] header nav .menu .submenu a:hover,
[data-theme="dark"] header nav .menu .submenu a:focus {
    background: #1a3a5e;
    color: #fff;
}
[data-theme="dark"] header .tenant {
    color: rgba(255,255,255,0.85);
}
[data-theme="dark"] header .brand {
    color: #fff;
}
