:root {
    --bg: #0a0b0f;
    --bg-elevated: #12141a;
    --surface: #16181f;
    --surface-hover: #1c1f28;
    --border: #2a2d38;
    --text: #f0f2f7;
    --muted: #8b92a5;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-soft: rgba(249, 115, 22, 0.14);
    --accent-glow: rgba(249, 115, 22, 0.35);
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --sidebar-collapsed: 68px;
    --sidebar-expanded: 220px;
    --topbar-height: 64px;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* App shell */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.has-sidebar .app-shell {
    margin-left: var(--sidebar-collapsed);
    transition: margin-left 0.25s ease;
}

.has-sidebar.sidebar-open .app-shell,
.has-sidebar .sidebar:hover + .sidebar-backdrop + .app-shell {
    margin-left: var(--sidebar-expanded);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-collapsed);
    background: #0d0e12;
    border-right: 1px solid var(--border);
    z-index: 200;
    transition: width 0.22s ease, box-shadow 0.22s ease;
    overflow: hidden;
}

.sidebar:hover,
.sidebar.is-open {
    width: var(--sidebar-expanded);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.55);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.85rem 0.55rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.45rem;
    margin-bottom: 1rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #fb923c);
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.85rem;
    color: #111;
    margin: 0 auto;
}

.brand-logo {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto;
    display: block;
}

.brand-logo--auth {
    width: 56px;
    height: 56px;
}

.sidebar:hover .brand-mark,
.sidebar.is-open .brand-mark,
.sidebar:hover .brand-logo,
.sidebar.is-open .brand-logo {
    margin: 0;
}

.brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s, width 0.2s;
}

.sidebar:hover .brand-text,
.sidebar.is-open .brand-text {
    opacity: 1;
    width: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-section + .sidebar-section {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(42, 45, 56, 0.65);
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 0.55rem 0.35rem;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.2s, height 0.2s;
}

.sidebar:hover .sidebar-section-title,
.sidebar.is-open .sidebar-section-title {
    opacity: 1;
    height: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.45rem;
    border-radius: 12px;
    color: #6b7288;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.sidebar-link:hover {
    color: var(--accent);
}

.sidebar-link.active {
    color: var(--accent);
}

.sidebar-icon-wrap {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.sidebar-icon-wrap svg {
    width: 21px;
    height: 21px;
}

.sidebar-link:hover .sidebar-icon-wrap {
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent);
}

.sidebar-link.active .sidebar-icon-wrap {
    background: linear-gradient(135deg, var(--accent) 0%, #fb923c 100%);
    color: #111;
    box-shadow: 0 4px 18px var(--accent-glow);
}

.sidebar-link.active .sidebar-icon-wrap svg {
    stroke: #111;
}

.sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    font-size: 0.88rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.sidebar:hover .sidebar-label,
.sidebar.is-open .sidebar-label {
    opacity: 1;
    width: auto;
}

.sidebar-footer {
    border-top: 1px solid rgba(42, 45, 56, 0.65);
    padding-top: 0.65rem;
    margin-top: 0.35rem;
}

.admin-area .sidebar-link.active .sidebar-icon-wrap {
    background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(10, 11, 15, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-spacer { flex: 1; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    border-radius: var(--radius);
    transition: background 0.15s ease;
}

.topbar-user:hover {
    background: rgba(255, 255, 255, 0.04);
}

.topbar-name { font-size: 0.9rem; color: var(--muted); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #fdba74);
    color: #111;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    object-fit: cover;
}

.avatar--img {
    display: block;
    border: 1px solid var(--border);
}

.icon-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

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

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
    max-width: 1400px;
    width: 100%;
}

/* Typography */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header .lead,
.lead {
    margin: 0;
    color: var(--muted);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card,
.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.card {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.card h2, .card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.panel { margin-bottom: 1.5rem; }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h2 { margin: 0; font-size: 1.1rem; }

/* Hero banner */
.hero-banner {
    background: linear-gradient(135deg, #1a1510 0%, var(--surface) 50%, #14161f 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.hero-banner h1 { margin: 0 0 0.5rem; font-size: 2rem; }
.hero-banner .version { color: var(--accent); font-size: 0.9rem; font-weight: 600; }

.hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #111;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #111;
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Forms */
.form-card label,
.form-group label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.form-card input,
.form-card select,
.form-card textarea,
.form-group input,
.form-group select,
.form-group textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tr:hover td { background: var(--surface-hover); }

/* Badges & alerts */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-disabled { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.badge-user { background: rgba(139, 146, 165, 0.15); color: var(--muted); }

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: rgba(34, 197, 94, 0.12); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.25); }
.alert-error { background: rgba(239, 68, 68, 0.12); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.25); }
.alert-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.25); }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(249, 115, 22, 0.25); }

.hint { color: var(--muted); font-size: 0.85rem; }

/* Auth pages */
.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(249, 115, 22, 0.08), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(249, 115, 22, 0.05), transparent 50%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

.footer-links a { color: var(--muted); margin-left: 1rem; }
.footer-links a:hover { color: var(--accent); }

/* Placeholder sections */
.coming-soon {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.coming-soon h2 { color: var(--text); margin-bottom: 0.5rem; }

/* Camp scan admin */
.scan-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scan-lk-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--accent-soft);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: var(--radius);
}

.scan-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin: 0;
}

