/* ═══════════════════════════════════════════════════════════════
   Medi DT | Swiss Medical Billing - Premium Design System
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS VARIABLES / DESIGN TOKENS ─────────────────────────── */
:root {
    /* Brand Colors - Swiss Red accent */
    --color-primary: #E3000F;
    --color-primary-light: #FF3342;
    --color-primary-dark: #B3000C;
    --color-primary-50: #FDE6E7;
    --color-primary-100: #FAD1D4;
    --color-primary-200: #F6A3A8;
    
    --color-secondary: #1D1D1F;
    --color-secondary-light: #424245;
    --color-accent: #E3000F;
    --color-accent-light: #FF3342;
    
    /* Semantic Colors */
    --color-success: #34C759;
    --color-success-light: #E8F8EE;
    --color-success-dark: #248A3D;
    --color-warning: #FF9500;
    --color-warning-light: #FFF4E5;
    --color-warning-dark: #B26800;
    --color-danger: #E3000F;
    --color-danger-light: #FDE6E7;
    --color-danger-dark: #B3000C;
    --color-info: #5AC8FA;
    --color-info-light: #EFFFFF;
    
    /* Neutral Colors - Whites & Grays */
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F5F5F7;
    --color-bg-tertiary: #EBEBF0;
    --color-surface: #FFFFFF;
    --color-surface-hover: #FAFAFA;
    --color-surface-active: #F2F2F2;
    --color-border: rgba(60, 60, 67, 0.12);
    --color-border-hover: rgba(60, 60, 67, 0.2);
    
    /* Text Colors */
    --color-text: #1D1D1F;
    --color-text-secondary: #86868B;
    --color-text-muted: #8E8E93;
    --color-text-inverse: #FFFFFF;
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-blur: 20px;
    
    /* Shadows - Soft and diffused */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(227, 0, 15, 0.15);
    --shadow-glow-sm: 0 0 10px rgba(227, 0, 15, 0.1);
    
    /* Spacing */
    --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;
    
    /* Border Radius - Squircle */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-md: 0.9375rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-base: 250ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-slow: 350ms cubic-bezier(0.25, 0.1, 0.25, 1);
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 60px;
}

/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

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

/* ─── APP LAYOUT ───────────────────────────────────────────── */
#app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-base), transform var(--transition-base);
    position: relative;
    z-index: 100;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-details {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
    padding: var(--space-4) var(--space-3);
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: var(--space-3);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-header {
    padding: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

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

.logo-text h1 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text);
    white-space: nowrap;
}

.logo-text span {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-base);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-4) var(--space-3);
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-tertiary) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 0 var(--space-3) var(--space-2);
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
    white-space: nowrap;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.nav-link:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.nav-link.active {
    background: var(--color-primary-50);
    color: var(--color-primary);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-link.active svg {
    color: var(--color-primary-light);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4) var(--space-4);
    border-top: 1px solid var(--color-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.user-details {
    overflow: hidden;
    transition: opacity var(--transition-base);
}

.user-name {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
}

.user-role {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ─── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ─── TOPBAR ───────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    flex-shrink: 0;
    gap: var(--space-4);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.breadcrumb-sep svg {
    width: 14px;
    height: 14px;
}

.breadcrumb-item.active {
    color: var(--color-text);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box svg {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
}

.search-box input {
    width: 100%;
    padding: var(--space-2) var(--space-3) var(--space-2) 36px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
    outline: none;
}

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

.search-box input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--color-bg-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.topbar-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: var(--transition-fast);
}

.topbar-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

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

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--color-danger);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* ─── PAGE CONTENT ─────────────────────────────────────────── */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-tertiary) transparent;
}

.page-content::-webkit-scrollbar {
    width: 6px;
}

