:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #dfe3e8;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  background: #111827;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 56px;
}
.topnav .brand { font-weight: 600; margin-right: 28px; color: #fff; }
.topnav a { color: #cbd5e1; margin-right: 18px; font-size: 14px; }
.topnav a.active { color: #fff; font-weight: 600; }
.topnav .spacer { flex: 1; }
.topnav .user { font-size: 13px; color: #9ca3af; margin-right: 14px; }

.container { max-width: 1000px; margin: 32px auto; padding: 0 16px; }
.container.narrow { max-width: 420px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 12px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 4px; }
input[type=text], input[type=password], input[type=email], select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

button, .btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
}
button:hover, .btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: #6b7280; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12px; margin-top: 0; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.success { background: #dcfce7; color: #14532d; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }

input[type=datetime-local] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  margin-top: 8px;
}
input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }

.badge.ok { background: #dcfce7; color: #14532d; }
.badge.off { background: #fee2e2; color: #991b1b; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.big { font-size: 20px; font-weight: 600; margin: 2px 0 6px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.req { color: var(--danger); }
.warn-text { color: #b45309; font-size: 13px; }

.info-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; font-size: 14px; }
.info-row .muted { margin-bottom: 4px; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-form .span2 { grid-column: 1 / -1; }
.grid-form .muted { margin-top: 4px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.inline .btn { white-space: nowrap; }
.inline-form { display: inline; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-right: 16px; }

tr.disabled td { color: var(--muted); }
table.dim td { color: var(--muted); font-size: 13px; }
td .btn.small + .inline-form button { margin-left: 4px; }

@media (max-width: 700px) {
  .info-row, .grid-form { grid-template-columns: 1fr; }
  .topnav { overflow-x: auto; }
  table { display: block; overflow-x: auto; }
}

.badge.all { background: #e0e7ff; color: #3730a3; }
.topnav .inline-form { display: inline; }
button.linklike { background: none; color: #cbd5e1; padding: 0; margin: 0; font-size: 14px; }
button.linklike:hover { background: none; color: #fff; text-decoration: underline; }
.topnav a.user { margin-right: 14px; font-size: 13px; color: #9ca3af; }
.card.login { margin-top: 60px; }
.card.login h1 { text-align: center; }
.card.login button { width: 100%; }
.narrow-card { max-width: 440px; }
.badge.warn { background: #fef3c7; color: #92400e; }
