/* ============================================================
   Zeit - Design System 2026
   Modern SaaS UI with glassmorphism, micro-animations, depth
   ============================================================ */

/* --- Design Tokens --- */
:root {
    /* Primary brand */
    --color-primary:          #6366f1;
    --color-primary-light:    #818cf8;
    --color-primary-dark:     #4f46e5;
    --color-primary-subtle:   #eef2ff;

    /* Accent */
    --color-accent:           #8b5cf6;
    --color-accent-light:     #a78bfa;

    /* Neutral scale (warm gray) */
    --color-gray-50:          #fafaf9;
    --color-gray-100:         #f5f5f4;
    --color-gray-200:         #e7e5e4;
    --color-gray-300:         #d6d3d1;
    --color-gray-400:         #a8a29e;
    --color-gray-500:         #78716c;
    --color-gray-600:         #57534e;
    --color-gray-700:         #44403c;
    --color-gray-800:         #292524;
    --color-gray-900:         #1c1917;

    /* Semantic */
    --color-success:          #22c55e;
    --color-success-light:    #dcfce7;
    --color-error:            #ef4444;
    --color-error-light:      #fef2f2;
    --color-info:             #3b82f6;
    --color-info-light:       #eff6ff;

    /* Sidebar */
    --sidebar-bg:             rgba(15, 15, 25, 0.92);
    --sidebar-border:         rgba(255, 255, 255, 0.08);
    --sidebar-text:           rgba(255, 255, 255, 0.6);
    --sidebar-text-active:    #ffffff;
    --sidebar-accent:         #818cf8;

    /* Dashboard gradients */
    --card-gradient-1:        linear-gradient(135deg, #6366f1, #8b5cf6);
    --card-gradient-2:        linear-gradient(135deg, #3b82f6, #6366f1);
    --card-gradient-3:        linear-gradient(135deg, #8b5cf6, #ec4899);
    --card-gradient-4:        linear-gradient(135deg, #06b6d4, #3b82f6);

    /* Shadows */
    --shadow-xs:              0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm:              0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:              0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg:              0 10px 15px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.03);
    --shadow-xl:              0 20px 25px rgba(0, 0, 0, 0.06), 0 8px 10px rgba(0, 0, 0, 0.03);

    /* Radius */
    --radius-sm:              6px;
    --radius-md:              10px;
    --radius-lg:              14px;
    --radius-xl:              20px;
    --radius-full:            9999px;

    /* Typography */
    --font-sans:              'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-xs:                0.75rem;
    --text-sm:                0.8125rem;
    --text-base:              0.875rem;
    --text-lg:                1.0625rem;
    --text-xl:                1.25rem;
    --text-2xl:               1.5rem;
    --text-3xl:               1.875rem;
    --text-4xl:               2.25rem;

    /* Spacing */
    --space-1:   0.25rem;
    --space-2:   0.5rem;
    --space-3:   0.75rem;
    --space-4:   1rem;
    --space-5:   1.25rem;
    --space-6:   1.5rem;
    --space-8:   2rem;
    --space-10:  2.5rem;

    /* Transitions */
    --transition-fast:        150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base:        200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:        300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Reset & Typography --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-gray-700);
    background-color: var(--color-gray-50);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-gray-900);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

h1 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); color: var(--color-gray-700); }

/* --- Page Layout --- */
.page {
    display: flex;
    min-height: 100vh;
    background: var(--color-gray-50);
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-gray-50);
}

.content {
    padding: var(--space-8);
    max-width: 1400px;
    width: 100%;
    animation: fadeInUp 0.35s ease-out;
}

/* --- Glassmorphism Sidebar --- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #fff;
    flex-shrink: 0;
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 50%, transparent 100%);
    pointer-events: none;
}

.nav-brand {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--sidebar-border);
    position: relative;
}

.nav-brand h3 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.015em;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Top Bar --- */
.top-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: var(--space-4) var(--space-8);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-gray-200);
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: 50;
}

.user-info {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-gray-700);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-info::before {
    content: '';
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--card-gradient-1);
    display: inline-flex;
    flex-shrink: 0;
}

.logout-form {
    display: inline;
}

.btn-logout {
    color: var(--color-gray-500);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
}

.btn-logout:hover {
    color: var(--color-error);
    background: var(--color-error-light);
    text-decoration: none;
}