.page-content::-webkit-scrollbar-thumb {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

/* ─── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

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

/* ─── STAT CARDS ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px) scale(1.01);
    border-color: rgba(227, 0, 15, 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

.stat-icon.accent {
    background: rgba(6, 182, 212, 0.15);
    color: var(--color-accent);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
}

.stat-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.stat-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

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

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

.card-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-title svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary-light);
}

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

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── GRID LAYOUTS ─────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-top: var(--space-6);
}

/* ─── TABLE ────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    margin: -1px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table thead th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--color-border);
}

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

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
    vertical-align: middle;
}

.data-table .col-actions {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    justify-content: flex-end;
}

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.5;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: var(--shadow-sm), 0 2px 10px rgba(227, 0, 15, 0.2);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary-dark));
    box-shadow: var(--shadow-md), 0 4px 15px rgba(227, 0, 15, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #28a745);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.2);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #2ecc71, #218838);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #dc3545);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff4b4b, #c82333);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-ghost {
    color: var(--color-text-secondary);
    padding: var(--space-2);
}

.btn-ghost:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-md);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
}

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

/* ─── FORMS ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    outline: none;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--color-bg-secondary);
}

.form-input:disabled,
.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-select option {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.form-help {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--color-danger);
    margin-top: var(--space-1);
}

/* ─── BADGES / STATUS ──────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

.badge-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--color-text-secondary);
}

/* Status dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.status-dot.active { background: var(--color-success); box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.status-dot.pending { background: var(--color-warning); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.status-dot.inactive { background: var(--color-text-muted); }

/* ─── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-6);
    opacity: 0;
    transition: opacity var(--transition-base);
}

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

.modal-container {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-container.modal-lg {
    max-width: 900px;
}

.modal-container.modal-xl {
    max-width: 1100px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
}

/* ─── TOAST ────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 450px;
    animation: toastIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.toast.toast-success::before { background: var(--color-success); }
.toast.toast-error::before { background: var(--color-danger); }
.toast.toast-warning::before { background: var(--color-warning); }
.toast.toast-info::before { background: var(--color-info); }

.toast-icon {
    flex-shrink: 0;
}

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

.toast.toast-success .toast-icon { color: var(--color-success); }
.toast.toast-error .toast-icon { color: var(--color-danger); }
.toast.toast-warning .toast-icon { color: var(--color-warning); }
.toast.toast-info .toast-icon { color: var(--color-info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.toast-message {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.toast-close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast.removing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* ─── LOADING ──────────────────────────────────────────────── */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.loader {
    text-align: center;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-4);
}

.loader-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

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

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-hover) 50%, var(--color-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── PAGINATION ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.pagination-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

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

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-info {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0 var(--space-3);
}

/* ─── TABS ─────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
    cursor: pointer;
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--color-primary-light);
    border-bottom-color: var(--color-primary);
}

/* ─── FILTERS BAR ──────────────────────────────────────────── */
.filters-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.filter-input {
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    min-width: 200px;
    outline: none;
    transition: var(--transition-fast);
}

.filter-input:focus {
    border-color: var(--color-primary);
}

.filter-select {
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

.filter-select option {
    background: var(--color-bg-secondary);
}

/* ─── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
    color: var(--color-text-muted);
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.empty-state-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-5);
    max-width: 400px;
}

/* ─── INVOICE PREVIEW ──────────────────────────────────────── */
.invoice-preview {
    background: white;
    color: #1a1a1a;
    padding: 40px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    line-height: 1.5;
    max-width: 800px;
    margin: 0 auto;
}

.invoice-preview .inv-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.invoice-preview .inv-logo {
    font-size: 20px;
    font-weight: 700;
    color: #4f46e5;
}

.invoice-preview .inv-title {
    text-align: right;
}

.invoice-preview .inv-title h2 {
    font-size: 24px;
    color: #111;
    margin-bottom: 4px;
}

.invoice-preview .inv-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.invoice-preview .inv-party-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
}

.invoice-preview .inv-party-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.invoice-preview .inv-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 30px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.invoice-preview .inv-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 4px;
}

.invoice-preview .inv-meta-value {
    font-weight: 600;
    font-size: 13px;
}

.invoice-preview table {
    width: 100%;
    margin-bottom: 20px;
}

.invoice-preview table th {
    background: #f3f4f6;
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 600;
}

.invoice-preview table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.invoice-preview table .text-right {
    text-align: right;
}

.invoice-preview .inv-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
}

.invoice-preview .inv-totals-table {
    width: 280px;
}

.invoice-preview .inv-totals-table .row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.invoice-preview .inv-totals-table .row.total {
    font-weight: 700;
    font-size: 16px;
    border-bottom: 2px solid #111;
    border-top: 2px solid #111;
    padding: 10px 0;
    margin-top: 8px;
}

.invoice-preview .inv-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    font-size: 11px;
    color: #6b7280;
}

.invoice-preview .inv-qr {
    margin-top: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.invoice-preview .inv-qr-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
}

/* ─── DETAIL VIEW ──────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.detail-item {
    padding: var(--space-3) 0;
}

.detail-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.detail-value {
    font-size: var(--font-size-md);
    font-weight: 500;
}

/* ─── CHARTS (Simple CSS) ──────────────────────────────────── */
.chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    height: 200px;
    padding: var(--space-4) 0;
}

.chart-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(to top, var(--color-primary), var(--color-primary-light));
    transition: height var(--transition-slow);
    min-height: 4px;
    position: relative;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-bar-value {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    font-weight: 600;
}

