@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg-body: #0e1117;
    --bg-sidebar: #12151c;
    --bg-card: #161a24;
    --bg-card-hover: #1a1f2b;
    --bg-input: #1a1f2b;
    --bg-table-hover: rgba(255,255,255,0.04);
    --border-default: rgba(255,255,255,0.06);
    --border-card: rgba(255,255,255,0.08);
    --border-input: rgba(255,255,255,0.1);
    --border-input-focus: rgba(74,222,128,0.5);
    --accent-green: #4ade80;
    --accent-green-dim: rgba(74,222,128,0.12);
    --accent-orange: #f97316;
    --accent-orange-dim: rgba(249,115,22,0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239,68,68,0.12);
    --accent-yellow: #eab308;
    --accent-yellow-dim: rgba(234,179,8,0.12);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59,130,246,0.12);
    --accent-cyan: #22d3ee;
    --accent-purple: #a78bfa;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;
    --text-positive: #4ade80;
    --text-negative: #ef4444;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --sidebar-width: 210px;
    --header-height: 60px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow-glow-green: 0 0 20px rgba(74,222,128,0.1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: var(--font-sans);
    font-size: 14px; line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection { background: rgba(74,222,128,0.25); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

a { color: var(--accent-green); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: #5ceb93; }
h1,h2,h3,h4,h5,h6 { color: var(--text-heading); font-weight: 600; margin: 0 0 0.5em; }

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

.app-sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-default);
    z-index: 1000; display: flex; flex-direction: column;
    transition: transform 0.4s var(--ease-out);
    overflow-y: auto; overflow-x: hidden;
}

.app-main {
    flex: 1; margin-left: var(--sidebar-width);
    min-height: 100vh; display: flex; flex-direction: column;
    transition: margin-left 0.4s var(--ease-out);
}

.app-header {
    position: sticky; top: 0; z-index: 900;
    height: var(--header-height);
    background: rgba(14,17,23,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-default);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
}

.app-content { flex: 1; padding: 24px; }

.app-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border-default);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--text-muted);
}

/* === SIDEBAR === */
.sidebar-brand {
    padding: 20px 16px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border-default); margin-bottom: 8px;
}
.sidebar-brand-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-orange), #fb923c);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0;
}
.sidebar-brand-name {
    font-weight: 600; font-size: 15px; color: var(--text-heading);
    font-family: var(--font-mono); letter-spacing: 0.02em;
}
.sidebar-brand-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-section { margin-top: 8px; }
.sidebar-section-label {
    padding: 8px 20px 4px; font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav-item { margin: 1px 8px; }
.sidebar-nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 13.5px; font-weight: 450;
    transition: all 0.15s ease; position: relative; text-decoration: none;
}
.sidebar-nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.sidebar-nav-link.active {
    color: var(--accent-green); background: var(--accent-green-dim); font-weight: 500;
}
.sidebar-nav-link.active::before {
    content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-green);
}
.sidebar-nav-icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.sidebar-nav-link.active .sidebar-nav-icon { opacity: 1; }
.sidebar-footer {
    margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--border-default);
}
.sidebar-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.sidebar-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-green); animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74,222,128,0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(74,222,128,0); }
}
.sidebar-status-text strong { color: var(--text-secondary); font-weight: 500; }
.sidebar-status-version { font-size: 11px; color: var(--text-muted); opacity: 0.7; }

/* === HEADER === */
.header-left { display: flex; align-items: center; gap: 16px; }
.header-title { font-size: 20px; font-weight: 600; color: var(--text-heading); letter-spacing: -0.02em; }
.header-breadcrumb { font-size: 13px; color: var(--text-muted); }
.header-breadcrumb span { color: var(--text-secondary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-lang-toggle { display: flex; gap: 2px; background: rgba(255,255,255,0.06); border-radius: 6px; padding: 2px; }
.header-lang-btn {
    padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.15s ease;
    color: var(--text-muted); background: transparent; font-family: var(--font-sans);
}
.header-lang-btn.active { background: var(--accent-green); color: #0e1117; }
.header-time {
    padding: 5px 12px; border-radius: 6px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border-default);
    font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary);
}
.header-logout-btn {
    padding: 6px 16px; border-radius: 6px; background: transparent;
    border: 1px solid var(--border-default); color: var(--text-secondary);
    font-size: 13px; cursor: pointer; transition: all 0.15s ease; font-family: var(--font-sans);
}
.header-logout-btn:hover { border-color: var(--accent-red); color: var(--accent-red); background: var(--accent-red-dim); }
.header-menu-toggle { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 8px; }

/* === STAT CARDS === */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-card);
    border-radius: var(--radius); padding: 20px;
    transition: all 0.25s ease; position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.2), transparent);
    opacity: 0; transition: opacity 0.25s ease;
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: rgba(255,255,255,0.1); }
.stat-card-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 10.5px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 10px;
}
.stat-card-label svg { width: 14px; height: 14px; opacity: 0.6; }
.stat-card-value {
    font-size: 28px; font-weight: 700; font-family: var(--font-mono);
    letter-spacing: -0.02em; color: var(--text-heading); line-height: 1.1;
}
.stat-card-value.positive { color: var(--text-positive); }
.stat-card-value.negative { color: var(--text-negative); }
.stat-card-value.orange { color: var(--accent-orange); }
.stat-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* === DATA CARDS === */
.data-card {
    background: var(--bg-card); border: 1px solid var(--border-card);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 24px;
}
.data-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-default);
}
.data-card-title { font-size: 15px; font-weight: 600; color: var(--text-heading); }
.data-card-actions { display: flex; gap: 8px; align-items: center; }
.data-card-body { padding: 20px; }

