/* ===================================================
   Zeiterfassung – Stylesheet
   =================================================== */

/* ── Reset & Basis ─────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary: var(--primary-color);
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --success: #16a34a;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
}

/* Dark Mode */
body.dark-mode {
    --primary: var(--primary-color);
    --primary-dark: #2563eb;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

body.dark-mode .navbar {
    background: #1e293b;
    border-bottom: 1px solid var(--border);
}

body.dark-mode .sidebar {
    background: #1e293b;
    border-right: 1px solid var(--border);
}

body.dark-mode .sidebar-link:hover {
    background: rgba(59, 130, 246, 0.1);
}

body.dark-mode .sidebar-link.active {
    background: rgba(59, 130, 246, 0.2);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode .autocomplete-suggestions {
    background: var(--card);
    border-color: var(--border);
}

body.dark-mode .autocomplete-suggestion:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* DataTables Dark Mode */
body.dark-mode table.dataTable {
    color: var(--text);
    background: var(--card);
}

body.dark-mode table.dataTable thead th,
body.dark-mode table.dataTable thead td {
    border-bottom-color: var(--border);
    color: var(--text) !important;
    background: var(--card) !important;
}

body.dark-mode table.dataTable.display thead th,
body.dark-mode table.dataTable.display thead td {
    background: var(--card) !important;
    color: var(--text) !important;
}

body.dark-mode table.dataTable thead th.sorting:before,
body.dark-mode table.dataTable thead th.sorting:after,
body.dark-mode table.dataTable thead th.sorting_asc:before,
body.dark-mode table.dataTable thead th.sorting_asc:after,
body.dark-mode table.dataTable thead th.sorting_desc:before,
body.dark-mode table.dataTable thead th.sorting_desc:after {
    opacity: 0.5;
}

body.dark-mode table.dataTable tbody tr {
    background-color: var(--card);
}

body.dark-mode table.dataTable tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

body.dark-mode table.dataTable tbody td {
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode .dataTables_wrapper .dataTables_length,
body.dark-mode .dataTables_wrapper .dataTables_filter,
body.dark-mode .dataTables_wrapper .dataTables_info,
body.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: var(--text);
}

body.dark-mode .dataTables_wrapper .dataTables_filter input {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text) !important;
    background: var(--card);
    border-color: var(--border);
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--border);
    color: var(--text) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: rgba(59, 130, 246, 0.3) !important;
    border-color: var(--primary);
    color: var(--text) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: var(--text-light) !important;
}

body.dark-mode table.dataTable.stripe tbody tr.odd,
body.dark-mode table.dataTable.display tbody tr.odd {
    background-color: rgba(255, 255, 255, 0.02);
}

body.dark-mode table.dataTable.stripe tbody tr.odd:hover,
body.dark-mode table.dataTable.display tbody tr.odd:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

body.dark-mode table.dataTable.hover tbody tr:hover,
body.dark-mode table.dataTable.display tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Tabs Dark Mode */
body.dark-mode .tabs {
    border-bottom-color: var(--border);
}

body.dark-mode .tab-btn {
    color: var(--text-light);
}

body.dark-mode .tab-btn:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

body.dark-mode .tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--primary);
}

