/* Aktivitetslogg – designsystem (vanilla CSS) */

:root {
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    --bg: #eef2f6;
    --bg-subtle: #f8fafc;
    --surface: #ffffff;
    --ink: #152535;
    --ink-soft: #2d3f52;
    --muted: #5c6b7a;
    --muted-light: #8a97a5;

    --brand: #1a5f8c;
    --brand-mid: #2474a8;
    --brand-dark: #0f3d5c;
    --brand-light: #e6f0f7;
    --brand-glow: rgba(26, 95, 140, .14);

    --accent-individ: #2d6a4f;
    --accent-individ-bg: #e8f5ee;
    --accent-kommun: #1a5f8c;
    --accent-kommun-bg: #e6f0f7;
    --accent-admin: #4a5568;
    --accent-admin-bg: #edf0f4;

    --border: #d4dde6;
    --border-light: #e8edf2;

    --error-bg: #fdecea;
    --error-ink: #9b1c0f;
    --info-bg: #e8f2fa;
    --info-ink: #1a5f8c;
    --success-bg: #e6f4ea;
    --success-ink: #1a5c34;
    --warning-bg: #fef6e6;
    --warning-ink: #7a5800;

    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-xs: 0 1px 2px rgba(21, 37, 53, .05);
    --shadow-sm: 0 1px 3px rgba(21, 37, 53, .07), 0 1px 2px rgba(21, 37, 53, .04);
    --shadow-md: 0 4px 16px rgba(21, 37, 53, .08), 0 2px 6px rgba(21, 37, 53, .04);
    --shadow-lg: 0 12px 40px rgba(21, 37, 53, .1), 0 4px 12px rgba(21, 37, 53, .06);

    --transition: .18s ease;
    --sidebar-width: 260px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
svg { display: block; flex-shrink: 0; }

a { color: var(--brand-mid); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-dark); }

.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem;
}
.container.narrow { max-width: 440px; }

/* ── Typografi ─────────────────────────────────────────────────────────── */

.brand { text-align: center; margin-bottom: 2rem; }
.brand h1 {
    margin: 0 0 .35rem;
    color: var(--brand-dark);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}
.tagline { margin: 0; color: var(--muted); font-size: .95rem; }

.page-lead {
    margin: 0;
    color: var(--muted);
    font-size: .95rem;
    max-width: 52ch;
}

/* ── Landningssida ─────────────────────────────────────────────────────── */

.landing {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(26, 95, 140, .12), transparent 55%),
        linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg) 100%);
}

.landing-hero {
    padding: 3.5rem 1.25rem 2rem;
    text-align: center;
}

.landing-hero-inner {
    max-width: 640px;
    margin: 0 auto;
}

.landing-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 1.25rem;
    background: linear-gradient(145deg, var(--brand-mid), var(--brand-dark));
    border-radius: 14px;
    box-shadow: 0 8px 24px var(--brand-glow);
    color: #fff;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -.03em;
}

.landing-hero h1 {
    margin: 0 0 .5rem;
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--ink);
    line-height: 1.15;
}

.landing-hero .tagline {
    font-size: 1.05rem;
    line-height: 1.5;
}

.landing-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: 1.5rem;
}

.landing-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .85rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    box-shadow: var(--shadow-xs);
}

.landing-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success-ink);
}

.landing-content { padding-top: 0; }

.portals {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.portal-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.5rem 1.35rem;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--portal-accent, var(--brand));
    opacity: .85;
}

.portal-card:hover {
    border-color: var(--border);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.portal-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background: var(--portal-accent-bg, var(--brand-light));
    color: var(--portal-accent, var(--brand));
}

.portal-card-icon svg {
    width: 22px;
    height: 22px;
}

.portal-card h2 {
    margin: 0 0 .45rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.01em;
}

.portal-card p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
    flex: 1;
}

.portal-card-arrow {
    margin-top: 1rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--portal-accent, var(--brand));
}

.portal-card--individ { --portal-accent: var(--accent-individ); --portal-accent-bg: var(--accent-individ-bg); }
.portal-card--kommun { --portal-accent: var(--accent-kommun); --portal-accent-bg: var(--accent-kommun-bg); }
.portal-card--admin { --portal-accent: var(--accent-admin); --portal-accent-bg: var(--accent-admin-bg); }

.site-footer {
    text-align: center;
    margin-top: 3rem;
    font-size: .85rem;
    color: var(--muted-light);
}

/* ── Portal-inloggning (delad layout) ───────────────────────────────────── */

.portal-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.portal-auth-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem 3rem;
    background: linear-gradient(155deg, var(--auth-brand-dark, var(--brand-dark)) 0%, var(--auth-brand, var(--brand)) 55%, var(--auth-brand-mid, var(--brand-mid)) 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.portal-auth-brand::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.06) 0%, transparent 40%);
    pointer-events: none;
}

.portal-auth-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 380px;
}

.portal-auth-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, .2);
}

.portal-auth-brand h1 {
    margin: 0 0 .5rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.portal-auth-brand .tagline {
    color: rgba(255, 255, 255, .75);
    font-size: 1rem;
    line-height: 1.5;
}

.portal-auth-features {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    font-size: .9rem;
    color: rgba(255, 255, 255, .8);
}

.portal-auth-features li {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: .65rem;
}

.portal-auth-features li::before {
    content: '✓';
    flex-shrink: 0;
    font-weight: 700;
    color: rgba(255, 255, 255, .9);
}

.portal-auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--bg);
}

.portal-auth-form-wrap {
    width: 100%;
    max-width: 400px;
}

.portal-auth-form-wrap .back {
    margin-top: 1.25rem;
    text-align: left;
}

.portal-individ { --auth-brand: #2d6a4f; --auth-brand-mid: #3d8b66; --auth-brand-dark: #1e4a36; }

.portal-individ--authenticated {
    min-height: 100vh;
    background: var(--bg);
}

.portal-individ-main {
    padding: 2rem 1rem 3rem;
}

.portal-individ-main-inner {
    max-width: 36rem;
    margin: 0 auto;
}

.portal-individ-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .25rem;
}

.portal-individ-header-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

.portal-individ-header-brand h1 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--accent-individ);
}

.portal-individ-mark {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--accent-individ);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}

.portal-individ-logout {
    margin: 0;
}

