/* ============================================================
   AzadTech Platform — Design System v1.0
   2026-era AI-native SaaS aesthetic
   ============================================================ */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
    /* Brand */
    --brand-50: #f0f4ff;
    --brand-100: #dbe4ff;
    --brand-200: #bac8ff;
    --brand-300: #91a7ff;
    --brand-400: #748ffc;
    --brand-500: #5c7cfa;
    --brand-600: #4c6ef5;
    --brand-700: #4263eb;
    --brand-800: #3b5bdb;
    --brand-900: #364fc7;

    /* Semantic */
    --success: #40c057;
    --warning: #fab005;
    --danger: #fa5252;
    --info: #339af0;

    /* Neutral */
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --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-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    /* 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);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(20px);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ── Dark Mode ────────────────────────────────────────────── */
[data-theme="dark"] {
    --gray-50: #18191c;
    --gray-100: #212225;
    --gray-200: #2c2d31;
    --gray-300: #3a3b3f;
    --gray-400: #4a4b50;
    --gray-500: #6b6d73;
    --gray-600: #8a8c93;
    --gray-700: #b0b2b8;
    --gray-800: #d1d3d8;
    --gray-900: #f0f1f3;

    --glass-bg: rgba(24, 25, 28, 0.72);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.3), 0 10px 10px -5px rgba(0,0,0,0.2);
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--brand-700);
}

img {
    max-width: 100%;
    display: block;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--gray-500); }
.text-brand { color: var(--brand-600); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
    overflow-y: auto;
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--gray-900);
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.875rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 0 8px;
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.sidebar-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.sidebar-link.active {
    background: var(--brand-50);
    color: var(--brand-700);
}

[data-theme="dark"] .sidebar-link.active {
    background: rgba(92, 124, 250, 0.15);
    color: var(--brand-400);
}

.sidebar-link .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active .icon {
    opacity: 1;
}

.sidebar-link .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

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

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

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

.topbar-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.page-content {
    padding: 24px;
    max-width: 1400px;
}

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

.card:hover {
    box-shadow: var(--shadow-lg);
}

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

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    background: var(--gray-50);
}

[data-theme="dark"] .card-footer {
    background: rgba(0,0,0,0.15);
}

/* Stat Cards */
.stat-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-icon.brand {
    background: var(--brand-50);
    color: var(--brand-600);
}
.stat-icon.success {
    background: rgba(64, 192, 87, 0.1);
    color: var(--success);
}
.stat-icon.warning {
    background: rgba(250, 176, 5, 0.1);
    color: var(--warning);
}
.stat-icon.danger {
    background: rgba(250, 82, 82, 0.1);
    color: var(--danger);
}

[data-theme="dark"] .stat-icon.brand { background: rgba(92, 124, 250, 0.15); }
[data-theme="dark"] .stat-icon.success { background: rgba(64, 192, 87, 0.15); }
[data-theme="dark"] .stat-icon.warning { background: rgba(250, 176, 5, 0.15); }
[data-theme="dark"] .stat-icon.danger { background: rgba(250, 82, 82, 0.15); }

