:root {
    --bg: #f0f0f0;
    --surface: #fdfdfc;
    --text: #1d2124;
    --text-secondary: #606365;
    --accent: #00345e;
    --accent-light: #004d83;
    --green: #2d8c3e;
    --red: #d9000d;
    --orange: #c58023;
    --border: #d3d3d3;
    --radius: 6px;
    --shadow: 0 1px 4px rgba(0,0,0,.10);
    --header-height: 56px;
    font-family: helvetica, arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1e22;
        --surface: #24292e;
        --text: #f0f0f0;
        --text-secondary: #9ea3a8;
        --border: #404548;
        --shadow: 0 1px 4px rgba(0,0,0,.35);
    }
}

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

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── WDR Header ─────────────────────────────────────────── */
.wdr-header {
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.wdr-wordmark {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    text-decoration: none;
    line-height: 1.2;
}

.wdr-header-right { display: none; }

.btn-logout {
    background: rgba(255,255,255,.18);
    color: #fff;
    border: 2px solid rgba(255,255,255,.5);
    border-radius: 6px;
    padding: 14px 28px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(255,255,255,.3);
    text-decoration: none;
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px;
}

h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-title {
    font-weight: 600;
    font-size: 16px;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-available  { background: var(--green); color: #fff; }
.badge-borrowed   { background: var(--red);   color: #fff; }
.badge-missing    { background: var(--orange); color: #fff; }
.badge-maintenance{ background: #606365;       color: #fff; }

/* ── Forms ──────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(0,77,131,.2);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-group { margin-bottom: 16px; }

/* ── Checklist ──────────────────────────────────────────── */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.checklist-item span { font-size: 15px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 11px 22px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    width: 100%;
    transition: opacity .15s;
    font-family: inherit;
}

.btn:disabled       { opacity: .4; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: .85; }

.btn-primary     { background: var(--accent);       color: #fff; }
.btn-danger      { background: var(--red);           color: #fff; }
.btn-secondary   { background: var(--border);        color: var(--text); }
.btn-maintenance { background: #606365;              color: #fff; }
.btn-available   { background: var(--green);         color: #fff; }

.btn-small {
    padding: 5px 12px;
    font-size: 13px;
    width: auto;
}

/* ── Admin card actions ─────────────────────────────────── */
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.card-maintenance {
    opacity: .7;
    border-left: 3px solid #606365;
}

/* ── Info box ───────────────────────────────────────────── */
.info-box {
    background: rgba(0,52,94,.07);
    border: 1px solid rgba(0,52,94,.2);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.info-box strong { display: block; margin-bottom: 2px; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── History ────────────────────────────────────────────── */
.history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.history-item:last-child { border-bottom: none; }

.history-meta {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ── Admin: Item editor ─────────────────────────────────── */
.item-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.item-row input { flex: 1; }

.remove-btn {
    background: none;
    border: none;
    color: var(--red);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.modal h2 { margin-bottom: 16px; }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.modal-actions .btn { flex: 1; }

/* ── Messages ───────────────────────────────────────────── */
.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    border-left: 4px solid;
}

.message-success    { background: rgba(45,140,62,.1);  color: var(--green); border-color: var(--green); }
.message-error      { background: rgba(217,0,13,.08);  color: var(--red);   border-color: var(--red);   }
.message-maintenance{ background: rgba(96,99,101,.1);  color: #606365;      border-color: #606365;       }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .container { padding: 16px 12px; }
    h1 { font-size: 22px; }
    .wdr-header { padding: 0 12px; }
    .wdr-wordmark span { display: none; }
}

.hidden { display: none; }

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

/* ── Login/Password card ────────────────────────────────── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
    padding: 20px 16px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    border: 1px solid var(--border);
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .subtitle { margin-bottom: 28px; }

.error-msg {
    background: rgba(217,0,13,.08);
    color: var(--red);
    border-left: 3px solid var(--red);
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}

.success-msg {
    background: rgba(45,140,62,.1);
    color: var(--green);
    border-left: 3px solid var(--green);
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}
