/**
 * QR Menü SaaS — Süper Yönetici Paneli Design System
 * Inspired by Stripe Dashboard + Vercel + Linear + Modern Filament Admin
 * Production Ready, Highly Accessible, Dark/Light Mode, Ultra-Responsive (360px to 4K)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ==========================================================================
   1. CSS VARIABLES & THEME TOKENS
   ========================================================================== */
:root {
    /* Color Palette - Light Theme (Default) */
    --saas-bg: #f8fafc;
    --saas-surface: #ffffff;
    --saas-surface-hover: #f1f5f9;
    --saas-surface-subtle: #f8fafc;
    --saas-card: #ffffff;
    --saas-card-hover: #ffffff;
    --saas-border: #e2e8f0;
    --saas-border-subtle: #edf2f7;
    --saas-border-strong: #cbd5e1;

    /* Sidebar & Navigation Specific */
    --saas-sidebar-bg: #0f172a;
    --saas-sidebar-surface: #1e293b;
    --saas-sidebar-hover: #334155;
    --saas-sidebar-border: #1e293b;
    --saas-sidebar-text: #94a3b8;
    --saas-sidebar-text-active: #ffffff;
    --saas-sidebar-section: #64748b;

    /* Header Specific */
    --saas-header-bg: #ffffff;
    --saas-header-border: #e2e8f0;
    --saas-header-text: #0f172a;

    /* Typography Colors */
    --saas-text: #0f172a;
    --saas-text-secondary: #334155;
    --saas-text-muted: #64748b;
    --saas-text-inverse: #ffffff;

    /* Brand / Primary */
    --saas-primary: #4f46e5;
    --saas-primary-hover: #4338ca;
    --saas-primary-active: #3730a3;
    --saas-primary-soft: rgba(79, 70, 229, 0.08);
    --saas-primary-border: rgba(79, 70, 229, 0.2);
    --saas-primary-contrast: #ffffff;

    /* Semantic States */
    --saas-success: #10b981;
    --saas-success-hover: #059669;
    --saas-success-soft: #ecfdf5;
    --saas-success-border: #a7f3d0;
    --saas-success-text: #047857;

    --saas-warning: #f59e0b;
    --saas-warning-hover: #d97706;
    --saas-warning-soft: #fffbeb;
    --saas-warning-border: #fde68a;
    --saas-warning-text: #b45309;

    --saas-danger: #ef4444;
    --saas-danger-hover: #dc2626;
    --saas-danger-soft: #fef2f2;
    --saas-danger-border: #fecaca;
    --saas-danger-text: #b91c1c;

    --saas-info: #06b6d4;
    --saas-info-hover: #0891b2;
    --saas-info-soft: #ecfeff;
    --saas-info-border: #a5f3fc;
    --saas-info-text: #0e7490;

    /* Radius Tokens */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --radius: var(--radius-md);

    /* Elevation & Shadows */
    --saas-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --saas-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --saas-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --saas-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --saas-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --saas-shadow-dropdown: 0 12px 30px rgba(15, 23, 42, 0.12);

    /* Transitions & Focus */
    --saas-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --saas-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --saas-focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.2);

    /* Layout Dimensions */
    --header-height: 64px;
    --sidebar-width: 260px;
}

/* ==========================================================================
   2. DARK THEME TOKENS
   ========================================================================== */