.scan-fieldset legend {
    padding: 0 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.scan-mode-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    cursor: pointer;
}

.source-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.source-options label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.kingdom-picker {
    margin-top: 0.75rem;
}

.kingdom-picker-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.kingdom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.kingdom-chip {
    display: block;
    cursor: pointer;
}

.kingdom-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kingdom-chip-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color 0.15s, background 0.15s;
}

.kingdom-chip input:checked + .kingdom-chip-body {
    border-color: rgba(249, 115, 22, 0.55);
    background: var(--accent-soft);
}

.kingdom-chip:hover .kingdom-chip-body {
    border-color: rgba(249, 115, 22, 0.35);
}

.scan-credentials {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
}

.scan-credentials summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
}

.scan-credentials-open {
    background: rgba(249, 115, 22, 0.04);
}

.scan-auth-alert {
    margin-bottom: 1rem;
}

.scan-auth-steps {
    margin: 0.35rem 0 0.75rem;
    line-height: 1.55;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.recent-runs-scroll {
    max-height: min(70vh, 560px);
    overflow-y: auto;
    overflow-x: auto;
    margin: 0 0 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.recent-runs-scroll .data-table {
    margin: 0;
}

.recent-runs-scroll .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-elevated, var(--surface));
    box-shadow: 0 1px 0 var(--border);
}

.data-table-compact th,
.data-table-compact td {
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
}

.scan-help-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* KvK portal */
.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.breadcrumb {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.search-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.search-bar label { flex: 1; min-width: 200px; }

/* KvK overview — grouped by story, then LK cards */
.kvk-story-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.kvk-story-jump__link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.kvk-story-jump__link:hover {
    border-color: rgba(249, 115, 22, 0.45);
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.kvk-story-jump__chapter {
    color: var(--muted);
    font-weight: 500;
}

.kvk-story-jump__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.14);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
}

.kvk-story-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.kvk-story-section {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.2rem 1.25rem;
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.06) 0%, var(--surface) 28%);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
}

.kvk-story-section--has-cover {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.9) 55%, var(--surface) 100%),
        var(--story-cover) center / cover no-repeat;
    border-color: rgba(255, 255, 255, 0.12);
}

.kvk-story-section--has-cover .kvk-story-section__title {
    color: #f8fafc;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.kvk-story-section--has-cover .kvk-story-section__meta {
    color: rgba(248, 250, 252, 0.82);
}

.kvk-story-section--has-cover .kvk-story-section__chapter {
    color: #f8fafc;
}

.kvk-story-section--has-cover .kvk-story-section__header {
    border-bottom-color: rgba(255, 255, 255, 0.14);
}

.kvk-story-section--sid-20 {
    border-color: rgba(249, 115, 22, 0.28);
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.1) 0%, var(--surface) 32%);
}

.kvk-story-section--sid-20.kvk-story-section--has-cover {
    border-color: rgba(249, 115, 22, 0.45);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.68) 0%, rgba(120, 53, 15, 0.55) 40%, rgba(15, 23, 42, 0.92) 100%),
        var(--story-cover) center / cover no-repeat;
}

.kvk-story-section__header {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.kvk-story-section__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.kvk-story-section__meta {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.kvk-story-section__chapter {
    font-weight: 600;
    color: var(--text);
}

.kvk-story-section__dot {
    margin: 0 0.2rem;
    opacity: 0.55;
}

.kvk-story-section__live {
    color: #4ade80;
    font-weight: 600;
}

.kvk-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.kvk-hero-grid--nested {
    gap: 1rem;
}

.kvk-hero-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.15rem 1.2rem 1.2rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.kvk-hero-card:hover {
    border-color: rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
}

.kvk-hero-card--scanned {
    border-color: rgba(249, 115, 22, 0.22);
}

.kvk-hero-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.kvk-hero-card__code {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.kvk-hero-card__subtitle {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.kvk-hero-card__dot {
    margin: 0 0.15rem;
    opacity: 0.65;
}

.kvk-hero-card__header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    flex-shrink: 0;
}

.kvk-hero-card__dash-btn {
    border-color: rgba(249, 115, 22, 0.45);
    color: var(--accent);
    background: transparent;
}

.kvk-hero-card__dash-btn:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.kvk-hero-status {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.kvk-hero-status--ongoing {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.kvk-hero-status--upcoming {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.kvk-hero-status--ended {
    background: rgba(139, 146, 165, 0.12);
    color: var(--muted);
    border: 1px solid var(--border);
}

.kvk-hero-card__progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kvk-hero-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.kvk-hero-progress__bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-hover), var(--accent));
    box-shadow: 0 0 12px var(--accent-glow);
    transition: width 0.35s ease;
}

.kvk-hero-progress__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--muted);
}

.kvk-hero-card__summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.15rem;
}

