/* ============================================
   MU License Panel - Design System
   Inspirado en mu.png: clean dashboard, icon sidebar, KPI cards, azul
   ============================================ */

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

:root {
    --bg-main: #F0F2F5;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1A1D2E;
    --bg-sidebar-hover: #252836;
    --bg-input: #F8F9FA;
    --bg-topbar: #FFFFFF;

    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;
    --text-sidebar: #94A3B8;
    --text-sidebar-active: #FFFFFF;

    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --accent-light: #DBEAFE;
    --accent-gradient: linear-gradient(135deg, #3B82F6, #6366F1);

    --success: #10B981;
    --success-bg: #D1FAE5;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --danger: #EF4444;
    --danger-bg: #FEE2E2;
    --info: #3B82F6;
    --info-bg: #DBEAFE;

    --badge-admin-bg: #EDE9FE;
    --badge-admin-text: #7C3AED;
    --badge-user-bg: #DBEAFE;
    --badge-user-text: #3B82F6;

    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

    --bg-row-even: #FAFBFC;
    --bg-row-hover: #F8FAFC;
    --bg-btn-secondary-hover: #E2E8F0;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;

    --font: 'Inter', 'Segoe UI', -apple-system, sans-serif;
    --transition: all 0.2s ease;
}

/* Utilities */
.position-relative { position: relative !important; }
.overflow-visible { overflow: visible !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-2 { gap: 0.5rem !important; }

[data-theme="dark"] {
    --bg-main: #0B0F19;
    --bg-card: #141824;
    --bg-sidebar: #090B10;
    --bg-sidebar-hover: #1A1D2E;
    --bg-input: #1F2437;
    --bg-topbar: #141824;

    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --border: #2A3043;
    --border-light: #1F2437;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.24);

    --bg-row-even: #1A1D2E;
    --bg-row-hover: #1F2437;

    --success-bg: rgba(16, 185, 129, 0.15);
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info-bg: rgba(59, 130, 246, 0.15);
    
    --accent-light: rgba(59, 130, 246, 0.2);
    --badge-admin-bg: rgba(124, 58, 237, 0.2);
    --badge-admin-text: #A78BFA;
    --badge-user-bg: rgba(59, 130, 246, 0.2);
    --badge-user-text: #60A5FA;
    --bg-btn-secondary-hover: #2D3748;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: var(--topbar-height);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-title {
    color: var(--text-white);
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
}

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

.sidebar-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-section-title {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 12px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-sidebar);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.92rem;
    font-weight: 400;
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
}

.sidebar-link.active {
    background: var(--accent);
    color: var(--text-white);
    font-weight: 500;
}

.sidebar-link .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer a {
    color: var(--text-sidebar);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-footer a:hover { color: var(--danger); }

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

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

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

.topbar-breadcrumb {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.topbar-search {
    position: relative;
}

.topbar-search input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 16px 8px 36px;
    font-size: 0.88rem;
    width: 240px;
    outline: none;
    transition: var(--transition);
    font-family: var(--font);
    color: var(--text-primary);
}

.topbar-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.topbar-search .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.topbar-user:hover { background: var(--bg-input); }

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.topbar-username {
    font-weight: 500;
    font-size: 0.9rem;
}

.topbar-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-primary);
    font-size: 1.4rem;
}

/* --- Page Content --- */
.page-content {
    padding: 28px;
}

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

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
}

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

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

.card-header h2, .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-input);
}

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

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.kpi-icon.blue { background: var(--accent-light); color: var(--accent); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }

.kpi-info h4 {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.kpi-info .kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-info .kpi-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
}

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

thead th {
    background: var(--bg-input);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--bg-row-hover);
}

tbody tr:nth-child(even) {
    background: var(--bg-row-even);
}