/* Calendar Dark Mode */
body.dark-mode .cal-grid {
    background: var(--border);
    border-color: var(--border);
}
body.dark-mode .cal-header-cell {
    background: var(--card);
    color: var(--text-light);
}
body.dark-mode .cal-day {
    background: var(--card);
}
body.dark-mode .cal-day:hover {
    background: #253348;
}
body.dark-mode .cal-day.cal-empty {
    background: #1a2332;
}
body.dark-mode .cal-day.cal-weekend {
    background: #1a2332;
}
body.dark-mode .cal-day.cal-today {
    box-shadow: inset 0 0 0 2px var(--primary);
}
body.dark-mode .cal-day-number {
    color: var(--text-light);
}
body.dark-mode .cal-day.cal-today .cal-day-number {
    color: var(--primary);
}
body.dark-mode .cal-day-total {
    color: var(--text);
    border-top-color: var(--border);
}
body.dark-mode .cal-legend-item {
    color: var(--text-light);
}
body.dark-mode .view-toggle:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}
body.dark-mode .view-toggle.active {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Flatpickr Dark Mode */
body.dark-mode .flatpickr-calendar {
    background: var(--card);
    border-color: var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
body.dark-mode .flatpickr-months .flatpickr-month,
body.dark-mode .flatpickr-current-month .flatpickr-monthDropdown-months,
body.dark-mode .flatpickr-weekdays,
body.dark-mode span.flatpickr-weekday {
    background: var(--card);
    color: var(--text);
}
body.dark-mode .flatpickr-current-month input.cur-year {
    color: var(--text);
}
body.dark-mode .flatpickr-day {
    color: var(--text);
}
body.dark-mode .flatpickr-day:hover {
    background: var(--border);
    border-color: var(--border);
}
body.dark-mode .flatpickr-day.today {
    border-color: var(--primary);
}
body.dark-mode .flatpickr-day.selected {
    background: var(--primary);
    border-color: var(--primary);
}
body.dark-mode .flatpickr-day.flatpickr-disabled {
    color: var(--text-light);
}
body.dark-mode .flatpickr-months .flatpickr-prev-month,
body.dark-mode .flatpickr-months .flatpickr-next-month {
    fill: var(--text);
    color: var(--text);
}
body.dark-mode .flatpickr-input,
body.dark-mode input.flatpickr-input {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}
body.dark-mode .flatpickr-time input {
    background: var(--card);
    color: var(--text);
}

/* Modal Dark Mode */
body.dark-mode .modal-content {
    background: var(--card);
}
body.dark-mode .template-create-box {
    background: rgba(255,255,255,0.03);
}
body.dark-mode .template-item {
    background: rgba(255,255,255,0.03);
    border-color: var(--border);
}
body.dark-mode .template-item:hover {
    background: rgba(255,255,255,0.06);
}

html {
    font-size: 15px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ────────────────────────────────────────── */
.navbar {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 56px;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hamburger {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 14px;
    justify-content: space-between;
}

.hamburger::before,
.hamburger::after,
.hamburger {
    content: '';
    background: #fff;
    height: 2px;
    border-radius: 2px;
    transition: transform 0.3s;
}

.hamburger::before {
    content: '';
    display: block;
}

.hamburger::after {
    content: '';
    display: block;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    font-size: 1.5rem;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ── Container ─────────────────────────────────────── */
.container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-outline {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* ── Cards ─────────────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.15rem;
    color: var(--text);
}

/* ── Alerts ────────────────────────────────────────── */
.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert p {
    margin: 0;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: var(--danger);
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: var(--success);
}

/* ── Login ─────────────────────────────────────────── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4rem;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ── Formulare ─────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

.form-group.flex-2 {
    flex: 2;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Tabelle ───────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* ── Stats Grid ────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── Dashboard ─────────────────────────────────────── */
.dashboard {
    max-width: 100%;
    margin: 0 auto;
}

.dashboard h1 {
    margin-bottom: 0.25rem;
}

.welcome {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* ── Utilities ─────────────────────────────────────── */
.text-center {
    text-align: center;
}

/* ── Footer ────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.82rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
}

/* ── Setup-Seite ───────────────────────────────────── */
.setup-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 3rem;
}

.setup-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 560px;
}

.setup-header {
    text-align: center;
    margin-bottom: 2rem;
}

.setup-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.setup-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.setup-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
}

.info-box h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.info-box ul {
    list-style: none;
    padding: 0;
}

.info-box li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.info-box li::before {
    content: '📦 ';
}

.btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 1.05rem;
}

.setup-results h2 {
    margin-bottom: 1rem;
    font-size: 1.15rem;
}

.steps-list {
    margin-bottom: 1.5rem;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.step-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.step-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
}

.step-icon {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.4;
}

.step-ok .step-icon {
    color: var(--success);
}

.step-error .step-icon {
    color: var(--danger);
}

.step-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.step-details strong {
    font-size: 0.92rem;
}

.step-message {
    font-size: 0.82rem;
    color: var(--text-light);
}

.setup-actions {
    text-align: center;
    margin-top: 1.5rem;
}

.setup-hint {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-light);
}
/* ── Sidebar ───────────────────────────────────────── */
body.with-sidebar {
    padding-top: 56px;
}

body.sidebar-collapsed {
    padding-top: 56px;
}

.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 56px);
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transition: transform 0.3s, width 0.3s;
    z-index: 90;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.sidebar-link:hover {
    background: var(--bg);
}

.sidebar-link.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-icon {
    font-size: 1.25rem;
    min-width: 1.25rem;
    text-align: center;
}

.sidebar-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s;
}

