/* ============================================================
   MTO DESIGN SYSTEM
   Compact, clean, minimal, modern
   ============================================================ */

/* ---------- CSS VARIABLES ---------- */
:root {
    /* Brand Colors - extracted from MTO logo */
    --primary: #2E7AB8;           /* Main blue (from logo) */
    --primary-light: #4A95CF;     /* Lighter blue */
    --primary-dark: #1F5A8E;      /* Darker blue for hover */
    --accent: #3B8FC7;            /* Blue accent */
    --accent-light: #5CA7D8;      /* Light accent */
    --teal: #14B8A6;              /* Teal from logo gradient */
    --teal-light: #2DD4BF;        /* Light teal */

    /* Backgrounds */
    --bg-body: #F8FAFC;           /* Very light gray-blue page bg */
    --bg-white: #FFFFFF;          /* Cards, panels */
    --bg-sidebar: #FFFFFF;        /* Sidebar bg */
    --bg-header: #FFFFFF;         /* Header bg */
    --bg-hover: #F1F5F9;          /* Hover state bg */
    --bg-active: #EFF6FF;         /* Active/selected state */
    --bg-input: #FFFFFF;          /* Input fields */
    --bg-muted: #F1F5F9;          /* Muted/disabled bg */

    /* Text */
    --text-primary: #1E293B;      /* Main body text - dark slate */
    --text-secondary: #64748B;    /* Secondary/muted text */
    --text-placeholder: #94A3B8;  /* Placeholder text */
    --text-inverse: #FFFFFF;      /* Text on dark bg */
    --text-link: #2E7AB8;         /* Links */

    /* Borders */
    --border: #D1E3F0;            /* Slight blue tint for borders */
    --border-light: #E8F2F8;      /* Subtle blue borders */
    --border-focus: #2E7AB8;      /* Focus ring */

    /* Status Colors */
    --success: #16A34A;           /* Green */
    --success-bg: #F0FDF4;
    --success-border: #BBF7D0;
    --error: #DC2626;             /* Red */
    --error-bg: #FEF2F2;
    --error-border: #FECACA;
    --warning: #D97706;           /* Amber */
    --warning-bg: #FFFBEB;
    --warning-border: #FDE68A;
    --info: #3B8FC7;              /* Blue info */
    --info-bg: #F0F9FF;
    --info-border: #BAE6FD;

    /* Typography - ONE size for body, ONE for headers */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size: 0.875rem;        /* 14px - THE body text size */
    --font-size-sm: 0.75rem;      /* 12px - small labels, captions */
    --font-size-header: 1.125rem; /* 18px - THE header/title size */
    --font-size-page-title: 1rem; /* 16px - page titles (compact!) */
    --line-height: 1.5;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;

    /* Spacing - compact scale */
    --space-1: 0.25rem;    /* 4px */
    --space-2: 0.5rem;     /* 8px */
    --space-3: 0.75rem;    /* 12px */
    --space-4: 1rem;       /* 16px */
    --space-5: 1.25rem;    /* 20px */
    --space-6: 1.5rem;     /* 24px */

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-full: 9999px;

    /* Shadows - subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

    /* Transitions */
    --transition: 0.15s ease;

    /* Layout */
    --sidebar-width: 220px;
    --header-height: 48px;
}

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

html {
    font-size: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-body);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5, h6 {
    font-size: var(--font-size-header);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.3;
}

p, li, td, th, label, span, input, select, textarea, button {
    font-size: var(--font-size);
}

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

.text-secondary {
    color: var(--text-secondary);
}

.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* ---------- APP LAYOUT ---------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border);
}

.sidebar__logo img {
    max-width: 140px;
    height: auto;
}

.sidebar__nav {
    flex: 1;
    padding: var(--space-2) var(--space-2);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar__section-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-3) var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: var(--font-size);
    font-weight: var(--font-weight-normal);
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: var(--space-1);
    border-left: 3px solid transparent;
    padding-left: calc(var(--space-3) - 3px);
}

.sidebar__link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar__link--active {
    background: linear-gradient(90deg, var(--bg-active), var(--bg-white));
    color: var(--primary);
    font-weight: var(--font-weight-medium);
    border-left-color: var(--primary);
}