/* ── Grid System ──────────────────────────────────────────── */
.grid {
    display: grid;
    gap: 20px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    color: white;
    box-shadow: 0 2px 8px rgba(66, 99, 235, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}
.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

[data-theme="dark"] .btn-ghost {
    color: var(--gray-600);
}
[data-theme="dark"] .btn-ghost:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-secondary:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-300);
}
[data-theme="dark"] .btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: linear-gradient(135deg, #37b24d, #2f9e44);
    color: white;
}
[data-theme="dark"] .btn-success {
    background: linear-gradient(135deg, #2f9e44, #2b8a3e);
}

.btn-danger {
    background: linear-gradient(135deg, #f03e3e, #e03131);
    color: white;
}
[data-theme="dark"] .btn-danger {
    background: linear-gradient(135deg, #e03131, #c92a2a);
}

.btn-warning {
    background: linear-gradient(135deg, #f59f00, #f08c00);
    color: white;
}
[data-theme="dark"] .btn-warning {
    background: linear-gradient(135deg, #f08c00, #e67700);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

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

/* ── Theme Toggle Button ──────────────────────────────────── */
.theme-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--gray-200);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

[data-theme="dark"] .theme-toggle {
    background: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

[data-theme="dark"] .theme-toggle:hover {
    background: var(--brand-600);
    color: white;
    border-color: var(--brand-600);
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--gray-900);
    background: white;
    transition: all var(--transition-fast);
    outline: none;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
}

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

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-600);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

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

/* ── Tables ───────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

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

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

[data-theme="dark"] thead th {
    background: rgba(0,0,0,0.2);
    color: var(--gray-500);
    border-color: var(--gray-300);
}

tbody td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

[data-theme="dark"] tbody td {
    border-color: var(--gray-200);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--gray-50);
}

[data-theme="dark"] tbody tr:hover {
    background: rgba(0,0,0,0.1);
}

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

.badge-active, .badge-paid {
    background: rgba(64, 192, 87, 0.12);
    color: #2b8a3e;
}
[data-theme="dark"] .badge-active, [data-theme="dark"] .badge-paid {
    background: rgba(64, 192, 87, 0.2);
    color: #69db7c;
}

.badge-pending {
    background: rgba(250, 176, 5, 0.12);
    color: #e67700;
}
[data-theme="dark"] .badge-pending {
    background: rgba(250, 176, 5, 0.2);
    color: #fcc419;
}

.badge-suspended, .badge-failed {
    background: rgba(250, 82, 82, 0.12);
    color: #c92a2a;
}
[data-theme="dark"] .badge-suspended, [data-theme="dark"] .badge-failed {
    background: rgba(250, 82, 82, 0.2);
    color: #ff8787;
}

.badge-cancelled, .badge-expired {
    background: var(--gray-200);
    color: var(--gray-600);
}

.badge-open {
    background: rgba(51, 154, 240, 0.12);
    color: #1971c2;
}
[data-theme="dark"] .badge-open {
    background: rgba(51, 154, 240, 0.2);
    color: #74c0fc;
}

.badge-in_progress {
    background: rgba(121, 80, 242, 0.12);
    color: #7048e8;
}
[data-theme="dark"] .badge-in_progress {
    background: rgba(121, 80, 242, 0.2);
    color: #b197fc;
}

.badge-resolved {
    background: rgba(64, 192, 87, 0.12);
    color: #2b8a3e;
}

.badge-closed {
    background: var(--gray-200);
    color: var(--gray-600);
}

.badge-urgent {
    background: rgba(250, 82, 82, 0.12);
    color: #c92a2a;
}

.badge-high {
    background: rgba(253, 126, 20, 0.12);
    color: #d9480f;
}

.badge-medium {
    background: rgba(250, 176, 5, 0.12);
    color: #e67700;
}

.badge-low {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* ── CSS-Only Icons (Lucide-style) ───────────────────────── */
.icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Home */
.icon-home::before {
    content: '';
    width: 16px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 2px 2px 0 0;
    border-bottom: none;
    position: relative;
}
.icon-home::after {
    content: '';
    width: 20px;
    height: 2px;
    background: currentColor;
    position: absolute;
    bottom: 4px;
}

/* Users */
.icon-users::before,
.icon-users::after {
    content: '';
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}
.icon-users::before { top: 2px; left: 2px; }
.icon-users::after { top: 2px; right: 2px; }

/* Server */
.icon-server {
    flex-direction: column;
    gap: 2px;
}
.icon-server::before,
.icon-server::after {
    content: '';
    width: 16px;
    height: 5px;
    border: 2px solid currentColor;
    border-radius: 2px;
}

/* Package/Box */
.icon-package {
    flex-direction: column;
    gap: 0;
}
.icon-package::before {
    content: '';
    width: 14px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 0 0 3px 3px;
    position: relative;
    z-index: 1;
}
.icon-package::after {
    content: '';
    width: 18px;
    height: 4px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: absolute;
    top: 2px;
}

/* Invoice */
.icon-invoice {
    flex-direction: column;
    gap: 2px;
}
.icon-invoice::before {
    content: '';
    width: 14px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: relative;
}
.icon-invoice::after {
    content: '';
    width: 8px;
    height: 2px;
    background: currentColor;
    position: absolute;
    top: 6px;
}

/* Ticket */
.icon-ticket {
    flex-direction: column;
}
.icon-ticket::before {
    content: '';
    width: 16px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: relative;
}
.icon-ticket::after {
    content: '';
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
}

/* Settings/Gear */
.icon-settings {
    width: 18px;
    height: 18px;
}
.icon-settings::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}
.icon-settings::after {
    content: '';
    width: 6px;
    height: 6px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}

/* Activity/Activity */
.icon-activity {
    flex-direction: column;
    gap: 2px;
}
.icon-activity::before {
    content: '';
    width: 16px;
    height: 2px;
    background: currentColor;
    position: absolute;
    top: 5px;
    transform: rotate(-15deg);
}
.icon-activity::after {
    content: '';
    width: 16px;
    height: 2px;
    background: currentColor;
    position: absolute;
    bottom: 5px;
    transform: rotate(15deg);
}

/* Search */
.icon-search::before {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
}
.icon-search::after {
    content: '';
    width: 6px;
    height: 2px;
    background: currentColor;
    transform: rotate(45deg);
    position: absolute;
    bottom: 3px;
    right: 2px;
}

/* Sun/Moon */
.icon-sun::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}

/* Moon */
.icon-moon::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
    box-shadow: 4px -3px 0 0 currentColor;
}

/* Plus */
.icon-plus::before {
    content: '';
    width: 12px;
    height: 2px;
    background: currentColor;
    position: absolute;
}
.icon-plus::after {
    content: '';
    width: 2px;
    height: 12px;
    background: currentColor;
    position: absolute;
}

/* Trash */
.icon-trash::before {
    content: '';
    width: 12px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 0 0 2px 2px;
    position: absolute;
    top: 6px;
}
.icon-trash::after {
    content: '';
    width: 14px;
    height: 2px;
    background: currentColor;
    position: absolute;
    top: 4px;
}

/* Edit */
.icon-edit::before {
    content: '';
    width: 10px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 2px;
    transform: rotate(-15deg);
    position: absolute;
}

/* Eye */
.icon-eye::before {
    content: '';
    width: 16px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}
.icon-eye::after {
    content: '';
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    position: absolute;
}

/* Logout */
.icon-logout::before {
    content: '';
    width: 8px;
    height: 12px;
    border: 2px solid currentColor;
    border-right: none;
    border-radius: 2px 0 0 2px;
    position: absolute;
}
.icon-logout::after {
    content: '';
    width: 8px;
    height: 2px;
    background: currentColor;
    position: absolute;
    right: 1px;
}

/* Clock */
.icon-clock::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}