.portal-individ-greeting {
    margin: 0 0 1.25rem;
}
.portal-kommun { --auth-brand: #1a5f8c; --auth-brand-mid: #2474a8; --auth-brand-dark: #0f3d5c; }
.portal-admin.portal-admin--login { --auth-brand: #3d4a5c; --auth-brand-mid: #4a5568; --auth-brand-dark: #2d3748; }

.portal-kommun--login {
    min-height: 100vh;
}

.portal-kommun--login.portal-auth-page {
    width: 100%;
}

.portal-kommun--login .portal-auth-brand,
.portal-kommun--login .portal-auth-panel {
    min-height: 100vh;
}

.portal-kommun--authenticated {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
    --admin-chrome: #1a5f8c;
    --admin-chrome-dark: #0f3d5c;
    --admin-chrome-mid: #2474a8;
}

.portal-kommun--authenticated .admin-stat-icon {
    background: var(--accent-kommun-bg);
    color: var(--accent-kommun);
}

.kommun-quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.kommun-quick-links a {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: .92rem;
    color: var(--brand);
    text-decoration: none;
    padding: .35rem 0;
}

.kommun-quick-links a:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

/* Uppföljning på kommun-översikt */
.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-ink);
    border-color: rgba(146, 97, 0, .15);
}

.uppfoljning-card__lead {
    margin: 0 0 1.25rem;
}

.uppfoljning-typer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.uppfoljning-typ {
    background: var(--surface-muted, #f8fafc);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.uppfoljning-typ--prioritet {
    border-color: rgba(146, 97, 0, .25);
    background: var(--warning-bg);
}

.uppfoljning-typ__value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

.uppfoljning-typ--prioritet .uppfoljning-typ__value {
    color: var(--warning-ink);
}

.uppfoljning-typ__label {
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.3;
}

.uppfoljning-typ__meta {
    font-size: .75rem;
}

.uppfoljning-tabell-wrap {
    margin-bottom: .75rem;
}

.uppfoljning-rad--prioritet td:first-child {
    font-weight: 600;
}

.uppfoljning-overdue-tag {
    display: inline-block;
    margin-left: .5rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--error-ink);
    background: var(--error-bg);
    border-radius: 999px;
    padding: .1rem .45rem;
    vertical-align: middle;
}

.uppfoljning-card__footer {
    margin: 0;
    font-weight: 600;
}

.uppfoljning-card__footer a {
    color: var(--brand);
    text-decoration: none;
}

.uppfoljning-card__footer a:hover {
    text-decoration: underline;
}

.uppfoljning-empty {
    margin-top: .5rem;
}

/* ── Kort & formulär ───────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.card h2 {
    margin-top: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.01em;
}

.card h3 {
    margin: 1.75rem 0 .75rem;
    font-size: .95rem;
    font-weight: 700;
    color: var(--ink-soft);
    border-top: 1px solid var(--border-light);
    padding-top: 1.5rem;
}

.card + .card { margin-top: 1.25rem; }

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.card-header h2 { margin: 0; }

.card--highlight {
    border-color: var(--brand);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(26, 95, 140, .08);
}

label {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    margin: 1rem 0 .4rem;
    color: var(--ink-soft);
}

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="search"], input[type="date"], input[type="file"], input[name="code"], input[name="pnr"], input:not([type]), select,
textarea {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
    min-height: 6rem;
    resize: vertical;
    line-height: 1.5;
}

input[type="search"] {
    appearance: none;
    -webkit-appearance: none;
}

input::placeholder { color: var(--muted-light); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-mid);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c6b7a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-top: 1.25rem;
    padding: .7rem 1.35rem;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 1px 2px rgba(21, 37, 53, .12);
}

.btn:hover:not(:disabled) {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--brand-glow);
}

.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-secondary { background: var(--ink-soft); }
.btn-secondary:hover:not(:disabled) { background: var(--ink); }

.btn-danger {
    background: var(--error-ink);
    box-shadow: 0 1px 2px rgba(155, 28, 15, .2);
}
.btn-danger:hover:not(:disabled) {
    background: #7a1609;
    box-shadow: 0 4px 12px rgba(155, 28, 15, .25);
}

.card-danger {
    border-color: rgba(155, 28, 15, .25);
    background: linear-gradient(180deg, rgba(155, 28, 15, .03) 0%, var(--surface) 100%);
}

.individ-gallring-summary {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1.25rem;
    font-size: .92rem;
}

.individ-gallring-form label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
}

.individ-gallring-form input[type="text"] {
    max-width: 12rem;
}

.individ-gallring-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.individ-gallring-actions .btn { margin-top: 0; }

.btn-ghost {
    background: transparent;
    color: var(--brand);
    box-shadow: none;
    border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-subtle);
    border-color: var(--brand-mid);
    color: var(--brand-dark);
    box-shadow: none;
    transform: none;
}

.btn-sm { padding: .4rem .8rem; font-size: .82rem; margin-top: 0; }
.btn-block { width: 100%; }
.btn-link {
    background: none;
    color: var(--brand);
    padding: .35rem 0;
    margin-top: .5rem;
    box-shadow: none;
    font-weight: 600;
}
.btn-link:hover:not(:disabled) {
    text-decoration: underline;
    transform: none;
    box-shadow: none;
    background: none;
}

form.inline { display: inline; }

.auth-alt-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .5rem;
    margin-top: .75rem;
}

.auth-alt-actions .auth-alt-sep {
    color: var(--muted);
    user-select: none;
}

.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .92rem;
    border: 1px solid transparent;
}

.alert-error { background: var(--error-bg); color: var(--error-ink); border-color: rgba(155, 28, 15, .15); }
.alert-info { background: var(--info-bg); color: var(--info-ink); border-color: rgba(26, 95, 140, .15); }
.alert-success { background: var(--success-bg); color: var(--success-ink); border-color: rgba(26, 92, 52, .15); }

.muted { color: var(--muted); font-size: .9rem; }
.hint { font-size: .82rem; color: var(--muted-light); margin: -.35rem 0 .75rem; line-height: 1.4; }

.field-feedback {
    font-size: .85rem;
    margin: .35rem 0 0;
    line-height: 1.4;
}

.field-feedback--checking { color: var(--muted); }
.field-feedback--available { color: var(--success-ink); }
.field-feedback--taken,
.field-feedback--invalid { color: var(--error-ink); }

input[data-personnummer-state="taken"],
input[data-personnummer-state="invalid"] {
    border-color: var(--error-ink);
}

input[data-personnummer-state="available"] {
    border-color: var(--success-ink);
}

.stats { list-style: none; padding: 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.stats li { background: var(--bg-subtle); padding: .85rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-light); }
.stats strong { font-size: 1.4rem; color: var(--brand-dark); display: block; font-weight: 700; }

.back { margin-top: 1.5rem; text-align: center; }
.back a { color: var(--muted); font-size: .88rem; font-weight: 500; }
.back a:hover { color: var(--brand); }

/* Statusmärken */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-active { background: var(--success-bg); color: var(--success-ink); border-color: rgba(26, 92, 52, .12); }
.badge-pilot { background: var(--info-bg); color: var(--info-ink); border-color: rgba(26, 95, 140, .12); }
.badge-suspended { background: var(--error-bg); color: var(--error-ink); border-color: rgba(155, 28, 15, .12); }
.badge-att-gora { background: var(--accent-individ-bg); color: var(--accent-individ); border-color: rgba(45, 106, 79, .15); }
.badge-aktivitet { background: var(--accent-kommun-bg); color: var(--accent-kommun); border-color: rgba(26, 95, 140, .15); }

