/* ============================================================
   BASE
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #0f172a;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   SHELL LAYOUT
   ============================================================ */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 220px;
  background: #1e293b;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  color: #38bdf8;
  font-size: 16px;
  font-weight: 700;
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #334155;
  margin-bottom: 12px;
}

.sidebar-logo span {
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: #94a3b8;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: #273549;
  color: #e2e8f0;
}

.nav-item.active {
  background: #0f2744;
  color: #38bdf8;
  font-weight: 500;
}

.nav-sep {
  border-top: 1px solid #334155;
  margin: 12px 0;
}

.nav-logout {
  color: #94a3b8;
}

.nav-logout:hover {
  background: #3b1a1a;
  color: #ef4444;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  margin-left: 220px;
  padding: 28px 32px;
  flex: 1;
  min-width: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.15s, filter 0.15s;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.88;
}

.btn:active {
  filter: brightness(0.92);
}

.btn-primary {
  background: #38bdf8;
  color: #0f172a;
}

.btn-secondary {
  background: #334155;
  color: #e2e8f0;
}

.btn-success {
  background: #14532d;
  color: #86efac;
}

.btn-danger {
  background: #450a0a;
  color: #fca5a5;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.form-input {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: #38bdf8;
}

.form-input::placeholder {
  color: #475569;
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #1e293b;
  border-radius: 10px;
  padding: 18px 20px;
}

.stat-card .label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 26px;
  font-weight: 700;
  color: #e2e8f0;
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.data-table th {
  background: #162032;
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 12px 16px;
  border-top: 1px solid #1e2d3d;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #243447;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green  { background: #14532d; color: #86efac; }
.badge-yellow { background: #713f12; color: #fde68a; }
.badge-red    { background: #450a0a; color: #fca5a5; }
.badge-gray   { background: #1e293b; color: #64748b; border: 1px solid #334155; }
.badge-blue   { background: #0c2a4a; color: #7dd3fc; }
.badge-purple { background: #2d1e4a; color: #c4b5fd; }

/* ============================================================
   TAGS
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.tag-green  { background: #14532d; color: #86efac; }
.tag-yellow { background: #713f12; color: #fde68a; }
.tag-red    { background: #450a0a; color: #fca5a5; }
.tag-blue   { background: #0c2a4a; color: #7dd3fc; }
.tag-purple { background: #2d1e4a; color: #c4b5fd; }
.tag-gray   { background: #1e293b; color: #64748b; }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #334155;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: #16a34a;
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 1px solid #334155;
  margin-bottom: 20px;
  gap: 4px;
}

.tab {
  padding: 8px 16px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: #e2e8f0;
}

.tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.detail-panel {
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-body {
  padding: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.info-grid .info-item label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

.info-grid .info-item span {
  font-size: 14px;
  color: #e2e8f0;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error   { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.alert-success { background: #14532d; color: #86efac; border: 1px solid #166534; }
.alert-warning { background: #713f12; color: #fde68a; border: 1px solid #92400e; }
.alert-info    { background: #0c2a4a; color: #7dd3fc; border: 1px solid #1e4976; }

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

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

.modal {
  background: #1e293b;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  color: #e2e8f0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search-box {
  flex: 1;
  max-width: 320px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.filter-btn:hover {
  background: #273549;
  color: #e2e8f0;
}

.filter-btn.active {
  background: #0f2744;
  color: #38bdf8;
  border-color: #38bdf8;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.top-bar h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 2px;
}

.top-bar .sub {
  font-size: 13px;
  color: #64748b;
}

/* ============================================================
   MONITOR GRID
   ============================================================ */
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.monitor-card {
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.monitor-header {
  padding: 14px 18px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}

.monitor-metrics {
  padding: 16px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric .metric-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric .metric-value {
  font-size: 20px;
  font-weight: 700;
  color: #e2e8f0;
}

/* ============================================================
   UPTIME BLOCKS
   ============================================================ */
.uptime-blocks {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.ub {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  background: #334155;
}

.ub.up   { background: #16a34a; }
.ub.down { background: #dc2626; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  border-radius: 50%;
  background: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.avatar-lg {
  width: 46px;
  height: 46px;
  font-size: 18px;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #0f172a;
}

.login-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 6px;
  text-align: center;
}

.login-card p {
  text-align: center;
  margin-bottom: 24px;
}

/* ============================================================
   COLORS
   ============================================================ */
.green  { color: #22c55e; }
.yellow { color: #f59e0b; }
.red    { color: #ef4444; }
.blue   { color: #38bdf8; }
.purple { color: #a78bfa; }
.gray   { color: #64748b; }

/* ============================================================
   UTILITY
   ============================================================ */
.section-title {
  margin-bottom: 24px;
}

.section-title h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.text-sm   { font-size: 12px; }
.text-muted { color: #64748b; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e2d3d;
}

.settings-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 20px;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  white-space: nowrap;
}

.settings-check input[type="checkbox"] {
  accent-color: #38bdf8;
  width: 16px;
  height: 16px;
}

/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.log-timeline {
  position: relative;
  padding-left: 28px;
}

.log-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: #1e2d3d;
  border-radius: 1px;
}

.log-entry {
  position: relative;
  padding: 10px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.log-entry::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
  border: 2px solid #0f172a;
}

.log-entry.log-up::before { background: #16a34a; }
.log-entry.log-down::before { background: #dc2626; }
.log-entry.log-maint::before { background: #d97706; }
.log-entry.log-billing::before { background: #38bdf8; }
.log-entry.log-notif::before { background: #a78bfa; }

.log-time {
  font-size: 11px;
  color: #64748b;
  min-width: 120px;
  flex-shrink: 0;
}

.log-msg {
  font-size: 13px;
  color: #e2e8f0;
}

.log-msg .text-muted {
  font-size: 12px;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.dash-card {
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.dash-card-title {
  padding: 14px 18px;
  border-bottom: 1px solid #334155;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.dash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #1e2d3d;
  font-size: 13px;
}

.dash-row:last-child {
  border-bottom: none;
}