tbody tr:nth-child(even):hover {
    background: var(--bg-row-hover);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active, .badge-success, .badge-open {
    background: var(--success-bg);
    color: var(--success);
}

.badge-blocked, .badge-danger, .badge-closed {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-expired, .badge-muted {
    background: #F1F5F9;
    color: var(--text-muted);
}

.badge-pending, .badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-admin {
    background: var(--badge-admin-bg);
    color: var(--badge-admin-text);
}

.badge-user {
    background: var(--badge-user-bg);
    color: var(--badge-user-text);
}

.badge-critical {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: var(--font);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(59,130,246,0.3);
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 2px 6px rgba(59,130,246,0.4);
    transform: translateY(-1px);
}

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

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { 
    background: #DC2626; 
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}
.btn-warning:hover { 
    background: #D97706; 
    color: #fff;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { 
    background: var(--bg-btn-secondary-hover); 
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

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

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

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

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

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

.form-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 4px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   FLASH MESSAGES
   ============================================ */
.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: flashIn 0.3s ease;
    position: relative;
}

.flash-message .flash-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    color: inherit;
}

.flash-success {
    background: var(--success-bg);
    color: #065F46;
    border-left: 4px solid var(--success);
}

.flash-error {
    background: var(--danger-bg);
    color: #991B1B;
    border-left: 4px solid var(--danger);
}

.flash-warning {
    background: var(--warning-bg);
    color: #92400E;
    border-left: 4px solid var(--warning);
}

.flash-info {
    background: var(--info-bg);
    color: #1E40AF;
    border-left: 4px solid var(--info);
}

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

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-muted);
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.pagination a {
    color: var(--text-primary);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.pagination a:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination .active {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

.pagination .disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ============================================
   ANNOUNCEMENTS (user dashboard)
   ============================================ */
.announcement {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    border-left: 4px solid;
}

.announcement-info {
    background: var(--info-bg);
    border-color: var(--info);
}

.announcement-warning {
    background: var(--warning-bg);
    border-color: var(--warning);
}

.announcement-critical {
    background: var(--danger-bg);
    border-color: var(--danger);
    font-weight: 500;
}

.announcement h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.announcement p {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* ============================================
   TICKET MESSAGES
   ============================================ */
.ticket-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ticket-msg {
    padding: 16px;
    border-radius: var(--radius);
    max-width: 85%;
}

.ticket-msg.user-msg {
    background: var(--bg-input);
    align-self: flex-start;
    border-left: 3px solid var(--accent);
}

.ticket-msg.admin-msg {
    background: var(--accent-light);
    align-self: flex-end;
    border-right: 3px solid var(--accent);
}

.ticket-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.ticket-msg-header strong {
    font-weight: 600;
}

.ticket-msg-header .time {
    color: var(--text-muted);
}

.ticket-msg-body {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================
   LICENSE KEY display
   ============================================ */
.license-key-display {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--bg-input);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    letter-spacing: 0.1em;
    color: var(--text-primary);
    display: inline-block;
}

/* ============================================
   GRID Layouts
   ============================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card-header .filter-bar {
    margin-bottom: 0;
    width: 100%;
}

.filter-bar .form-control {
    max-width: 180px;
}

/* ============================================
   DETAIL CARDS (license/user detail)
   ============================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    font-size: 0.9rem;
}

.detail-grid dt {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-grid dd {
    color: var(--text-primary);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F1117 0%, #1A1D2E 50%, #252836 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 auto 16px;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.login-lang {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.login-lang a {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.login-lang a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ============================================
   SIDEBAR OVERLAY (mobile)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu-toggle {
        display: block;
    }

    .page-content {
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .topbar-search {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control {
        max-width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .login-card {
        padding: 28px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.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); }
.text-accent { color: var(--accent); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.w-100 { width: 100%; }
.fw-bold { font-weight: 700; }
.fs-sm { font-size: 0.85rem; }

.mono {
    font-family: 'Courier New', monospace;
}

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

.hidden { display: none !important; }

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-item {
    transition: var(--transition);
}

.notification-item:hover {
    background: #FAFBFC;
}

.notification-item.unread {
    background: var(--accent-light);
    border-left: 3px solid var(--accent);
}

/* ============================================
   AUTOCOMPLETE DROPDOWN
   ============================================ */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 500;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.autocomplete-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* ============================================
   SIDEBAR ANIMATIONS
   ============================================ */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

/* ============================================
   HISTORY TIMELINE (license detail)
   ============================================ */
.history-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
}

.history-action {
    font-weight: 600;
    color: var(--text-primary);
}

.history-details {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
}

.history-date {
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

/* ============================================
   TOAST NOTIFICATIONS (JS)
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--accent); }

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

/* ============================================
   ADDITIONAL RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .ticket-msg {
        max-width: 95%;
    }

    .license-key-display {
        font-size: 0.85rem;
        word-break: break-all;
    }

    .topbar-user .topbar-username,
    .topbar-user .topbar-role {
        display: none;
    }

    .btn-group {
        flex-direction: column;
    }
}

/* Print styles */
@media print {
    .sidebar, .topbar, .btn, .filter-bar {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
}


/* ============================================
   VPS NOTIFICATION MODULE
   ============================================ */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.search-result {
    padding: 10px 15px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.search-result:hover {
    background: var(--bg-input);
    color: var(--accent);
}

.vps-user-badge {
    background: var(--accent);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    animation: badge-pop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vps-user-badge span {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vps-user-badge .remove-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: var(--transition);
    padding: 0;
    line-height: 1;
}

.vps-user-badge .remove-btn:hover {
    background: var(--danger);
}

.vps-table-pass {
    width: 150px;
    background: transparent !important;
    border: none !important;
    cursor: default !important;
}

.vps-table-row td {
    vertical-align: middle !important;
}

@keyframes badge-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   MODALS (Confirmations, UI)
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    width: 95%;
    max-width: 450px;
    padding: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    overflow: hidden;
    color: var(--text-primary);
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-input);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
