/*
 * ══════════════════════════════════════════════════════════════
 *  SennaHR Design System v2.0
 *  Einheitliches CSS für alle App-Seiten (nach Login)
 * ══════════════════════════════════════════════════════════════
 *
 *  Fonts:  DM Sans (body) + Fraunces (display/headings)
 *  Theme:  Light, professional, SaaS-grade
 *  Usage:  <link rel="stylesheet" href="/static/sennahr.css">
 *
 *  Sections:
 *    1. Reset & Variables
 *    2. Typography
 *    3. Layout & Page Structure
 *    4. Page Header
 *    5. Cards & Surfaces
 *    6. Tables
 *    7. Forms & Inputs
 *    8. Buttons
 *    9. Badges & Status
 *   10. Tabs
 *   11. Modals
 *   12. Alerts & Messages
 *   13. Stat Cards
 *   14. Calendar
 *   15. Utilities
 *   16. Animations
 *   17. Responsive
 * ══════════════════════════════════════════════════════════════
 */

@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;0,9..40,700;1,9..40,400&family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,700;1,9..144,400&display=swap');


/* ═══════════════════════════════════════════════════
   1. RESET & VARIABLES
   ═══════════════════════════════════════════════════ */

:root {
    /* Backgrounds */
    --bg:             #f7f8fa;
    --bg-alt:         #f1f3f6;
    --surface:        #ffffff;
    --surface-raised:  #ffffff;
    --surface-hover:  #f8f9fb;
    --surface-active: #f1f3f6;

    /* Borders */
    --border:         #e3e6ec;
    --border-light:   #eef0f4;
    --border-focus:   #2563eb;

    /* Text */
    --text:           #1a1e2c;
    --text-secondary: #5a6178;
    --text-muted:     #8b92a8;
    --text-on-primary:#ffffff;

    /* Primary (Blue) */
    --primary:        #2563eb;
    --primary-hover:  #1d4ed8;
    --primary-light:  #eff4ff;
    --primary-border: #bfdbfe;
    --primary-subtle: #dbeafe;

    /* Success (Green) */
    --success:        #16a34a;
    --success-light:  #ecfdf5;
    --success-border: #a7f3d0;

    /* Warning (Amber) */
    --warning:        #d97706;
    --warning-light:  #fffbeb;
    --warning-border: #fde68a;

    /* Danger (Red) */
    --danger:         #dc2626;
    --danger-light:   #fef2f2;
    --danger-border:  #fecaca;

    /* Info (Slate Blue) */
    --info:           #4f6bcc;
    --info-light:     #eef1fb;

    /* Purple accent */
    --purple:         #7c3aed;
    --purple-light:   #f3eeff;

    /* Fonts */
    --font-body:      'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display:   'Fraunces', Georgia, serif;
    --font-mono:      'SF Mono', 'Cascadia Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;

    /* Radii */
    --radius-sm:  6px;
    --radius:     8px;
    --radius-lg:  12px;
    --radius-xl:  16px;

    /* Shadows */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg:  0 8px 30px rgba(0,0,0,0.1);

    /* Transitions */
    --ease:       cubic-bezier(0.4, 0, 0.2, 1);
    --duration:   0.2s;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
a:hover { color: var(--primary-hover); }


/* ═══════════════════════════════════════════════════
   2. TYPOGRAPHY
   ═══════════════════════════════════════════════════ */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.78rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono  { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }


/* ═══════════════════════════════════════════════════
   3. LAYOUT & PAGE STRUCTURE
   ═══════════════════════════════════════════════════ */

/* Main content area — respects nav_sidebar.js */
.page-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.page-content-narrow {
    max-width: 960px;
    margin: 0 auto;
    padding: var(--space-xl);
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-lg); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Section spacing */
.section { margin-bottom: var(--space-xl); }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}
.section-header h2 { margin: 0; }


/* ═══════════════════════════════════════════════════
   4. PAGE HEADER
   Replaces the old purple gradient headers
   ═══════════════════════════════════════════════════ */