/* --- Login Page --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f19 0%, #1a1033 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
    animation: loginFloat 8s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent 70%);
    bottom: -80px;
    left: -80px;
    border-radius: 50%;
    animation: loginFloat 10s ease-in-out infinite reverse;
}

@keyframes loginFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.05); }
}

.login-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 1;
    color: #fff;
    animation: fadeInUp 0.6s ease-out;
}

.login-card h2 {
    text-align: center;
    margin-bottom: var(--space-1);
    font-size: var(--text-3xl);
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.login-error {
    color: #fca5a5;
    text-align: center;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: var(--space-3);
    border-radius: var(--radius-md);
}

.login-field {
    margin-bottom: var(--space-5);
}

.login-field:last-of-type {
    margin-bottom: var(--space-6);
}

.login-card label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.7);
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    color: #fff;
    transition: all var(--transition-base);
    outline: none;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
    border-color: rgba(129, 140, 248, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(255, 255, 255, 0.1);
}

.login-card input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-card button[type="submit"] {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.login-card button[type="submit"]:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.login-card button[type="submit"]:active {
    transform: translateY(0);
}

/* --- Dashboard Cards --- */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.dashboard-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-gray-200);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out both;
}

.dashboard-card:nth-child(1) { animation-delay: 0ms; }
.dashboard-card:nth-child(2) { animation-delay: 80ms; }
.dashboard-card:nth-child(3) { animation-delay: 160ms; }
.dashboard-card:nth-child(4) { animation-delay: 240ms; }

.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-gradient-1);
}

.dashboard-card:nth-child(2)::before { background: var(--card-gradient-2); }
.dashboard-card:nth-child(3)::before { background: var(--card-gradient-3); }
.dashboard-card:nth-child(4)::before { background: var(--card-gradient-4); }

.dashboard-card h4 {
    margin: 0 0 var(--space-2);
    color: var(--color-gray-500);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dashboard-card .value {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--color-gray-900);
    letter-spacing: -0.015em;
    line-height: 1;
}

.card-icon {
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-card:nth-child(1) .card-icon { background: var(--color-primary-subtle); color: var(--color-primary); }
.dashboard-card:nth-child(2) .card-icon { background: var(--color-info-light); color: var(--color-info); }
.dashboard-card:nth-child(3) .card-icon { background: rgba(139, 92, 246, 0.1); color: var(--color-accent); }
.dashboard-card:nth-child(4) .card-icon { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.page-header h1 {
    margin: 0;
    color: var(--color-gray-900);
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.page-subtitle {
    color: var(--color-gray-500);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

.section-header {
    margin-bottom: var(--space-4);
}

.section-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-gray-700);
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    align-items: end;
    background: #fff;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-xs);
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-field label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Form & Dialog --- */
.dialog-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-gray-700);
}

.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-row > * {
    flex: 1;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-check label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    cursor: pointer;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5) var(--space-5);
}

/* --- Alerts --- */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.alert-error {
    background: var(--color-error-light);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.alert-success {
    background: var(--color-success-light);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.15);
}

/* --- Summary Bar --- */
.summary-bar {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--color-primary-subtle);
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--color-primary-dark);
    font-size: var(--text-sm);
}

/* --- Telerik Component Overrides --- */

/* Scheduler */
.k-scheduler {
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--color-gray-200) !important;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: #fff !important;
}

.k-scheduler .k-scheduler-toolbar {
    background: var(--color-gray-50) !important;
    border-bottom: 1px solid var(--color-gray-200) !important;
    padding: var(--space-3) var(--space-4) !important;
}

.k-scheduler .k-scheduler-header {
    background: var(--color-gray-50) !important;
}

.k-scheduler .k-scheduler-header th {
    font-size: var(--text-xs) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    color: var(--color-gray-500) !important;
}

/* Appointment (Event) Styling */
.k-event {
    background: var(--color-primary) !important;
    border-color: var(--color-primary-dark) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3) !important;
    transition: all var(--transition-fast) !important;
    font-size: var(--text-xs) !important;
    overflow: hidden;
}

.k-event:hover {
    background: var(--color-primary-dark) !important;
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-1px);
}

.k-event .k-event-template {
    padding: 2px 4px !important;
}

