@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── TOKENS ──────────────────────────────────────────────────── */
:root {
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --color-primary-50:  #f0f4ff;
    --color-primary-100: #dce6fd;
    --color-primary-200: #b9ccfb;
    --color-primary-300: #84a5f8;
    --color-primary-400: #4f78f4;
    --color-primary-500: #2952e8;
    --color-primary-600: #1e3fcb;
    --color-primary-700: #1830a0;
    --color-primary-800: #172980;
    --color-primary-900: #172564;

    --color-neutral-0:   #ffffff;
    --color-neutral-50:  #f8f9fb;
    --color-neutral-100: #f1f3f7;
    --color-neutral-150: #e8eaf0;
    --color-neutral-200: #dde0e8;
    --color-neutral-300: #c4c9d6;
    --color-neutral-400: #9aa0b4;
    --color-neutral-500: #6b7390;
    --color-neutral-600: #4a5168;
    --color-neutral-700: #333a52;
    --color-neutral-800: #1e2438;
    --color-neutral-900: #10152a;

    --color-success-50:  #ecfdf5;
    --color-success-500: #10b981;
    --color-success-700: #047857;
    --color-warning-50:  #fffbeb;
    --color-warning-500: #f59e0b;
    --color-warning-700: #b45309;
    --color-danger-50:   #fef2f2;
    --color-danger-500:  #ef4444;
    --color-danger-700:  #b91c1c;
    --color-info-50:     #eff6ff;
    --color-info-500:    #3b82f6;
    --color-info-700:    #1d4ed8;

    --bg-app:     #f8f9fb;
    --bg-surface: #ffffff;
    --bg-subtle:  #f1f3f7;
    --bg-muted:   #e8eaf0;
    --bg-sidebar: #10152a;

    --text-primary:   #1e2438;
    --text-secondary: #6b7390;
    --text-muted:     #9aa0b4;
    --text-inverse:   #ffffff;
    --text-link:      #1e3fcb;

    --border-subtle:  #e8eaf0;
    --border-default: #dde0e8;
    --border-strong:  #c4c9d6;
    --border-focus:   #4f78f4;

    --text-xs:   11px;
    --text-sm:   13px;
    --text-base: 14px;
    --text-md:   15px;
    --text-lg:   17px;
    --text-xl:   20px;
    --text-2xl:  24px;
    --text-3xl:  30px;

    --weight-regular:  400;
    --weight-medium:   500;
    --weight-semibold: 600;

    --leading-tight:  1.3;
    --leading-normal: 1.5;
    --leading-loose:  1.7;

    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    --radius-sm:   4px;
    --radius-md:   6px;
    --radius-lg:   10px;
    --radius-xl:   14px;
    --radius-full: 9999px;

    --shadow-xs: 0 1px 2px rgba(16,21,42,.05);
    --shadow-sm: 0 1px 3px rgba(16,21,42,.08), 0 1px 2px rgba(16,21,42,.04);
    --shadow-md: 0 4px 6px -1px rgba(16,21,42,.08), 0 2px 4px -1px rgba(16,21,42,.04);
    --shadow-lg: 0 10px 15px -3px rgba(16,21,42,.08), 0 4px 6px -2px rgba(16,21,42,.04);
    --shadow-xl: 0 20px 25px -5px rgba(16,21,42,.10), 0 10px 10px -5px rgba(16,21,42,.04);

    --sidebar-width:     220px;
    --sidebar-collapsed: 56px;
    --topbar-height:     52px;
    --content-padding:   24px;

    --transition-fast: 100ms ease;
    --transition-base: 160ms ease;
    --transition-slow: 260ms ease;

    --z-base:     1;
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-overlay:  300;
    --z-modal:    400;
    --z-toast:    500;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-app);
    min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5 { font-weight: var(--weight-semibold); line-height: var(--leading-tight); color: var(--text-primary); }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
p  { line-height: var(--leading-loose); }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }

/* ── APP SHELL ───────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: var(--z-sticky);
    overflow: hidden;
}
.app-sidebar.collapsed { width: var(--sidebar-collapsed); }

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}
.app-sidebar.collapsed ~ .app-main { margin-left: var(--sidebar-collapsed); }

.app-topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 var(--content-padding);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    gap: 16px;
}

.app-content {
    flex: 1;
    padding: var(--content-padding);
    max-width: 1200px;
    width: 100%;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar-logo {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-logo-mark {
    width: 28px; height: 28px;
    background: var(--color-primary-500);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: var(--weight-semibold);
    color: white; flex-shrink: 0; letter-spacing: -0.5px;
}
.sidebar-logo-text { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden; line-height: 1.2; }
.sidebar-logo-sub  { font-size: var(--text-xs); color: rgba(255,255,255,0.4); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section { margin-bottom: 4px; }
.sidebar-section-label { font-size: 10px; font-weight: var(--weight-semibold); color: rgba(255,255,255,0.25); letter-spacing: 0.08em; text-transform: uppercase; padding: 16px 16px 8px; white-space: nowrap; overflow: hidden; }
.app-sidebar.collapsed .sidebar-section-label { opacity: 0; pointer-events: none; }

.sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 16px; margin: 1px 8px;
    border-radius: var(--radius-md);
    cursor: pointer; color: rgba(255,255,255,0.55);
    font-size: var(--text-sm); font-weight: var(--weight-medium);
    white-space: nowrap; text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    user-select: none;
}
.sidebar-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); text-decoration: none; }
.sidebar-item.active { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.95); }
.sidebar-item.active .sidebar-icon { color: var(--color-primary-400); }

.sidebar-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.sidebar-item.active .sidebar-icon,
.sidebar-item:hover  .sidebar-icon { opacity: 1; }
.sidebar-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar.collapsed .sidebar-item-text { display: none; }

.sidebar-badge { font-size: 10px; font-weight: var(--weight-semibold); background: var(--color-primary-500); color: white; padding: 1px 6px; border-radius: var(--radius-full); line-height: 1.6; flex-shrink: 0; }
.app-sidebar.collapsed .sidebar-badge { display: none; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; }

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar-toggle { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); cursor: pointer; color: var(--text-secondary); border: none; background: none; flex-shrink: 0; transition: background var(--transition-fast), color var(--transition-fast); }
.topbar-toggle:hover { background: var(--bg-muted); color: var(--text-primary); }

.topbar-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
.topbar-breadcrumb-sep     { color: var(--text-muted); }
.topbar-breadcrumb-current { color: var(--text-primary); font-weight: var(--weight-medium); }

.topbar-right  { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-avatar { width: 30px; height: 30px; border-radius: var(--radius-full); background: var(--color-primary-100); color: var(--color-primary-700); font-size: var(--text-xs); font-weight: var(--weight-semibold); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-title    { font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: 1.2; }
.page-subtitle { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 4px; }
.page-actions  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── KNAPPER ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 0 16px; height: 34px;
    font-size: var(--text-sm); font-weight: var(--weight-medium);
    border-radius: var(--radius-md); border: 1px solid transparent;
    cursor: pointer; white-space: nowrap;
    transition: all var(--transition-fast);
    text-decoration: none; user-select: none; line-height: 1;
    font-family: var(--font-sans);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-sm { height: 28px; padding: 0 12px; font-size: var(--text-xs); }
.btn-lg { height: 40px; padding: 0 24px; font-size: var(--text-base); }

.btn-primary { background: var(--color-primary-500); color: white; border-color: var(--color-primary-500); }
.btn-primary:hover { background: var(--color-primary-600); border-color: var(--color-primary-600); text-decoration: none; color: white; }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--border-strong); text-decoration: none; color: var(--text-primary); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }

.btn-danger { background: var(--color-danger-500); color: white; border-color: var(--color-danger-500); }
.btn-danger:hover { background: var(--color-danger-700); text-decoration: none; color: white; }

.btn-icon { width: 32px; height: 32px; padding: 0; }

/* ── KORT ────────────────────────────────────────────────────── */
.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
.card-body   { padding: 20px 24px; }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-title  { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 12px; }