/* Warning */
.icon-warning::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid currentColor;
    position: absolute;
}

/* Check */
.icon-check::before {
    content: '';
    width: 4px;
    height: 8px;
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    position: absolute;
    top: 3px;
}

/* External Link */
.icon-external::before {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: absolute;
}
.icon-external::after {
    content: '';
    width: 5px;
    height: 5px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    position: absolute;
    top: 3px;
    right: 1px;
}

/* Shield */
.icon-shield::before {
    content: '';
    width: 12px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: absolute;
}

/* Menu/Hamburger */
.icon-menu::before {
    content: '';
    width: 14px;
    height: 2px;
    background: currentColor;
    position: absolute;
    top: 6px;
    box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

/* Arrow/chevron */
.icon-chevron::before {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    position: absolute;
}

/* Globe */
.icon-globe::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: absolute;
}
.icon-globe::after {
    content: '';
    width: 14px;
    height: 2px;
    background: currentColor;
    position: absolute;
    top: 50%;
}

/* Key */
.icon-key::before {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50% 50% 0 0;
    position: absolute;
    top: 1px;
}
.icon-key::after {
    content: '';
    width: 6px;
    height: 2px;
    background: currentColor;
    position: absolute;
    bottom: 3px;
}

/* Copy */
.icon-copy::before {
    content: '';
    width: 10px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: absolute;
    top: 2px;
    left: 4px;
}
.icon-copy::after {
    content: '';
    width: 10px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: absolute;
    top: 5px;
    left: 6px;
    background: var(--gray-50);
}
[data-theme="dark"] .icon-copy::after {
    background: var(--gray-100);
}