body.sidebar-collapsed .sidebar-text {
    opacity: 0;
    width: 0;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 0;
}

.sidebar-section {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    transition: opacity 0.3s;
}

body.sidebar-collapsed .sidebar-section {
    opacity: 0;
}

.main-content {
    padding: 2rem;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

body:not(.with-sidebar) .main-content {
    margin-left: 0;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-admin {
    background: #fef3c7;
    color: #92400e;
    margin-left: 0.5rem;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ── Admin Panel ───────────────────────────────────── */
.admin-panel {
    max-width: 1400px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.page-header > div {
    display: flex;
    gap: 0.5rem;
}

.admin-table th {
    white-space: nowrap;
}

.action-cell {
    white-space: nowrap;
}

.role-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
}

.inline-form {
    display: inline;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}

.btn-secondary:hover {
    background: #4b5563;
}

.help-text {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.error-message {
    display: block;
    font-size: 0.82rem;
    color: var(--danger);
    margin-top: 0.3rem;
}

input.error,
select.error,
textarea.error {
    border-color: var(--danger);
}

.text-muted {
    color: var(--text-light);
}

.user-info-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.user-info-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.15rem;
}

.user-info-card p {
    margin: 0;
    color: var(--text-light);
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.role-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    gap: 1rem;
}

.role-assigned {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.role-available {
    background: var(--bg);
}

.role-info {
    flex: 1;
}

.role-info strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.role-name {
    font-size: 0.8rem;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
}

.role-desc {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
/* ── Sidebar ───────────────────────────────────────── */
body.with-sidebar {
    padding-left: var(--sidebar-width);
    transition: padding-left 0.3s ease;
}

body.sidebar-collapsed {
    padding-left: var(--sidebar-collapsed-width);
}

.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 50;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: var(--primary);
}

.sidebar-link.active {
    background: #eff6ff;
    color: var(--primary);
    border-right: 3px solid var(--primary);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 1.3rem;
    min-width: 1.3rem;
    text-align: center;
}

.sidebar-collapsed .sidebar-text {
    display: none;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 0;
}

.sidebar-section {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.sidebar-collapsed .sidebar-section {
    display: none;
}

.main-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-admin {
    background: #fef3c7;
    color: #92400e;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ── Admin Panel ───────────────────────────────────── */
.admin-panel {
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    margin: 0;
}

.admin-table th {
    font-size: 0.8rem;
}

.admin-table td {
    vertical-align: middle;
}

.role-select {
    padding: 0.35rem 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.role-select:focus {
    outline: none;
    border-color: var(--primary);
}

.inline-form {
    display: inline;
    margin: 0;
}

.action-cell {
    white-space: nowrap;
}

.btn-secondary {
    background: #64748b;
    color: #fff;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

/* ── User Form ─────────────────────────────────────── */
.user-form {
    max-width: 800px;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: var(--danger);
}

.error-message {
    display: block;
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 0.3rem;
}

.help-text {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    body.with-sidebar {
        padding-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    body:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-cell {
        white-space: normal;
    }

    .admin-table {
        font-size: 0.85rem;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 0 1rem;
    }

    .container {
        padding: 1rem;
    }

    .form-row {
        flex-direction: column;
    }

    .login-card {
        padding: 2rem 1.25rem;
    }

    .setup-card {
        padding: 2rem 1.25rem;
    }
}

/* ── Autocomplete ─────────────────────────────────────── */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius) var(--radius);
    display: none;
}

.autocomplete-suggestions.active {
    display: block;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #f8f9fa;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item strong {
    display: block;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.autocomplete-item small {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ── Template Items ────────────────────────────────── */
.template-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    transition: all 0.2s;
}

.template-item:hover {
    background: #e9ecef;
    box-shadow: var(--shadow);
}

.template-item .template-select:hover strong {
    color: var(--primary);
}

.template-item .delete-template-btn:hover {
    background: #c82333 !important;
}

/* ── Modal Overlay ────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.template-create-box {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.template-create-box h3 {
    margin-top: 0;
    font-size: 1rem;
}

.templates-list-title {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.templates-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── Language Switcher ─────────────────────────────── */
.language-switcher {
    display: inline-flex;
    align-items: center;
}

.language-switcher form {
    margin: 0;
}

.language-switcher button {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Modal Styles for Labels ──────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.admin-header {
    margin-bottom: 2rem;
}

.admin-header h1 {
    margin-bottom: 0.5rem;
}

.admin-header p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}
