/*
 * Eignaskanni — shared app shell
 * Sidebar + topbar layout, design tokens and common components used by the
 * signed-in pages (mælaborð, stjórnborð, greiningarsaga, samanburður, teymi …).
 * Pages link this file and add only their page-specific CSS inline.
 */

/* ────────── Theme tokens ────────── */
:root {
    --bg: #f5f4ef;
    --surface: #ffffff;
    --surface-2: #faf9f5;
    --border: rgba(20, 22, 26, 0.10);
    --border-2: rgba(20, 22, 26, 0.06);

    --ink: #14161a;
    --ink-2: #4b525d;
    --ink-3: #8b919b;
    --ink-4: #c4c8cf;

    --accent: #2f6fa8;
    --accent-50: #eaf1f9;
    --accent-100: #d6e3f1;
    --pos: #1f7a4e;
    --pos-50: #e9f4ee;
    --neg: #b3402c;
    --neg-50: #fbece8;
    --warn: #b07a1f;
    --warn-50: #f7efe0;

    --sans: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --serif: 'Newsreader', 'Source Serif 4', Georgia, serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;

    --radius: 7px;
    --radius-lg: 11px;
    --shadow-card: 0 1px 2px rgba(20, 22, 26, 0.04), 0 1px 1px rgba(20, 22, 26, 0.03);
    --shadow-pop: 0 10px 34px rgba(20, 22, 26, 0.12);
}

/* ────────── Reset ────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    background: var(--bg); color: var(--ink); font-family: var(--sans);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    font-size: 14px; line-height: 1.45;
}
button { cursor: pointer; font-family: var(--sans); border: none; background: none; color: inherit; }
input, textarea, select { font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseDot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.7); opacity: .45; } }
.rise { opacity: 0; transform: translateY(16px); }
.fillbar { width: var(--w, 0%); transition: width 1.05s cubic-bezier(.2, .7, .2, 1); }

/* ────────── App shell layout ────────── */
.layout { display: flex; min-height: 100vh; background: var(--bg); }

/* ── Sidebar ── */
.sidebar {
    width: 246px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 60;
}
.side-brand { padding: 20px 20px 14px; display: flex; align-items: center; gap: 10px; }
.side-brand .mark { width: 30px; height: 30px; border-radius: 7px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.side-brand .b-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; line-height: 1.1; }
.side-brand .b-sub { font-size: 11px; color: var(--ink-3); line-height: 1.1; margin-top: 1px; }

.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); padding: 14px 12px 6px; }
.navitem { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); transition: background .14s, color .14s; }
.navitem svg { flex-shrink: 0; }
.navitem:hover { background: var(--surface-2); color: var(--ink); }
.navitem.active { background: var(--accent-50); color: var(--accent); font-weight: 600; }

.side-user { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.side-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.side-user .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-user .u-info { min-width: 0; line-height: 1.25; flex: 1; }
.side-user .u-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .u-email { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink-3); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; transition: color .15s, border-color .15s; }
.btn-logout:hover { color: var(--neg); border-color: var(--neg); }
.btn-logout:disabled { opacity: .5; cursor: not-allowed; }

/* ── Main / topbar ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 64px; flex-shrink: 0; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 18px; padding: 0 28px; position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-family: var(--serif); font-weight: 500; font-size: 21px; letter-spacing: -.01em; line-height: 1.1; }
.topbar .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.menu-toggle { display: none; }

.content { flex: 1; overflow-y: auto; padding: 30px 32px 64px; }
.content-inner { max-width: 1180px; margin: 0 auto; }

/* ────────── Shared components ────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.hovlift { transition: border-color .18s, box-shadow .18s, transform .18s; }
.hovlift:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(47, 111, 168, .10); transform: translateY(-2px); }

.page-head { margin-bottom: 20px; }
.page-head .eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 7px; }
.page-head h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; letter-spacing: -.015em; line-height: 1.1; }
.page-head h2 em { font-style: italic; color: var(--ink-2); font-weight: 400; }
.page-head p { color: var(--ink-2); margin-top: 9px; max-width: 62ch; font-size: 13.5px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 9px 15px; font-size: 13px; font-weight: 500; transition: color .15s, border-color .15s, background .15s; }
.btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.btn-dark:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { color: var(--neg); border-color: var(--neg); }
.btn-danger:hover:not(:disabled) { background: var(--neg-50); color: var(--neg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* Badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge-accent { background: var(--accent-50); color: var(--accent); }
.badge-pos { background: var(--pos-50); color: var(--pos); }
.badge-neg { background: var(--neg-50); color: var(--neg); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }

/* Empty state */
.empty-state { text-align: center; padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink-3); }
.empty-state .empty-icon { font-size: 38px; opacity: .85; }
.empty-state h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; color: var(--ink); }
.empty-state p { color: var(--ink-3); max-width: 380px; font-size: 13.5px; }
.empty-state .btn { margin-top: 12px; }

/* Inline message */
.msg { font-size: 13px; margin-top: 10px; }
.msg.ok { color: var(--pos); }
.msg.err { color: var(--neg); }

/* ── Auth loading ── */
.auth-loading { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(245, 244, 239, 0.82); backdrop-filter: blur(3px); }
.loading-spinner { width: 28px; height: 28px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }

/* ── Mobile drawer ── */
.scrim { display: none; }
@media (max-width: 820px) {
    .sidebar { position: fixed; top: 0; left: 0; transform: translateX(-100%); transition: transform .22s cubic-bezier(.2, .7, .2, 1); box-shadow: var(--shadow-pop); }
    .layout.nav-open .sidebar { transform: translateX(0); }
    .layout.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 22, 26, .35); z-index: 55; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink-2); }
    .content { padding: 22px 18px 56px; }
    .topbar { padding: 0 16px; gap: 12px; }
    .page-head h2 { font-size: 26px; }
}
