@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #0d9488;
    --accent-hover: #0f766e;
    --accent-light: #ccfbf1;
    --danger: #dc2626;
    --danger-hover: #ef4444;
    --danger-light: #fef2f2;
    --success-bg: #f0fdf4;
    --success-text: #15803d;
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 3rem 2rem;
    line-height: 1.6;
    font-size: 15px;
}

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

/* ── Page header ─────────────────────────────────── */
.page-header { text-align: center; margin-bottom: 2.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.page-header .subtitle { font-size: 0.95rem; color: var(--text-muted); font-weight: 400; }

/* ── Top bar ─────────────────────────────────────── */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; max-width: 900px; margin-left: auto; margin-right: auto; }
.top-bar h2 { font-size: 1rem; font-weight: 500; color: var(--text-secondary); }
.logout { color: var(--danger); }
.logged-in-text { font-size: 0.9rem; color: var(--text-secondary); }

/* ── Admin button (internal page) ────────────────── */
.admin-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.75rem; font-size: 0.85rem;
    color: var(--text-secondary); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    text-decoration: none; transition: all 0.15s;
}
.admin-btn:hover { background: var(--bg); color: var(--text); border-color: var(--accent); text-decoration: none; }
.admin-btn svg { width: 1em; height: 1em; flex-shrink: 0; }
.top-bar-right { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.top-bar-buttons { display: inline-flex; gap: 0.4rem; }

/* ── Upload button ───────────────────────────────── */
.upload-btn {
    display: inline-block; padding: 0.45rem 1rem; font-size: 0.85rem; font-weight: 500;
    color: #fff; background: var(--accent); border-radius: var(--radius-sm);
    cursor: pointer; border: none; transition: all 0.15s;
}
.upload-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ── Upload section (top bar) ────────────────────── */
.upload-section { display: inline-flex; align-items: center; gap: 0.65rem; }
.upload-hint { font-size: 0.85rem; color: var(--text-muted); font-weight: 400; white-space: nowrap; }

/* ── View toggle ─────────────────────────────────── */
.view-controls { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle-btn {
    padding: 0.4rem 1.1rem; font-size: 0.85rem; font-weight: 500;
    color: var(--text-secondary); background: var(--surface);
    border: none; cursor: pointer; transition: all 0.15s;
}
.view-toggle-btn:not(:last-child) { border-right: 1px solid var(--border); }
.view-toggle-btn.active { background: var(--accent); color: #fff; }
.view-toggle-btn:hover:not(.active) { background: var(--bg); color: var(--text); }
.view-subtitle { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

/* ── Admin document actions ──────────────────────── */
.doc-admin-actions { display: inline-flex; gap: 0.25rem; margin-left: 0.5rem; vertical-align: middle; }
.doc-admin-actions form { display: inline; }
.doc-action-btn {
    padding: 0.15rem 0.5rem; font-size: 0.72rem; font-weight: 500;
    border: 1px solid var(--border); border-radius: 4px;
    cursor: pointer; transition: all 0.15s; background: var(--surface);
    color: var(--text-secondary); line-height: 1.4;
}
.doc-action-hide:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.doc-action-delete { color: var(--danger); }
.doc-action-delete:hover { border-color: var(--danger); background: var(--danger-light); }
.doc-hidden { opacity: 0.45; }
.doc-hidden > a { text-decoration: line-through; }

/* ── Documents layout ────────────────────────────── */
.documents-layout { display: flex; gap: 2rem; flex-wrap: wrap; max-width: 900px; margin: 0 auto; }
.documents-main { flex: 1; min-width: 200px; }
.documents-side { width: 240px; flex-shrink: 0; }

/* ── Year sections ───────────────────────────────── */
.year-section { margin-bottom: 2rem; }
.year-section h2 { margin-bottom: 0.75rem; font-size: 1.15rem; font-weight: 600; color: var(--text); padding-bottom: 0.5rem; border-bottom: 2px solid var(--border-light); }
.year-section ul { list-style: none; }
.year-section li { margin-bottom: 0.6rem; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); transition: background 0.1s; }
.year-section li:hover { background: var(--surface); }

/* ── Document badges ─────────────────────────────── */
.doc-badges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-right: 0.5rem; vertical-align: middle; }
.doc-badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 12px; white-space: nowrap; }
.doc-badge-regnskab { background: #dbeafe; color: #1d4ed8; }
.doc-badge-referat { background: #fef3c7; color: #92400e; }
.doc-badge-vedtaegter { background: #ede9fe; color: #6d28d9; }
.doc-badge-andet { background: #f1f5f9; color: #475569; }
.doc-date { font-size: 0.8rem; color: var(--text-muted); vertical-align: middle; }

/* ── Sidebar sections ────────────────────────────── */
.side-section { margin-bottom: 1.5rem; background: var(--surface); padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.side-section h2 { margin-bottom: 0.75rem; font-size: 1rem; font-weight: 600; color: var(--text); }
.side-section ul { list-style: none; }
.side-section li { margin-bottom: 0.5rem; }
.side-section-hint { font-size: 0.9rem; color: var(--text-muted); margin: 0; }
.side-section .doc-filename { display: inline-block; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ── Load more ───────────────────────────────────── */
.load-more-wrap { margin-top: 1rem; margin-bottom: 1.5rem; }
.load-more-btn {
    padding: 0.5rem 1.2rem; font-size: 0.85rem; font-weight: 500;
    color: var(--text-secondary); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s;
}
.load-more-btn:hover { background: var(--bg); color: var(--text); border-color: var(--accent); }

/* ── Cards ───────────────────────────────────────── */
.card, .form-card, .admin-card, .del-card, .rights-card {
    background: var(--surface); padding: 2.5rem; border-radius: var(--radius);
    box-shadow: var(--shadow-md); max-width: 480px; margin: 0 auto;
}
.admin-card { max-width: 420px; }
.del-card { max-width: 520px; }
.rights-card { max-width: 620px; }
.card h1, .form-card h2, .admin-card h2, .del-card h2, .rights-card h2 {
    font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; color: var(--text);
    padding-bottom: 0.75rem; border-bottom: 2px solid var(--border-light);
}

/* ── Admin page bar ──────────────────────────────── */
.admin-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; max-width: 480px; margin-left: auto; margin-right: auto; }
.admin-bar a { color: var(--accent); }

/* ── Admin actions ───────────────────────────────── */
.admin-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.rights-link-btn {
    display: block; padding: 0.85rem 1rem; font-size: 0.95rem; font-weight: 500;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    text-align: left; text-decoration: none; transition: all 0.15s;
}
.rights-link-btn:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }

/* ── Form fields ─────────────────────────────────── */
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; }
.field input[type="text"], .field input[type="password"], .field input[type="url"], .field select {
    width: 100%; padding: 0.6rem 0.75rem; font-size: 0.95rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}
.field input[type="text"]:focus, .field input[type="password"]:focus, .field input[type="url"]:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); }

/* ── Password row ────────────────────────────────── */
.pw-row { display: flex; gap: 0.5rem; align-items: center; }
.pw-display {
    flex: 1; padding: 0.6rem 0.75rem; font-size: 0.95rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace; letter-spacing: 0.5px;
    min-height: 2.3rem; word-break: break-all;
}
.gen-btn {
    padding: 0.6rem 0.9rem; font-size: 0.82rem; font-weight: 500;
    color: var(--text-secondary); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.gen-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ── Password requirements hint ─────────────────── */
.pw-requirements { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.25rem; margin-bottom: 0; }

/* ── Rights grid (create user) ───────────────────── */
.rights-grid { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.rights-grid label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; color: var(--text-secondary); }
.rights-grid input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); cursor: pointer; }

/* ── Buttons ─────────────────────────────────────── */
.submit-btn, .save-btn {
    padding: 0.65rem 1.5rem; font-size: 0.95rem; font-weight: 500;
    color: #fff; background: var(--accent); border: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s;
}
.submit-btn:hover, .save-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.submit-row, .save-row { margin-top: 1.5rem; text-align: right; }

.del-btn {
    padding: 0.65rem 1.5rem; font-size: 0.95rem; font-weight: 500;
    color: #fff; background: var(--danger); border: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s;
}
.del-btn:hover { background: var(--danger-hover); transform: translateY(-1px); }
.del-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Admin links list ────────────────────────────── */
.links-list { list-style: none; margin-bottom: 1.5rem; }
.links-list li { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.links-list li a { flex: 1; min-width: 0; }
.links-list .inline-del-form { margin: 0; }
.links-list .del-btn { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

/* ── Tables ──────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: center; padding: 0.6rem 0.75rem; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border-light); }
th:first-child { text-align: left; }
td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border-light); }
tr:hover td { background: var(--bg); }
.user-cell { font-weight: 500; }
.check-cell { text-align: center; }
.check-cell input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); cursor: pointer; }
.del-card .check-cell input[type="checkbox"] { accent-color: var(--danger); }

/* ── Messages ────────────────────────────────────── */
.msg { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; text-align: center; font-size: 0.9rem; font-weight: 500; }
.error-msg { background: var(--error-bg); color: var(--error-text); }
.success-msg { background: var(--success-bg); color: var(--success-text); }
.saved-banner { background: var(--success-bg); color: var(--success-text); padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; text-align: center; font-size: 0.9rem; font-weight: 500; }
.empty-msg { color: var(--text-muted); font-style: italic; }

/* ── Classify page ───────────────────────────────── */
.classify-body { display: flex; justify-content: center; align-items: flex-start; }
.file-row { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-light); }
.file-row:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.filename { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.75rem; word-break: break-all; }
.classify-fields { display: flex; gap: 2rem; flex-wrap: wrap; }
.classify-year > label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; }
.classify-year select {
    padding: 0.45rem 0.6rem; font-size: 0.9rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color 0.15s; cursor: pointer;
}
.classify-year select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); }
.checkboxes > label:first-child { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; cursor: default; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; cursor: pointer; font-size: 0.9rem; color: var(--text-secondary); }
.checkbox-group input { width: auto; accent-color: var(--accent); }
.form-actions { margin-top: 1.5rem; }
.form-actions button { padding: 0.65rem 1.5rem; font-size: 0.95rem; font-weight: 500; color: #fff; background: var(--accent); border: none; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; }
.form-actions button:hover { background: var(--accent-hover); }
.form-actions a { margin-left: 1rem; }

/* ── Login page ──────────────────────────────────── */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #e0f2fe, #ccfbf1);
    padding: 2rem;
}
.login-card {
    background: var(--surface); padding: 2.5rem; border-radius: var(--radius);
    box-shadow: var(--shadow-md); width: 100%; max-width: 360px;
}
.login-card h1 { margin-bottom: 0.25rem; font-size: 1.4rem; text-align: center; color: var(--text); }
.login-card .login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.75rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.form-group input {
    width: 100%; padding: 0.6rem 0.75rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); font-size: 0.95rem;
    transition: border-color 0.15s;
}
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); }
.error { color: var(--error-text); font-size: 0.85rem; margin-bottom: 1rem; text-align: center; }
.login-submit {
    width: 100%; padding: 0.75rem; font-size: 0.95rem; font-weight: 600;
    color: #fff; background: var(--accent); border: none; border-radius: var(--radius-sm);
    cursor: pointer; margin-top: 0.5rem; transition: all 0.15s;
}
.login-submit:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ── Landing page ────────────────────────────────── */
.landing-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background-image: url('https://images.unsplash.com/photo-1557683316-973673baf926?w=1920');
    background-size: cover; background-position: center; background-repeat: no-repeat;
    padding: 2rem;
}
.landing-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 0; }
.landing-content { position: relative; z-index: 1; text-align: center; }
.landing-card {
    background: rgba(255,255,255,0.85); backdrop-filter: blur(16px);
    padding: 3rem 3.5rem; border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.landing-card h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.landing-card p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 2rem; }
.login-btn {
    display: inline-block; padding: 0.85rem 2.5rem;
    font-size: 1rem; font-weight: 600; color: #fff;
    background: var(--accent); border-radius: var(--radius-sm);
    text-decoration: none; transition: all 0.2s;
}
.login-btn:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(13,148,136,0.3); text-decoration: none; color: #fff; }

/* ── User display in tables ──────────────────────── */
.user-detail { color: var(--text-muted); font-size: 0.85em; }