.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-xl);
}

.page-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.page-header-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

/* Compact header variant for sub-pages */
.page-header-compact {
    padding: var(--space-md) var(--space-xl);
}


/* ═══════════════════════════════════════════════════
   5. CARDS & SURFACES
   ═══════════════════════════════════════════════════ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 0.95rem;
    font-family: var(--font-body);
    font-weight: 600;
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

/* Card with accent top border */
.card-accent {
    border-top: 3px solid var(--primary);
}

/* Clickable card */
.card-interactive {
    cursor: pointer;
    transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.card-interactive:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Empty state inside card */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}
.empty-state p {
    font-size: 0.9rem;
    max-width: 360px;
    margin: 0 auto;
}


/* ═══════════════════════════════════════════════════
   6. TABLES
   ═══════════════════════════════════════════════════ */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.table-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.table-header h3 {
    font-size: 0.95rem;
    font-family: var(--font-body);
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface-hover);
}

/* Table action buttons */
.table-actions {
    display: flex;
    gap: 0.35rem;
}

.table-footer {
    padding: var(--space-sm) var(--space-lg);
    border-top: 1px solid var(--border-light);
    background: var(--bg);
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* ═══════════════════════════════════════════════════
   7. FORMS & INPUTS
   ═══════════════════════════════════════════════════ */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.form-group label .req {
    color: var(--danger);
    margin-left: 2px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-input,
input[type="text"].form-input,
input[type="email"].form-input,
input[type="password"].form-input,
input[type="number"].form-input,
input[type="date"].form-input,
input[type="tel"].form-input,
input[type="search"].form-input,
select.form-input,
textarea.form-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:disabled {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Select */
select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6178' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6.5 6.5-6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
}

/* Textarea */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox / Radio custom */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.form-check input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Inline form row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* Search input */
.search-box {
    position: relative;
}
.search-box input {
    padding-left: 2.25rem;
}
.search-box::before {
    content: '🔍';
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    pointer-events: none;
}


/* ═══════════════════════════════════════════════════
   8. BUTTONS
   ═══════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary */
.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    color: var(--text-on-primary);
}

/* Secondary */
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 0.4rem 0.65rem;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--surface-active);
    color: var(--text);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Success */
.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
}

/* Sizes */
.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}
.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}
.btn-block {
    width: 100%;
}

/* Icon button */
.btn-icon {
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1;
    min-width: 32px;
    min-height: 32px;
}


/* ═══════════════════════════════════════════════════
   9. BADGES & STATUS
   ═══════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-primary  { background: var(--primary-light);  color: var(--primary); }
.badge-success  { background: var(--success-light);  color: var(--success); }
.badge-warning  { background: var(--warning-light);  color: var(--warning); }
.badge-danger   { background: var(--danger-light);   color: var(--danger); }
.badge-info     { background: var(--info-light);     color: var(--info); }
.badge-purple   { background: var(--purple-light);   color: var(--purple); }
.badge-neutral  { background: var(--bg-alt);         color: var(--text-muted); }

/* Dot indicator */
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dot-green   { background: var(--success); }
.dot-yellow  { background: var(--warning); }
.dot-red     { background: var(--danger); }
.dot-blue    { background: var(--primary); }
.dot-gray    { background: var(--text-muted); }


/* ═══════════════════════════════════════════════════
   10. TABS
   ═══════════════════════════════════════════════════ */

.tab-bar {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1.5px solid var(--border);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.6rem 1rem;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration) var(--ease);
    margin-bottom: -1.5px;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
    animation: fadeIn 0.25s var(--ease);
}

/* Pill-style tabs (alternative) */
.tab-bar-pills {
    display: flex;
    gap: 0.35rem;
    margin-bottom: var(--space-lg);
    border-bottom: none;
}
.tab-bar-pills .tab-btn {
    border-radius: var(--radius);
    border-bottom: none;
    margin-bottom: 0;
    padding: 0.5rem 0.9rem;
}
.tab-bar-pills .tab-btn.active {
    background: var(--primary);
    color: white;
    border-bottom-color: transparent;
}