[data-theme="dark"] {
    --saas-bg: #090d16;
    --saas-surface: #111827;
    --saas-surface-hover: #1f2937;
    --saas-surface-subtle: #0f172a;
    --saas-card: #111827;
    --saas-card-hover: #182234;
    --saas-border: #1f2937;
    --saas-border-subtle: #162032;
    --saas-border-strong: #374151;

    --saas-header-bg: #111827;
    --saas-header-border: #1f2937;
    --saas-header-text: #f9fafb;

    --saas-text: #f9fafb;
    --saas-text-secondary: #d1d5db;
    --saas-text-muted: #9ca3af;
    --saas-text-inverse: #0f172a;

    --saas-primary: #6366f1;
    --saas-primary-hover: #4f46e5;
    --saas-primary-active: #4338ca;
    --saas-primary-soft: rgba(99, 102, 241, 0.15);
    --saas-primary-border: rgba(99, 102, 241, 0.35);

    --saas-success: #10b981;
    --saas-success-soft: rgba(16, 185, 129, 0.15);
    --saas-success-border: rgba(16, 185, 129, 0.3);
    --saas-success-text: #34d399;

    --saas-warning: #f59e0b;
    --saas-warning-soft: rgba(245, 158, 11, 0.15);
    --saas-warning-border: rgba(245, 158, 11, 0.3);
    --saas-warning-text: #fbbf24;

    --saas-danger: #ef4444;
    --saas-danger-soft: rgba(239, 68, 68, 0.15);
    --saas-danger-border: rgba(239, 68, 68, 0.3);
    --saas-danger-text: #f87171;

    --saas-info: #06b6d4;
    --saas-info-soft: rgba(6, 182, 212, 0.15);
    --saas-info-border: rgba(6, 182, 212, 0.3);
    --saas-info-text: #38bdf8;

    --saas-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --saas-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --saas-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --saas-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    --saas-shadow-dropdown: 0 12px 30px rgba(0, 0, 0, 0.6);
    --saas-focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

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

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--saas-bg);
    color: var(--saas-text);
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    color: var(--saas-text);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }

p, span, label, td, th, li {
    font-size: 0.88rem;
}

small, .text-sm {
    font-size: 0.78rem;
}

code, kbd, pre, samp {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.82em;
    word-break: break-all;
    overflow-wrap: anywhere;
}

code {
    background: var(--saas-surface-hover);
    color: var(--saas-primary);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--saas-border);
}

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

:focus-visible {
    outline: 2px solid var(--saas-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   4. WRAPPER & MAIN LAYOUT
   ========================================================================== */
.super-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--saas-bg);
}

.super-body {
    display: flex;
    flex: 1;
    position: relative;
    min-height: calc(100vh - var(--header-height));
}

.super-main {
    flex: 1;
    padding: 28px 32px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
}

/* ==========================================================================
   5. HEADER & TOP BAR
   ========================================================================== */
.super-header {
    background: var(--saas-header-bg);
    color: var(--saas-header-text);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--saas-header-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.super-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--saas-header-text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.super-brand .brand-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.super-brand span.badge-role {
    background: var(--saas-primary-soft);
    color: var(--saas-primary);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--saas-primary-border);
}

.sidebar-toggle-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--saas-border);
    color: var(--saas-text);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    transition: all var(--saas-transition-fast);
}
.sidebar-toggle-btn:hover {
    background: var(--saas-surface-hover);
}

/* Header Action Controls */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--saas-surface-subtle);
    border: 1px solid var(--saas-border);
    border-radius: var(--radius-sm);
    color: var(--saas-text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--saas-transition-fast);
    min-height: 36px;
}
.header-search-btn:hover {
    border-color: var(--saas-primary);
    color: var(--saas-text);
}
.header-search-btn kbd {
    background: var(--saas-surface);
    border: 1px solid var(--saas-border-strong);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: var(--saas-text-secondary);
}

/* User Menu & Initials Avatar */
.header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    color: var(--saas-text);
    transition: all var(--saas-transition-fast);
    min-height: 38px;
}
.header-user-btn:hover {
    background: var(--saas-surface-hover);
    border-color: var(--saas-border);
}

.user-initials-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--saas-surface-subtle);
    border: 1px solid var(--saas-border);
    color: var(--saas-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--saas-transition-fast);
}
.theme-toggle-btn:hover {
    color: var(--saas-text);
    border-color: var(--saas-border-strong);
}

/* ==========================================================================
   6. SIDEBAR & NAVIGATION
   ========================================================================== */
.super-sidebar {
    width: var(--sidebar-width);
    background: var(--saas-sidebar-bg);
    color: var(--saas-sidebar-text);
    padding: 16px 10px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--saas-sidebar-border);
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--saas-sidebar-section);
    padding: 14px 12px 6px;
    text-transform: uppercase;
    user-select: none;
}