.sidebar__link .material-symbols-outlined {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar__badge {
    margin-left: auto;
    background: var(--error);
    color: var(--text-inverse);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

.sidebar__link--active .sidebar__badge {
    background: var(--primary);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.sidebar__profile {
    padding: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar__profile:hover {
    background: var(--bg-hover);
}

.sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-light), var(--teal));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

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

.sidebar__profile-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__profile-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar__profile-action {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.sidebar__profile-action:hover {
    color: var(--error);
    transform: scale(1.1);
}

.sidebar__profile-action .material-symbols-outlined {
    font-size: 20px;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
}

/* ---------- HEADER ---------- */
.header {
    height: 56px;
    background: linear-gradient(to bottom, #FFFFFF, #FCFCFD);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.header__menu-toggle {
    display: none; /* Hidden by default on desktop */
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.header__menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

.header__menu-toggle:active {
    transform: scale(0.95);
}

.header__title {
    font-size: 1.125rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    flex: 1;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.header__icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-white);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    border: 1px solid transparent;
}

.header__icon-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.header__icon-btn:active {
    transform: translateY(0);
}

.header__icon-btn .material-symbols-outlined {
    font-size: 20px;
}

.header__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    border-radius: var(--radius-full);
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.4);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

/* ---------- HEADER AVATAR DROPDOWN ---------- */
.header__avatar-wrap {
    position: relative;
}

.header__avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-light), var(--teal));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.header__avatar:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46, 122, 184, 0.15);
    transform: scale(1.05);
}

.header__avatar:active {
    transform: scale(0.97);
}

.header__avatar-initials {
    color: white;
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    letter-spacing: 0.02em;
}

.header__avatar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    overflow: hidden;
}