/* Scheduler Appointment Content (ItemTemplate) */
.scheduler-appointment-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
    color: #fff;
    overflow: hidden;
}

.scheduler-appointment-content .apt-customer {
    font-weight: 600;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scheduler-appointment-content .apt-article {
    font-size: 0.65rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scheduler-appointment-content .apt-minutes {
    font-size: 0.6rem;
    opacity: 0.75;
    font-weight: 500;
}

/* Scheduler time slot hover */
.k-scheduler .k-scheduler-content td:hover {
    background: var(--color-primary-subtle) !important;
}

/* Current time indicator */
.k-current-time {
    background: var(--color-error) !important;
}

/* Grid */
.k-grid {
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--color-gray-200) !important;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.k-grid .k-grid-header {
    background: var(--color-gray-50) !important;
    border-bottom: 2px solid var(--color-gray-200) !important;
}

.k-grid .k-grid-header th.k-header {
    font-size: var(--text-xs) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--color-gray-500) !important;
    padding: var(--space-3) var(--space-4) !important;
}

.k-grid td {
    font-size: var(--text-sm) !important;
    padding: var(--space-3) var(--space-4) !important;
    border-bottom-color: var(--color-gray-100) !important;
}

.k-grid .k-grid-content tr:hover > td {
    background: var(--color-primary-subtle) !important;
}

.k-grid .k-pager {
    border-top: 1px solid var(--color-gray-200) !important;
    background: var(--color-gray-50) !important;
}

/* Buttons */
.k-button-solid-primary {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    transition: all var(--transition-base) !important;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3) !important;
}

.k-button-solid-primary:hover {
    background: var(--color-primary-dark) !important;
    border-color: var(--color-primary-dark) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35) !important;
    transform: translateY(-1px);
}

.k-button-solid-error {
    border-radius: var(--radius-md) !important;
}

.k-button {
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
    transition: all var(--transition-base) !important;
}

/* Window / Dialog */
.k-window {
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    border: none !important;
    overflow: hidden;
    animation: fadeInUp 0.25s ease-out !important;
}

.k-window .k-window-titlebar {
    background: #fff !important;
    border-bottom: 1px solid var(--color-gray-200) !important;
    padding: var(--space-5) !important;
}

.k-window .k-window-title {
    font-weight: 600 !important;
    font-size: var(--text-lg) !important;
    color: var(--color-gray-900) !important;
}

.k-dialog {
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-xl) !important;
    overflow: hidden;
}

.k-dialog .k-dialog-titlebar {
    background: #fff !important;
    border-bottom: 1px solid var(--color-gray-200) !important;
}

/* Inputs */
.k-input,
.k-textbox,
.k-picker {
    border-radius: var(--radius-md) !important;
    transition: all var(--transition-base) !important;
}

.k-input:focus-within,
.k-textbox:focus,
.k-picker:focus-within {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
}

/* Checkbox */
.k-checkbox:checked {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

/* Loader */
.k-loader-container {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(4px) !important;
}

/* Overlay */
.k-overlay {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(4px) !important;
}

/* --- Hamburger Button (mobile only) --- */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    cursor: pointer;
    color: var(--color-gray-700);
    transition: all var(--transition-base);
    margin-right: auto;
}

.hamburger-btn:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-900);
}

/* --- Sidebar Overlay (mobile only) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================================
   RESPONSIVE / MOBILE SUPPORT
   =========================================================== */