.super-sidebar a {
    color: var(--saas-sidebar-text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: all var(--saas-transition-fast);
    min-height: 42px;
}

.sidebar-link-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.super-sidebar a:hover {
    background: var(--saas-sidebar-hover);
    color: var(--saas-sidebar-text-active);
}

.super-sidebar a.active {
    background: var(--saas-primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}
.super-sidebar a.active .sidebar-icon {
    opacity: 1;
}

.sidebar-badge {
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1;
}
.sidebar-badge-warning { background: #f59e0b; color: #78350f; }
.sidebar-badge-danger  { background: #ef4444; color: #ffffff; }
.sidebar-badge-info    { background: #06b6d4; color: #ffffff; }

/* Backdrop for Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity var(--saas-transition);
}

/* ==========================================================================
   7. PAGE HEADERS & METRICS
   ========================================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
}

.page-header-title {
    min-width: 0;
    flex: 1 1 280px;
}

.page-header-title h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--saas-text);
    word-break: break-word;
}
.page-header-title p {
    color: var(--saas-text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
    word-break: break-word;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Metrics / KPI Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--saas-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--saas-border);
    box-shadow: var(--saas-shadow-xs);
    position: relative;
    overflow: hidden;
    min-width: 0;
    transition: all var(--saas-transition-fast);
}
.metric-card:hover {
    box-shadow: var(--saas-shadow-sm);
    border-color: var(--saas-border-strong);
}

.metric-card .metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.metric-card h3 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--saas-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .metric-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.metric-card .metric-icon .app-icon,
.metric-card .metric-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Unified SVG Icon System */
.app-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.saas-tab-btn .app-icon {
    margin-right: 6px;
    vertical-align: -2px;
}

.card-title .app-icon {
    margin-right: 6px;
    vertical-align: -2px;
}

.btn .app-icon {
    margin-right: 5px;
    vertical-align: -2px;
}

.btn-icon .app-icon {
    margin-right: 0;
}

.badge .app-icon {
    margin-right: 4px;
    vertical-align: -1px;
}

.metric-card .value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--saas-text);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 6px;
    word-break: break-word;
}

.metric-card .metric-footer {
    font-size: 0.75rem;
    color: var(--saas-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}
.metric-trend--up   { background: var(--saas-success-soft); color: var(--saas-success-text); }
.metric-trend--down { background: var(--saas-danger-soft); color: var(--saas-danger-text); }

/* ==========================================================================
   8. CARDS & CONTAINERS
   ========================================================================== */
.card {
    background: var(--saas-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--saas-border);
    box-shadow: var(--saas-shadow-xs);
    margin-bottom: 24px;
    min-width: 0;
    transition: border-color var(--saas-transition-fast);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--saas-text);
    word-break: break-word;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--saas-text-muted);
    margin-top: 2px;
    word-break: break-word;
}

/* ==========================================================================
   9. BUTTONS SYSTEM (Touch target min 44px on mobile)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
    transition: all var(--saas-transition-fast);
    white-space: nowrap;
    user-select: none;
    min-height: 38px;
}
.btn:focus-visible {
    outline: none;
    box-shadow: var(--saas-focus-ring);
}

/* Button Variants */
.btn-primary {
    background: var(--saas-primary);
    color: #ffffff;
    border-color: var(--saas-primary);
}
.btn-primary:hover {
    background: var(--saas-primary-hover);
    border-color: var(--saas-primary-hover);
    color: #ffffff;
}
.btn-primary:active {
    background: var(--saas-primary-active);
}

.btn-secondary {
    background: var(--saas-surface);
    color: var(--saas-text-secondary);
    border-color: var(--saas-border);
}
.btn-secondary:hover {
    background: var(--saas-surface-hover);
    border-color: var(--saas-border-strong);
    color: var(--saas-text);
}

.btn-success {
    background: var(--saas-success);
    color: #ffffff;
}
.btn-success:hover {
    background: var(--saas-success-hover);
    color: #ffffff;
}

.btn-danger {
    background: var(--saas-danger-soft);
    color: var(--saas-danger-text);
    border-color: var(--saas-danger-border);
}
.btn-danger:hover {
    background: var(--saas-danger);
    color: #ffffff;
    border-color: var(--saas-danger);
}

.btn-warning {
    background: var(--saas-warning-soft);
    color: var(--saas-warning-text);
    border-color: var(--saas-warning-border);
}
.btn-warning:hover {
    background: var(--saas-warning);
    color: #ffffff;
}

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

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

.btn-small, .btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    min-height: 32px;
}

.btn-large, .btn-lg {
    padding: 12px 22px;
    font-size: 0.95rem;
    min-height: 44px;
}

/* ==========================================================================
   10. FORMS & INPUTS
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 6px;
    color: var(--saas-text-secondary);
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--saas-border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--saas-text);
    background: var(--saas-surface);
    transition: border-color var(--saas-transition-fast), box-shadow var(--saas-transition-fast);
    min-height: 38px;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--saas-primary);
    box-shadow: var(--saas-focus-ring);
}

.form-control::placeholder {
    color: var(--saas-text-muted);
    opacity: 0.7;
}

.form-control:disabled, .form-control[readonly] {
    background: var(--saas-surface-subtle);
    color: var(--saas-text-muted);
    cursor: not-allowed;
    border-color: var(--saas-border);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--saas-text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--saas-danger-text);
    margin-top: 4px;
    font-weight: 500;
}

/* Form Grids */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Custom Modern Switch / Toggle */
.saas-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    min-height: 36px;
}
.saas-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.saas-switch-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background-color: var(--saas-border-strong);
    border-radius: var(--radius-full);
    transition: background-color var(--saas-transition-fast);
    flex-shrink: 0;
}
.saas-switch-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform var(--saas-transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.saas-switch input:checked + .saas-switch-slider {
    background-color: var(--saas-primary);
}
.saas-switch input:checked + .saas-switch-slider::before {
    transform: translateX(18px);
}
.saas-switch input:focus-visible + .saas-switch-slider {
    box-shadow: var(--saas-focus-ring);
}

/* Input with action/copy addon */
.input-with-addon {
    display: flex;
    position: relative;
}
.input-with-addon .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-with-addon .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

/* Password Eye Toggle Container */
.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.password-input-wrap .form-control {
    padding-right: 48px;
}
.password-toggle-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 4px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: transparent;
    border: none;
    color: var(--saas-text-muted);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}