.kvk-hero-card__summary-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.86rem;
    color: var(--text);
}

.kvk-hero-card__scan-meta {
    font-size: 0.76rem;
    color: var(--muted);
}

.kvk-hero-card__summary-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.kvk-hero-card__view-link {
    font-size: 0.82rem;
    color: var(--muted);
    text-decoration: none;
}

.kvk-hero-card__view-link:hover {
    color: var(--accent);
}

.kvk-hero-card__camps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.kvk-camp-tile {
    --camp-accent: var(--accent);
    position: relative;
    padding: 0.65rem 0.7rem 0.7rem 0.85rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.kvk-camp-tile::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--camp-accent);
    border-radius: 3px 0 0 3px;
}

.kvk-camp-tile--aeolia { --camp-accent: #e2e8f0; }
.kvk-camp-tile--dardania { --camp-accent: #f472b6; }
.kvk-camp-tile--lycia { --camp-accent: #c084fc; }
.kvk-camp-tile--mycenae { --camp-accent: #4ade80; }
.kvk-camp-tile--fire { --camp-accent: #fb923c; }
.kvk-camp-tile--earth { --camp-accent: #a3e635; }
.kvk-camp-tile--water { --camp-accent: #38bdf8; }
.kvk-camp-tile--wind { --camp-accent: #94a3b8; }

.kvk-camp-tile__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
}

.kvk-camp-tile__name {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.kvk-camp-tile__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--camp-accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--camp-accent) 55%, transparent);
}

.kvk-camp-tile__count {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.kvk-camp-tile__kingdoms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.kvk-kd-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.14rem 0.4rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.kvk-kd-tag--more {
    color: var(--muted);
    font-style: italic;
    border-style: dashed;
}

@media (max-width: 520px) {
    .kvk-hero-grid {
        grid-template-columns: 1fr;
    }

    .kvk-hero-card__header {
        flex-direction: column;
    }

    .kvk-hero-card__header-actions {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }

    .kvk-hero-card__summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

.kvk-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.camp-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.camp-summary-card {
    display: block;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.camp-summary-card:hover,
.camp-summary-card.is-active {
    border-color: rgba(249, 115, 22, 0.5);
    background: var(--accent-soft);
    color: var(--text);
}

.camp-summary-card h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.camp-summary-stats {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.camp-summary-stats strong { color: var(--text); }

.camp-summary-delta { margin-top: 0.45rem; font-size: 0.8rem; }

.kingdom-rank-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kingdom-rank-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}

.kingdom-rank-link {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    padding: 0.2rem 0.35rem;
    color: var(--text);
    text-decoration: none;
}

.kingdom-rank-item:hover,
.kingdom-rank-item.is-active {
    border-color: rgba(249, 115, 22, 0.45);
    background: var(--accent-soft);
}

.kingdom-rank-csv {
    flex-shrink: 0;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
}

.kingdom-rank-id { font-weight: 700; }
.kingdom-rank-camp { color: var(--muted); }
.kingdom-rank-kp { font-weight: 600; color: var(--accent); }

.delta {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.delta-up { color: var(--success); }
.delta-down { color: var(--error); }
.delta-zero { color: var(--muted); }
.delta-na { color: var(--muted); }

.stat-delta { margin-top: 0.25rem; font-size: 0.85rem; }

.governor-stats-dl .status-row dd {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 900px) {
    .kvk-dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Admin dashboard */
.admin-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.admin-tab {
    padding: 0.55rem 1rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.admin-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.admin-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.admin-hero .hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.admin-stat-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.stat-card-accent {
    border-color: rgba(249, 115, 22, 0.35);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), var(--surface));
}

.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.alert-banner-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-banner-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.alert-banner-body .hint {
    color: rgba(245, 158, 11, 0.85);
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.admin-main,
.admin-aside {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.status-list {
    margin: 0;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row dt {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-row dd {
    margin: 0;
    text-align: right;
    font-size: 0.9rem;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    flex-shrink: 0;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.action-item:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: inherit;
}

.action-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.action-item strong {
    display: block;
    font-size: 0.92rem;
}

.action-item .hint {
    display: block;
    margin-top: 0.1rem;
}

.promo-panel {
    background: linear-gradient(135deg, #1a1510 0%, var(--surface) 100%);
    border-color: rgba(249, 115, 22, 0.25);
}

.promo-panel h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.promo-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    text-align: center;
}

.promo-stats strong {
    display: block;
    font-size: 1.35rem;
    color: var(--accent);
}

.promo-stats span {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.profile-card {
    text-align: center;
    padding: 1.5rem 1.25rem;
}

.profile-card__avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.profile-avatar,
.profile-card__avatar-wrap .avatar,
.profile-card__avatar-wrap .profile-avatar {
    width: 96px;
    height: 96px;
    font-size: 2rem;
}

.profile-card__name {
    margin: 0;
    font-size: 1.25rem;
}

.profile-card__meta {
    margin: 0.35rem 0 0;
}

.profile-card__ids {
    margin: 1rem 0 0;
    text-align: left;
    font-size: 0.9rem;
}

.profile-card__ids div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--border);
}

.profile-card__ids dt {
    color: var(--muted);
    margin: 0;
}

.profile-card__ids dd {
    margin: 0;
    font-weight: 600;
}

.profile-form .scan-fieldset {
    margin-bottom: 1.25rem;
}

.profile-avatar-upload input[type="file"] {
    margin-top: 0.35rem;
}

@media (max-width: 900px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 900px) {
    .has-sidebar .app-shell { margin-left: 0; }
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-expanded);
    }
    .sidebar.is-open {
        transform: translateX(0);
        width: var(--sidebar-expanded);
    }
    .sidebar .brand-text,
    .sidebar .sidebar-label { opacity: 1; }
    .main-content { padding: 1rem; }
}

/* Player stats tables */
.stats-table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}
.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.stats-table th,
.stats-table td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.stats-table th.stats-th {
    background: var(--bg-elevated);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-th-rank { color: var(--accent); }
.stats-th-power { color: #f59e0b; }
.stats-th-kp { color: var(--accent); }
.stats-th-acclaim { color: #fbbf24; }
.stats-th-ratio { color: var(--success); }
.stats-th-dead { color: var(--error); }
.stats-th-rss { color: #fb923c; }
.stats-th-kd { color: var(--success); }
.stats-rank {
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    width: 2.5rem;
}
.stats-player a {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.stats-player a:hover { color: var(--accent); }
.stats-alliance,
.stats-ch,
.stats-camp { color: var(--muted); font-size: 0.85rem; }
.stats-kd-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
    text-decoration: none;
}
.stats-metric { min-width: 5.5rem; }
.stats-metric-value {
    display: block;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}
.stats-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}
.stats-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}
.stats-metric-power .stats-metric-value { color: #f59e0b; }
.stats-metric-power .stats-bar-fill { background: #f59e0b; }
.stats-metric-kp .stats-metric-value { color: var(--accent); }
.stats-metric-kp .stats-bar-fill { background: var(--accent); }
.stats-metric-acclaim .stats-metric-value { color: #fbbf24; }
.stats-metric-acclaim .stats-bar-fill { background: #fbbf24; }
.stats-metric-dead .stats-metric-value { color: var(--error); }
.stats-metric-dead .stats-bar-fill { background: var(--error); }
.stats-metric-rss .stats-metric-value { color: #fb923c; }
.stats-metric-rss .stats-bar-fill { background: #fb923c; }
.stats-metric-ratio .stats-ratio-value {
    font-weight: 700;
    color: var(--success);
}
.player-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.player-avatar-wrap--sm { width: 40px; height: 40px; }
.player-avatar-wrap--lg { width: 120px; height: 120px; }
.player-avatar-circle {
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
}
.player-avatar-initials {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
}
.player-avatar-wrap--lg .player-avatar-initials { font-size: 2rem; }
.player-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.player-avatar-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
}
.stats-avatar-cell { width: 48px; padding-right: 0.25rem; }
.governor-header {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1.25rem;
}
.governor-header-main { margin: 0; }

.scanner-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.scanner-status-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    background: var(--surface);
}
.scanner-status-card.is-ok { border-color: rgba(46, 160, 67, 0.45); }
.scanner-status-card.is-bad { border-color: rgba(248, 81, 73, 0.45); }
.scanner-status-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.scanner-status-value {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.scanner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin-top: 1rem;
}
.scanner-actions .btn-lg {
    padding: 0.75rem 1.35rem;
    font-size: 1rem;
}