/* --- Tablet (768px - 1024px) --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .content {
        padding: var(--space-6);
    }

    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        gap: var(--space-3);
        padding: var(--space-4);
    }

    .k-grid .k-grid-header th.k-header {
        padding: var(--space-2) var(--space-3) !important;
        font-size: 0.7rem !important;
    }

    .k-grid td {
        padding: var(--space-2) var(--space-3) !important;
        font-size: var(--text-xs) !important;
    }
}

/* --- Mobile (< 768px) --- */
@media (max-width: 767px) {
    /* Show hamburger */
    .hamburger-btn {
        display: flex;
    }

    /* Sidebar: off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        z-index: 200;
    }

    /* Sidebar open state */
    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-overlay {
        display: block;
        opacity: 1;
    }

    /* Top bar */
    .top-row {
        padding: var(--space-3) var(--space-4);
        gap: var(--space-3);
    }

    /* Content area */
    .content {
        padding: var(--space-4);
    }

    /* Page header stacked */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .page-header h1 {
        font-size: var(--text-xl);
    }

    /* Dashboard cards single column */
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .dashboard-card {
        padding: var(--space-5);
    }

    .dashboard-card .value {
        font-size: var(--text-3xl);
    }

    /* Filter bar vertical stack */
    .filter-bar {
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-4);
    }

    .filter-field {
        width: 100%;
    }

    .filter-field .k-input,
    .filter-field .k-picker {
        width: 100% !important;
    }

    /* Scheduler: full width, reduced height */
    .k-scheduler {
        height: 500px !important;
    }

    .scheduler-appointment-content .apt-article {
        display: none;
    }

    /* Grid: scrollable, reduced sizes */
    .k-grid {
        height: auto !important;
        max-height: 70vh;
    }

    .k-grid .k-grid-header th.k-header {
        padding: var(--space-2) var(--space-2) !important;
        font-size: 0.65rem !important;
        letter-spacing: 0.02em !important;
    }

    .k-grid td {
        padding: var(--space-2) !important;
        font-size: var(--text-xs) !important;
    }

    /* Summary bar */
    .summary-bar {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-xs);
    }

    /* Form rows: stack on mobile */
    .form-row {
        flex-direction: column;
        gap: var(--space-4);
    }

    /* Dialog form */
    .dialog-form {
        padding: var(--space-4);
        gap: var(--space-4);
    }

    .dialog-footer {
        padding: var(--space-3) var(--space-4) var(--space-4);
    }

    /* Telerik Window: full width on mobile */
    .k-window {
        width: calc(100vw - 1rem) !important;
        max-width: 100vw !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        border-radius: var(--radius-lg) !important;
    }

    /* Telerik Dialog: full width on mobile */
    .k-dialog-wrapper .k-dialog {
        width: calc(100vw - 1rem) !important;
        max-width: 100vw !important;
        margin: 0 0.5rem;
    }

    /* Login adjustments */
    .login-card {
        margin: var(--space-4);
        padding: var(--space-6);
        max-width: none;
    }

    .login-card h2 {
        font-size: var(--text-2xl);
    }

    .login-container::before {
        width: 250px;
        height: 250px;
    }

    .login-container::after {
        width: 200px;
        height: 200px;
    }

    /* User info: hide avatar circle on mobile */
    .user-info::before {
        width: 28px;
        height: 28px;
    }

    .user-info {
        font-size: var(--text-xs);
    }

    .btn-logout {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-2);
    }

    /* Alerts */
    .alert {
        font-size: var(--text-xs);
        padding: var(--space-2) var(--space-3);
    }

    /* Section headers */
    .section-header h3 {
        font-size: var(--text-base);
    }

    /* Card icons smaller */
    .card-icon {
        width: 32px;
        height: 32px;
        top: var(--space-4);
        right: var(--space-4);
    }

    .card-icon svg {
        width: 16px;
        height: 16px;
    }

    /* Telerik DropDownList popup */
    .k-animation-container {
        max-width: calc(100vw - 2rem) !important;
    }
}

/* --- Small phones (< 400px) --- */
@media (max-width: 399px) {
    .content {
        padding: var(--space-3);
    }

    .page-header h1 {
        font-size: var(--text-lg);
    }

    .dashboard-card .value {
        font-size: var(--text-2xl);
    }

    .login-card {
        padding: var(--space-5);
        margin: var(--space-3);
    }

    .filter-bar {
        padding: var(--space-3);
    }

    .top-row {
        padding: var(--space-2) var(--space-3);
    }
}

/* --- Touch-friendly: larger tap targets --- */
@media (pointer: coarse) {
    .k-grid td {
        min-height: 44px;
    }

    .k-button {
        min-height: 40px !important;
    }

    .nav-link {
        min-height: 44px;
    }

    .hamburger-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* --- Print styles --- */
@media print {
    .sidebar,
    .top-row,
    .hamburger-btn,
    .sidebar-overlay,
    .filter-bar .k-button,
    .page-header .k-button {
        display: none !important;
    }

    .content {
        padding: 0;
        max-width: none;
    }

    .k-grid {
        height: auto !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }

    main {
        width: 100%;
    }
}
