:root {
  --primary: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
  --primary-bg: #eff6ff;
  --secondary: #64748b;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --purple: #7c3aed;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ========== LOGIN SCREEN ========== */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 40%, #3b82f6 100%);
  position: relative; overflow: hidden;
}
.login-screen::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  top: -100px; right: -100px; border-radius: 50%;
}
.login-screen::after {
  content: ''; position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  bottom: -50px; left: -50px; border-radius: 50%;
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 48px 40px;
  width: 100%; max-width: 440px; box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  text-align: center; position: relative; z-index: 1;
}
.login-logo { height: 56px; margin-bottom: 16px; }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-card > p { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.login-form { text-align: left; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.login-search-box { position: relative; }
.login-search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--secondary); }
.login-search-box input {
  width: 100%; padding: 12px 16px 12px 40px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 15px; outline: none; transition: border-color 0.2s;
}
.login-search-box input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.login-results {
  max-height: 240px; overflow-y: auto; margin-top: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.login-results.hidden { display: none; }
.login-result-item {
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.login-result-item:last-child { border-bottom: none; }
.login-result-item:hover { background: var(--primary-bg); }
.login-result-item .lr-name { font-weight: 600; font-size: 14px; }
.login-result-item .lr-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.login-demo-hint {
  margin-top: 20px; padding: 10px 14px; background: var(--primary-bg);
  border-radius: var(--radius); font-size: 13px; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.login-screen.hidden, .app-shell.hidden { display: none !important; }

/* ========== TOP NAV ========== */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow); z-index: 100; position: sticky; top: 0;
}
.nav-left { display: flex; align-items: center; gap: 12px; }
.nav-logo { height: 34px; }
.nav-title { font-weight: 600; font-size: 16px; color: var(--primary-dark); }
.nav-right { display: flex; align-items: center; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-name { font-size: 14px; font-weight: 500; }
.btn-signout {
  border: none; background: none; cursor: pointer; color: var(--text-muted);
  font-size: 16px; margin-left: 8px; padding: 4px;
}
.btn-signout:hover { color: var(--danger); }

/* ========== APP LAYOUT ========== */
.app-layout { display: flex; min-height: calc(100vh - 60px); }

/* Sidebar */
.sidebar {
  width: 220px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 12px; flex-shrink: 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  text-decoration: none; color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); }
.nav-item i { width: 18px; text-align: center; }

/* Main Content */
.main-content { flex: 1; overflow-y: auto; padding: 24px 32px; max-height: calc(100vh - 60px); }

/* Views */
.view { display: none; }
.view.active { display: block; }
.view-header { margin-bottom: 24px; }
.view-header h1 { font-size: 24px; font-weight: 700; }
.view-header .subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; display: block; }

/* ========== STATS GRID ========== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 20px;
}
.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.orange { background: #fed7aa; color: var(--warning); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.purple { background: #ede9fe; color: var(--purple); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-value { font-size: 28px; font-weight: 700; display: block; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ========== CARDS ========== */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); 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-body { padding: 16px 20px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ========== USAGE BARS ========== */
.usage-bar-container { margin-bottom: 20px; }
.usage-bar-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px; font-size: 14px;
}
.usage-bar-label .label-name { font-weight: 600; }
.usage-bar-label .label-value { font-size: 13px; color: var(--text-muted); }
.usage-bar-track {
  height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden;
}
.usage-bar-fill {
  height: 100%; border-radius: 6px; transition: width 0.6s ease;
}
.usage-bar-fill.low { background: linear-gradient(90deg, #059669, #34d399); }
.usage-bar-fill.medium { background: linear-gradient(90deg, #d97706, #fbbf24); }
.usage-bar-fill.high { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ========== PLAN CARD ========== */
.plan-hero {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border-radius: var(--radius); padding: 32px; color: white; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.plan-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.plan-hero h2 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.plan-hero .plan-price { font-size: 22px; font-weight: 600; opacity: 0.9; }
.plan-hero .plan-price span { font-size: 14px; font-weight: 400; opacity: 0.7; }
.plan-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.plan-feature {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; opacity: 0.9;
}
.plan-feature i { font-size: 12px; opacity: 0.7; }

/* ========== TABLES ========== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 12px; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 2px solid var(--border); font-weight: 600;
}
.data-table td {
  padding: 12px; font-size: 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover { background: var(--bg); }
.data-table tr { cursor: pointer; }

/* ========== BADGES ========== */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500; text-transform: capitalize;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-orange { background: #fed7aa; color: #92400e; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-yellow { background: #fef3c7; color: #92400e; }

/* ========== BILLS ========== */
.bill-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.bill-card:last-child { border-bottom: none; }
.bill-left { display: flex; align-items: center; gap: 16px; }
.bill-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--primary-bg);
  color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.bill-info .bill-period { font-weight: 600; font-size: 15px; }
.bill-info .bill-date { font-size: 12px; color: var(--text-muted); }
.bill-amount { font-size: 18px; font-weight: 700; }
.bill-actions { display: flex; gap: 8px; margin-left: 16px; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); font-size: 13px;
  font-weight: 500; border: none; cursor: pointer; transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline {
  background: transparent; color: var(--primary); border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

/* ========== CATALOG / SHOP ========== */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.catalog-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column;
}
.catalog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.catalog-card h4 { font-size: 16px; margin-bottom: 6px; }
.catalog-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; flex: 1; }
.catalog-card .price { font-size: 22px; font-weight: 700; color: var(--primary); }
.catalog-card .price-period { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.catalog-card .card-footer { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; }

/* ========== FILTERS ========== */
.filters {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: end;
}
.filter-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.filter-group select, .filter-group input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; background: var(--surface); cursor: pointer;
}

/* ========== FORMS ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ========== MODAL ========== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-content {
  position: relative; background: var(--surface); border-radius: 16px;
  width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close { border: none; background: none; cursor: pointer; font-size: 18px; color: var(--text-muted); }
.modal-body { padding: 20px 24px; }
.modal-body .detail-row { display: flex; padding: 8px 0; border-bottom: 1px solid var(--border); }
.modal-body .detail-label { width: 130px; font-size: 13px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.modal-body .detail-value { flex: 1; font-size: 14px; }

/* ========== SUPPORT TICKETS ========== */
.ticket-list { }
.ticket-item {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.ticket-item:hover { background: var(--bg); }
.ticket-item:last-child { border-bottom: none; }
.ticket-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.ticket-icon.open { background: #dbeafe; color: var(--primary); }
.ticket-icon.resolved { background: #d1fae5; color: var(--success); }
.ticket-icon.pending { background: #fef3c7; color: var(--warning); }
.ticket-info { flex: 1; }
.ticket-info .ticket-name { font-weight: 600; font-size: 14px; }
.ticket-info .ticket-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ticket-status { display: flex; align-items: center; gap: 12px; }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ========== LOADING ========== */
.loading-spinner { text-align: center; padding: 32px; color: var(--text-muted); font-size: 14px; }

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  padding: 14px 20px; border-radius: var(--radius);
  background: #1e293b; color: white; font-size: 14px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .login-card { margin: 16px; padding: 32px 24px; }
}