.chart-bar-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-align: center;
}

/* Donut chart placeholder */
.chart-donut {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-full);
    position: relative;
    margin: var(--space-4) auto;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* ─── AMOUNT / CURRENCY ────────────────────────────────────── */
.amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.amount.positive { color: var(--color-success); }
.amount.negative { color: var(--color-danger); }

.currency {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-left: 2px;
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-box {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        z-index: 200;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .topbar {
        padding: 0 var(--space-4);
    }
    
    .page-content {
        padding: var(--space-4);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-box {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        max-width: 95%;
        margin: var(--space-4);
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-input, .filter-select {
        min-width: auto;
    }
    
    .invoice-preview .inv-meta {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .invoice-preview .inv-parties {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ─── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.animate-slide-in { animation: slideInLeft 0.3s ease-out; }

/* Stagger animations for grid items */
.stats-grid .stat-card:nth-child(1) { animation: fadeInUp 0.4s ease-out 0.0s both; }
.stats-grid .stat-card:nth-child(2) { animation: fadeInUp 0.4s ease-out 0.1s both; }
.stats-grid .stat-card:nth-child(3) { animation: fadeInUp 0.4s ease-out 0.2s both; }
.stats-grid .stat-card:nth-child(4) { animation: fadeInUp 0.4s ease-out 0.3s both; }
.stats-grid .stat-card:nth-child(5) { animation: fadeInUp 0.4s ease-out 0.4s both; }
.stats-grid .stat-card:nth-child(6) { animation: fadeInUp 0.4s ease-out 0.5s both; }

/* ─── PRINT STYLES ─────────────────────────────────────────── */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .sidebar, .topbar, .page-header-actions, .btn, .toast-container, .modal-overlay {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
    }
    
    .page-content {
        padding: 0;
    }
    
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
    
    .invoice-preview {
        box-shadow: none;
        padding: 0;
    }
}

/* ─── SWISS CROSS DECORATION ───────────────────────────────── */
.swiss-cross {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
}

.swiss-cross::before,
.swiss-cross::after {
    content: '';
    position: absolute;
    background: var(--color-danger);
}

.swiss-cross::before {
    width: 60%;
    height: 20%;
    top: 40%;
    left: 20%;
}

.swiss-cross::after {
    width: 20%;
    height: 60%;
    top: 20%;
    left: 40%;
}

/* ─── SETTINGS PAGE ────────────────────────────────────────── */
.settings-section {
    margin-bottom: var(--space-8);
}

.settings-section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.settings-section-title svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary-light);
}

/* ─── PREMIUM LOGIN PAGE ────────────────────────────── */
body.is-login-page .sidebar,
body.is-login-page .topbar {
    display: none !important;
}

body.is-login-page .main-content {
    margin: 0 !important;
    width: 100vw;
    height: 100vh;
}

body.is-login-page .page-content {
    padding: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.login-premium-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent 40%),
                radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.08), transparent 40%);
}

.login-premium-container {
    display: flex;
    width: 100%;
    max-width: 1000px;
    height: 600px;
    background: var(--color-surface);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, var(--color-primary) 0%, #4338ca 100%);
    color: white;
    padding: var(--space-10);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    transform: rotate(30deg);
}

.login-branding {
    position: relative;
    z-index: 10;
}

.logo-icon-large {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    margin-bottom: var(--space-6);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.logo-icon-large svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-branding h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: var(--space-2);
    letter-spacing: -1px;
}

.login-branding p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: var(--space-10);
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 16px;
    font-weight: 500;
}

.feature-item svg {
    width: 20px;
    height: 20px;
    color: #a5b4fc;
}

.login-right {
    flex: 1;
    padding: var(--space-10) var(--space-12);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--color-surface);
}

.login-form-premium {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.login-header {
    margin-bottom: var(--space-8);
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.login-header p {
    color: var(--color-text-muted);
}

/* Floating Labels */
.form-floating {
    position: relative;
    margin-bottom: var(--space-5);
}

.form-floating input {
    width: 100%;
    height: 56px;
    padding: 20px 16px 8px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.2s;
    outline: none;
}

.form-floating input:focus {
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-floating label {
    position: absolute;
    left: 16px;
    top: 18px;
    color: var(--color-text-muted);
    font-size: 15px;
    pointer-events: none;
    transition: all 0.2s;
    transform-origin: left top;
}

.form-floating input:focus ~ label,
.form-floating input:not(:placeholder-shown) ~ label {
    top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
}

/* Server Cards */
.server-selection {
    margin-bottom: var(--space-8);
}

.server-section-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-3);
}

.server-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.server-card {
    cursor: pointer;
    position: relative;
}

.server-card input {
    position: absolute;
    opacity: 0;
}

.server-card-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    background: var(--color-surface);
}