/* Formulär */
.form-grid { display: grid; gap: 0 1.25rem; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full-width { grid-column: 1 / -1; }

.form-section-title {
    grid-column: 1 / -1;
    margin: .5rem 0 0;
    padding-top: .5rem;
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-light);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .88rem;
    margin: 1rem 0 .35rem;
}
.checkbox-label input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--brand); }

.individ-4d-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
}
.individ-4d-form .checkbox-label { margin: 0; }

/* Tabeller */
.table-wrap {
    overflow-x: auto;
    margin: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.table th, .table td {
    text-align: left;
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    background: var(--bg-subtle);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(26, 95, 140, .03); }
.table td:last-child, .table th:last-child { text-align: right; white-space: nowrap; }
.table code {
    font-size: .85em;
    background: var(--bg-subtle);
    padding: .15rem .45rem;
    border-radius: 4px;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    color: var(--ink-soft);
}

/* ── Systemägarportal (/admin) ─────────────────────────────────────────── */

.portal-admin--login {
    min-height: 100vh;
}

.portal-admin--login.portal-auth-page {
    width: 100%;
}

.portal-admin--login .portal-auth-brand,
.portal-admin--login .portal-auth-panel {
    min-height: 100vh;
}

.input-code {
    letter-spacing: .35em;
    font-size: 1.35rem;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.portal-admin--authenticated {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
    --admin-chrome: #3d4a5c;
    --admin-chrome-dark: #2d3748;
    --admin-chrome-mid: #4a5568;
}

.admin-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--admin-chrome-dark) 0%, var(--admin-chrome) 55%, var(--admin-chrome-mid) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-right: 1px solid rgba(255, 255, 255, .06);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-brand {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.admin-sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
    text-align: center;
}

.admin-sidebar-mark {
    width: 100%;
    height: 80px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2rem;
    flex-shrink: 0;
}

.admin-sidebar-brand h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.25;
}

.admin-sidebar-brand p {
    margin: .25rem 0 0;
    font-size: .8rem;
    opacity: .55;
}

.admin-nav-label {
    padding: 1rem 1.25rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .4);
}

.admin-nav {
    list-style: none;
    margin: 0;
    padding: .25rem .75rem;
    flex: 1;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
}

.admin-nav a:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.admin-nav a.is-active {
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-weight: 600;
}

.admin-nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: .85;
}

.admin-nav a.is-active .admin-nav-icon { opacity: 1; }

.admin-nav__badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #fff;
    color: var(--accent-kommun);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

.admin-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    margin-top: auto;
}

.admin-sidebar-footer a {
    color: rgba(255, 255, 255, .45);
    font-size: .8rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}

.admin-sidebar-footer a:hover { color: rgba(255, 255, 255, .85); }

.admin-nav-icon svg {
    width: 20px;
    height: 20px;
}

.admin-stat-icon svg {
    width: 20px;
    height: 20px;
}

.admin-empty-icon svg {
    width: 24px;
    height: 24px;
}

.admin-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-topbar-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.02em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-topbar-user {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem .75rem;
    font-size: .85rem;
    color: var(--muted);
}

.admin-topbar-user form { margin: 0; }
.admin-topbar-user .btn { margin-top: 0; }

.admin-topbar-user strong { color: var(--ink); font-weight: 600; }

.admin-main {
    flex: 1;
    padding: 1.75rem 2rem 2.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.admin-main > .admin-alerts,
.admin-main > .admin-stats,
.admin-main > .admin-page-grid,
.admin-main > .admin-section-stack,
.admin-main > .admin-health-banner,
.admin-main > .card,
.admin-main > .admin-back-link,
.admin-main > .page-lead {
    margin: 0;
}

.admin-alerts .alert { margin-bottom: .5rem; }
.admin-alerts .alert:last-child { margin-bottom: 0; }

.admin-section-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.admin-page-grid .card + .card,
.admin-section-stack .card + .card,
.admin-main > .card + .card {
    margin-top: 0;
}

.admin-back-link {
    margin: 0;
    text-align: left;
}

.admin-back-link a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--muted);
}

.admin-back-link a:hover { color: var(--brand); }

/* Statistik-kort */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.admin-stat {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.admin-stat:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

a.admin-stat {
    text-decoration: none;
    color: inherit;
}

a.admin-stat:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.admin-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--accent-admin-bg);
    color: var(--accent-admin);
}

.portal-admin--authenticated .admin-stat--info .admin-stat-icon {
    background: var(--info-bg);
    color: var(--info-ink);
}

.admin-stat-icon svg { width: 20px; height: 20px; }

.admin-stat-body { min-width: 0; }

.admin-stat-value {
    display: block;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.admin-stat-label {
    display: block;
    margin-top: .2rem;
    font-size: .82rem;
    color: var(--muted);
    font-weight: 500;
}

.admin-stat--success .admin-stat-icon { background: var(--success-bg); color: var(--success-ink); }
.admin-stat--warning .admin-stat-icon { background: var(--warning-bg); color: var(--warning-ink); }
.admin-stat--info .admin-stat-icon { background: var(--info-bg); color: var(--info-ink); }

.admin-page-grid { display: grid; gap: 1.25rem; align-items: start; }
.admin-page-grid--split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-page-grid--single { grid-template-columns: 1fr; }

.admin-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    font-size: .85rem;
    color: var(--muted);
    margin: -.25rem 0 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.admin-meta code {
    background: var(--bg-subtle);
    padding: .15rem .45rem;
    border-radius: 4px;
    font-size: .88em;
}

.admin-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--muted);
    font-size: .92rem;
}

.admin-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-light);
}

.admin-empty-icon svg { width: 24px; height: 24px; }

