:root {
  --bg: #edf2f7;
  --sidebar: #0f2740;
  --sidebar-2: #163554;
  --white: #fff;
  --blue: #1e73be;
  --blue-dark: #155a96;
  --red: #c62828;
  --green: #2e7d32;
  --amber: #b78103;
  --line: #d7e0ea;
  --text: #1f2a37;
  --muted: #607080;
  --shadow: 0 10px 28px rgba(15, 39, 64, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, #0f2740, #1e73be 55%, #edf2f7);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--white);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.auth-card h1 { color: var(--blue-dark); font-size: 1.4rem; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 0.92rem; margin-bottom: 16px; }

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #dce7f3;
  padding: 22px 16px;
}
.brand {
  font-weight: 800;
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 22px;
}
.side-nav { display: grid; gap: 6px; }
.side-nav a {
  color: #dce7f3;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
}
.side-nav a:hover,
.side-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}
.content { padding: 22px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 1.35rem; }
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--blue-dark);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat .n {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--blue-dark);
  line-height: 1.1;
}
.stat .l { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

label { display: block; font-weight: 700; margin-bottom: 12px; font-size: 0.9rem; }
input[type=text], input[type=password], input[type=search], input[type=file], select, textarea {
  width: 100%;
  margin-top: 6px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.95rem;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.btn, button {
  display: inline-block;
  border: none;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}
.btn:hover, button:hover { background: var(--blue-dark); text-decoration: none; color:#fff; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a51f1f; }
.btn-secondary { background: #607080; }
.btn-green { background: var(--green); }
.btn-amber { background: var(--amber); color:#fff; }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline > * { flex: 1; min-width: 140px; }
.inline button, .inline .btn { flex: 0 0 auto; height: 42px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.alert.error { background: #fdecea; color: #b71c1c; border: 1px solid #f5c2c0; }
.alert.success { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.alert.info { background: #e3f2fd; color: #0d47a1; border: 1px solid #bbdefb; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.on { background: #e8f5e9; color: #1b5e20; }
.badge.off { background: #fdecea; color: #b71c1c; }
.actions form { display: inline; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.searchbar { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.searchbar input, .searchbar select { max-width: 220px; }
.menu-toggle { display:none; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; }
  .stats, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .stats, .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}