.password-toggle-btn:hover {
    color: var(--saas-text);
}

/* Password Strength Indicator */
.password-strength-meter {
    height: 4px;
    width: 100%;
    background: var(--saas-border);
    border-radius: var(--radius-full);
    margin-top: 6px;
    overflow: hidden;
}
.password-strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}
.strength-weak   { width: 25%; background-color: var(--saas-danger); }
.strength-fair   { width: 50%; background-color: var(--saas-warning); }
.strength-good   { width: 75%; background-color: var(--saas-info); }
.strength-strong { width: 100%; background-color: var(--saas-success); }

/* ==========================================================================
   11. TABLES & RESPONSIVE DATA DISPLAY
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table, table.saas-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

th {
    background: var(--saas-surface-subtle);
    padding: 10px 14px;
    font-weight: 700;
    color: var(--saas-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--saas-border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--saas-border);
    vertical-align: middle;
    color: var(--saas-text-secondary);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}
.badge-success   { background: var(--saas-success-soft); color: var(--saas-success-text); border: 1px solid var(--saas-success-border); }
.badge-warning   { background: var(--saas-warning-soft); color: var(--saas-warning-text); border: 1px solid var(--saas-warning-border); }
.badge-danger    { background: var(--saas-danger-soft); color: var(--saas-danger-text); border: 1px solid var(--saas-danger-border); }
.badge-primary   { background: var(--saas-primary-soft); color: var(--saas-primary); border: 1px solid var(--saas-primary-border); }
.badge-secondary { background: var(--saas-surface-hover); color: var(--saas-text-muted); border: 1px solid var(--saas-border); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.badge-dot-success { background-color: var(--saas-success); }
.badge-dot-warning { background-color: var(--saas-warning); }
.badge-dot-danger  { background-color: var(--saas-danger); }

/* ==========================================================================
   12. ALERTS & TOAST NOTIFICATION STACK
   ========================================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    word-break: break-word;
}
.alert--success { background: var(--saas-success-soft); color: var(--saas-success-text); border: 1px solid var(--saas-success-border); }
.alert--error   { background: var(--saas-danger-soft); color: var(--saas-danger-text); border: 1px solid var(--saas-danger-border); }
.alert--warning { background: var(--saas-warning-soft); color: var(--saas-warning-text); border: 1px solid var(--saas-warning-border); }
.alert--info    { background: var(--saas-info-soft); color: var(--saas-info-text); border: 1px solid var(--saas-info-border); }

/* Toast Notifications Container */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.saas-toast {
    background: var(--saas-surface);
    color: var(--saas-text);
    border: 1px solid var(--saas-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--saas-shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.25s ease;
}
.saas-toast.toast-removing {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

.saas-toast .toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}
.saas-toast .toast-body {
    flex: 1;
    min-width: 0;
}
.saas-toast .toast-title {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 2px;
    word-break: break-word;
}
.saas-toast .toast-message {
    font-size: 0.78rem;
    color: var(--saas-text-muted);
    line-height: 1.4;
    word-break: break-word;
}
.saas-toast .toast-close {
    background: transparent;
    border: none;
    color: var(--saas-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   13. MODALS & BOTTOM SHEETS
   ========================================================================== */
.saas-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--saas-transition);
}
.saas-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.saas-modal-dialog {
    background: var(--saas-surface);
    border: 1px solid var(--saas-border);
    border-radius: var(--radius-lg);
    max-width: 580px;
    width: 100%;
    box-shadow: var(--saas-shadow-xl);
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--saas-transition);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.saas-modal-backdrop.open .saas-modal-dialog {
    transform: scale(1) translateY(0);
}

.saas-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--saas-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.saas-modal-header h3 {
    font-size: 1.15rem;
    word-break: break-word;
}

.saas-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.saas-modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--saas-border);
    background: var(--saas-surface-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   14. COMMAND PALETTE (Ctrl + K)
   ========================================================================== */
.cmd-palette-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--saas-transition-fast);
}
.cmd-palette-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.cmd-palette-box {
    background: var(--saas-surface);
    border: 1px solid var(--saas-border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    box-shadow: var(--saas-shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
}

.cmd-palette-input-wrap {
    padding: 14px 18px;
    border-bottom: 1px solid var(--saas-border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.cmd-palette-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    color: var(--saas-text);
}

.cmd-palette-results {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.cmd-group-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--saas-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 10px 4px;
}

.cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--saas-text);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color var(--saas-transition-fast);
    min-height: 42px;
}
.cmd-item:hover, .cmd-item.selected {
    background: var(--saas-surface-hover);
    color: var(--saas-primary);
}
.cmd-item .cmd-item-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   15. DROPDOWN MENUS
   ========================================================================== */
.saas-dropdown {
    position: relative;
    display: inline-block;
}

.saas-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--saas-surface);
    border: 1px solid var(--saas-border);
    border-radius: var(--radius);
    min-width: 220px;
    box-shadow: var(--saas-shadow-dropdown);
    padding: 6px;
    z-index: 250;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all var(--saas-transition-fast);
}
.saas-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.saas-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--saas-text);
    text-decoration: none;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--saas-transition-fast);
    min-height: 36px;
}
.saas-dropdown-item:hover {
    background: var(--saas-surface-hover);
    color: var(--saas-primary);
}
.saas-dropdown-divider {
    height: 1px;
    background: var(--saas-border);
    margin: 4px 0;
}

