/**
 * ====================================================
 * DUY NAMLC LICENSE SYSTEM - SAAS DESIGN SYSTEM v3.0
 * Modern SaaS Dashboard & Mobile-First Experience
 * Hỗ trợ đồng bộ Dark / Light Mode tức thì
 * ====================================================
 */

:root {
    /* Base typography & metrics */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
    --sidebar-width: 260px;
    --header-height: 64px;
    --bottom-nav-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Brand accents */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);

    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #0ea5e9;
    --info-light: rgba(14, 165, 233, 0.12);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
}

/* ================= DARK THEME (DEFAULT) ================= */
[data-theme="dark"], :root {
    color-scheme: dark;
    --bg-body: #090d16;
    --bg-mesh-1: rgba(99, 102, 241, 0.12);
    --bg-mesh-2: rgba(14, 165, 233, 0.08);
    --bg-surface: #0f172a;
    --bg-card: rgba(19, 27, 46, 0.85);
    --bg-card-hover: rgba(26, 36, 61, 0.95);
    --bg-card-solid: #131b2e;
    --bg-sidebar: #0b1120;
    --bg-header: rgba(11, 17, 32, 0.85);
    --bg-bottom-nav: rgba(11, 17, 32, 0.92);
    --bg-input: rgba(15, 23, 42, 0.8);
    --bg-modal: #111827;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-highlight: rgba(99, 102, 241, 0.4);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;
}

/* ================= LIGHT THEME ================= */
[data-theme="light"] {
    color-scheme: light;
    --bg-body: #f8fafc;
    --bg-mesh-1: rgba(99, 102, 241, 0.08);
    --bg-mesh-2: rgba(14, 165, 233, 0.05);
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: #ffffff;
    --bg-card-solid: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.85);
    --bg-bottom-nav: rgba(255, 255, 255, 0.95);
    --bg-input: #f1f5f9;
    --bg-modal: #ffffff;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --border-highlight: rgba(99, 102, 241, 0.5);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #0f172a;

    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08);
}

/* ================= GLOBAL RESETS ================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 0% 0%, var(--bg-mesh-1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--bg-mesh-2) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================= APP LAYOUT ================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ================= SIDEBAR (DESKTOP & DRAWER) ================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

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

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

.brand-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    text-transform: uppercase;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-close-btn:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.nav-link.active {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-link.active i {
    color: #ffffff;
}

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

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ================= MAIN CONTENT WRAPPER ================= */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s ease, width 0.3s ease;
}

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

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.menu-toggle-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ================= CONTENT BODY ================= */
.content-body {
    flex: 1;
    padding: 24px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* ================= STATS CARDS GRID ================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: var(--transition);
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

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

.stat-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 8px;
}

.stat-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ================= MODERN GLASS CARD CONTAINER ================= */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
}

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

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

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: #ffffff;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ================= FORM CONTROLS ================= */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-select {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 10px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-select option,
select option {
    background-color: #0f172a;
    color: #f8fafc;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-family: inherit;
}

[data-theme="light"] .form-select option,
[data-theme="light"] select option {
    background-color: #ffffff;
    color: #0f172a;
}

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

/* ================= MODERN PLAN SELECTOR ================= */
.plan-selector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.plan-card-option {
    position: relative;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card-solid);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 4px;
    user-select: none;
}
.plan-card-option:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.plan-card-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
}
.plan-card-option .plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.plan-card-option .plan-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.plan-card-option .plan-check {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: transparent;
    transition: var(--transition);
}
.plan-card-option.active .plan-check {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}
.plan-card-option .plan-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* ================= FEATURES CHECKLIST ================= */
.features-checklist-box {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
}
.feature-check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}
.feature-check-item:hover {
    border-color: var(--border-hover);
}
.feature-check-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
    margin-top: 2px;
}
.feature-info {
    flex: 1;
}
.feature-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.feature-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.feature-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}
.tag-pro {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.tag-basic {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.badge-plan-pro {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    font-weight: 700;
}
.badge-plan-admin {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(220, 38, 38, 0.18) 100%);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.45);
    font-weight: 800;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
.badge-plan-basic {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    font-weight: 700;
}

/* ================= STATUS BADGES ================= */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: currentColor;
}

.badge-active { background: var(--success-light); color: var(--success); }
.badge-unused { background: var(--info-light); color: var(--info); }
.badge-expired { background: var(--warning-light); color: var(--warning); }
.badge-banned { background: var(--danger-light); color: var(--danger); }
.badge-secondary { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

/* ================= DATA TABLES (DESKTOP) ================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.custom-table th {
    padding: 12px 16px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition);
}

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

/* Key Code Monospace Display */
.key-code-display {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ================= MOBILE CARD LIST (RESPONSIVE TABLE) ================= */
.mobile-cards-view {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.mobile-data-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
}

.mobile-data-card:active {
    background: var(--bg-card-hover);
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.mobile-card-label {
    color: var(--text-muted);
    font-weight: 500;
}

.mobile-card-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.mobile-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* ================= FILTER & SEARCH BAR ================= */
.toolbar-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-input-wrapper input {
    padding-left: 38px;
}

/* ================= MODALS & BOTTOM SHEETS ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

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

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 22px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
}

.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: var(--bg-modal);
}

/* ================= TOAST NOTIFICATION ================= */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

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

/* ================= BOTTOM NAVIGATION (MOBILE ONLY) ================= */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-bottom-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 80;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 0 4px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    height: 100%;
    transition: var(--transition);
}

.bottom-nav-item i {
    font-size: 1.15rem;
    transition: var(--transition);
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
}

/* ================= CHART CONTAINERS ================= */
.chart-container {
    width: 100%;
    height: 240px;
    position: relative;
}

.chart-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* ================= RESPONSIVE MEDIA QUERIES ================= */

/* Tablets & Mobile (< 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close-btn {
        display: block;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .menu-toggle-btn {
        display: flex;
    }
}

/* Mobile Devices (< 768px) */
@media (max-width: 768px) {
    .content-body {
        padding: 16px;
        padding-bottom: calc(var(--bottom-nav-height) + 20px);
    }

    .topbar {
        padding: 0 16px;
    }

    .user-name {
        display: none;
    }

    .bottom-nav {
        display: grid;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    /* Convert Desktop Table to Mobile Cards */
    .table-responsive {
        display: none;
    }

    .mobile-cards-view {
        display: flex;
    }

    .toolbar-grid {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrapper {
        max-width: 100%;
    }

    /* Modal Mobile Bottom Sheet */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
    }

    .modal-overlay.active .modal-content {
        transform: translateY(0);
    }

    .modal-body {
        padding: 16px 18px 24px;
    }

    .modal-footer {
        padding: 14px 18px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        position: sticky;
        bottom: 0;
        z-index: 10;
    }

    .toast-container {
        bottom: calc(var(--bottom-nav-height) + 12px);
        left: 16px;
        right: 16px;
    }

    .toast {
        max-width: 100%;
    }
}

/* Small Screens (< 430px) */
@media (max-width: 430px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .bulk-plan-section {
        grid-template-columns: 1fr !important;
    }
}
