:root {
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --primary: #1b5fbf;
  --primary-soft: #e0edff;
  --danger: #d9534f;
  --text: #222;
  --muted: #6c757d;
  --border: #dde3f0;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 8px 20px rgba(15, 35, 52, 0.08);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #f0f5ff 0, var(--bg) 60%);
  color: var(--text);
}

.topbar {
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e1e7f3;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  height: 36px;
  width: auto;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--muted);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.topnav-link {
  text-decoration: none;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.topnav-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.topnav-user {
  font-weight: 500;
  color: var(--primary);
}

.topnav-logout {
  border: 1px solid #f3c6c6;
  color: var(--danger);
}

.page {
  max-width: 960px;
  margin: 1.5rem auto 2rem;
  padding: 0 1rem;
}

.section {
  margin-bottom: 1.5rem;
}

.section.centered {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem 1.7rem;
}

.card-narrow {
  max-width: 420px;
  width: 100%;
}

.card-title {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
}

.card-subtitle {
  margin-top: 0;
  font-size: 1.05rem;
}

.card-intro {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 800px) {
  .grid {
    grid-template-columns: 1.1fr 1.1fr;
  }
}

.form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.field-input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
}

.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(27, 95, 191, 0.15);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-full {
  width: 100%;
}

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

.btn-primary:hover {
  background: #144a94;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c74541;
}

.alert {
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.alert-error {
  background: #ffe5e5;
  color: #781b1b;
  border: 1px solid #f3b3b3;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.status-dot-on {
  background: #2ecc71;
}

.status-dot-off {
  background: #95a5a6;
}

.status-on {
  color: #1d6f3b;
}

.status-off {
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

.table th, .table td {
  border-bottom: 1px solid #edf0f7;
  padding: 0.45rem 0.35rem;
  text-align: left;
}

.table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.table tr:nth-child(even) td {
  background: #fafbff;
}

.card-footer-link {
  margin-top: 0.8rem;
  font-size: 0.85rem;
}

.card-footer-link a {
  color: var(--primary);
  text-decoration: none;
}

.card-footer-link a:hover {
  text-decoration: underline;
}

.footer {
  border-top: 1px solid #e1e7f3;
  padding: 0.7rem 1rem 1.1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}