.server-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

.server-info {
    display: flex;
    flex-direction: column;
}

.server-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.server-status {
    font-size: 11px;
    font-weight: 600;
}

.status-stable { color: var(--color-success); }
.status-beta { color: var(--color-warning); }

.server-check {
    margin-left: auto;
    color: var(--color-primary);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.server-card input:checked + .server-card-content {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.02);
}

.server-card input:checked + .server-card-content .server-icon {
    background: var(--color-primary);
    color: white;
}

.server-card input:checked + .server-card-content .server-check {
    opacity: 1;
    transform: scale(1);
}

/* Premium Button */
.btn-login-premium {
    width: 100%;
    height: 52px;
    background: var(--color-text);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-login-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.btn-login-premium.is-loading {
    background: var(--color-text-secondary);
    pointer-events: none;
}

.btn-login-premium.is-success {
    background: var(--color-success);
    pointer-events: none;
}

@media (max-width: 768px) {
    .login-premium-container {
        flex-direction: column;
        height: auto;
        min-height: 600px;
    }
    
    .login-left {
        padding: var(--space-8) var(--space-6);
    }
    
    .login-branding h1 {
        font-size: 32px;
    }
    
    .login-right {
        padding: var(--space-8) var(--space-6);
    }
}

/* ─── CARD SCANNER UI ────────────────────────────── */
.scanner-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    transition: all 0.3s ease;
}

.scanner-indicator.is-listening {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.scanner-indicator.is-success {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.05);
}

.scanner-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.scanner-indicator.is-listening .scanner-icon {
    color: var(--color-primary);
    animation: pulse 2s infinite;
}

.scanner-indicator.is-success .scanner-icon {
    color: white;
    background: var(--color-success);
}

.scanner-text {
    flex: 1;
}

.scanner-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.scanner-desc {
    font-size: 12px;
    color: var(--color-text-muted);
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
}

/* ─── UPDATE CENTER UI ────────────────────────────── */
.update-status-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-6) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.update-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.update-status-icon {
    width: 32px;
    height: 32px;
}

.update-status-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.update-status-desc {
    color: var(--color-text-muted);
    font-size: 14px;
}

.update-info-box {
    padding: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.update-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.update-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.update-info-label {
    color: var(--color-text-secondary);
    font-size: 14px;
}

.update-info-value {
    font-weight: 600;
    font-size: 14px;
}

/* Changelog Timeline */
.changelog-timeline {
    position: relative;
    padding-left: 20px;
}

.changelog-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 2px;
    background: var(--color-border);
}

.changelog-item {
    position: relative;
    margin-bottom: var(--space-8);
}

.changelog-item:last-child {
    margin-bottom: 0;
}

.changelog-marker {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    border: 2px solid var(--color-surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.changelog-content {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.changelog-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.changelog-date {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.changelog-group {
    margin-top: var(--space-4);
}

.changelog-group h5 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: var(--space-3);
}

.changelog-group h5 i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
}

.changelog-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.changelog-group li {
    position: relative;
    padding-left: var(--space-4);
    margin-bottom: var(--space-2);
    color: var(--color-text-secondary);
    line-height: 1.5;
    font-size: 14px;
}

.changelog-group li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-border);
}

.changelog-group li strong {
    color: var(--color-text);
}

/* SUPER ADMIN NAV */
body.is-super-admin .nav-section-standard { display: none !important; }
body:not(.is-super-admin) .nav-section-super { display: none !important; }

/* ─── PREMIUM DASHBOARD WIDGETS ─────────────────────────────── */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-6);
}

.widget-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    position: relative;
    overflow: hidden;
}

.widget-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(227, 0, 15, 0.2);
}

.gradient-card {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border: none;
}

.gradient-card .widget-title,
.gradient-card .widget-value,
.gradient-card p,
.gradient-card i {
    color: white;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
}

.widget-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-top: var(--space-2);
}

.widget-icon-bg {
    position: absolute;
    right: -10px;
    bottom: -10px;
    opacity: 0.1;
    width: 120px;
    height: 120px;
}

.widget-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: auto;
}

@media (max-width: 480px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }
    .widget-card {
        padding: var(--space-4);
    }
}

/* Role based UI rendering */
.nav-item-gestionnaire {
    display: none !important;
}
body.is-gestionnaire .nav-item-gestionnaire {
    display: flex !important;
}
