/* ─── Variables ─── */
:root {
  --bg:         #0a0f1e;
  --bg-2:       #0d1526;
  --bg-3:       #112035;
  --border:     #1e3a5f;
  --border-2:   #2a4f7a;
  --text:       #e2f0ff;
  --text-2:     #4a7fa5;
  --text-3:     #2d5a7a;
  --accent:     #38bdf8;
  --accent-dim: #0c2a3d;
  --green:      #34d399;
  --green-dim:  #0d3327;
  --yellow:     #fbbf24;
  --yellow-dim: #3d2e0a;
  --red:        #f87171;
  --red-dim:    #3b1515;
  --sidebar-w:  224px;
  --radius:     8px;
  --mono:       'Outfit', sans-serif;
  --sans:       'Outfit', sans-serif;
}

/* ─── Light theme ─── */
[data-theme="light"] {
  --bg:         #f0f9ff;
  --bg-2:       #ffffff;
  --bg-3:       #e0f2fe;
  --border:     #bae6fd;
  --border-2:   #7dd3fc;
  --text:       #0c1a2e;
  --text-2:     #075985;
  --text-3:     #0369a1;
  --accent:     #0284c7;
  --accent-dim: #e0f2fe;
  --green:      #059669;
  --green-dim:  #d1fae5;
  --yellow:     #b45309;
  --yellow-dim: #fef3c7;
  --red:        #b91c1c;
  --red-dim:    #fee2e2;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Page wrapper ─── */
.page-wrapper {
  display: flex;
  flex: 1;
  overflow-x: hidden;
  min-width: 0;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.sidebar-logo:hover { text-decoration: none; }
.logo-icon { font-size: 22px; color: var(--accent); }
.logo-text { font-family: var(--sans); font-weight: 700; font-size: 14px; line-height: 1.2; }
.logo-text small { font-size: 11px; color: var(--text-2); font-weight: 400; }
.sidebar-nav { list-style: none; padding: 12px 0; flex: 1; }
.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.nav-item a:hover { color: var(--text); background: var(--bg-3); text-decoration: none; }
.nav-item.active a { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }
.nav-icon { font-size: 15px; }
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-info { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
}
.role-admin    { background: var(--accent-dim); color: var(--accent); }
.role-head     { background: #0c2a3d; color: #7dd3fc; }
[data-theme="light"] .role-head { background: #e0f2fe; color: #0284c7; }
.role-teamlead { background: var(--yellow-dim); color: var(--yellow); }
.role-employee { background: var(--bg-3); color: var(--text-2); }
.logout-btn { color: var(--text-3); font-size: 16px; cursor: pointer; transition: color 0.15s; padding: 4px; }
.logout-btn:hover { color: var(--red); text-decoration: none; }

/* ─── Theme toggle ─── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 9px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  line-height: 1.4;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-2); }

/* ─── Main content ─── */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; min-height: 100vh; min-width: 0; }

/* ─── Page header ─── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.page-title { font-family: var(--sans); font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ─── Cards ─── */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 9px 14px;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: var(--bg-3); }
tbody td { padding: 11px 14px; color: var(--text); font-size: 14px; }
tbody tr:last-child { border-bottom: none; }

/* ─── Badges ─── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-gray   { background: var(--bg-3);       color: var(--text-2); }
.badge-blue   { background: var(--accent-dim); color: var(--accent); }
.badge-indigo { background: #1e2060; color: #818cf8; }
[data-theme="light"] .badge-indigo { background: #e0e7ff; color: #4338ca; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-3); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--red-dim); color: var(--red); border-color: var(--red-dim); }
.btn-danger:hover { filter: brightness(1.15); }
.btn-ghost     { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }
.btn-sm  { padding: 5px 11px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border-2);
  border-radius: var(--radius); color: var(--text); font-family: var(--sans);
  font-size: 14px; padding: 9px 12px; outline: none; transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text-3); }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ─── Filters bar ─── */
.filters-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters-bar input,
.filters-bar select {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--sans); font-size: 14px; padding: 7px 11px; outline: none;
}
.filters-bar input:focus, .filters-bar select:focus { border-color: var(--accent); }
.filter-spacer { flex: 1; }

/* ─── Flash / Alert ─── */
.flash { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; }
.flash-success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-dim); }
.flash-error   { background: var(--red-dim);   color: var(--red);   border: 1px solid var(--red-dim); }
.flash-info    { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-dim); }
.flash-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; padding: 0 4px; opacity: 0.7; }
.flash-close:hover { opacity: 1; }
.alert { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-dim); }

/* ─── Tags ─── */
.tag { display: inline-block; padding: 2px 8px; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 4px; font-size: 11px; color: var(--text-2); margin: 1px 2px; }