.header__avatar-menu--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.header__avatar-menu-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.header__avatar-menu-name {
    font-size: var(--font-size);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header__avatar-menu-role {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

.header__avatar-menu-divider {
    height: 1px;
    background: var(--border-light);
}

.header__avatar-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}

.header__avatar-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header__avatar-menu-item .material-symbols-outlined {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.header__avatar-menu-item--danger {
    color: var(--error);
}

.header__avatar-menu-item--danger:hover {
    background: var(--error-bg);
    color: var(--error);
}

/* ---------- PAGE CONTENT ---------- */
.page {
    padding: var(--space-5);
    max-width: 1200px;
}

.page--full {
    max-width: none;
}

/* ---------- CARDS ---------- */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

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

.card__title {
    font-size: var(--font-size);
    font-weight: var(--font-weight-semibold);
}

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 9px 16px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn .material-symbols-outlined {
    font-size: 18px;
    margin: -2px 0;
}

.btn--primary {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 1px 3px rgba(46, 122, 184, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn--primary:hover {
    background: linear-gradient(180deg, var(--primary-dark) 0%, #174569 100%);
    border-color: var(--primary-dark);
    color: white;
    box-shadow: 0 2px 5px rgba(46, 122, 184, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn--secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn--secondary:hover {
    background: var(--bg-hover);
    border-color: #C1D8E8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    box-shadow: none;
}

.btn--ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn--danger {
    background: var(--bg-white);
    color: var(--error);
    border-color: var(--error-border);
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn--danger:hover {
    background: var(--error-bg);
    border-color: var(--error);
    color: #B91C1C;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn--sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn--sm .material-symbols-outlined {
    font-size: 16px;
}

/* ---------- FORM INPUTS ---------- */
.form-group {
    margin-bottom: var(--space-3);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.form-input {
    width: 100%;
    padding: 6px 10px;
    font-size: var(--font-size);
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

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

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

.form-input--error {
    border-color: var(--error);
}

.form-input--error:focus {
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.form-group--error {
    border-left: 3px solid var(--error);
    padding-left: var(--space-2);
}

.form-error {
    font-size: 11px;
    color: var(--error);
    margin-top: 2px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

select.form-input {
    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'%3E%3Cpath fill='%232E7AB8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
    font-weight: var(--font-weight-medium);
}

select.form-input:hover {
    border-color: var(--primary-light);
    background-color: #FAFBFC;
}

select.form-input:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%232E7AB8' d='M7 14l5-5 5 5z'/%3E%3C/svg%3E");
}

select.form-input option {
    padding: 8px;
    font-weight: var(--font-weight-normal);
}

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

/* Checkbox & Radio - Custom styled labels */
.form-check {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--font-size);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.form-check:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.form-check:has(input:checked) {
    background: var(--bg-active);
    border-color: rgba(46, 122, 184, 0.2);
}

.form-check span {
    line-height: 1.4;
    color: var(--text-primary);
}

.form-check:has(input:checked) span {
    color: var(--primary-dark);
    font-weight: var(--font-weight-medium);
}

/* Global custom checkbox */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-white);
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

input[type="checkbox"]:hover {
    border-color: var(--primary-light);
    background: var(--bg-active);
    box-shadow: 0 0 0 3px rgba(46, 122, 184, 0.08);
}

input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-dark);
    box-shadow: 0 2px 4px rgba(46, 122, 184, 0.3);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 122, 184, 0.2);
    border-color: var(--primary);
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Global custom radio */
input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--bg-white);
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

input[type="radio"]:hover {
    border-color: var(--primary-light);
    background: var(--bg-active);
    box-shadow: 0 0 0 3px rgba(46, 122, 184, 0.08);
}

input[type="radio"]:checked {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(46, 122, 184, 0.3);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 1px 2px rgba(46, 122, 184, 0.3);
}

input[type="radio"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 122, 184, 0.2);
    border-color: var(--primary);
}

input[type="radio"]:disabled,
.form-check:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- TABLE ---------- */
.table-wrap {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--border);
    background: var(--bg-muted);
    white-space: nowrap;
}

.table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

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

/* Clickable table rows */
.table tbody tr.table__row--clickable {
    cursor: pointer;
    transition: background 0.15s ease;
}
.table tbody tr.table__row--clickable:hover {
    background: var(--bg-active);
}
.table tbody tr.table__row--clickable:active {
    background: var(--bg-hover);
}

/* ---------- BADGES / STATUS ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge--success {
    background: var(--success-bg);
    color: var(--success);
}

.badge--error {
    background: var(--error-bg);
    color: var(--error);
}

.badge--warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge--info {
    background: var(--info-bg);
    color: var(--info);
}

.badge--neutral {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

/* ---------- ALERTS ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size);
    border: 1px solid;
}

.alert .material-symbols-outlined {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert--success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}

.alert--error {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
}

.alert--warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning-border);
}

.alert--info {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info-border);
}

/* ---------- STATS ROW ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
}

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

.stat-card__value {
    font-size: var(--font-size-header);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.stat-card__change {
    font-size: 11px;
    margin-top: 2px;
}

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

.tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    font-family: var(--font-family);
}

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

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

/* ---------- MODAL ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

.modal__title {
    font-size: var(--font-size);
    font-weight: var(--font-weight-semibold);
}

.modal__body {
    padding: var(--space-4);
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--text-secondary);
}

.empty-state .material-symbols-outlined {
    font-size: 40px;
    color: var(--border);
    margin-bottom: var(--space-2);
}

.empty-state__text {
    font-size: var(--font-size);
    margin-bottom: var(--space-3);
}

/* ---------- MODAL VARIANTS ---------- */
.modal--sm {
    max-width: 360px;
}

.modal--md {
    max-width: 520px;
}

.modal--lg {
    max-width: 680px;
}

.modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}

.modal__close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ---------- SEARCH ---------- */
.search-box {
    position: relative;
    max-width: 240px;
}

.search-box .material-symbols-outlined {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-placeholder);
}

.search-box .form-input {
    padding-left: 30px;
}

/* Input with icon wrapper */
.input-icon {
    position: relative;
}

.input-icon__icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-placeholder);
    pointer-events: none;
}

.input-icon .form-input {
    padding-left: 32px;
}

/* ---------- BTN FULL WIDTH ---------- */
.btn--full {
    width: 100%;
    justify-content: center;
}

/* ---------- FORM INPUT SM ---------- */
.form-input--sm {
    padding: 4px 8px;
    font-size: var(--font-size-sm);
}

/* ---------- TOOLTIP ---------- */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    font-size: 11px;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    margin-bottom: 4px;
}

