/**
 * MirroVate Admin Panel - Unified Stylesheet
 * 
 * Features:
 * - CSS Variables for theming
 * - Dark/Light mode support
 * - Responsive design
 * - Modern UI components
 */

/* ============================================
   CSS VARIABLES - LIGHT THEME (DEFAULT)
   ============================================ */
:root {
    /* Primary colors - Viola/Blu gradient */
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #7c8ff0;
    --secondary: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-hover: linear-gradient(135deg, #5a67d8 0%, #6b4190 100%);

    /* Status colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Background colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;

    /* Sidebar - Light Theme */
    --bg-sidebar: #ffffff;
    --bg-sidebar-hover: #f1f5f9;
    --bg-sidebar-active: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    --sidebar-border: #e2e8f0;
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);

    /* Text colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --text-sidebar: #64748b;
    --text-sidebar-active: #667eea;
    --text-sidebar-brand: #1e293b;

    /* Border colors */
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 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);

    /* Sizing */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Transitions */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16162a;
    --bg-card: #1a1a2e;

    /* Sidebar - Dark Theme */
    --bg-sidebar: #0f0f1a;
    --bg-sidebar-hover: #1a1a2e;
    --bg-sidebar-active: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    --sidebar-border: #2d2d44;
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #a5b4fc;
    --text-sidebar-brand: #f1f5f9;

    --border: #2d2d44;
    --border-light: #1e1e2d;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   LAYOUT
   ============================================ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.content-wrapper {
    flex: 1;
    padding: 24px;
    margin-top: var(--header-height);
}

/* ============================================
   SIDEBAR
   ============================================ */