.stat-card  { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); padding: 20px 24px; box-shadow: var(--shadow-xs); }
.stat-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.stat-value { font-size: var(--text-3xl); font-weight: var(--weight-semibold); line-height: 1; letter-spacing: -0.5px; }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--text-xs); font-weight: var(--weight-medium); margin-top: 8px; }
.stat-delta.up   { color: var(--color-success-700); }
.stat-delta.down { color: var(--color-danger-700); }

/* ── GRID ────────────────────────────────────────────────────── */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── TABELL ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-xl); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-xs); background: var(--bg-surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table thead { background: var(--bg-subtle); border-bottom: 1px solid var(--border-subtle); }
.table th { padding: 12px 16px; text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-subtle); cursor: pointer; }
.table-empty { text-align: center; padding: 64px 24px; color: var(--text-muted); font-size: var(--text-sm); }
.col-xs { width: 60px; } .col-sm { width: 100px; } .col-md { width: 160px; } .col-lg { width: 220px; }

/* ── FILTER-BAR ──────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }

/* ── SKJEMA ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); margin-bottom: 8px; }
.form-label-optional { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-regular); margin-left: 4px; }

.form-input,
.form-select,
.form-textarea {
    width: 100%; height: 36px; padding: 0 12px;
    font-size: var(--text-sm); font-family: var(--font-sans);
    color: var(--text-primary); background: var(--bg-surface);
    border: 1px solid var(--border-default); border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none; appearance: none;
}
.form-textarea { height: auto; padding: 12px; resize: vertical; min-height: 80px; line-height: var(--leading-normal); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-strong); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(79,120,244,0.12); }
.form-input.error { border-color: var(--color-danger-500); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.form-hint  { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: var(--text-xs); color: var(--color-danger-500); margin-top: 4px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7390' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }
.form-input.search { padding-left: 32px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 40px; }
.input-action { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--text-muted); border-radius: var(--radius-sm); transition: color var(--transition-fast), background var(--transition-fast); }
.input-action:hover { color: var(--text-secondary); background: var(--bg-muted); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: var(--text-xs); font-weight: var(--weight-semibold); border-radius: var(--radius-full); line-height: 1.5; white-space: nowrap; }
.badge-dot { width: 5px; height: 5px; border-radius: var(--radius-full); flex-shrink: 0; }
.badge-success { background: var(--color-success-50); color: var(--color-success-700); }
.badge-success .badge-dot { background: var(--color-success-500); }
.badge-warning { background: var(--color-warning-50); color: var(--color-warning-700); }
.badge-warning .badge-dot { background: var(--color-warning-500); }
.badge-danger  { background: var(--color-danger-50);  color: var(--color-danger-700); }
.badge-danger  .badge-dot { background: var(--color-danger-500); }
.badge-info    { background: var(--color-info-50);    color: var(--color-info-700); }
.badge-info    .badge-dot { background: var(--color-info-500); }
.badge-neutral { background: var(--bg-muted); color: var(--text-secondary); }
.badge-neutral .badge-dot { background: var(--color-neutral-400); }
.badge-primary { background: var(--color-primary-50); color: var(--color-primary-700); }

/* ── ALERT ───────────────────────────────────────────────────── */
.alert { display: none; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--radius-lg); font-size: var(--text-sm); line-height: 1.45; margin-bottom: 20px; }
.alert-danger  { background: var(--color-danger-50);  color: var(--color-danger-700); }
.alert-warning { background: var(--color-warning-50); color: var(--color-warning-700); }
.alert-success { background: var(--color-success-50); color: var(--color-success-700); }
.alert-info    { background: var(--color-info-50);    color: var(--color-info-700); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,21,42,0.45); z-index: var(--z-overlay); display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity var(--transition-base); }
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; transform: translateY(8px) scale(0.98); transition: transform var(--transition-base); overflow: hidden; }
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 700px; }
.modal-sm { max-width: 380px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-title  { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.modal-close  { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); border: none; background: none; color: var(--text-muted); cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast); flex-shrink: 0; }
.modal-close:hover { background: var(--bg-muted); color: var(--text-primary); }
.modal-body   { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-shrink: 0; }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--color-neutral-900); color: rgba(255,255,255,0.92); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: var(--text-sm); font-weight: var(--weight-medium); min-width: 240px; max-width: 380px; pointer-events: all; transform: translateX(16px); opacity: 0; transition: transform var(--transition-base), opacity var(--transition-base); }
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success .toast-icon { color: var(--color-success-500); }
.toast-error   .toast-icon { color: var(--color-danger-500); }
.toast-warning .toast-icon { color: var(--color-warning-500); }
.toast-info    .toast-icon { color: var(--color-info-500); }