.admin-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .55rem 1.5rem;
    font-size: .9rem;
}

.admin-dl dt { font-weight: 600; color: var(--muted); font-size: .82rem; }
.admin-dl dd { margin: 0; color: var(--ink-soft); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.role-descriptions {
    margin: 1rem 0 1.5rem;
    display: grid;
    gap: 1rem;
}

.role-descriptions__item {
    margin: 0;
    padding: .85rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.role-descriptions dt {
    margin: 0 0 .35rem;
    font-weight: 600;
    color: var(--ink);
}

.role-descriptions dd {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
}

.role-matrix th,
.role-matrix td {
    text-align: center;
    vertical-align: middle;
}

.role-matrix th[scope="row"],
.role-matrix thead th:first-child {
    text-align: left;
}

.role-matrix__access {
    font-size: 1rem;
    line-height: 1;
}

.role-matrix__yes {
    color: var(--success-ink);
    font-weight: 700;
}

.role-matrix__no {
    color: var(--muted-light);
}

.admin-health-banner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    font-size: .92rem;
    border: 1px solid transparent;
}

.admin-health-banner ul { margin: .5rem 0 0; padding-left: 1.25rem; }
.admin-health-ok { background: var(--success-bg); color: var(--success-ink); border-color: rgba(26, 92, 52, .15); }
.admin-health-warn { background: var(--warning-bg); color: var(--warning-ink); border-color: rgba(122, 88, 0, .15); }

.portal-admin--authenticated .admin-onboarding-card {
    border-color: var(--accent-admin);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(74, 85, 104, .1);
}

.input-with-action {
    display: flex;
    gap: .5rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.input-with-action select {
    flex: 1 1 12rem;
    min-width: 0;
}

.admin-pricing-effective {
    margin: .35rem 0 0;
    font-size: 1.05rem;
}

.admin-pricing-effective strong {
    color: var(--ink);
}

.admin-support-active {
    background: var(--info-bg);
    border: 1px solid rgba(26, 95, 140, .12);
    border-radius: var(--radius-sm);
    padding: 1.15rem 1.25rem;
}

.admin-support-summary {
    list-style: none;
    padding: 0;
    margin: .75rem 0;
    font-size: .9rem;
    display: grid;
    gap: .35rem;
}

.admin-audit-filter {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.admin-audit-filter select { width: auto; min-width: 180px; margin: 0; }

.admin-list-search {
    margin: 0;
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: .5rem;
    width: 100%;
}

.admin-list-search input[type="search"] {
    flex: 1;
    min-width: 0;
    width: auto;
    margin: 0;
}

.admin-list-search .btn {
    flex-shrink: 0;
    margin: 0;
}

.admin-list-search-clear {
    align-self: center;
    white-space: nowrap;
}

.card-header--individ {
    align-items: center;
}

.individ-header-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-left: auto;
}

.individ-search-meta {
    margin: 0 0 .75rem;
}

.individ-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.individ-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
}

.individ-list__item:last-child {
    border-bottom: none;
}

.individ-list__item.is-highlighted {
    background: rgba(26, 95, 140, .06);
}

.individ-list__name {
    font-weight: 600;
    color: var(--ink);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.individ-list__actions {
    display: flex;
    flex-shrink: 0;
    flex-wrap: nowrap;
    gap: .35rem;
}

@media (min-width: 901px) {
    .card-header--individ .admin-list-search {
        width: auto;
        min-width: 280px;
        max-width: 360px;
    }
}

.card-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-left: auto;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.table tbody tr.is-highlighted {
    background: rgba(26, 95, 140, .06);
}

.portal-admin--authenticated .card-header .admin-audit-filter,
.portal-kommun--authenticated .card-header .admin-audit-filter,
.portal-admin--authenticated .card-header .card-header-actions .admin-audit-filter {
    margin-left: 0;
}
.inline-label { font-weight: 600; font-size: .82rem; margin: 0; color: var(--muted); }

.admin-audit-table .audit-details {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
    color: var(--muted);
    font-family: ui-monospace, monospace;
}

/* Mobilmeny */
.admin-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
}

.admin-menu-toggle:hover {
    background: var(--bg-subtle);
    border-color: var(--brand-mid);
    color: var(--ink);
}

.admin-menu-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

.admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(21, 37, 53, .45);
    z-index: 90;
    border: none;
    padding: 0;
    margin: 0;
}

body.admin-nav-open {
    overflow: hidden;
}

body.admin-nav-open .admin-sidebar-overlay {
    display: block;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.confirm-modal[hidden] {
    display: none;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(21, 37, 53, .45);
    cursor: pointer;
}

.confirm-modal-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 28rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem 1.5rem 1.5rem;
}

.confirm-modal-title {
    margin: 0 0 .75rem;
    font-size: 1.15rem;
}

.confirm-modal-message {
    margin: 0 0 1.25rem;
    color: var(--text);
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .5rem;
}

body.confirm-modal-open {
    overflow: hidden;
}

.admin-backup-progress {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(21, 37, 53, .55);
}

.admin-backup-progress[hidden] {
    display: none;
}

