:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252838;
  --bg-input: #16181f;
  --border: #2a2d3a;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b2;
  --text-muted: #6b7280;
  --accent-primary: #FFEA00;
  --accent-blue: #FFEA00;
  --accent-green: #22c55e;
  --accent-yellow: #facc15;
  --accent-red: #ef4444;
  --accent-purple: #ffea00;
  --accent-teal: #14b8a6;
  --accent-gold: #FFEA00;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Montserrat', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; }
.hidden { display: none !important; }

.login-screen { min-height: 100vh; display: flex; }
.login-left {
  flex: 0 0 45%; background: var(--accent-primary);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; width: 300px; height: 300px;
  background: rgba(0,0,0,0.04); border-radius: 50%;
  top: -80px; left: -80px;
}
.login-left::after {
  content: ''; position: absolute; width: 200px; height: 200px;
  background: rgba(0,0,0,0.03); border-radius: 50%;
  bottom: -60px; right: -40px;
}
.login-left img { width: 55%; max-width: 320px; filter: brightness(0); position: relative; z-index: 1; }
.login-right {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, #0f1117, #141720);
  padding: 40px;
}
.login-card { width: 100%; max-width: 380px; animation: fadeInUp 0.6s ease; }
.login-card-title {
  font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 6px;
}
.login-card-subtitle {
  font-size: 14px; color: var(--text-muted); margin-bottom: 32px;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.input-group { position: relative; margin-bottom: 20px; }
.input-group i {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}
.input-group input {
  width: 100%; padding: 16px 16px 16px 46px;
  background: rgba(255,255,255,0.04); border: 1px solid #2a2d3a;
  border-radius: var(--radius-sm); color: #fff;
  font-size: 14px; font-family: inherit; transition: var(--transition);
}
.input-group input:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 234, 0, 0.1);
  background: rgba(255,255,255,0.06);
}
.input-group input::placeholder { color: var(--text-muted); }
.error-message { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); color: var(--accent-red); padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-top: 12px; text-align: center; }

.btn-primary { background: var(--accent-primary); color: #000; border: none; padding: 14px 28px; border-radius: 100px; font-size: 15px; font-weight: 800; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255, 234, 0, 0.35); }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border); padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-secondary:hover { background: var(--border); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 40px; height: 40px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

.dashboard { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: var(--transition); }
.sidebar-header { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; }
.sidebar-logo i { color: var(--accent-blue); }
.sidebar-toggle { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 18px; display: none; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 500; transition: var(--transition); }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(255, 234, 0, 0.12); color: var(--accent-primary); }
.nav-item i { width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent-primary), #ffcc00); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #000; }
.user-name { display: block; font-size: 13px; font-weight: 600; }
.user-role { display: block; font-size: 11px; color: var(--text-muted); }
.btn-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 8px; transition: var(--transition); }
.btn-logout:hover { color: var(--accent-red); }

.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }
.top-header { height: var(--header-height); padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--bg-secondary); position: sticky; top: 0; z-index: 50; }
.header-left h2 { font-size: 20px; font-weight: 700; }
.header-date { font-size: 12px; color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 12px; }
.connection-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent-green); }
.status-dot { width: 8px; height: 8px; background: var(--accent-green); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.content-area { padding: 24px 32px; max-width: 1400px; }

.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-blue .stat-icon { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.stat-green .stat-icon { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.stat-yellow .stat-icon { background: rgba(234,179,8,0.15); color: var(--accent-yellow); }
.stat-red .stat-icon { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.stat-purple .stat-icon { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.stat-teal .stat-icon { background: rgba(20,184,166,0.15); color: var(--accent-teal); }
.stat-gold .stat-icon { background: rgba(245,158,11,0.15); color: var(--accent-gold); }
.stat-value { display: block; font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--accent-blue); }
.card-body { padding: 16px 20px; }

.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-available { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.badge-active { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.badge-trial { background: rgba(20,184,166,0.12); color: var(--accent-teal); }
.badge-pending { background: rgba(234,179,8,0.12); color: var(--accent-yellow); }
.badge-suspended { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.badge-disabled { background: rgba(107,114,128,0.12); color: var(--text-muted); }
.badge-cancelled { background: rgba(239,68,68,0.08); color: #f87171; }
.badge-expired { background: rgba(107,114,128,0.08); color: var(--text-muted); }
.badge-past-due { background: rgba(245,158,11,0.12); color: var(--accent-gold); }

.actions-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 400px; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input { width: 100%; padding: 10px 14px 10px 40px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; font-family: inherit; transition: var(--transition); }
.search-box input:focus { outline: none; border-color: var(--accent-blue); }
.actions-right { display: flex; gap: 8px; align-items: center; }
.filter-select { padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; font-family: inherit; cursor: pointer; }
.filter-select option { background: var(--bg-secondary); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; animation: fadeIn 0.2s ease; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 480px; box-shadow: 0 24px 48px rgba(0,0,0,0.4); animation: slideUp 0.3s ease; }
.modal-wide { max-width: 640px; }
.modal-sm { max-width: 380px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal-header h3 i { color: var(--accent-blue); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-size: 14px; font-family: inherit; transition: var(--transition); }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent-blue); }
.form-group small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.batch-input { width: 100%; resize: vertical; font-family: monospace; }
.batch-results { margin-top: 16px; padding: 12px; background: var(--bg-input); border-radius: 6px; font-size: 13px; max-height: 200px; overflow-y: auto; }
.qr-modal-body { text-align: center; }
.qr-modal-body img { width: 240px; height: 240px; border-radius: var(--radius-sm); margin-bottom: 12px; background: #fff; padding: 12px; }
.qr-imei { font-family: monospace; font-size: 16px; font-weight: 700; color: var(--accent-blue); margin-bottom: 4px; }
.qr-url { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.activity-icon.act-register { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.activity-icon.act-activate { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.activity-icon.act-suspend { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.activity-icon.act-default { background: rgba(107,114,128,0.15); color: var(--text-muted); }
.activity-text { font-size: 13px; line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.pagination { padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 4px; border-top: 1px solid var(--border); }
.page-btn { padding: 6px 12px; background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: var(--transition); }
.page-btn:hover { background: var(--bg-hover); }
.page-btn.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.3); animation: slideInRight 0.3s ease; min-width: 280px; }
.toast-success { background: rgba(34,197,94,0.95); color: #fff; }
.toast-error { background: rgba(239,68,68,0.95); color: #fff; }
.toast-info { background: rgba(59,130,246,0.95); color: #fff; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item { padding: 10px; background: var(--bg-input); border-radius: 6px; }
.detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 600; }
.action-btns { display: flex; gap: 4px; }
.action-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: transparent; border-radius: 6px; color: var(--text-secondary); cursor: pointer; font-size: 12px; transition: var(--transition); }
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-btn.enable:hover { color: var(--accent-green); border-color: var(--accent-green); }
.action-btn.disable:hover { color: var(--accent-red); border-color: var(--accent-red); }
.action-btn.qr:hover { color: var(--accent-purple); border-color: var(--accent-purple); }
.action-btn.info:hover { color: var(--accent-blue); border-color: var(--accent-blue); }

@media (max-width: 768px) {
  .login-screen { flex-direction: column; }
  .login-left { flex: none; height: 250px; width: 100%; }
  .login-right { flex: 1; width: 100%; padding: 40px 20px; justify-content: flex-start; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main-content { margin-left: 0; }
  .content-area { padding: 16px; }
  .stats-grid, .stats-grid-3 { grid-template-columns: 1fr; }
  .actions-bar { flex-direction: column; }
  .search-box { max-width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
}