.tooltip:hover::after {
    opacity: 1;
}

/* ---------- PAGINATION ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-3);
}

.pagination__btn {
    padding: 4px 8px;
    font-size: var(--font-size-sm);
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-family: var(--font-family);
}

.pagination__btn:hover {
    background: var(--bg-hover);
}

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

/* ---------- LOADING ---------- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .header__menu-toggle {
        display: flex; /* Show hamburger on mobile */
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar--open {
        transform: translateX(0);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        padding: 0 var(--space-4);
        height: 52px;
    }

    .header__title {
        font-size: 1rem;
    }

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

    .page {
        padding: var(--space-3);
    }
}

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

/* ---------- DEVICE CONFIRMATION CARDS ---------- */
.device-confirm-card {
    border-left: 4px solid var(--border);
    transition: border-color var(--transition), background var(--transition), opacity var(--transition);
}

.device-confirm-card--confirmed {
    border-left-color: var(--success);
    background: rgba(34, 197, 94, 0.04);
}

.device-confirm-card--rejected {
    border-left-color: var(--error);
    opacity: 0.5;
}

/* ---------- CUSTOM DROPDOWN ---------- */
/* Easy to customize - all styling here! */

.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    font-size: var(--font-size);
    font-family: var(--font-family);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.custom-dropdown__trigger:hover {
    border-color: var(--primary-light);
    background: #FAFBFC;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.custom-dropdown--open .custom-dropdown__trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 122, 184, 0.1);
}

.custom-dropdown__value {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-dropdown__arrow {
    display: flex;
    align-items: center;
    color: var(--primary);
    transition: transform 0.2s ease;
    margin-left: var(--space-2);
}

.custom-dropdown--open .custom-dropdown__arrow {
    transform: rotate(180deg);
}

.custom-dropdown__menu {
    position: fixed;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(46, 122, 184, 0.08);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    max-height: 280px;
    overflow: hidden;
}

.custom-dropdown__menu--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown__options {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}

/* Custom scrollbar for options */
.custom-dropdown__options::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown__options::-webkit-scrollbar-track {
    background: transparent;
}

.custom-dropdown__options::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.custom-dropdown__options::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.custom-dropdown__option {
    padding: 8px 10px;
    font-size: var(--font-size);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.15s ease;
    font-weight: var(--font-weight-normal);
}

.custom-dropdown__option:hover {
    background: var(--bg-active);
    color: var(--primary);
    font-weight: var(--font-weight-medium);
}

.custom-dropdown__option--selected {
    background: linear-gradient(90deg, rgba(46, 122, 184, 0.12), transparent);
    color: var(--primary);
    font-weight: var(--font-weight-semibold);
    border-left: 3px solid var(--primary);
    padding-left: 7px;
}

.custom-dropdown__option--selected:hover {
    background: linear-gradient(90deg, rgba(46, 122, 184, 0.18), transparent);
}

/* Optgroup section headers */
.custom-dropdown__group-label {
    padding: 6px 10px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-light);
    margin-top: 4px;
    pointer-events: none;
}

.custom-dropdown__group-label:first-child {
    margin-top: 0;
    border-top: none;
}

/* ---------- SIDEBAR FOOTER ---------- */
.sidebar__footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
}

/* ---------- LANGUAGE SWITCHER ---------- */
.sidebar__lang-switch {
    padding: var(--space-3);
    text-align: center;
}

.sidebar__lang-label {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
}

.sidebar__profile-action.sidebar__lang-btn {
    color: var(--text-tertiary);
}

.sidebar__profile-action.sidebar__lang-btn:hover {
    color: var(--primary);
    transform: none;
}

/* Standalone lang button (guest / auth pages) */
.sidebar__lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 28px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.sidebar__lang-btn:hover {
    background: var(--bg-active);
    color: var(--primary);
    border-color: var(--primary-light);
}

/* Auth page language toggle (no sidebar) */
.auth-lang-toggle {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 50;
}

.auth-lang-toggle .sidebar__lang-btn {
    box-shadow: var(--shadow-sm);
    background: var(--bg-white);
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
