:root {
  --bg: #0f1117;
  --bg2: #181c27;
  --bg3: #1e2333;
  --bg4: #252b3b;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e8eaf0;
  --text2: #8b90a0;
  --text3: #5a5f70;
  --accent: #00c2ff;
  --accent2: #0090cc;
  --accent-dim: rgba(0,194,255,0.12);
  --accent-border: rgba(0,194,255,0.3);
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 220px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); min-height: 100vh; overflow-x: hidden; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 10px; }

/* APP LAYOUT */
.app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: transform 0.25s ease;
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #000;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-name { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--text); line-height: 1; }
.logo-sub { font-size: 10px; color: var(--text3); margin-top: 3px; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }

.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: none; background: transparent; cursor: pointer;
  color: var(--text2); font-family: var(--font-body); font-size: 13.5px;
  border-radius: var(--radius);
  width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-btn i { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.nav-btn.active i { color: var(--accent); }

.nav-badge {
  position: absolute; right: 10px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

.sidebar-bottom { padding: 10px 10px 16px; border-top: 1px solid var(--border); }
.sidebar-date { font-size: 11px; color: var(--text3); padding: 8px 12px 0; }

/* MAIN */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
}
.menu-btn { display: none; background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; padding: 6px; border-radius: 8px; }
.topbar-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; flex: 1; }

.add-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.add-btn:hover { background: #00aadd; }
.add-btn:active { transform: scale(0.97); }

/* PAGES */
.page-wrap { flex: 1; overflow-y: auto; padding: 20px; }
.page { display: none; animation: fadeIn 0.2s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

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

.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--border2); }
.kpi-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.kpi-value { font-family: var(--font-head); font-size: 28px; font-weight: 700; line-height: 1; }
.kpi-sub { font-size: 11px; color: var(--text3); margin-top: 5px; }
.kv-blue { color: var(--accent); }
.kv-green { color: var(--green); }
.kv-amber { color: var(--amber); }
.kv-red { color: var(--red); }

/* DASH GRID */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.dash-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.dash-card-head {
  font-family: var(--font-head); font-size: 13px; font-weight: 600;
  color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.dash-card-head i { margin-right: 6px; }

/* ALERT ROWS */
.alert-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  border: 1px solid rgba(245,158,11,0.2);
  background: rgba(245,158,11,0.06);
}
.alert-row.danger { border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.06); }
.alert-row-name { font-size: 13px; font-weight: 500; }
.alert-row-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.alert-row-actions { margin-left: auto; display: flex; gap: 6px; }

/* PLAN BARS */
.plan-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 4px; }
.plan-bar-item { display: flex; flex-direction: column; gap: 6px; }
.plan-bar-label { font-size: 12px; color: var(--text2); display: flex; justify-content: space-between; }
.plan-bar-track { height: 8px; background: var(--bg4); border-radius: 10px; overflow: hidden; }
.plan-bar-fill { height: 100%; border-radius: 10px; transition: width 0.6s ease; }

/* TOOLBAR */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 13px; }
.search-wrap input { padding-left: 32px; }
.filter-wrap { display: flex; gap: 8px; }

/* INPUTS */
input, select, textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a5f70' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
input::placeholder { color: var(--text3); }

/* TABLE */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg3); }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-amber { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-blue { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-gray { background: rgba(255,255,255,0.05); color: var(--text2); border: 1px solid var(--border2); }

/* ACTION BTNS */
.action-btns { display: flex; gap: 5px; }
.icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg4); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-dim); color: var(--red); border-color: rgba(239,68,68,0.3); }

/* AVATAR */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 11px; font-weight: 700;
  color: var(--accent); flex-shrink: 0;
}

/* CUSTOMER NAME CELL */
.cust-cell { display: flex; align-items: center; gap: 10px; }
.cust-cell-info .name { font-weight: 500; font-size: 13px; }
.cust-cell-info .cid { font-size: 11px; color: var(--text3); }

/* ALERTS PAGE */
.alert-section { margin-bottom: 20px; }
.alert-section-title {
  font-family: var(--font-head); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.alert-section-title i { font-size: 13px; }
.alert-section-title.danger { color: var(--red); }
.alert-section-title.warning { color: var(--amber); }
.alert-section-title.info { color: var(--accent); }

.auto-info-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
}
.auto-info-card p { font-size: 13px; color: var(--text2); margin-bottom: 12px; }
.auto-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text3); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-off { background: var(--text3); }
.dot-on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; }

/* SETTINGS */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.settings-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.settings-card-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.settings-card-title i { color: var(--accent); }
.settings-note { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.settings-note a { color: var(--accent); }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group label { font-size: 12px; color: var(--text2); font-weight: 500; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* BUTTONS */
.save-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.save-btn:hover { background: #00aadd; }
.save-btn.secondary { background: var(--bg4); color: var(--text); border: 1px solid var(--border2); }
.save-btn.secondary:hover { background: var(--bg3); }

/* MODALS */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 200;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 680px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: 1px solid var(--border2); color: var(--text2); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: background 0.15s; }
.modal-close:hover { background: var(--bg4); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.btn-primary {
  padding: 9px 20px; background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; gap: 7px;
  transition: background 0.15s;
}
.btn-primary:hover { background: #00aadd; }
.btn-secondary {
  padding: 9px 20px;
  background: transparent; color: var(--text2);
  border: 1px solid var(--border2); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--bg3); }

/* RENEW BTN */
.renew-btn {
  padding: 5px 12px;
  background: transparent; color: var(--amber);
  border: 1px solid rgba(245,158,11,0.3); border-radius: var(--radius);
  font-size: 12px; font-weight: 500; cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.renew-btn:hover { background: var(--amber-dim); }

/* VIEW PROFILE */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; margin-bottom: 16px; }
.profile-row { display: flex; flex-direction: column; gap: 2px; }
.profile-row .plabel { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
.profile-row .pval { color: var(--text); font-weight: 500; }
.profile-section-title { font-family: var(--font-head); font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.remarks-box { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; color: var(--text2); margin-bottom: 8px; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 32px 20px; color: var(--text3); font-size: 13px; }
.empty-state i { font-size: 28px; display: block; margin-bottom: 8px; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg4); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 12px 18px;
  font-size: 13px; color: var(--text);
  z-index: 999;
  transform: translateY(80px); opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: 300px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34,197,94,0.4); }
.toast.error { border-color: rgba(239,68,68,0.4); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  .menu-btn { display: flex; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .plan-bars { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
