:root {
  --bg: #fafafa;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --card: #fff;
  --accent: #0a66c2;
  --warn-bg: #fdecea;
  --warn-fg: #b3261e;
  --ok: #1e7e34;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161617;
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --line: #3a3a3c;
    --card: #1f1f21;
    --accent: #4da3ff;
    --warn-bg: #3b1714;
    --warn-fg: #ff8a80;
    --ok: #6fdc8c;
  }
}
* {
  box-sizing: border-box;
}
/* hidden wins over the display set below (main is a grid, .chips a flex box). */
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 -apple-system, "PingFang TC", sans-serif;
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
header .spacer {
  flex: 1;
}
h1 {
  font-size: 17px;
  margin: 0;
}
h2 {
  font-size: 15px;
  margin: 0;
}
.target {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.target.live {
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.target.local {
  background: var(--line);
}
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}
section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
}
th {
  color: var(--muted);
  font-weight: 500;
  border-top: none;
  white-space: nowrap;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
a {
  color: var(--accent);
}
/* Short columns stay on one line; the content column takes the room. */
#scheduled td:nth-child(-n + 4),
#scheduled td:nth-child(6),
#scheduled td:nth-child(8),
#log td:nth-child(-n + 4),
#holidays td:nth-child(-n + 2),
button {
  white-space: nowrap;
}
.status {
  font-weight: 600;
  white-space: nowrap;
}
.status.sent,
.status.validated {
  color: var(--ok);
}
.status.failed,
.status.missed {
  color: var(--warn-fg);
}
input,
textarea,
button {
  font: inherit;
  color: inherit;
}
input[type="text"],
input[type="email"],
input[type="password"],
input:not([type]),
textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
textarea {
  min-height: 60px;
  resize: vertical;
}
button {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 7px 18px;
}
button.primary.danger {
  background: var(--warn-fg);
  border-color: var(--warn-fg);
}
.message {
  min-height: 1.5em;
  margin-top: 8px;
}
.message.error {
  color: var(--warn-fg);
}
.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
form {
  display: grid;
  gap: 14px;
  max-width: 820px;
}
.field {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 4px 12px;
  align-items: start;
}
.field > .label {
  padding-top: 6px;
  color: var(--muted);
}
.field > .hint {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}
.field > .hint.error {
  color: var(--warn-fg);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chip {
  border-radius: 999px;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
#other-day {
  width: 180px;
}
#time {
  width: 80px;
  text-align: center;
}
#dedupe_key {
  margin-top: 6px;
}
.choice {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.choice small {
  display: block;
  color: var(--muted);
}
.choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.choice.danger:has(input:checked) {
  border-color: var(--warn-fg);
  background: var(--warn-bg);
  box-shadow: inset 0 0 0 1px var(--warn-fg);
}
.preview {
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.preview .title {
  font-weight: 600;
}
.preview .empty {
  color: var(--muted);
}
.preview .link {
  color: var(--accent);
  font-size: 12px;
  word-break: break-all;
}
details summary {
  cursor: pointer;
  color: var(--muted);
}
.submit {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
#confirm-production {
  width: 260px;
}
#login {
  max-width: 360px;
  margin: 48px auto;
}
#login form {
  gap: 10px;
}
#login label {
  display: grid;
  gap: 4px;
  color: var(--muted);
}
/* A handled holiday: still listed, quieter. */
tr.handled td {
  color: var(--muted);
}