/* ============================================
   SIDEBAR - PREMIUM DESIGN
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: var(--sidebar-shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 70px;
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: var(--gradient);
    opacity: 0.02;
    pointer-events: none;
}

/* Logo Link */
.sidebar-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-logo-link img {
    height: 72px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.sidebar-logo-link:hover img {
    transform: scale(1.03);
}

/* Collapsed state */
.sidebar-collapsed .sidebar-logo-link img {
    height: 36px;
    max-width: 50px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Nav Section */
.nav-section {
    margin-bottom: 28px;
}

.nav-section-title {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 14px;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar-collapsed .nav-section-title {
    opacity: 0;
    transform: scale(0.8);
}

/* Nav Item */
.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    color: var(--text-sidebar);
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    text-decoration: none;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--gradient);
    border-radius: 0 3px 3px 0;
    transition: height 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
    transform: translateX(4px);
}

.nav-item:hover::before {
    height: 24px;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 500;
}

.nav-item.active::before {
    height: 60%;
}

.nav-item.active i {
    color: var(--primary);
}

/* Nav Item Icon */
.nav-item i {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.nav-item:hover i {
    transform: scale(1.1);
}

/* Nav Item Text */
.nav-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.sidebar-collapsed .nav-item span {
    opacity: 0;
    width: 0;
}

/* Nav Badge */
.nav-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.sidebar-collapsed .nav-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    font-size: 0.5625rem;
    min-width: 18px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
}

.sidebar-footer .nav-item {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.sidebar-footer .nav-item:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: translateX(4px);
}

.sidebar-footer .nav-item::before {
    background: var(--danger);
}

/* Sidebar Collapsed State */
.sidebar-collapsed .sidebar-header {
    padding: 20px;
    justify-content: center;
}

.sidebar-collapsed .sidebar-logo {
    width: 36px;
    height: 36px;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 14px;
}

.sidebar-collapsed .nav-item:hover {
    transform: translateX(0) scale(1.05);
}

.sidebar-collapsed .sidebar-footer .nav-item {
    justify-content: center;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar.open + .sidebar-overlay {
    display: block;
    opacity: 1;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: var(--transition);
}

.sidebar-collapsed .header {
    left: var(--sidebar-collapsed-width);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu:hover {
    background: var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    transition: all 0.2s ease;
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.header-search i {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.header-search input {
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 200px;
    outline: none;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.plan-filter-active {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid var(--primary);
    border-radius: 8px;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.plan-filter-active strong {
    color: var(--primary);
}

.clear-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    transition: all 0.15s ease;
}

.clear-filter:hover {
    transform: scale(1.1);
    color: white;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-icon.primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.kpi-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.kpi-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.kpi-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 4px;
}

.kpi-change.positive {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-change.negative {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

.btn-primary:hover {
    background: var(--gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #0ea572;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.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(--border-radius-sm);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   PREMIUM LICENSE TABLE
   ============================================ */
.licenses-container {
    padding: 8px 0;
}

.licenses-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    background: var(--bg-card);
}

.licenses-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.licenses-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.licenses-table th i {
    margin-right: 8px;
    color: var(--primary);
    opacity: 0.7;
}

/* License Row */
.license-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.license-row:hover {
    background: var(--bg-tertiary);
}

.license-row td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Customer Cell */
.license-customer {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.customer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.customer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.customer-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-email {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-hwid {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.customer-hwid i {
    font-size: 0.6875rem;
    opacity: 0.7;
}

/* Plan Cell */
.license-plan {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--primary);
    width: fit-content;
    transition: all 0.15s ease;
}

.plan-badge:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.plan-badge i {
    font-size: 0.75rem;
}

.plan-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.plan-receivers {
    font-size: 0.75rem;
    color: #ec4899;
    font-weight: 500;
}

.plan-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Status Cell */
.license-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8125rem;
    width: fit-content;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.trial {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge.expired {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-badge.canceled {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.status-badge.canceled-valid {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-badge i {
    font-size: 0.5rem;
}

.activation-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.activation-status.activated {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
}

.activation-status.pending {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

.activation-status i {
    font-size: 0.6875rem;
}

/* Platforms Cell */
.license-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.platform-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.platform-tag i {
    font-size: 0.6875rem;
    opacity: 0.7;
}

.platform-tag.ctrader { color: #f59e0b; }
.platform-tag.mt5 { color: #3b82f6; }
.platform-tag.mt4 { color: #8b5cf6; }

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--success);
}

.feature-tag.statistics {
    background: rgba(59, 130, 246, 0.08);
    color: var(--info);
}

/* Expiration Cell */
.license-expiration {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.expiration-date {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.expiration-days {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    width: fit-content;
}

.expiration-days.ok {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
}

.expiration-days.warning {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

.expiration-days.danger {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

/* Created Cell */
.license-created {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.created-date {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.created-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Payment Cell */
.license-payment {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-method-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: fit-content;
    transition: all 0.15s ease;
}

.payment-method-badge:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.payment-method-badge i {
    font-size: 1.125rem;
}

.payment-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.payment-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

[data-theme="dark"] .payment-detail {
    background: rgba(255, 255, 255, 0.1);
}

.payment-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-amount {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.payment-amount strong {
    font-weight: 700;
    color: var(--success);
}

/* Amount Cell */
.license-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.amount-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--success);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.amount-value.empty {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.875rem;
}

/* ============================================
   REVENUE KPI SECTION
   ============================================ */
.revenue-kpi-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.revenue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.revenue-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.revenue-header h3 i {
    color: var(--primary);
}

.revenue-filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.revenue-filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.revenue-filter-form select,
.revenue-filter-form input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.revenue-filter-form select:hover,
.revenue-filter-form input[type="date"]:hover {
    border-color: var(--primary);
}

.revenue-filter-form select:focus,
.revenue-filter-form input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.revenue-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.revenue-kpi-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.revenue-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.revenue-kpi-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.revenue-kpi-card .kpi-content {
    flex: 1;
    min-width: 0;
}

.revenue-kpi-card .kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.revenue-kpi-card .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.revenue-kpi-card .kpi-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.revenue-kpi-card .kpi-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.revenue-kpi-card .kpi-change.positive {
    color: var(--success);
}

.revenue-kpi-card .kpi-change.negative {
    color: var(--danger);
}

/* KPI Card Color Variants */
.revenue-kpi-card.revenue .kpi-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.revenue-kpi-card.month .kpi-icon {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.revenue-kpi-card.refunds .kpi-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.revenue-kpi-card.customers .kpi-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.revenue-kpi-card.arpu .kpi-icon {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.revenue-kpi-card.active .kpi-icon {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

/* Dark theme adjustments */
[data-theme="dark"] .revenue-kpi-section {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .revenue-kpi-card {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .revenue-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .revenue-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .revenue-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* Stripe Links */
.payment-stripe-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stripe-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #635bff 0%, #7c3aed 100%);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.stripe-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.4);
    color: white;
}

.stripe-link i {
    font-size: 1rem;
}

.stripe-link.customer {
    background: linear-gradient(135deg, #635bff 0%, #7c3aed 100%);
}

.stripe-link.subscription {
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
}

.stripe-link.payment {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stripe-link.invoice {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Actions Cell */
.license-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    text-decoration: none;
    color: inherit;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.action-btn.toggle {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.action-btn.toggle:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.action-btn.toggle.deactivate {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-btn.toggle.deactivate:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.action-btn.extend {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.action-btn.extend:hover {
    background: var(--info);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-btn.edit {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.action-btn.edit:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.action-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-btn.delete:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Expand Icon */
.expand-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.license-row.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Expanded Details Row - Compact Layout */
.license-details-row {
    display: none;
}

.license-details-row.show {
    display: table-row;
}

.license-details-row td {
    padding: 0 !important;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.license-details-compact {
    padding: 20px 32px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 24px;
    align-items: start;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-column {
    min-width: 0;
}

.detail-column-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-column-title i {
    color: var(--primary);
    font-size: 0.8125rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.8125rem;
    gap: 12px;
}

.detail-row:not(:last-child) {
    border-bottom: 1px dashed var(--border);
}

.detail-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

.detail-value.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
}

.feature-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    margin-right: 4px;
}

.feature-badge.copy {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.feature-badge.stats {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* Detail Actions Compact */
.detail-actions-compact {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid var(--border);
    min-width: 140px;
}

.detail-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.detail-action-btn i {
    font-size: 0.875rem;
}

.detail-action-btn.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.detail-action-btn.success:hover {
    background: #10b981;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.detail-action-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.detail-action-btn.danger:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.detail-action-btn.primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.detail-action-btn.primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.detail-action-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.detail-action-btn.secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Responsive Details */
@media (max-width: 1200px) {
    .license-details-compact {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .detail-actions-compact {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 16px;
    }
}

@media (max-width: 768px) {
    .license-details-compact {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .detail-actions-compact {
        justify-content: center;
    }
}

/* ============================================
   LICENSE STATS BAR
   ============================================ */
.license-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    color: inherit;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.stat-card.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    box-shadow: 0 0 0 1px var(--primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.total {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: var(--primary);
}

.stat-icon.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.expiring {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   FILTER BAR PREMIUM
   ============================================ */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
}

.filter-pill:hover {
    background: var(--border);
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.filter-pill i {
    font-size: 0.8125rem;
}

.filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.filter-pill:not(.active) .filter-count {
    background: var(--bg-secondary);
}

.plan-filter-active {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.plan-filter-active strong {
    color: var(--primary);
}

.plan-filter-active .clear-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    color: var(--danger);
    text-decoration: none;
    transition: all 0.15s ease;
}

.plan-filter-active .clear-filter:hover {
    background: var(--danger);
    color: white;
}

.filter-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.filter-search input {
    width: 240px;
    padding: 10px 16px 10px 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.filter-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-search input::placeholder {
    color: var(--text-muted);
}

.filter-search i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
}

/* Plan Stat Cards - Clickable */
.stat-card.plan-stat {
    cursor: pointer;
    transition: all 0.2s ease;
}

.stat-card.plan-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ============================================
   LICENSE PLANS SECTION
   ============================================ */
.license-plans-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.plans-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, transparent 100%);
}

.plans-header h4 {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plans-header h4 i {
    color: var(--primary);
    opacity: 0.5;
}

.license-plans-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--border);
}

.plan-card {
    background: var(--bg-card);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.plan-card:hover {
    background: var(--bg-tertiary);
}

.plan-card.active {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.plan-card.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
}

.plan-card.empty {
    opacity: 0.6;
}

.plan-card.empty .plan-count {
    opacity: 0.5;
}

.plan-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.plan-card:hover .plan-icon {
    transform: scale(1.1);
}

.plan-info {
    margin-bottom: 12px;
}

.plan-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.plan-desc {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.plan-count {
    font-size: 1.75rem;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 12px;
    line-height: 1;
}

/* Responsive Plans Grid */
@media (max-width: 1200px) {
    .license-plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .license-plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .plan-card {
        padding: 16px 12px;
    }

    .plan-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .plan-count {
        font-size: 1.5rem;
        padding: 6px 16px;
    }
}

@media (max-width: 480px) {
    .license-plans-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.pagination-btn:hover:not(.disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.pagination-btn.disabled {
    color: var(--text-muted);
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 8px;
}

.pagination-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.pagination-num:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-num.active {
    background: var(--gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-muted);
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        text-align: center;
    }

    .pagination-info {
        order: 2;
    }

    .pagination-controls {
        order: 1;
    }

    .pagination-numbers {
        order: -1;
        width: 100%;
        justify-content: center;
        margin: 0 0 12px 0;
    }
}

/* ============================================
   LEGACY TABLE SUPPORT (for other pages)
   ============================================ */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

.table td {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* ============================================
   RESPONSIVE LICENSE TABLE
   ============================================ */
@media (max-width: 1200px) {
    .license-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .license-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-pills {
        justify-content: center;
    }

    .filter-search {
        margin-left: 0;
        width: 100%;
    }

    .filter-search input {
        width: 100%;
    }

    .license-details {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .detail-actions {
        flex-direction: column;
    }

    .licenses-table th,
    .licenses-table td {
        padding: 12px;
    }

    .customer-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .license-actions {
        flex-direction: column;
    }
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.badge-primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.login-page::before {
    width: 600px;
    height: 600px;
    background: #667eea;
    top: -200px;
    left: -200px;
}

.login-page::after {
    width: 500px;
    height: 500px;
    background: #764ba2;
    bottom: -150px;
    right: -150px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 60px;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 12px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ============================================
   RESPONSIVE
   ============================================ */

/* Desktop - Sidebar ALWAYS visible and expanded */
@media (min-width: 1025px) {
    /* Force sidebar expanded */
    .sidebar {
        transform: translateX(0) !important;
        width: var(--sidebar-width) !important;
    }

    /* Remove any collapsed state on desktop */
    .admin-wrapper.sidebar-collapsed .sidebar {
        width: var(--sidebar-width) !important;
    }

    .admin-wrapper .main-content {
        margin-left: var(--sidebar-width) !important;
    }

    .admin-wrapper .header {
        left: var(--sidebar-width) !important;
    }

    /* Restore logo size */
    .admin-wrapper.sidebar-collapsed .sidebar-logo-link img {
        width: auto !important;
        height: 36px !important;
    }

    /* Restore nav text */
    .admin-wrapper.sidebar-collapsed .nav-item span {
        display: block !important;
        opacity: 1 !important;
    }

    .admin-wrapper.sidebar-collapsed .nav-section-title {
        display: block !important;
        opacity: 1 !important;
        padding-left: 20px !important;
    }

    /* Restore sidebar header padding */
    .admin-wrapper.sidebar-collapsed .sidebar-header {
        padding: 20px !important;
    }

    /* Restore nav items */
    .admin-wrapper.sidebar-collapsed .nav-item {
        padding: 12px 20px !important;
        justify-content: flex-start !important;
    }

    .admin-wrapper.sidebar-collapsed .nav-item i {
        margin-right: 12px !important;
    }

    /* Hide hamburger on desktop */
    .mobile-menu-toggle {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        left: 0;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 16px;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .user-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .page-title {
        font-size: 1rem;
    }
}

/* ============================================
   DATATABLES STYLING
   ============================================ */

/* DataTables Wrapper - Layout generale */
.dataTables_wrapper {
    margin-top: 20px;
    font-family: inherit;
}

.dataTables_wrapper .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

/* DataTables Header Controls */
.dataTables_length {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.dataTables_length select {
    padding: 6px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    cursor: pointer;
}

.dataTables_length select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* DataTables Search */
.dataTables_filter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.dataTables_filter input {
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    min-width: 200px;
}

.dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dataTables_filter input::placeholder {
    color: var(--text-muted);
}

/* DataTables Info */
.dataTables_info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 16px;
    padding: 8px 0;
}

/* DataTables Pagination */
.dataTables_paginate {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    transition: var(--transition-fast);
    cursor: pointer;
    user-select: none;
}

.dataTables_paginate .paginate_button:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.dataTables_paginate .paginate_button.current {
    background: var(--gradient);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.dataTables_paginate .paginate_button.current:hover {
    background: var(--gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.dataTables_paginate .paginate_button.disabled {
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.dataTables_paginate .paginate_button.disabled:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-muted);
    transform: none;
}

/* Stili specifici per Previous/Next */
.dataTables_paginate .paginate_button.previous,
.dataTables_paginate .paginate_button.next {
    font-weight: 500;
    padding: 6px 16px;
}

.dataTables_paginate .paginate_button.previous:before {
    content: "‹";
    margin-right: 4px;
    font-size: 1rem;
}

.dataTables_paginate .paginate_button.next:after {
    content: "›";
    margin-left: 4px;
    font-size: 1rem;
}

/* DataTables Processing Indicator */
.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 16px 24px;
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    z-index: 1000;
}

/* DataTables Empty State */
.dataTables_empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive DataTables */
@media (max-width: 768px) {
    .dataTables_wrapper .row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .dataTables_filter {
        margin-left: 0;
        order: -1;
    }
    
    .dataTables_filter input {
        min-width: 100%;
    }
    
    .dataTables_paginate {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .dataTables_paginate .paginate_button {
        min-width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }
    
    .dataTables_info {
        text-align: center;
        margin-top: 12px;
    }
}

/* Integrazione con il tema card esistente */
.card .dataTables_wrapper {
    margin-top: 0;
}

.card .dataTables_wrapper .table {
    margin-bottom: 0;
}

/* Fix per tabelle dentro card */
.card-body .dataTables_wrapper {
    margin: -24px;
    padding: 24px;
}

.card-body .dataTables_wrapper .table-wrapper {
    margin: 0 -24px;
}

/* ============================================
   USERS PAGE PREMIUM STYLES
   ============================================ */

/* User Stats Cards */
.user-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.user-stats .stat-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.user-stats .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.user-stats .stat-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.user-stats .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.user-stats .stat-icon.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-stats .stat-icon.verified {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.user-stats .stat-icon.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.user-stats .stat-icon.banned {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.user-stats .stat-content {
    flex: 1;
}

.user-stats .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-stats .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.user-stats .stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.user-stats .stat-change.positive {
    color: var(--success);
}

.user-stats .stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Quick Stats Row */
.user-quick-stats {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.quick-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-stat i {
    color: var(--primary);
    font-size: 0.875rem;
}

.quick-stat .quick-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.quick-stat .quick-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.quick-stat.countries {
    gap: 0.5rem;
}

.country-badge {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.filter-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Header Search */
.header-search {
    display: flex;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper > i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-input-wrapper input {
    padding: 0.5rem 2rem 0.5rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 220px;
    transition: all 0.2s ease;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-secondary);
    width: 280px;
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    position: absolute;
    right: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.search-clear:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Users Table */
.users-table-wrapper {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.users-table thead th i {
    margin-right: 0.5rem;
    opacity: 0.6;
}

.users-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.users-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.users-table tbody tr.expanded {
    background: var(--bg-tertiary);
}

.users-table td {
    padding: 1rem;
    vertical-align: middle;
}

/* Expand Icon */
.users-table .expand-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.users-table tr.expanded .expand-icon {
    transform: rotate(180deg);
}

/* User Cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-cell .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-cell .user-info {
    min-width: 0;
}

.user-cell .user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.user-cell .user-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* Email Cell */
.user-email-cell .email-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Status Cell */
.user-status-cell {
    display: flex;
}

.user-status-cell .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.verified {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.unverified {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-badge.banned {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Subscription Cell */
.user-subscription-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.subscription-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid;
    width: fit-content;
}

.subscription-badge.none {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.2);
}

.subscription-expires {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Subscription Cell Improved */
.sub-cell {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.sub-plan {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    width: fit-content;
}

.sub-plan i {
    font-size: 0.75rem;
}

.sub-plan-starter {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sub-plan-professional {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.15) 100%);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.sub-plan-enterprise {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(126, 34, 206, 0.15) 100%);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.sub-plan-default {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.sub-info {
    display: flex;
    align-items: center;
}

.sub-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sub-status {
    font-size: 0.6875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.sub-status.expiring {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.sub-status.expired {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.sub-status.lifetime {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.sub-status.canceled-valid {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.no-sub {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Subscription Badge for Details */
.sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sub-badge-starter {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.sub-badge-professional {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.sub-badge-enterprise {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

/* Date Cell */
.user-date-cell .date-value {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.user-date-cell .date-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Action Buttons */
.user-actions {
    display: flex;
    gap: 0.375rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.ban:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.action-btn.unban:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.action-btn.verify:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.action-btn.edit:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* License button - Green theme */
.action-btn.license {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.action-btn.license:hover {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* User Details Row */
.user-details-row {
    display: none;
}

.user-details-row.show {
    display: table-row;
}

.user-details-row td {
    padding: 0 !important;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.user-details-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
}

.detail-column {
    min-width: 0;
}

.detail-column-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-column-title i {
    color: var(--primary);
    font-size: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.375rem 0;
    gap: 0.5rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-value {
    font-size: 0.8125rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
}

.detail-value.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

.detail-value.mono.small {
    font-size: 0.6875rem;
    opacity: 0.8;
}

.detail-value.text-muted {
    color: var(--text-muted);
    font-style: italic;
}

.detail-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* Badge Mini */
.badge-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
}

.badge-mini.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-mini.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-mini.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Country Flag */
.country-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Plan Badge */
.plan-badge {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Banned Info */
.detail-row.banned-info {
    background: rgba(239, 68, 68, 0.05);
    margin: 0 -0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
}

.detail-row.banned-info .detail-label,
.detail-row.banned-info .detail-value {
    color: #ef4444;
}

/* Edit User Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-section-title i {
    color: var(--primary);
    font-size: 0.8125rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-grid .form-group:last-child:nth-child(odd) {
    grid-column: span 2;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 1400px) {
    .user-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1100px) {
    .user-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .user-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-quick-stats {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-buttons {
        order: 1;
        width: 100%;
        justify-content: center;
    }

    .user-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .user-stats {
        grid-template-columns: 1fr;
    }
}

/* Dark theme */
[data-theme="dark"] .user-stats .stat-card,
[data-theme="dark"] .user-quick-stats {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .user-details-row td {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   USER EDIT MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex;
}

.modal-container {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h3 i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* ============================================
   USER LOGS PANEL
   ============================================ */
.logs-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.logs-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logs-header h3 i {
    color: var(--primary);
}

.logs-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.logs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.logs-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.logs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.log-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.log-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.log-content {
    flex: 1;
    min-width: 0;
}

.log-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.log-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.log-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.log-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================
   USER TABLE NEW COLUMNS
   ============================================ */
.contact-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.contact-item i {
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 14px;
}

.location-cell {
    display: flex;
    flex-direction: column;
}

.location-main {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.location-prov {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-cell {
    display: flex;
}

.activity-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.activity-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.activity-row i {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.activity-row.last {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-email-small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Action Buttons */
.action-btn.edit:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.action-btn.logs {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
}

.action-btn.logs:hover {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-container {
        max-width: 100%;
        margin: 0.5rem;
        max-height: 95vh;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .logs-panel {
        width: 100%;
    }
}

/* Dark theme for modal */
[data-theme="dark"] .modal-container {
    background: var(--bg-secondary);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .logs-panel {
    background: var(--bg-secondary);
}

[data-theme="dark"] .logs-header {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .log-item {
    background: rgba(255, 255, 255, 0.03);
}

/* ============================================
   SUPPORT PAGE STYLES
   ============================================ */

/* Support Stats Cards */
.support-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.support-stats .stat-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.support-stats .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.support-stats .stat-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.support-stats .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.support-stats .stat-icon.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.support-stats .stat-icon.open {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.support-stats .stat-icon.progress {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.support-stats .stat-icon.resolved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.support-stats .stat-content {
    flex: 1;
}

.support-stats .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.support-stats .stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.support-stats .stat-alert {
    font-size: 0.6875rem;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Tickets Table */
.tickets-container {
    overflow-x: auto;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
}

.tickets-table thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.tickets-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    cursor: pointer;
}

.tickets-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.tickets-table tbody tr.has-unread {
    background: rgba(239, 68, 68, 0.03);
}

.tickets-table tbody tr.has-unread:hover {
    background: rgba(239, 68, 68, 0.06);
}

.tickets-table td {
    padding: 1rem;
    vertical-align: middle;
}

.tickets-table .expand-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Ticket Cell */
.ticket-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ticket-subject {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.ticket-subject a {
    color: inherit;
    text-decoration: none;
}

.ticket-subject a:hover {
    color: var(--primary);
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ticket-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* Customer Cell */
.customer-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.customer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge i {
    font-size: 0.625rem;
}

.status-badge.open {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge.active {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge.resolved {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.closed {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* Date Cell */
.date-cell {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.date-main {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.date-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Ticket Actions */
.ticket-actions {
    display: flex;
    gap: 0.375rem;
}

.ticket-actions .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
}

.ticket-actions .action-btn:hover {
    transform: scale(1.1);
}

.ticket-actions .action-btn.view:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.ticket-actions .action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem !important;
    color: var(--text-muted);
}

.empty-state i {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state span {
    font-size: 0.9375rem;
}

/* Dark theme adjustments */
[data-theme="dark"] .support-stats .stat-card {
    background: var(--bg-secondary);
}

[data-theme="dark"] .tickets-table tbody tr.has-unread {
    background: rgba(239, 68, 68, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .support-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tickets-table {
        font-size: 0.875rem;
    }

    .tickets-table td {
        padding: 0.75rem;
    }
}

/* ============================================
   MOBILE MENU TOGGLE (HAMBURGER)
   ============================================ */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: var(--primary);
}

.mobile-menu-toggle:hover .hamburger-line {
    background: white;
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.25s ease;
}

/* Hamburger animation when sidebar open */
.sidebar.open ~ .main-content .mobile-menu-toggle .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.sidebar.open ~ .main-content .mobile-menu-toggle .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.sidebar.open ~ .main-content .mobile-menu-toggle .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   ENHANCED RESPONSIVE - LICENSE PAGE
   ============================================ */

/* Tablet Landscape (1024px - 1200px) */
@media (max-width: 1200px) {
    .revenue-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .license-stats {
        gap: 16px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .card-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .header-search {
        flex: 1;
        min-width: 200px;
    }

    .header-search input {
        width: 100%;
    }
}

/* Tablet Portrait (768px - 1024px) */
@media (max-width: 1024px) {
    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Sidebar mobile behavior */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        left: 0;
        padding: 0 16px;
    }

    .header-left {
        gap: 12px;
    }

    /* Revenue KPI */
    .revenue-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .revenue-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .revenue-filter-form {
        width: 100%;
    }

    /* Plan cards */
    .license-plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* License details */
    .license-details-compact {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Large (480px - 768px) */
@media (max-width: 768px) {
    /* Content */
    .content-wrapper {
        padding: 12px;
    }

    /* Header adjustments */
    .header {
        height: 60px;
    }

    .page-title {
        font-size: 1rem;
    }

    .user-info {
        display: none;
    }

    .user-menu {
        padding: 8px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    /* Stats cards - 2 columns */
    .license-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Revenue KPI - 2 columns */
    .revenue-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .revenue-kpi-card {
        padding: 12px;
    }

    .revenue-kpi-card .kpi-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .revenue-kpi-card .kpi-value {
        font-size: 1.125rem;
    }

    .revenue-kpi-card .kpi-label {
        font-size: 0.7rem;
    }

    .revenue-kpi-card .kpi-sub {
        font-size: 0.65rem;
    }

    /* Plan cards - 2 columns */
    .license-plans-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .plan-card {
        padding: 10px;
    }

    .plan-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .plan-name {
        font-size: 0.8125rem;
    }

    .plan-desc {
        display: none;
    }

    /* Card header */
    .card-header {
        padding: 12px 16px;
    }

    .card-title {
        font-size: 0.9375rem;
    }

    .card-header-actions {
        gap: 8px;
    }

    .header-search {
        order: -1;
        width: 100%;
        margin-bottom: 8px;
    }

    .header-search input {
        width: 100%;
    }

    .btn-secondary {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }

    /* License Table - Card View */
    .licenses-table-wrapper {
        overflow-x: visible;
    }

    .licenses-table thead {
        display: none;
    }

    .licenses-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .license-row {
        display: none; /* Hide main row, show mobile card */
    }

    /* Mobile License Card */
    .license-row.mobile-card {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--border-radius);
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

    .license-row.mobile-card td {
        display: block;
        padding: 0;
        border: none;
    }

    /* Details row mobile */
    .license-details-compact {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .detail-column {
        padding: 12px;
        border-bottom: 1px solid var(--border);
    }

    .detail-column:last-child {
        border-bottom: none;
    }

    /* Actions mobile */
    .license-actions {
        gap: 6px;
    }

    .action-btn {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    /* Payment links mobile */
    .payment-stripe-links {
        flex-wrap: wrap;
        gap: 4px;
    }

    .stripe-link {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .stripe-link span {
        display: none;
    }

    .stripe-link i {
        margin: 0;
    }

    /* Pagination mobile */
    .pagination-container {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .pagination-info {
        text-align: center;
        font-size: 0.8125rem;
    }

    .pagination-controls {
        justify-content: center;
    }

    .pagination-numbers {
        gap: 4px;
    }

    .pagination-num {
        min-width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }

    .pagination-btn {
        width: 32px;
        height: 32px;
    }

    /* KPI Grid single column fallback */
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }
}

/* Mobile Small (< 480px) */
@media (max-width: 480px) {
    /* Content */
    .content-wrapper {
        padding: 8px;
    }

    /* Header */
    .header {
        height: 56px;
        padding: 0 12px;
    }

    .page-title {
        font-size: 0.9375rem;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }

    .hamburger-line {
        width: 18px;
    }

    /* Stats - 2 columns always on mobile */
    .license-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px 8px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
    }

    .stat-card .stat-icon {
        margin-right: 0;
    }

    .stat-content {
        align-items: center;
    }

    /* Revenue KPI - single column */
    .revenue-kpi-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .revenue-kpi-card {
        padding: 12px;
        flex-direction: row;
    }

    .revenue-header h3 {
        font-size: 0.9375rem;
    }

    .revenue-filter-form {
        flex-wrap: wrap;
    }

    .revenue-filter-form select {
        width: 100%;
    }

    .revenue-filter-form input[type="date"] {
        width: calc(50% - 4px);
    }

    /* Plan cards - single column */
    .license-plans-grid {
        grid-template-columns: 1fr;
    }

    .plan-card {
        padding: 12px;
    }

    .plan-icon {
        width: 40px;
        height: 40px;
    }

    /* Card header */
    .card-header {
        padding: 10px 12px;
    }

    .card-title {
        font-size: 0.875rem;
        flex-wrap: wrap;
    }

    .card-title span {
        width: 100%;
        font-size: 0.75rem;
    }

    /* Plan filter badge */
    .plan-filter-active {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Buttons */
    .btn {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Alert */
    .alert {
        padding: 12px 14px;
        font-size: 0.875rem;
    }

    /* License details mobile */
    .license-details-compact {
        padding: 0;
    }

    .detail-column-title {
        font-size: 0.8125rem;
    }

    .detail-row {
        padding: 8px 0;
    }

    .detail-label {
        font-size: 0.75rem;
    }

    .detail-value {
        font-size: 0.8125rem;
    }

    /* Feature badges */
    .feature-badge {
        font-size: 0.625rem;
        padding: 2px 6px;
    }

    /* Pagination simplified */
    .pagination-numbers {
        gap: 2px;
    }

    .pagination-num {
        min-width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .pagination-btn {
        width: 28px;
        height: 28px;
    }

    /* Hide ellipsis on very small screens */
    .pagination-ellipsis {
        padding: 0 4px;
    }

    /* User dropdown mobile */
    .user-dropdown {
        right: 12px;
        min-width: 160px;
    }

    .dropdown-item {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
}

/* ============================================
   MOBILE LICENSE CARD VIEW
   ============================================ */
@media (max-width: 768px) {
    /* Transform table into card layout */
    .licenses-table tbody tr:not(.license-details-row) {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--border-radius);
        margin-bottom: 12px;
        overflow: hidden;
    }

    .licenses-table tbody tr:not(.license-details-row) td {
        display: block;
        padding: 12px;
        border-bottom: 1px solid var(--border-light);
    }

    .licenses-table tbody tr:not(.license-details-row) td:last-child {
        border-bottom: none;
    }

    /* Hide expand icon column on mobile */
    .licenses-table tbody tr:not(.license-details-row) td:first-child {
        display: none;
    }

    /* Mobile card header with customer */
    .license-customer {
        align-items: center;
    }

    .customer-avatar {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .customer-name {
        font-size: 1rem;
        font-weight: 600;
    }

    .customer-email {
        font-size: 0.8125rem;
    }

    /* Mobile card info grid */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(2) {
        background: var(--bg-tertiary);
    }

    /* Mobile layout for status and plan */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(3),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(4) {
        display: inline-block;
        width: calc(50% - 12px);
        vertical-align: top;
        padding: 10px 12px;
    }

    .licenses-table tbody tr:not(.license-details-row) td:nth-child(3) {
        border-right: 1px solid var(--border-light);
    }

    /* Payment, amount, expiration in a row */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(5),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(6),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(7) {
        display: inline-block;
        width: calc(33.33% - 8px);
        padding: 10px 8px;
        font-size: 0.8125rem;
    }

    /* Actions - full width */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(9) {
        background: var(--bg-tertiary);
        padding: 10px 12px;
    }

    .license-actions {
        justify-content: flex-start;
        gap: 8px;
    }

    .license-actions form {
        display: inline;
    }

    /* Expand icon mobile */
    .expand-icon {
        width: 32px;
        height: 32px;
    }

    /* Details row mobile */
    .license-details-row td {
        padding: 0 !important;
    }

    .license-details-row.show td {
        border-top: 2px solid var(--primary);
    }

    /* Payment badges mobile */
    .payment-method-badge {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .payment-name {
        font-size: 0.7rem;
    }

    /* Plan badge mobile */
    .plan-badge {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .plan-duration {
        font-size: 0.7rem;
    }

    /* Status badge mobile */
    .status-badge {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .activation-status {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    /* Amount mobile */
    .amount-value {
        font-size: 0.9375rem;
    }

    /* Expiration mobile */
    .expiration-date {
        font-size: 0.875rem;
    }

    .expiration-days {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Created date mobile */
    .created-date {
        font-size: 0.8125rem;
    }

    .created-time {
        font-size: 0.7rem;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION FIXES
   ============================================ */
@media (max-width: 896px) and (orientation: landscape) {
    .header {
        height: 50px;
    }

    .content-wrapper {
        padding-top: 8px;
    }

    .mobile-menu-toggle {
        width: 36px;
        height: 36px;
    }

    .hamburger-line {
        width: 16px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-item {
        min-height: 48px;
    }

    .btn {
        min-height: 44px;
    }

    .action-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .stat-card {
        min-height: 80px;
    }

    /* Remove hover effects on touch */
    .license-row:hover {
        background: transparent;
    }

    .nav-item:hover {
        transform: none;
    }

    .kpi-card:hover {
        transform: none;
    }
}

/* ============================================
   DARK THEME MOBILE ADJUSTMENTS
   ============================================ */
[data-theme="dark"] .mobile-menu-toggle {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .mobile-menu-toggle:hover {
    background: var(--primary);
}

[data-theme="dark"] .licenses-table tbody tr:not(.license-details-row) td:nth-child(2) {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .licenses-table tbody tr:not(.license-details-row) td:nth-child(9) {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .license-details-row.show td {
    border-top-color: var(--primary);
}

/* ============================================
   MOBILE DATA LABELS (CSS-only)
   ============================================ */
@media (max-width: 768px) {
    /* Add labels to mobile card cells */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(3)::before {
        content: 'Piano';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .licenses-table tbody tr:not(.license-details-row) td:nth-child(4)::before {
        content: 'Stato';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .licenses-table tbody tr:not(.license-details-row) td:nth-child(5)::before {
        content: 'Pagamento';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .licenses-table tbody tr:not(.license-details-row) td:nth-child(6)::before {
        content: 'Importo';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .licenses-table tbody tr:not(.license-details-row) td:nth-child(7)::before {
        content: 'Scadenza';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .licenses-table tbody tr:not(.license-details-row) td:nth-child(8)::before {
        content: 'Creazione';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    /* Actions label */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(9)::before {
        content: 'Azioni';
        display: block;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 6px;
    }
}

/* ============================================
   COLLAPSIBLE KPI SECTIONS (Mobile Only)
   ============================================ */

/* Desktop: Show normally, no collapsible behavior */
@media (min-width: 1025px) {
    .kpi-collapsible-section {
        margin-bottom: 24px;
    }

    .kpi-section-header {
        display: none; /* Hide header on desktop */
    }

    .kpi-section-content {
        display: block !important; /* Always visible on desktop */
    }

    /* Keep original styles for revenue section on desktop */
    .kpi-collapsible-section[data-section="revenue"] {
        background: var(--bg-card);
        border-radius: var(--border-radius);
        border: 1px solid var(--border);
        padding: 20px 24px;
    }

    .kpi-collapsible-section[data-section="revenue"] .revenue-filters {
        margin-bottom: 16px;
    }
}

/* Mobile: Collapsible sections */
@media (max-width: 1024px) {
    .kpi-collapsible-section {
        background: var(--bg-card);
        border-radius: var(--border-radius);
        border: 1px solid var(--border);
        margin-bottom: 12px;
        overflow: hidden;
    }

    /* Section Header - Clickable */
    .kpi-section-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        background: var(--bg-tertiary);
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.2s ease;
        pointer-events: auto;
    }

    .kpi-section-header:hover {
        background: var(--border);
    }

    .kpi-section-header:active {
        background: var(--primary);
        color: white;
    }

    .kpi-section-header:active .kpi-section-title i,
    .kpi-section-header:active .kpi-section-count,
    .kpi-section-header:active .kpi-section-toggle i {
        color: white;
    }

    .kpi-section-title {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 600;
        font-size: 0.9375rem;
        color: var(--text-primary);
    }

    .kpi-section-title i {
        color: var(--primary);
        font-size: 1rem;
    }

    .kpi-section-count {
        font-weight: 400;
        font-size: 0.75rem;
        color: var(--text-muted);
        background: var(--bg-card);
        padding: 2px 8px;
        border-radius: 10px;
    }

    /* Toggle Icon */
    .kpi-section-toggle {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-card);
        border-radius: 50%;
        transition: all 0.3s ease;
    }

    .kpi-section-toggle i {
        color: var(--text-secondary);
        font-size: 0.75rem;
        transition: transform 0.3s ease;
    }

    /* Open state - rotate icon */
    .kpi-collapsible-section.open .kpi-section-toggle i {
        transform: rotate(180deg);
    }

    /* Section Content */
    .kpi-section-content {
        display: none;
        padding: 16px;
    }

    .kpi-collapsible-section.open .kpi-section-content {
        display: block;
    }

    /* Revenue section specific */
    .kpi-collapsible-section[data-section="revenue"] .revenue-filters {
        margin-bottom: 12px;
    }
}

/* Mobile specific adjustments for collapsed sections */
@media (max-width: 768px) {
    .kpi-section-header {
        padding: 12px 14px;
    }

    .kpi-section-title {
        font-size: 0.875rem;
    }

    .kpi-section-title i {
        font-size: 0.9375rem;
    }

    .kpi-section-count {
        font-size: 0.6875rem;
        padding: 2px 6px;
    }

    .kpi-section-toggle {
        width: 24px;
        height: 24px;
    }

    .kpi-section-toggle i {
        font-size: 0.625rem;
    }

    .kpi-collapsible-section.open .kpi-section-content {
        padding: 12px 14px;
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .kpi-section-header {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .kpi-section-header:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .kpi-section-count {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .kpi-section-toggle {
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   LICENSE DETAIL MODAL (Mobile)
   ============================================ */
.license-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.license-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.license-modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.license-modal-overlay.show .license-modal {
    transform: translateY(0);
}

.license-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.license-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.license-modal-header h3 i {
    color: var(--primary);
}

.license-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.license-modal-close:hover {
    background: var(--danger);
    color: white;
}

.license-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    -webkit-overflow-scrolling: touch;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section-title i {
    font-size: 0.875rem;
}

.modal-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.modal-row:last-child {
    border-bottom: none;
}

.modal-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.modal-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

.modal-value.mono {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.75rem;
}

.modal-value.mono.small {
    font-size: 0.6875rem;
}

/* Modal badges */
.plan-badge-modal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-badge-modal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-badge-modal i {
    font-size: 0.5rem;
}

.status-badge-modal.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge-modal.trial {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge-modal.expired,
.status-badge-modal.canceled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge-modal.canceled-valid {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

/* Modal footer */
.license-modal-footer {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.license-modal-footer .btn {
    flex: 1;
    min-width: 100px;
}

/* ============================================
   MOBILE LICENSE ROW LAYOUT
   ============================================ */
@media (max-width: 768px) {
    /* Hide the expandable details row on mobile */
    .license-details-row {
        display: none !important;
    }

    /* Table as vertical list */
    .licenses-table thead {
        display: none;
    }

    .licenses-table tbody {
        display: block;
    }

    .licenses-table tbody tr:not(.license-details-row) {
        display: flex;
        align-items: center;
        padding: 14px 16px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--border-radius);
        margin-bottom: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .licenses-table tbody tr:not(.license-details-row):active {
        background: var(--bg-tertiary);
        border-color: var(--primary);
    }

    /* Reset all td styling */
    .licenses-table tbody tr:not(.license-details-row) td {
        padding: 0;
        border: none;
        background: transparent;
    }

    /* Hide all columns except customer */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(1),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(3),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(4),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(5),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(6),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(7),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(8),
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(9) {
        display: none !important;
    }

    /* Customer column - full width */
    .licenses-table tbody tr:not(.license-details-row) td:nth-child(2) {
        flex: 1;
        display: flex;
    }

    .license-customer {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .customer-avatar {
        width: 42px;
        height: 42px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .customer-info {
        min-width: 0;
        flex: 1;
    }

    .customer-name {
        font-size: 0.9375rem;
        font-weight: 600;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.4;
    }

    .customer-email {
        font-size: 0.8125rem;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.4;
    }

    .customer-hwid {
        display: none;
    }

    /* Arrow indicator */
    .licenses-table tbody tr:not(.license-details-row)::after {
        content: '\f105';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        color: var(--text-muted);
        font-size: 0.875rem;
        flex-shrink: 0;
        margin-left: 8px;
    }
}

/* Desktop - show table normally */
@media (min-width: 769px) {
    .license-modal-overlay {
        display: none !important;
    }
}

/* Dark theme modal */
[data-theme="dark"] .license-modal-overlay {
    background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .license-modal {
    background: var(--bg-card);
}

[data-theme="dark"] .license-modal-header {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .license-modal-footer {
    background: rgba(255, 255, 255, 0.03);
}

/* Modal feature badges */
.modal-value .feature-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 4px;
}

.modal-value .feature-badge.copy {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.modal-value .feature-badge.stats {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.modal-value .text-muted {
    color: var(--text-muted);
}

/* Modal footer layout */
.modal-footer-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.modal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-footer-actions .btn {
    flex-shrink: 0;
}

/* Modal button colors */
.license-modal-footer .btn {
    border: none;
}

/* Cliente - Stripe purple */
.modal-footer-actions .btn[href*="customers"] {
    background: #635bff;
    color: white;
}

.modal-footer-actions .btn[href*="customers"]:hover {
    background: #5851ea;
}

/* Fatture - Blue */
.modal-footer-actions .btn[href*="invoices"] {
    background: #3b82f6;
    color: white;
}

.modal-footer-actions .btn[href*="invoices"]:hover {
    background: #2563eb;
}

/* Sub - Green */
.modal-footer-actions .btn[href*="subscriptions"] {
    background: #10b981;
    color: white;
}

.modal-footer-actions .btn[href*="subscriptions"]:hover {
    background: #059669;
}

/* Payment - Orange */
.modal-footer-actions .btn[href*="payments"] {
    background: #f59e0b;
    color: white;
}

.modal-footer-actions .btn[href*="payments"]:hover {
    background: #d97706;
}

/* ============================================
   MOBILE USER ROW LAYOUT
   ============================================ */
@media (max-width: 768px) {
    /* Hide the expandable details row on mobile */
    .user-details-row {
        display: none !important;
    }

    /* Table as vertical list */
    .users-table thead {
        display: none;
    }

    .users-table tbody {
        display: block;
        padding: 10px;
    }

    .users-table tbody tr.user-row {
        display: flex !important;
        align-items: center !important;
        padding: 14px 16px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--border-radius) !important;
        margin-bottom: 8px !important;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .users-table tbody tr.user-row:active {
        background: var(--bg-tertiary) !important;
        border-color: var(--primary) !important;
    }

    /* Reset all td styling */
    .users-table tbody tr.user-row td {
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        display: none !important;
    }

    /* Show only user column */
    .users-table tbody tr.user-row td:nth-child(2) {
        display: flex !important;
        flex: 1;
    }

    /* User cell styling */
    .users-table tbody tr.user-row .user-cell {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .users-table tbody tr.user-row .user-avatar {
        width: 42px !important;
        height: 42px !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: #ffffff !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 600 !important;
    }

    .users-table tbody tr.user-row .user-info {
        min-width: 0 !important;
        flex: 1 !important;
        display: block !important;
    }

    .users-table tbody tr.user-row .user-name {
        display: block !important;
        font-size: 0.9375rem !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.4 !important;
    }

    .users-table tbody tr.user-row .user-email {
        display: block !important;
        font-size: 0.8125rem !important;
        color: #6b7280 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.4 !important;
    }

    /* Dark mode text colors */
    [data-theme="dark"] .users-table tbody tr.user-row .user-name {
        color: #f3f4f6 !important;
    }

    [data-theme="dark"] .users-table tbody tr.user-row .user-email {
        color: #9ca3af !important;
    }

    /* Arrow indicator */
    .users-table tbody tr.user-row::after {
        content: '\f105';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        color: #9ca3af;
        font-size: 0.875rem;
        flex-shrink: 0;
        margin-left: 8px;
    }
}

/* ============================================
   EDIT MODAL RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    /* Modal overlay */
    .modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    /* Modal content - slide up */
    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 90vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        animation: none !important;
    }

    .modal-overlay.show .modal-content {
        transform: translateY(0) !important;
    }

    /* Header */
    .modal-header {
        padding: 16px 20px !important;
        background: var(--bg-card) !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .modal-title {
        font-size: 1rem !important;
    }

    /* Body - scrollable */
    .modal-body {
        padding: 16px 20px 32px 20px !important;
        max-height: calc(90vh - 180px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Form sections */
    .modal-section {
        margin-bottom: 24px !important;
    }

    .modal-section:last-child {
        margin-bottom: 0 !important;
    }

    .modal-section-title {
        font-size: 0.75rem !important;
        margin-bottom: 12px !important;
    }

    /* Form grid - single column */
    .form-grid {
        display: block !important;
    }

    .form-group {
        margin-bottom: 14px !important;
        max-width: 100% !important;
    }

    .form-group:last-child {
        margin-bottom: 0 !important;
    }

    /* Input fields */
    .form-control {
        font-size: 16px !important;
        padding: 12px 14px !important;
    }

    /* Footer - always visible */
    .modal-footer {
        display: flex !important;
        flex-direction: column !important;
        padding: 16px 20px !important;
        gap: 10px !important;
        background: var(--bg-card) !important;
        border-top: 1px solid var(--border) !important;
    }

    .modal-footer .btn {
        width: 100% !important;
        text-align: center !important;
    }
}

/* Desktop modal - ensure normal behavior */
@media (min-width: 769px) {
    .modal-overlay {
        align-items: center !important;
        padding: 20px !important;
    }

    .modal-content {
        max-width: 600px !important;
        border-radius: var(--border-radius-lg) !important;
        transform: none !important;
    }
}
