:root {
  --ink: #16333a;
  --mute: #5d7275;
  --line: #d5e0dd;
  --bg: #eef3f1;
  --surface: #fff;
  --primary: #0b6e66;
  --primary-dark: #085750;
  --danger: #c23b4b;
  --warn: #c98512;
  --ok: #1f8a5b;
  --sidebar: #14353a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 53, 58, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Cairo", Tahoma, sans-serif;
  font-weight: 700;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: #c5d8dc;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.12);
}
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid; place-items: center;
}
.brand strong { display: block; color: #fff; font-size: 1.05rem; }
.brand small { color: #8aa3a8; font-size: 0.75rem; }
.sidebar nav { padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  color: #b7cdd1;
  text-decoration: none;
  font-weight: 700;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar nav a.active { background: rgba(11,110,102,0.35); color: #dff7f3; }
.sidebar-foot {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.who { display: flex; gap: 8px; align-items: center; margin-bottom: 0.75rem; font-size: 0.85rem; }
.logout {
  display: inline-flex; gap: 8px; align-items: center;
  color: #fca5a5; text-decoration: none; font-size: 0.85rem;
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.5rem;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 1.3rem; }
.top-meta { color: var(--mute); font-size: 0.85rem; }
.content { padding: 1.25rem 1.5rem 2rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  border-right: 4px solid var(--primary);
}
.stat.online { border-right-color: var(--ok); }
.stat.stopped { border-right-color: var(--danger); }
.stat.ads { border-right-color: var(--warn); }
.stat .label { color: var(--mute); font-size: 0.82rem; margin-bottom: 0.35rem; }
.stat .value { font-size: 1.9rem; line-height: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}
.card-head h2 { font-size: 1.05rem; }
.card-body { padding: 1.1rem 1.2rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.75rem 0.85rem; border-bottom: 1px solid #e8efec; text-align: right; vertical-align: middle; }
th { color: var(--mute); font-size: 0.78rem; background: #f7faf9; }
tr:hover td { background: #fafcfb; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
}
.badge.ok { background: #e8f6ef; color: var(--ok); }
.badge.warn { background: #f8f0e2; color: var(--warn); }
.badge.danger { background: #fdecee; color: var(--danger); }
.badge.mute { background: #eef2f1; color: var(--mute); }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--primary);
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f4f7f6; }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 0.8rem; color: var(--mute); margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-weight: 600;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.85rem; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert.ok { background: #e8f6ef; color: #065f46; border: 1px solid #a7f3d0; }
.alert.err { background: #fdecee; color: #991b1b; border: 1px solid #fecaca; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, #0b6e66 0%, #0a5f58 55%, #14353a 100%);
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.login-card h1 { font-size: 1.4rem; margin-bottom: 0.35rem; }
.login-card p { color: var(--mute); margin-bottom: 1.25rem; font-size: 0.9rem; }
.login-card .field { margin-bottom: 0.85rem; }
.login-card .btn { width: 100%; justify-content: center; min-height: 44px; }

.muted { color: var(--mute); font-size: 0.82rem; font-weight: 600; }
.mono { font-family: Consolas, monospace; font-size: 0.78rem; font-weight: 600; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