.admin-backup-progress-panel {
    width: min(100%, 28rem);
    padding: 1.75rem 1.5rem;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.admin-backup-progress-spinner {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 1rem;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: admin-backup-spin .8s linear infinite;
}

.admin-backup-progress-title {
    margin: 0 0 .5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.admin-backup-progress-text {
    margin: 0;
    font-size: .95rem;
    line-height: 1.5;
}

@keyframes admin-backup-spin {
    to { transform: rotate(360deg); }
}

/* Responsiv */
@media (max-width: 900px) {
    .portal-auth-page {
        flex-direction: column;
        min-height: 100dvh;
        min-height: 100svh;
    }

    .portal-kommun--login .portal-auth-brand,
    .portal-kommun--login .portal-auth-panel,
    .portal-admin--login .portal-auth-brand,
    .portal-admin--login .portal-auth-panel {
        min-height: auto;
    }

    .portal-auth-brand {
        flex: 0 0 auto;
        min-height: auto;
        padding: 1rem 1.25rem .85rem;
    }

    .portal-auth-brand h1 {
        margin: 0;
        font-size: 1.2rem;
        line-height: 1.25;
    }

    .portal-auth-brand .tagline {
        display: none;
    }

    .portal-auth-features {
        display: none;
    }

    .portal-auth-mark,
    .tenant-logo--auth {
        width: 36px;
        height: 36px;
        margin-bottom: .65rem;
        font-size: .95rem;
    }

    .portal-individ--authenticated .portal-individ-header {
        display: grid;
        grid-template-areas:
            "logo logout"
            "title title";
        gap: .5rem .75rem;
        align-items: start;
        margin-bottom: .75rem;
    }

    .portal-individ--authenticated .portal-individ-header-brand {
        display: contents;
    }

    .portal-individ--authenticated .portal-individ-header-brand h1 {
        grid-area: title;
        margin: 0;
        font-size: 1.2rem;
    }

    .portal-individ--authenticated .portal-individ-header-brand .tenant-logo--header {
        grid-area: logo;
        width: auto;
        height: auto;
        max-width: min(calc(100vw - 7rem), 280px);
        max-height: 120px;
    }

    .portal-individ--authenticated .portal-individ-header-brand .portal-individ-mark {
        grid-area: logo;
        width: 96px;
        height: 96px;
        font-size: 2.1rem;
        border-radius: 20px;
    }

    .portal-individ--authenticated .portal-individ-logout {
        grid-area: logout;
        justify-self: end;
    }

    .portal-auth-panel {
        flex: 1 1 auto;
        align-items: flex-start;
        justify-content: flex-start;
        padding: .75rem 1rem 1rem;
        min-height: 0;
    }

    .portal-auth-form-wrap .card {
        padding: 1.15rem;
    }

    .portal-auth-form-wrap .card h2 {
        margin-bottom: .35rem;
        font-size: 1.05rem;
    }

    .portal-auth-form-wrap .card > .muted {
        margin: 0 0 .65rem;
        font-size: .85rem;
        line-height: 1.4;
    }

    .portal-auth-form-wrap label {
        margin: .65rem 0 .35rem;
    }

    .portal-auth-form-wrap .alert {
        margin-bottom: .75rem;
        padding: .65rem .85rem;
        font-size: .88rem;
    }

    .portal-auth-form-wrap .btn {
        margin-top: .85rem;
    }

    .portal-auth-form-wrap .back {
        margin-top: .85rem;
    }

    .portal-admin--authenticated,
    .portal-kommun--authenticated {
        flex-direction: column;
        min-height: 100dvh;
        min-height: 100svh;
        overflow-x: clip;
    }

    .admin-shell {
        overflow-x: clip;
        max-width: 100%;
    }

    .admin-menu-toggle { display: inline-flex; }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(var(--sidebar-width), 85vw);
        z-index: 100;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        padding: 0;
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
        gap: 0;
        transform: translateX(-100%);
        transition: transform var(--transition);
        box-shadow: var(--shadow-lg);
        height: auto;
    }

    body.admin-nav-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-brand {
        border-bottom: 1px solid rgba(255, 255, 255, .08);
        padding: 1.5rem 1.25rem 1.25rem;
        flex: none;
    }

    .admin-nav-label { display: block; }

    .admin-nav {
        display: block;
        padding: .25rem .75rem;
        flex: 1;
        width: auto;
        order: unset;
    }

    .admin-nav a { font-size: .9rem; padding: .65rem .75rem; }

    .admin-sidebar-footer {
        display: block;
        width: auto;
        order: unset;
        padding: 1rem 1.25rem;
        border-top: 1px solid rgba(255, 255, 255, .08);
        margin-top: auto;
    }

    .admin-topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "menu title"
            "user user";
        align-items: center;
        gap: .5rem .75rem;
        padding: max(.75rem, env(safe-area-inset-top, 0)) max(1rem, env(safe-area-inset-right, 0)) .75rem max(1rem, env(safe-area-inset-left, 0));
    }

    .admin-menu-toggle { grid-area: menu; }

    .admin-topbar-title {
        grid-area: title;
        font-size: 1rem;
    }

    .admin-topbar-user {
        grid-area: user;
        width: 100%;
        justify-content: space-between;
        padding-top: .35rem;
        border-top: 1px solid var(--border-light);
    }

    .admin-topbar-user span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-main {
        padding: 1rem max(1rem, env(safe-area-inset-right, 0)) max(1rem, env(safe-area-inset-bottom, 0)) max(1rem, env(safe-area-inset-left, 0));
        max-width: none;
    }

    .portal-admin--authenticated .admin-main code,
    .portal-admin--authenticated .admin-dl dd,
    .portal-admin--authenticated .card .muted code {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .portal-admin--login .input-code {
        letter-spacing: .2em;
        font-size: 1.25rem;
    }
    .admin-page-grid--split { grid-template-columns: 1fr; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }

    .card { padding: 1.25rem; }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header h2 {
        overflow-wrap: anywhere;
    }

    .portal-admin--authenticated .card-header .admin-audit-filter {
        margin-left: 0;
        width: 100%;
    }

    .card-header--individ {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
    }

    .individ-header-tools {
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .card-header--individ .individ-header-tools > .btn-sm {
        width: 100%;
        justify-content: center;
    }

    .card-header--individ .admin-list-search {
        width: 100%;
        max-width: none;
    }

    .card-header--individ .admin-list-search input[type="search"] {
        flex: 1;
        min-width: 0;
    }

    .individ-list__item {
        flex-wrap: wrap;
        padding: .85rem 1rem;
    }

    .individ-list__name {
        flex: 1 1 auto;
        white-space: normal;
    }

    .individ-list__actions {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .individ-flikar {
        gap: .25rem;
        padding: .25rem;
    }

    .individ-flik {
        flex: 1 1 calc(50% - .25rem);
        justify-content: center;
        padding: .65rem .5rem;
        font-size: .82rem;
    }

    .card-header-actions {
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .card-header-actions form.inline,
    .card-header-actions .admin-audit-filter {
        width: 100%;
    }

    .card-header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .admin-audit-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-audit-filter select {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    .admin-backup-actions .btn {
        width: 100%;
    }

    .admin-dl {
        grid-template-columns: 1fr;
        gap: .25rem;
    }

    .admin-dl dt { margin-top: .65rem; }
    .admin-dl dt:first-child { margin-top: 0; }

    .table--responsive thead { display: none; }

    .table--responsive tbody tr {
        display: block;
        margin-bottom: .75rem;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        background: var(--surface);
    }

    .table--responsive tbody tr:last-child { margin-bottom: 0; }

    .table--responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: .5rem 1rem;
        border-bottom: 1px solid var(--border-light);
        text-align: left !important;
        white-space: normal;
    }

    .table--responsive tbody td:last-child {
        border-bottom: none;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: .35rem;
        padding-top: .65rem;
    }

    .table--responsive tbody td:last-child .table-actions {
        display: flex;
        flex-wrap: wrap;
        gap: .35rem;
        justify-content: flex-start;
        flex: 1;
        min-width: 0;
    }

    .table--responsive tbody td:last-child .table-actions .btn {
        margin-top: 0;
    }

    .table--responsive tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--muted);
        flex-shrink: 0;
    }

    .table--responsive .audit-details {
        max-width: none;
        white-space: normal;
        word-break: break-word;
        text-align: right;
    }

    .table-wrap:has(.table--responsive) {
        overflow: visible;
        border: none;
    }
}

@media (max-width: 640px) {
    .landing-hero { padding: 2.5rem 1rem 1.5rem; }
    .admin-stats { grid-template-columns: 1fr; }
    .admin-meta { flex-direction: column; align-items: flex-start; }
    .btn { min-height: 2.75rem; }
    .btn-sm { min-height: 2.25rem; }

    .portal-admin--authenticated .table--responsive tbody td:last-child > .btn,
    .portal-admin--authenticated .table--responsive tbody td:last-child > form,
    .portal-admin--authenticated .table--responsive tbody td:last-child > .table-actions {
        width: 100%;
    }

    .portal-admin--authenticated .table--responsive tbody td:last-child > form .btn,
    .portal-admin--authenticated .table--responsive tbody td:last-child > .table-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Individ – interna kommunvyer (anteckning, notislogg, bilagor) */
.individ-profil-header {
    margin-bottom: 0;
}

.individ-profil-sammanfattning {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .85rem;
    padding-top: .15rem;
    font-size: .9rem;
    color: var(--ink-muted);
}

.individ-profil-sammanfattning__punkt::before {
    content: "·";
    margin-right: .85rem;
    color: var(--border);
}

.individ-profil-sammanfattning__punkt:first-of-type::before {
    content: none;
    margin: 0;
}

.individ-flikar {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: 1rem 0 1.25rem;
    padding: .35rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-subtle);
}

.individ-flik {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .85rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.individ-flik:hover {
    color: var(--ink);
    background: var(--surface);
}

.individ-flik.is-active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.individ-flik-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--accent-kommun);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

.individ-oversikt-paminnelser {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-top: 1rem;
}

.individ-oversikt-paminnelse {
    display: inline-flex;
    align-items: center;
    padding: .45rem .75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--ink);
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
}

.individ-oversikt-paminnelse:hover {
    border-color: var(--accent-kommun);
    color: var(--accent-kommun);
}

.individ-oversikt-paminnelse--meddelande {
    border-color: rgba(26, 95, 140, .35);
    background: var(--accent-kommun-bg);
    color: var(--accent-kommun);
}

.individ-oversikt-paminnelse--dokument {
    border-color: rgba(26, 95, 140, .35);
    background: var(--accent-kommun-bg);
    color: var(--accent-kommun);
}

.individ-list__meddelande-badge {
    display: inline-flex;
    margin-left: .45rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--accent-kommun-bg);
    color: var(--accent-kommun);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.individ-list__meddelande-badge:hover {
    background: var(--accent-kommun);
    color: #fff;
}

.individ-list__dokument-badge {
    display: inline-flex;
    margin-left: .45rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--accent-kommun-bg);
    color: var(--accent-kommun);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.individ-list__dokument-badge:hover {
    background: var(--accent-kommun);
    color: #fff;
}

.kommun-meddelande-notis {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .85rem 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(26, 95, 140, .22);
    border-radius: var(--radius);
    background: var(--accent-kommun-bg);
    color: var(--accent-kommun);
}

.kommun-meddelande-notis__innehall {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    min-width: min(100%, 18rem);
}

.kommun-meddelande-notis__ikon {
    display: inline-flex;
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    margin-top: .1rem;
}

.kommun-meddelande-notis__ikon svg {
    width: 100%;
    height: 100%;
}

.kommun-meddelande-notis__text strong {
    display: block;
    font-size: .95rem;
    line-height: 1.45;
}

.kommun-meddelande-notis__lista {
    list-style: none;
    margin: .55rem 0 0;
    padding: 0;
    display: grid;
    gap: .35rem;
}

.kommun-meddelande-notis__lista a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.kommun-meddelande-notis__knapp {
    flex-shrink: 0;
    align-self: center;
}

.kommun-meddelande-kort__lead {
    margin: 0 0 1rem;
}

.kommun-meddelande-kort__lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .65rem;
}