/* ── DROPDOWN ────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); right: 0; min-width: 180px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: var(--z-dropdown); padding: 4px 0; opacity: 0; pointer-events: none; transform: translateY(-4px); transition: opacity var(--transition-fast), transform var(--transition-fast); }
.dropdown-menu.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 7px 16px; font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; transition: background var(--transition-fast); text-decoration: none; }
.dropdown-item:hover { background: var(--bg-subtle); text-decoration: none; }
.dropdown-item.danger { color: var(--color-danger-500); }
.dropdown-item.danger:hover { background: var(--color-danger-50); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ── TABS ────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border-subtle); margin-bottom: 24px; }
.tab { padding: 12px 20px; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition-fast), border-color var(--transition-fast); user-select: none; white-space: nowrap; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--color-primary-600); border-bottom-color: var(--color-primary-500); }

/* ── SPINNER & SKELETON ──────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.35); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.spinner-dark { border-color: var(--border-default); border-top-color: var(--color-primary-500); }

@keyframes skeleton-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.skeleton { background: var(--bg-muted); border-radius: var(--radius-sm); animation: skeleton-pulse 1.6s ease-in-out infinite; }
.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; margin-bottom: 12px; }
.skeleton-block { height: 48px; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-muted); }
.empty-state-title { font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text  { font-size: var(--text-sm); margin-bottom: 20px; }

/* ── AUTH / LOGIN ────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg-app); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 40px 36px 32px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 32px; }
.auth-logo-mark {
    width: 72px; height: 72px;
    border-radius: var(--radius-lg);
    background: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: var(--weight-semibold);
    color: white; letter-spacing: -0.5px;
    margin-bottom: 16px; overflow: hidden; flex-shrink: 0;
}
.auth-logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.auth-title    { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin-bottom: 4px; }
.auth-subtitle { font-size: var(--text-sm); color: var(--text-secondary); }
.auth-footer   { margin-top: 20px; text-align: center; font-size: var(--text-xs); color: var(--text-muted); }

/* ── UTILITIES ───────────────────────────────────────────────── */
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; } .flex-wrap { flex-wrap: wrap; } .shrink-0 { flex-shrink: 0; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.ml-auto { margin-left: auto; }
.text-xs { font-size: 11px; } .text-sm { font-size: 13px; }
.text-base { font-size: 14px; } .text-lg { font-size: 17px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; }
.text-primary { color: var(--text-primary); } .text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); } .text-danger { color: var(--color-danger-500); }
.text-success { color: var(--color-success-700); }
.text-right { text-align: right; } .text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none; } .w-full { width: 100%; }
.divider { height: 1px; background: var(--border-subtle); margin: 24px 0; }

/* ── PAGE VIEWS (dashboard modul-system) ─────────────────────── */
.page-view { display: none; }
.page-view.active { display: block; }

body:not(.is-admin) .admin-only { display: none !important; }

/* ── SETTINGS TOGGLE ROW ─────────────────────────────────────── */
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    gap: 16px;
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-row input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--color-primary-500);
    flex-shrink: 0; cursor: pointer;
}

.settings-section { display: block; }
.settings-section.hidden { display: none; }

/* ── RESPONSIV ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .app-sidebar { width: var(--sidebar-collapsed); }
    .sidebar-item-text, .sidebar-section-label { display: none; }
    .app-main { margin-left: var(--sidebar-collapsed); }
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; }
}