:root {
  --sidebar-bg: #ffffff;
  --sidebar-width: 220px;
  --sidebar-border: #e8e8ed;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --card-radius: 12px;
  --primary: #4f46e5;
  --primary-light: #ede9fe;
  --primary-dark: #3730a3;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --green: #10b981;
  --green-light: #d1fae5;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --red: #ef4444;
  --red-light: #fee2e2;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  padding: 0;
}

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

.sidebar-logo img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.sidebar-logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.sidebar-nav a:hover {
  background: #f9fafb;
  color: var(--text);
}

.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-nav a.active svg,
.sidebar-nav a.active .nav-icon { color: var(--primary); }

.sidebar-nav svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
}

.sidebar-nav a.active svg { opacity: 1; }

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); truncate; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

.sidebar-user a {
  color: var(--text-light);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.sidebar-user a:hover { color: var(--red); }

/* ── MAIN ────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0;
}

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {}
.topbar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 24px 28px; }

/* ── STAT CARDS ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--card-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;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.blue   { background: var(--blue-light);   color: var(--blue);   }
.stat-icon.green  { background: var(--green-light);  color: var(--green);  }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.red    { background: var(--red-light);    color: var(--red);    }

.stat-info {}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -.5px; }

/* ── GRID 2 COL ──────────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ── CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.card-link:hover { text-decoration: underline; }

.card-body { padding: 20px; }

/* ── TABLE ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--text);
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafafa; }

/* ── BADGES ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green   { background: var(--green-light);  color: #065f46; }
.badge-orange  { background: var(--orange-light); color: #92400e; }
.badge-red     { background: var(--red-light);    color: #991b1b; }
.badge-blue    { background: var(--blue-light);   color: #1e40af; }
.badge-purple  { background: var(--purple-light); color: #5b21b6; }
.badge-gray    { background: #f3f4f6;             color: #374151; }
.badge-success { background: var(--green-light);  color: #065f46; }
.badge-danger  { background: var(--red-light);    color: #991b1b; }
.badge-warning { background: var(--orange-light); color: #92400e; }
.badge-info    { background: var(--blue-light);   color: #1e40af; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
}
.btn-secondary:hover { background: #e5e7eb; }

.btn-danger {
  background: var(--red-light);
  color: var(--red);
}
.btn-danger:hover { background: #fca5a5; }

.btn-success {
  background: var(--green-light);
  color: #065f46;
}

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

/* ── FORMS ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: var(--font);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

select.form-control { cursor: pointer; }

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

/* ── ALERT ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
  font-weight: 500;
}

.alert-success { background: var(--green-light);  color: #065f46; }
.alert-danger  { background: var(--red-light);    color: #991b1b; }
.alert-warning { background: var(--orange-light); color: #92400e; }
.alert-info    { background: var(--blue-light);   color: #1e40af; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: #fff;
  border-radius: 16px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal > form { padding: 20px 24px 0; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: 6px;
  display: flex; align-items: center;
}
.modal-close:hover { background: #f3f4f6; color: var(--text); }

.modal-body { padding: 20px 24px; }


/* ── QUICK ACTIONS ───────────────────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 10px;
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  cursor: pointer;
  text-align: center;
}

.qa-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.qa-btn svg { width: 22px; height: 22px; }

/* ── SERVER STATUS ───────────────────────────────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.status-row:last-child { border-bottom: none; }
.status-label { color: var(--text-muted); font-weight: 500; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }
.dot-red { background: var(--red); }

/* ── LOGIN PAGE ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f0ff 0%, #f4f5f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo img { height: 40px; }

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 6px;
}

.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

/* ── TOAST ───────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: none;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  max-width: 320px;
}

.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }

/* ── SEARCH INPUT ────────────────────────────────────────────────────────── */
.search-input {
  position: relative;
  display: inline-block;
}

.search-input svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input input {
  padding-left: 34px;
}

/* ── UTILITIES ───────────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── PROGRESS BAR ────────────────────────────────────────────────────────── */
.progress-wrap { margin-top: 4px; }
.progress-bar-bg {
  height: 6px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-bar-fill.green  { background: var(--green); }
.progress-bar-fill.orange { background: var(--orange); }
.progress-bar-fill.red    { background: var(--red); }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ── ACTIVITY FEED ───────────────────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-icon svg { width: 15px; height: 15px; }
.activity-body { flex: 1; min-width: 0; }
.activity-desc { font-size: 13px; color: var(--text); font-weight: 500; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ── EXPIRY WARNING ──────────────────────────────────────────────────────── */
.expiry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  gap: 12px;
}
.expiry-item:last-child { border-bottom: none; }
.expiry-domain { font-size: 13px; font-weight: 600; color: var(--text); }
.expiry-customer { font-size: 11px; color: var(--text-muted); }