/* ─── Uptime bar ─── */
.uptime-bar { display: flex; gap: 2px; align-items: center; }
.uptime-block { width: 6px; height: 16px; border-radius: 2px; background: var(--border); }
.uptime-block.up         { background: var(--green); }
.uptime-block.down       { background: var(--red); }
.uptime-block.degraded   { background: var(--yellow); }
.uptime-block.redirected { background: #818cf8; }

/* ─── Auth ─── */
.auth-wrapper { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 380px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 40px 36px; }
.login-brand { text-align: center; margin-bottom: 32px; }
.logo-icon-lg { font-size: 36px; color: var(--accent); display: block; margin-bottom: 10px; }
.login-brand h1 { font-family: var(--sans); font-size: 26px; font-weight: 700; }
.login-brand p { color: var(--text-2); font-size: 13px; margin-top: 4px; }

/* ─── Status dots ─── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }
.dot-gray   { background: var(--text-3); }

/* ─── Collapsible ─── */
.collapsible-header {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 0; color: var(--text-2); font-size: 12px;
  letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600;
  border-top: 1px solid var(--border); user-select: none; transition: color 0.15s;
}
.collapsible-header:hover { color: var(--text); }
.collapsible-arrow { transition: transform 0.2s; }
.collapsible-header.open .collapsible-arrow { transform: rotate(90deg); }
.collapsible-body { display: none; padding-bottom: 12px; }
.collapsible-body.open { display: block; }

/* ─── Password reveal ─── */
.password-field { position: relative; }
.password-field input { padding-right: 36px; }
.password-reveal { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 0; transition: color 0.15s; }
.password-reveal:hover { color: var(--text); }

/* ─── Stats row ─── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat-value { font-family: var(--sans); font-size: 24px; font-weight: 700; margin-top: 6px; line-height: 1; }
.stat-value.green  { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red    { color: var(--red); }

/* ─── Pagination ─── */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; justify-content: flex-end; }
.pagination a, .pagination span { padding: 5px 11px; border-radius: var(--radius); font-size: 13px; border: 1px solid var(--border); color: var(--text-2); }
.pagination a:hover { color: var(--text); background: var(--bg-3); text-decoration: none; }
.pagination .current { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }

/* ─── Mobile topbar ─── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 150;
}
.mobile-topbar-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.mobile-topbar-logo:hover { text-decoration: none; }
.mobile-topbar-icon { font-size: 18px; color: var(--accent); }
.mobile-topbar-name { font-size: 14px; font-weight: 700; color: var(--text); }
.mobile-topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-topbar-user { font-size: 12px; color: var(--text-2); }
.mobile-menu-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; color: var(--text-2); font-size: 18px; cursor: pointer; line-height: 1; }
.mobile-menu-btn:hover { color: var(--text); }

/* ─── Mobile nav drawer ─── */
.mobile-nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; }
.mobile-nav-overlay.open { display: block; }
.mobile-nav-drawer {
  position: fixed;
  top: 0; left: -280px; bottom: 0;
  width: 260px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  z-index: 201;
  transition: left .25s ease;
  display: flex;
  flex-direction: column;
  padding: 20px 0 0;
}
.mobile-nav-drawer.open { left: 0; }
.mobile-nav-drawer .nav-item a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: var(--text-2); font-size: 15px; font-weight: 500; border-left: 2px solid transparent; transition: all .15s; }
.mobile-nav-drawer .nav-item a:hover { color: var(--text); background: var(--bg-3); text-decoration: none; }
.mobile-nav-drawer .nav-item.active a { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }
.mobile-nav-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-3); font-size: 22px; cursor: pointer; line-height: 1; }
.mobile-nav-close:hover { color: var(--text); }
.mobile-nav-user { padding: 16px 20px; border-top: 1px solid var(--border); margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.mobile-nav-username { font-size: 13px; color: var(--text-2); }

/* ─── Mobile domain cards ─── */
.domain-cards { display: none; flex-direction: column; gap: 10px; }
.domain-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-decoration: none; display: block; }
.domain-card:hover { text-decoration: none; border-color: var(--border-2); }
.domain-card.has-issue { border-color: var(--red); }
.domain-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.domain-card-fqdn { font-size: 15px; font-weight: 600; color: var(--text); }
.domain-card-profile { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.domain-card-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.domain-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-top: 1px solid var(--border); padding-top: 8px; }
.meta-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.meta-value { font-size: 12px; color: var(--text-2); margin-top: 1px; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .sidebar { display: none !important; }
  .mobile-topbar { display: flex !important; }
  .main-content { margin-left: 0 !important; padding: 16px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  #domains-table { display: none; }
  .domain-cards { display: flex; }
  #users-table { display: none; }
  #users-cards { display: flex; }
  .notif-cols { grid-template-columns: 1fr !important; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