/* === TABLES === */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    padding: 10px 16px; font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); text-align: left;
    border-bottom: 1px solid var(--border-default); white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.03); transition: background 0.15s ease; }
.data-table tbody tr:hover { background: var(--bg-table-hover); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td { padding: 12px 16px; font-size: 13.5px; vertical-align: middle; }
.col-mono { font-family: var(--font-mono); font-size: 13px; }
.col-positive { color: var(--text-positive) !important; }
.col-negative { color: var(--text-negative) !important; }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-red { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-orange { background: var(--accent-orange-dim); color: var(--accent-orange); }
.badge-yellow { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.badge-blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; font-family: var(--font-sans); text-decoration: none; }
.btn-primary { background: var(--accent-green); color: #0e1117; }
.btn-primary:hover { background: #5ceb93; box-shadow: var(--shadow-glow-green); }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border-default); }
.btn-outline:hover { border-color: var(--text-secondary); color: var(--text-primary); background: rgba(255,255,255,0.04); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* === FORMS === */
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 9px 14px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid var(--border-input);
    color: var(--text-primary); font-family: var(--font-sans); font-size: 13.5px;
    transition: all 0.15s ease; outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--border-input-focus); box-shadow: 0 0 0 3px rgba(74,222,128,0.08); }
.form-input::placeholder { color: var(--text-muted); }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

/* === SEARCH === */
.search-bar { position: relative; }
.search-bar input { padding-left: 38px; }
.search-bar-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.filter-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-default); flex-wrap: wrap; }

/* === PAGE HEADER === */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-header-icon { width: 42px; height: 42px; border-radius: var(--radius); background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.page-header-icon svg { width: 22px; height: 22px; }
.page-header-title { font-size: 20px; font-weight: 600; color: var(--text-heading); margin: 0; }
.page-header-sub { font-size: 13px; color: var(--text-muted); }
.page-header-right { display: flex; align-items: center; gap: 8px; }

/* === AVATAR === */
.avatar-initials { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: #fff; }

/* === STATUS === */
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.status-badge.active { background: var(--accent-green-dim); color: var(--accent-green); }
.status-badge.inactive { background: var(--accent-red-dim); color: var(--accent-red); }
.status-badge.pending { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.status-badge.expired { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 2000; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-lg); padding: 24px; width: 90%; max-width: 480px; animation: scaleIn 0.3s ease; }
.modal-title { font-size: 17px; font-weight: 600; color: var(--text-heading); margin-bottom: 16px; }

/* === ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.1s; opacity: 0; }
.stagger-3 { animation-delay: 0.15s; opacity: 0; }
.stagger-4 { animation-delay: 0.2s; opacity: 0; }
.stagger-5 { animation-delay: 0.25s; opacity: 0; }

/* === CHARTS === */
.apexcharts-canvas { background: transparent !important; }
.apexcharts-text { fill: var(--text-muted) !important; font-family: var(--font-mono) !important; }
.apexcharts-gridline { stroke: rgba(255,255,255,0.04) !important; }

/* === SIDEBAR OVERLAY === */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }

/* === GRID UTILS === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }
.text-orange { color: var(--accent-orange) !important; }
.font-mono { font-family: var(--font-mono) !important; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .header-menu-toggle { display: block; }
    .app-content { padding: 16px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card-value { font-size: 22px; }
    .header-time, .header-lang-toggle { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .sidebar-overlay.active { display: block; }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .stat-cards { grid-template-columns: 1fr; } }