/* ── Alerts/Flash Messages ────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: rgba(64, 192, 87, 0.1);
    color: #2b8a3e;
    border: 1px solid rgba(64, 192, 87, 0.2);
}
.alert-error {
    background: rgba(250, 82, 82, 0.1);
    color: #c92a2a;
    border: 1px solid rgba(250, 82, 82, 0.2);
}
.alert-warning {
    background: rgba(250, 176, 5, 0.1);
    color: #e67700;
    border: 1px solid rgba(250, 176, 5, 0.2);
}

[data-theme="dark"] .alert-success { color: #69db7c; }
[data-theme="dark"] .alert-error { color: #ff8787; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: var(--radius-xl);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .empty-state .empty-icon {
    background: var(--gray-200);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--gray-700);
}

.empty-state p {
    color: var(--gray-500);
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

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

.modal {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

[data-theme="dark"] .modal {
    background: var(--gray-100);
}

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

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}

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

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

.toast-success { background: #2b8a3e; color: white; }
.toast-error { background: #c92a2a; color: white; }

/* ── Expiry Highlight ─────────────────────────────────────── */
.expiry-urgent {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.renew-cta {
    background: linear-gradient(135deg, var(--warning), #f08c00);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: pulse 2s ease-in-out infinite;
}

.renew-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 176, 5, 0.4);
    animation: none;
}

/* ── Ticket Thread ────────────────────────────────────────── */
.ticket-message {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}

[data-theme="dark"] .ticket-message {
    border-color: var(--gray-200);
}

.ticket-message.staff {
    flex-direction: row-reverse;
}

.ticket-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ticket-avatar.client {
    background: var(--brand-100);
    color: var(--brand-700);
}

.ticket-avatar.staff {
    background: rgba(64, 192, 87, 0.15);
    color: var(--success);
}

.ticket-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    font-size: 0.875rem;
    line-height: 1.6;
}

[data-theme="dark"] .ticket-bubble {
    background: var(--gray-200);
}

.ticket-message.staff .ticket-bubble {
    background: var(--brand-50);
}

[data-theme="dark"] .ticket-message.staff .ticket-bubble {
    background: rgba(92, 124, 250, 0.1);
}

.ticket-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 6px;
}

/* ── Pricing Card ─────────────────────────────────────────── */
.pricing-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.pricing-card.featured {
    border-color: var(--brand-500);
}

.pricing-card.featured::before {
    content: 'POPULAR';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 4px 16px;
    border-radius: var(--radius-full);
    letter-spacing: 0.05em;
}

.pricing-card .price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 16px 0 4px;
    letter-spacing: -0.03em;
}

.pricing-card .price-period {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.pricing-card .features {
    list-style: none;
    margin: 24px 0;
    text-align: left;
}

.pricing-card .features li {
    padding: 8px 0;
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 10px;
}

.pricing-card .features li::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(64, 192, 87, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%232b8a3e' stroke-width='3'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* ── Login/Register Page ──────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(76, 110, 245, 0.08), transparent 70%);
    top: -200px;
    right: -200px;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(64, 192, 87, 0.06), transparent 70%);
    bottom: -100px;
    left: -100px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-img {
    height: 60px;
    width: auto;
    margin: 0 auto 16px;
    display: block;
}

.auth-logo .logo-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 16px rgba(66, 99, 235, 0.3);
}

.auth-logo h1 {
    font-size: 1.375rem;
    margin-bottom: 4px;
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ── Responsive ───────────────────────────────────────────── */
.mobile-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .page-content {
        padding: 16px;
    }
}

/* ── Utility Classes ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.hidden { display: none; }
.w-full { width: 100%; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

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

/* ── Permission Toggles ──────────────────────────────────── */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.permission-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

[data-theme="dark"] .permission-toggle {
    border-color: var(--gray-300);
}

.permission-toggle:hover {
    border-color: var(--brand-400);
}

.permission-toggle.active {
    background: var(--brand-50);
    border-color: var(--brand-400);
    color: var(--brand-700);
}

[data-theme="dark"] .permission-toggle.active {
    background: rgba(92, 124, 250, 0.15);
    color: var(--brand-400);
}
