:root {
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #dcdce0;
  --bg: #f6f6f7;
  --card: #fff;
  --accent: #b3122e;
  --ok: #1b7a3d;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

main { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.bar nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bar a { text-decoration: none; color: var(--muted); }
.bar a.on, .bar a:hover { color: var(--ink); }
.brand { font-weight: 700; color: var(--accent) !important; }

.tenant-head { margin-bottom: 20px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 20px; margin: 0 0 16px;
}
.narrow { max-width: 420px; margin: 48px auto; }
.item { position: relative; }
.item .delete { position: absolute; right: 20px; bottom: 20px; }

label { display: block; margin: 0 0 12px; font-weight: 500; }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .grow { flex: 1 1 260px; }

button {
  font: inherit; padding: 8px 16px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.danger { background: #fff; color: var(--accent); }
button.link { border: 0; background: none; color: var(--muted); padding: 0; }
button.link:hover { color: var(--ink); }
form.inline { display: inline; }

.notice { padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; }
.notice.error { background: #fdecef; color: var(--accent); }
.notice.ok { background: #e8f5ec; color: var(--ok); }

table { width: 100%; border-collapse: collapse; margin: 0 0 16px; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td.actions { text-align: right; }
td.actions form { display: inline; }
table.hours { background: none; }
table.hours input { margin: 0; min-width: 110px; }
table.hours .gap { color: var(--muted); text-align: center; }

.list { list-style: none; padding: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: 6px; margin: 0 0 8px; }
.list a { display: block; padding: 12px 16px; text-decoration: none; }

pre { overflow-x: auto; font-size: 13px; }

@media (max-width: 640px) {
  table.hours thead { display: none; }
  table.hours tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 0; }
  table.hours th { grid-column: 1 / -1; border: 0; }
  table.hours td { border: 0; padding: 0; }
  table.hours .gap { display: none; }
}

/* Admin panel */
body.admin .bar { background: #1d1d1f; border-bottom-color: #1d1d1f; }
body.admin .bar a, body.admin .bar button.link { color: #c7c7cc; }
body.admin .bar a.on, body.admin .bar a:hover { color: #fff; }
body.admin .brand { color: #fff !important; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--accent); color: #fff; vertical-align: middle; }
.crumbs { margin: 0 0 4px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.pill.on { background: #e8f5ec; border-color: #bfe3cb; color: var(--ok); }
.pill.off { background: #fdecef; border-color: #f4c4cd; color: var(--accent); }
.pill.wait { background: #fff6e0; border-color: #f0dca5; color: #7a5a00; }
h3 { font-size: 1rem; margin: 0 0 10px; }
.agent { border-top: 1px solid var(--line); padding: 16px 0 0; margin: 16px 0 0; }
.agent:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.actions-row { display: flex; gap: 8px; margin-top: 12px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
details { margin: 12px 0 0; }
summary { cursor: pointer; color: var(--accent); }
table.urls th { font-weight: 500; white-space: nowrap; vertical-align: top; width: 1%; }
table.urls code { word-break: break-all; font-size: 12px; }