/* ═══════════════════════════════════════════════════
   11. MODALS
   ═══════════════════════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s var(--ease);
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 400px; }

.modal-header {
    padding: var(--space-lg) var(--space-lg) var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-header h2 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
    transition: color var(--duration) var(--ease);
}
.modal-close:hover { color: var(--text); }

.modal-body {
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}


/* ═══════════════════════════════════════════════════
   12. ALERTS & MESSAGES
   ═══════════════════════════════════════════════════ */

.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    animation: fadeSlideIn 0.3s var(--ease);
}

.alert-success { background: var(--success-light); border: 1px solid var(--success-border); color: #065f46; }
.alert-error   { background: var(--danger-light);  border: 1px solid var(--danger-border);  color: #991b1b; }
.alert-warning { background: var(--warning-light); border: 1px solid var(--warning-border); color: #92400e; }
.alert-info    { background: var(--primary-light);  border: 1px solid var(--primary-border); color: #1e40af; }


/* ═══════════════════════════════════════════════════
   13. STAT CARDS
   ═══════════════════════════════════════════════════ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: box-shadow var(--duration) var(--ease);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card .stat-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.stat-card .stat-icon {
    float: right;
    font-size: 1.5rem;
    opacity: 0.6;
}

/* Colored stat accent */
.stat-card-blue   { border-left: 3px solid var(--primary); }
.stat-card-green  { border-left: 3px solid var(--success); }
.stat-card-yellow { border-left: 3px solid var(--warning); }
.stat-card-red    { border-left: 3px solid var(--danger); }
.stat-card-purple { border-left: 3px solid var(--purple); }


/* ═══════════════════════════════════════════════════
   14. CALENDAR
   ═══════════════════════════════════════════════════ */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calendar-grid .day-header {
    background: var(--bg);
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-grid .day-cell {
    background: var(--surface);
    min-height: 80px;
    padding: 0.35rem;
    position: relative;
}

.calendar-grid .day-cell.today {
    background: var(--primary-light);
}

.calendar-grid .day-cell.other-month {
    background: var(--bg);
    opacity: 0.5;
}

.calendar-grid .day-number {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.calendar-grid .day-cell.today .day-number {
    color: var(--primary);
    font-weight: 700;
}

.calendar-event {
    display: block;
    font-size: 0.68rem;
    padding: 1px 4px;
    border-radius: 3px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.calendar-event.vacation  { background: #dbeafe; color: #1d4ed8; }
.calendar-event.sick      { background: #fef2f2; color: #dc2626; }
.calendar-event.special   { background: #f3eeff; color: #7c3aed; }
.calendar-event.pending   { background: #fef9c3; color: #a16207; }


/* ═══════════════════════════════════════════════════
   15. UTILITIES
   ═══════════════════════════════════════════════════ */

.mt-xs  { margin-top: var(--space-xs); }
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mb-xs  { margin-bottom: var(--space-xs); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }

.p-md   { padding: var(--space-md); }
.p-lg   { padding: var(--space-lg); }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.w-full  { width: 100%; }
.hidden  { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }

.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-lg) 0;
}

/* Avatar */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-blue   { background: #3b82f6; }
.avatar-green  { background: #16a34a; }
.avatar-purple { background: #7c3aed; }
.avatar-amber  { background: #d97706; }
.avatar-red    { background: #dc2626; }
.avatar-slate  { background: #64748b; }

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-white {
    border-color: rgba(255,255,255,0.3);
    border-top-color: white;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

/* Tooltip (simple) */
[data-tooltip] {
    position: relative;
}
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.3rem 0.6rem;
    background: var(--text);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 4px;
    animation: fadeIn 0.15s var(--ease);
}


/* ═══════════════════════════════════════════════════
   16. ANIMATIONS
   ═══════════════════════════════════════════════════ */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* Staggered entrance */
.animate-in { animation: fadeUp 0.4s var(--ease) both; }
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }


/* ═══════════════════════════════════════════════════
   17. RESPONSIVE
   ═══════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --space-xl: 1.25rem;
        --space-2xl: 2rem;
    }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.15rem; }

    .page-content { padding: var(--space-md); }
    .page-header { padding: var(--space-md); }
    .page-header-inner { flex-direction: column; align-items: flex-start; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    .stats-row { grid-template-columns: repeat(2, 1fr); }

    table { font-size: 0.82rem; }
    thead th, tbody td { padding: 0.5rem 0.65rem; }

    .modal { margin: var(--space-md); max-height: 85vh; }

    .tab-bar { gap: 0; }
    .tab-btn { padding: 0.5rem 0.75rem; font-size: 0.82rem; }

    .calendar-grid .day-cell { min-height: 60px; }
}

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

    .page-header-actions {
        width: 100%;
    }
    .page-header-actions .btn {
        flex: 1;
    }

    .btn-sm { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
}


/* ═══════════════════════════════════════════════════
   18. DARK MODE
   ═══════════════════════════════════════════════════ */

[data-theme="dark"] {
    --bg:             #0f1219;
    --bg-alt:         #161b26;
    --surface:        #1a2030;
    --surface-raised: #1e2538;
    --surface-hover:  #232b3d;
    --surface-active: #2a3349;

    --border:         rgba(255,255,255,0.08);
    --border-light:   rgba(255,255,255,0.05);
    --border-focus:   #3b82f6;

    --text:           #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-on-primary:#ffffff;

    --primary:        #3b82f6;
    --primary-hover:  #60a5fa;
    --primary-light:  rgba(59,130,246,0.12);
    --primary-border: rgba(59,130,246,0.2);
    --primary-subtle: rgba(59,130,246,0.08);

    --success:        #4ade80;
    --success-light:  rgba(74,222,128,0.1);
    --success-border: rgba(74,222,128,0.2);

    --warning:        #fbbf24;
    --warning-light:  rgba(251,191,36,0.1);
    --warning-border: rgba(251,191,36,0.2);

    --danger:         #f87171;
    --danger-light:   rgba(248,113,113,0.1);
    --danger-border:  rgba(248,113,113,0.2);

    --info:           #60a5fa;
    --info-light:     rgba(96,165,250,0.1);

    --purple:         #a78bfa;
    --purple-light:   rgba(167,139,250,0.1);

    --shadow-xs:  0 1px 3px rgba(0,0,0,0.3);
    --shadow-sm:  0 2px 6px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);

    color-scheme: dark;
}

/* Dark mode overrides for specific elements */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 { color: #f1f5f9; }

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .table-footer { background: var(--bg-alt); }

[data-theme="dark"] thead th { background: var(--bg-alt); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] tbody td { border-color: var(--border); }

[data-theme="dark"] .form-input {
    background: var(--bg-alt);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .form-input::placeholder { color: var(--text-muted); }

[data-theme="dark"] .btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text);
}

[data-theme="dark"] .badge-primary  { background: rgba(59,130,246,0.15);  color: #60a5fa; }
[data-theme="dark"] .badge-success  { background: rgba(74,222,128,0.15);  color: #4ade80; }
[data-theme="dark"] .badge-warning  { background: rgba(251,191,36,0.15);  color: #fbbf24; }
[data-theme="dark"] .badge-danger   { background: rgba(248,113,113,0.15); color: #f87171; }
[data-theme="dark"] .badge-neutral  { background: rgba(255,255,255,0.06); color: var(--text-muted); }

[data-theme="dark"] .page-header { background: var(--surface); border-color: var(--border); }

[data-theme="dark"] .calendar-grid .day-cell { background: var(--surface); }
[data-theme="dark"] .calendar-grid .day-cell.today { background: var(--primary-light); }
[data-theme="dark"] .calendar-grid .day-cell.other-month { background: var(--bg-alt); }
[data-theme="dark"] .calendar-grid .day-header { background: var(--bg-alt); }

[data-theme="dark"] .modal { background: var(--surface-raised); }
[data-theme="dark"] .modal-footer { background: var(--bg-alt); border-color: var(--border); }

[data-theme="dark"] .loading-overlay { background: rgba(15,18,25,0.8); }
[data-theme="dark"] .spinner { border-color: var(--border); border-top-color: var(--primary); }

/* ── Theme Toggle Button ── */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border);
    border: none;
    border-radius: 11px;
    cursor: pointer;
    padding: 0;
    transition: background var(--duration) var(--ease);
    flex-shrink: 0;
}
.theme-toggle::after {
    content: '☀️';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    transition: transform var(--duration) var(--ease), content var(--duration);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
[data-theme="dark"] .theme-toggle {
    background: var(--primary);
}
[data-theme="dark"] .theme-toggle::after {
    content: '🌙';
    transform: translateX(18px);
}


/* ═══════════════════════════════════════════════════
   BREADCRUMBS (shared)
   ═══════════════════════════════════════════════════ */

.breadcrumb-nav {
    padding: 0.5rem var(--space-xl);
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82rem;
}
.breadcrumb-nav a {
    color: var(--text-muted);
    text-decoration: none;
}
.breadcrumb-nav a:hover { color: var(--primary); }
.breadcrumb-nav .separator {
    margin: 0 0.4rem;
    color: var(--border);
}
.breadcrumb-nav .current {
    color: var(--text);
    font-weight: 500;
}


/* ═══════════════════════════════════════════════════
   CSRF Token Helper (inlined, loads on every page)
   ═══════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════
   LAYOUT — Topbar, Page Shell (merged from sennahr-layout.css)
   ══════════════════════════════════════════════════════ */

.sennahr-topbar {
    position: sticky; top: 0; z-index: 100;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 2rem; gap: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.sennahr-topbar-left  { display:flex; align-items:center; gap:0.75rem; }
.sennahr-topbar-title { font-size:1.1rem; font-weight:700; color:#0f172a; }
.sennahr-topbar-subtitle { font-size:0.8rem; color:#94a3b8; font-weight:500; }
.sennahr-topbar-right { display:flex; align-items:center; gap:1rem; }

.sennahr-tenant-badge {
    background:#eff6ff; color:#2563eb;
    border:1px solid #bfdbfe; border-radius:20px;
    padding:0.3rem 0.85rem; font-size:0.8rem; font-weight:600;
}
.sennahr-user-chip {
    display:flex; align-items:center; gap:0.5rem;
    padding:0.35rem 0.85rem 0.35rem 0.35rem;
    background:#f8fafc; border:1px solid #e2e8f0;
    border-radius:20px; font-size:0.82rem; font-weight:600;
    color:#334155; cursor:pointer; transition:background 0.15s;
}
.sennahr-user-chip:hover { background:#f1f5f9; }
.sennahr-avatar {
    width:28px; height:28px;
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    border-radius:50%; display:flex;
    align-items:center; justify-content:center;
    color:white; font-size:0.75rem; font-weight:700;
}

/* Hide redundant auto-breadcrumbs (nav_sidebar.js injects its own) */
#auto-breadcrumbs { display: none !important; }

/* Dark mode topbar */
[data-theme="dark"] .sennahr-topbar        { background:#1e293b; border-color:#334155; }
[data-theme="dark"] .sennahr-topbar-title  { color:#f1f5f9; }
[data-theme="dark"] .sennahr-user-chip     { background:#1e293b; border-color:#334155; color:#cbd5e1; }
[data-theme="dark"] .sennahr-tenant-badge  { background:#1e3a5f; color:#93c5fd; border-color:#1e40af; }

/* ══════════════════════════════════════════════════════
   SENNAHR-APP WRAPPER — nav_sidebar.js wrapping fix
   ══════════════════════════════════════════════════════ */
.sennahr-app {
    display: contents; /* Transparant — geen layout effect, voorkomt wel "1 1" text nodes */
}