.kommun-meddelande-kort__lank {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem .95rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease;
}

.kommun-meddelande-kort__lank:hover {
    border-color: var(--accent-kommun);
    background: var(--accent-kommun-bg);
}

.kommun-meddelande-kort__namn {
    font-weight: 600;
    color: var(--ink);
}

.kommun-meddelande-kort__meta {
    flex-shrink: 0;
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent-kommun);
}

.individ-anteckning-sektion {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.individ-anteckning-textarea {
    min-height: 9rem;
}

.individ-intern-sektion {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.individ-intern-kort {
    margin-top: 1rem;
}

.individ-intern-sektion__title {
    margin: 0 0 .35rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}

.individ-intern-beskrivning {
    margin: 0 0 1rem;
    font-size: .88rem;
}

.individ-anteckning-visning {
    padding: .85rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    white-space: pre-wrap;
    line-height: 1.55;
    font-size: .92rem;
}

.individ-notislogg {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: grid;
    gap: .75rem;
}

.individ-notislogg__post {
    padding: .85rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.individ-notislogg__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    margin-bottom: .45rem;
    font-size: .8rem;
    color: var(--muted);
}

.individ-notislogg__meta time {
    font-weight: 700;
    color: var(--ink-soft);
}

.individ-notislogg__forfattare::before {
    content: "·";
    margin-right: 1rem;
}

.individ-notislogg__text {
    font-size: .92rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.individ-notis-form,
.individ-bilaga-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.individ-notis-textarea {
    min-height: 7rem;
    margin-bottom: .75rem;
}

.individ-bilaga-form input[type="file"] {
    margin-bottom: .35rem;
}

.individ-bilaga-notering {
    min-height: 3.5rem;
    margin-bottom: .75rem;
}

.individ-bilaga-edit-form h4 {
    margin: 0 0 .5rem;
    font-size: 1rem;
}

.individ-bilaga-edit-form .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.individ-bilaga-tabell td:first-child,
.individ-bilaga-tabell .individ-bilaga-notering-cell {
    word-break: break-word;
    max-width: 16rem;
    white-space: pre-wrap;
}

.individ-aktivitet-form,
.individ-att-gora-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.individ-aktivitet-form--standalone {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.individ-att-gora-form--standalone {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.individ-aktivitet-registrera-kort {
    border-color: rgba(26, 95, 140, .2);
    background: linear-gradient(to bottom, var(--accent-kommun-bg) 0, var(--bg) 3rem);
}

.individ-att-gora-registrera-kort {
    border-color: rgba(26, 95, 140, .2);
    background: linear-gradient(to bottom, var(--accent-kommun-bg) 0, var(--bg) 3rem);
}

.individ-aktivitet-form h4 {
    margin: 0 0 .75rem;
    font-size: 1rem;
}

.individ-aktivitet-notering {
    min-height: 5rem;
    margin-bottom: .35rem;
}

.aktivitet-katalog-preview {
    padding: .85rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.aktivitet-katalog-preview__kategori {
    margin: 0 0 .35rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.aktivitet-katalog-preview__beskrivning {
    margin: 0;
    font-size: .92rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.individ-aktivitet-status-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.individ-aktivitet-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.individ-aktivitet-status-select {
    max-width: 10rem;
}

.individ-aktivitet-narvaro-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.individ-aktivitet-narvaro-select {
    max-width: 11rem;
}

.individ-aktivitet-narvaro-kommentar {
    min-width: 10rem;
    max-width: 14rem;
}

.individ-aktivitet-kommentar-rad td {
    padding-top: 0;
    font-size: .85rem;
    border-top: none;
}

.individ-att-gora-lista {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    gap: .65rem;
}

.individ-att-gora-lista__post {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.individ-att-gora-lista__innehall {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    flex: 1;
    min-width: 12rem;
}

.individ-att-gora-lista__text {
    font-size: .92rem;
}

.individ-att-gora-textarea {
    min-height: 4rem;
    margin-bottom: .75rem;
}

.att-gora-forfall {
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}

.att-gora-forfall--overdue {
    color: var(--error-ink);
    background: var(--error-bg);
    padding: .12rem .45rem;
    border-radius: 4px;
    border: 1px solid rgba(155, 28, 15, .18);
}

.individ-att-gora-lista__forfall--overdue {
    color: var(--error-ink);
    font-weight: 600;
}

.att-gora-rad--overdue {
    background: rgba(253, 236, 234, .55);
}

.att-gora-rad--overdue:hover {
    background: rgba(253, 236, 234, .85);
}

.att-gora-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
    margin: -.5rem 0 1.25rem;
    font-size: .88rem;
}

.att-gora-klar-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
    min-width: 12rem;
}

.att-gora-klar-hint {
    font-size: .85rem;
    max-width: 12rem;
    line-height: 1.4;
}

.att-gora-klar-notering {
    width: 100%;
    min-width: 12rem;
    min-height: 3.5rem;
    font-size: .85rem;
}

.individ-att-gora-lista__post:has(.individ-att-gora-lista__forfall--overdue) {
    border-color: rgba(155, 28, 15, .22);
    background: rgba(253, 236, 234, .35);
}

.individ-att-gora-lista__forfall {
    font-size: .85rem;
}

.individ-att-gora-historik {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.individ-att-gora-historik__title {
    margin: 0 0 .75rem;
    font-size: .95rem;
}

.individ-att-gora-historik-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .75rem;
}

.individ-att-gora-historik-lista__post {
    padding: .75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: #fff;
}

.individ-att-gora-historik-lista__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .75rem;
    margin-bottom: .35rem;
    font-size: .85rem;
    color: var(--ink-soft);
}

.individ-att-gora-historik-lista__forfattare::before {
    content: '·';
    margin-right: .35rem;
    color: var(--ink-muted);
}

.individ-att-gora-historik-lista__text {
    font-size: .92rem;
}

.individ-att-gora-historik-lista__forfall {
    margin-top: .25rem;
    font-size: .85rem;
}

.individ-att-gora-historik-lista__notering {
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px dashed var(--border-light);
    font-size: .9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.att-gora-historik {
    margin-top: 1.5rem;
}

.att-gora-historik__lead {
    margin: 0 1.25rem 1rem;
    font-size: .9rem;
}

.att-gora-historik__notering {
    font-size: .9rem;
    line-height: 1.5;
    max-width: 20rem;
    white-space: pre-wrap;
}

.individ-list-filters {
    flex-wrap: wrap;
    gap: .5rem;
}

.individ-list-filters select {
    min-width: 9rem;
    max-width: 12rem;
}

.individ-register-filters {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.individ-register-filters__grid {
    margin-bottom: .75rem;
}

.individ-register-filters__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.individ-register-tabell {
    min-width: 52rem;
}

.individ-register-tabell th:nth-child(2),
.individ-register-tabell th:nth-child(3),
.individ-register-tabell td:nth-child(2),
.individ-register-tabell td:nth-child(3) {
    white-space: nowrap;
}

.individ-register-tabell .table-actions {
    white-space: nowrap;
}

.individ-list__krav-badge {
    margin-left: .5rem;
    font-size: .75rem;
    vertical-align: middle;
}

.individ-portal-akt-list {
    display: grid;
    gap: 1rem;
}

.individ-portal-akt {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    background: #fff;
}

.individ-portal-akt__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

.individ-portal-akt__header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.individ-portal-akt__meta {
    display: grid;
    gap: .35rem;
    margin: 0 0 .75rem;
    font-size: .92rem;
}

.individ-portal-akt__meta > div {
    display: flex;
    gap: .5rem;
}

.individ-portal-akt__meta dt {
    min-width: 6.5rem;
    margin: 0;
    color: var(--text-muted);
}

.individ-portal-akt__meta dd {
    margin: 0;
}

.individ-portal-akt__notering {
    margin: 0 0 .75rem;
    padding: .75rem;
    border-radius: var(--radius);
    background: var(--accent-individ-bg);
}

.individ-portal-akt__beskrivning {
    margin: 0 0 .75rem;
}

.individ-portal-akt__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: flex-end;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border-light);
}

.individ-portal-akt__actions--franvaro {
    flex-direction: column;
    align-items: stretch;
}

.individ-portal-akt__actions--franvaro textarea {
    width: 100%;
    min-height: 4rem;
}

.individ-portal-akt-list--history .individ-portal-akt {
    opacity: .92;
}

.individ-portal-undantag-list {
    display: grid;
    gap: 1rem;
}

.individ-portal-undantag {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    background: #fff;
}

.individ-portal-undantag__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
}

.individ-portal-undantag__header h3 {
    margin: 0;
    font-size: 1rem;
}

.individ-undantag-form label,
.individ-undantag-form select,
.individ-undantag-form input,
.individ-undantag-form textarea {
    display: block;
    width: 100%;
    margin-bottom: .75rem;
}

.individ-undantag-registrera-kort {
    border-color: rgba(26, 95, 140, .2);
    background: linear-gradient(to bottom, var(--accent-kommun-bg) 0, var(--bg) 3rem);
}

.individ-undantag-form .form-grid {
    display: grid;
    gap: .75rem;
}

.individ-portal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.individ-portal-nav__link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: .9rem;
    background: var(--bg);
}

.individ-portal-nav__link:hover {
    border-color: var(--accent-individ);
    color: var(--accent-individ);
}

.individ-portal-nav__link.is-active {
    background: var(--accent-individ-bg);
    border-color: rgba(45, 106, 79, .25);
    color: var(--accent-individ);
    font-weight: 600;
}

.individ-portal-nav__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--accent-individ);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

.individ-portal-start-list {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    display: grid;
    gap: .75rem;
}

.individ-portal-start-list__item {
    margin: 0;
}

.individ-portal-start-list__link {
    display: block;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    background: var(--bg);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.individ-portal-start-list__link:hover {
    border-color: var(--accent-individ);
    box-shadow: 0 2px 8px rgba(45, 106, 79, .08);
}

.individ-portal-start-list__title {
    display: block;
    font-weight: 600;
    color: var(--accent-individ);
    margin-bottom: .35rem;
}

.individ-portal-start-list__desc {
    display: block;
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.45;
}

.individ-portal-start-list__badge {
    display: inline-block;
    margin-top: .6rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--accent-individ-bg);
    color: var(--accent-individ);
    font-size: .78rem;
    font-weight: 600;
}

.individ-meddelanden-trad {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    max-height: 28rem;
    overflow-y: auto;
}

.individ-meddelanden-trad__post {
    max-width: 85%;
    padding: .75rem .9rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-subtle, #f7f8f9);
}

.individ-meddelanden-trad__post--egen {
    align-self: flex-end;
    background: var(--accent-individ-bg);
    border-color: rgba(45, 106, 79, .2);
}

.individ-meddelanden-trad__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .75rem;
    align-items: baseline;
    margin-bottom: .4rem;
    font-size: .82rem;
    color: var(--muted);
}

.individ-meddelanden-trad__forfattare {
    font-weight: 600;
    color: var(--text);
}

.individ-meddelanden-trad__text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
}

.individ-meddelanden-form {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.individ-meddelanden-textarea {
    width: 100%;
    margin-bottom: .75rem;
}

@media (min-width: 640px) {
    .form-grid--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.statistik-filter-card {
    margin-bottom: 1.25rem;
}

.statistik-filter-form .form-grid {
    margin-bottom: .75rem;
}

.statistik-bar-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 8rem;
}

.statistik-bar {
    height: .5rem;
    border-radius: 999px;
    background: var(--accent-individ);
    min-width: 0;
    flex: 1 1 auto;
    max-width: 8rem;
}

.statistik-fordelning-lista {
    list-style: none;
    margin: 0;
    padding: 0 1.25rem 1rem;
}

.statistik-fordelning-lista li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.statistik-fordelning-lista li:last-child {
    border-bottom: none;
}

.statistik-tabell--compact td,
.statistik-tabell--compact th {
    padding: .5rem .75rem;
}

.ivo-export-card .form-grid {
    margin-bottom: 1rem;
}

.ivo-export-checkbox {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1rem 0;
    font-size: .9375rem;
}

.ivo-export-hint {
    margin: 0 0 1rem;
    font-size: .875rem;
}

.ivo-export-info-list {
    margin: 0;
    padding-left: 1.25rem;
}

.ivo-export-info-list li {
    margin-bottom: .35rem;
}

.ivo-export-inline-form {
    display: inline;
}

.card-header-actions .ivo-export-inline-form {
    margin-right: .5rem;
}

.beslutsunderlag-card .form-grid {
    margin-bottom: 1rem;
}

.beslutsunderlag-form {
    margin-top: .5rem;
}

.aktivitetsplan-card {
    margin-bottom: 1.25rem;
}

.aktivitetsplan-filter-form {
    margin-bottom: 1rem;
}

.aktivitetsplan-filter-form .form-grid {
    margin-bottom: .75rem;
}

.admin-stats--compact {
    margin-bottom: 1.25rem;
}

.admin-stats--compact .admin-stat {
    min-height: auto;
}

.aktivitetsplan-tabell {
    margin-bottom: 1rem;
}

.plan-mall-apply-form {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.plan-mall-load-form {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.plan-mall-load-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.individ-aktivitetsplan-form textarea {
    width: 100%;
    margin-bottom: 1rem;
}

.plan-poster-editor {
    margin: 1rem 0;
}

.plan-poster-editor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .5rem;
}

.plan-poster-editor__header h4 {
    margin: 0;
    font-size: 1rem;
}

.plan-poster-tabell select,
.plan-poster-tabell input[type="text"] {
    width: 100%;
}

.plan-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border, #e2e8f0);
}

.plan-mall-basis,
.plan-senast-sparad {
    margin-bottom: .75rem;
}

.plan-mall-apply-options {
    margin-top: .5rem;
}

.plan-mall-admin-form .plan-poster-editor {
    margin-top: 1rem;
}

.plan-mall-post-chip {
    display: inline-block;
    margin: 0 .35rem .35rem 0;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--color-surface-muted, #f1f5f9);
    font-size: .85rem;
}

.aktivitet-schemalaggning {
    margin: 0 0 1.25rem;
    padding: 1rem 1rem .25rem;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: .5rem;
}

.aktivitet-schemalaggning legend {
    font-weight: 600;
    padding: 0 .35rem;
}

.aktivitet-schemalaggning__intro {
    margin: 0 0 .75rem;
}

/* Kommunlogotyp */
.tenant-logo {
    object-fit: contain;
    flex-shrink: 0;
}

.tenant-logo--sidebar {
    width: 100%;
    height: auto;
    max-height: 96px;
}

.tenant-logo--auth {
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
}

.tenant-logo--header {
    width: 40px;
    height: 40px;
}

.tenant-logo--admin {
    width: 120px;
    height: 120px;
}

.tenant-logo-admin {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

.tenant-logo-admin h3 {
    margin: 0 0 .35rem;
    font-size: 1rem;
}

.tenant-logo-admin-preview {
    margin: 1rem 0;
}

.tenant-logo-admin-upload {
    margin-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
