:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #17212b;
    --muted: #5d6b7a;
    --line: #dde3ea;
    --brand: #0f6e68;
    --brand-2: #14507a;
    --brand-contrast: #ffffff;
    --danger-bg: #fdecec;
    --danger-text: #8f1d1d;
    --info-bg: #e6f2fb;
    --info-text: #164b73;
    --shadow: 0 10px 30px rgba(20, 40, 60, .10);
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1419;
        --surface: #172029;
        --text: #e8eef4;
        --muted: #93a2b1;
        --line: #26323d;
        --brand: #2bb3a8;
        --brand-2: #3d8fd1;
        --brand-contrast: #06201e;
        --danger-bg: #3a1c1c;
        --danger-text: #ffb4b4;
        --info-bg: #14303f;
        --info-text: #a8d4f2;
        --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }

/* --- Knapper og formularer --- */
.btn {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: .75rem 1.1rem;
    font: inherit;
    font-weight: 600;
    color: var(--brand-contrast);
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
    padding: .4rem .8rem;
    font-weight: 500;
}

label { display: block; font-size: .875rem; font-weight: 600; margin: 1rem 0 .35rem; }
input[type=email], input[type=password], input[type=text] {
    width: 100%;
    padding: .75rem .85rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
}
label.check {
    display: flex;
    gap: .55rem;
    align-items: center;
    font-weight: 400;
    margin: 1rem 0 1.25rem;
    cursor: pointer;
}
label.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }

.alert {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-radius: 10px;
    padding: .7rem .9rem;
    margin: 1rem 0 0;
    font-size: .925rem;
}
.alert-info { background: var(--info-bg); color: var(--info-text); margin: 0 0 1.25rem; }

/* --- Brand --- */
.brand-mark {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.brand-mark-small { width: 48px; height: 48px; font-size: 1.5rem; border-radius: 14px; margin-bottom: 1rem; display: none; }
.brand-mark-tiny { width: 30px; height: 30px; font-size: 1rem; border-radius: 9px; box-shadow: none; }

/* --- Login --- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .14), transparent 45%),
        linear-gradient(145deg, #0f6e68, #14507a);
}
.login-brand .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; margin-bottom: 1.5rem; }
.login-brand h2 { font-size: 2.4rem; }
.login-brand p { font-size: 1.1rem; opacity: .85; max-width: 26rem; }
.login-card {
    align-self: center;
    justify-self: center;
    width: min(100% - 2rem, 25rem);
    background: var(--surface);
    padding: 2.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.login-card .btn { width: 100%; }

@media (max-width: 800px) {
    .login { grid-template-columns: 1fr; padding: 1.5rem 0; align-items: center; }
    .login-brand { display: none; }
    .brand-mark-small { display: grid; }
    .login-card { padding: 1.75rem 1.5rem; }
}

/* --- App-layout --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); text-decoration: none; }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.topbar-user form { margin: 0; }

.container { max-width: 1050px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.container.narrow { max-width: 560px; }
.page-head { margin-bottom: 1.5rem; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem;
}
.card-soon { border-style: dashed; background: transparent; }

.badge {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    background: var(--info-bg);
    color: var(--info-text);
}
.badge-admin { background: #fde8c8; color: #7a4300; }
.badge-write { background: #d9f2e4; color: #11613a; }
@media (prefers-color-scheme: dark) {
    .badge-admin { background: #4a3413; color: #ffd596; }
    .badge-write { background: #12392a; color: #9fe3bf; }
}

.levels { list-style: none; padding: 0; margin: .75rem 0 0; }
.levels li { padding: .35rem 0 .35rem 1.6rem; position: relative; }
.levels li::before { position: absolute; left: 0; font-weight: 700; }
.levels li.on::before { content: "✓"; color: var(--brand); }
.levels li.off { color: var(--muted); }
.levels li.off::before { content: "–"; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 560px) {
    .topbar { flex-wrap: wrap; padding: .75rem 1rem; }
    .topbar-name { display: none; }
    .container { padding: 1.25rem 1rem 2rem; }
}