/* ==========================================================================
   16. TABS SYSTEM
   ========================================================================== */
.saas-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--saas-border);
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.saas-tabs::-webkit-scrollbar { display: none; }

.saas-tab-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--saas-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--saas-transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}
.saas-tab-btn:hover {
    color: var(--saas-text);
}
.saas-tab-btn.active {
    color: var(--saas-primary);
    border-bottom-color: var(--saas-primary);
}

/* ==========================================================================
   17. PRICING CARDS & PHONE MOCKUP
   ========================================================================== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.pricing-card {
    background: var(--saas-card);
    border: 1px solid var(--saas-border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.pricing-card.popular {
    border-color: var(--saas-primary);
    box-shadow: 0 4px 20px var(--saas-primary-soft);
}

.phone-mockup-frame {
    width: 100%;
    max-width: 320px;
    height: 580px;
    border: 10px solid #1e293b;
    border-radius: 36px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: #ffffff;
    margin: 0 auto;
}
.phone-mockup-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
}
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 18px;
    background: #1e293b;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    z-index: 10;
}

/* ==========================================================================
   18. RESPONSIVE BREAKPOINTS & MOBILE CARD VIEW
   ========================================================================== */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 960px) {
    :root {
        --header-height: 60px;
    }
    .sidebar-toggle-btn { display: inline-flex; }
    
    .super-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform var(--saas-transition);
        height: 100vh;
        max-height: 100vh;
        box-shadow: var(--saas-shadow-xl);
    }
    .super-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-backdrop.open {
        display: block;
        opacity: 1;
    }
    
    .super-main { padding: 16px 14px; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .header-search-btn span { display: none; }
    .hide-mobile { display: none !important; }
    .dashboard-charts-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
    /* MOBILE BOTTOM SHEET FOR MODALS */
    .saas-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }
    .saas-modal-dialog {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-width: 100%;
        width: 100%;
        max-height: 88vh;
        transform: translateY(100%);
    }
    .saas-modal-backdrop.open .saas-modal-dialog {
        transform: translateY(0);
    }
    .sheet-handle {
        width: 36px;
        height: 4px;
        background: var(--saas-border-strong);
        border-radius: var(--radius-full);
        margin: 8px auto 4px;
        flex-shrink: 0;
    }

    /* MOBILE TABLE TO CARD VIEW TRANSFORMATION */
    .table-card-view thead {
        display: none;
    }
    .table-card-view, .table-card-view tbody, .table-card-view tr, .table-card-view td {
        display: block;
        width: 100%;
    }
    .table-card-view tr {
        background: var(--saas-card);
        border: 1px solid var(--saas-border);
        border-radius: var(--radius);
        margin-bottom: 12px;
        padding: 14px 16px;
        box-shadow: var(--saas-shadow-xs);
    }
    .table-card-view td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 0;
        border-bottom: 1px solid var(--saas-border-subtle);
        text-align: right;
        min-width: 0;
    }
    .table-card-view td > * {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .table-card-view td:last-child {
        border-bottom: none;
        padding-top: 12px;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }
    .table-card-view td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.75rem;
        color: var(--saas-text-muted);
        text-transform: uppercase;
        text-align: left;
        padding-right: 12px;
        flex-shrink: 0;
    }
    .table-card-view td[data-label=""]:before {
        display: none;
    }

    /* Mobile Buttons - Min 44px touch area */
    .btn {
        min-height: 42px;
        padding: 8px 14px;
    }
    .btn-small, .btn-sm {
        min-height: 38px;
        padding: 6px 12px;
    }
    
    #toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: calc(100% - 24px);
    }
}

@media (max-width: 480px) {
    .page-header-actions {
        width: 100%;
    }
    .page-header-actions .btn {
        flex: 1 1 auto;
    }
    .input-with-addon {
        flex-direction: column;
    }
    .input-with-addon .form-control {
        border-radius: var(--radius-sm);
        margin-bottom: 6px;
    }
    .input-with-addon .btn {
        border-radius: var(--radius-sm);
        border-left: 1px solid var(--saas-border);
        width: 100%;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
