:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1b1f24; --muted: #6b7280; --line: #e5e7eb;
  --accent: #1f5fbf; --accent-ink: #fff; --ok: #e7f6ec; --ok-ink: #14532d;
  --warn: #fff4d6; --warn-ink: #7a4b00; --err: #fde8e8; --err-ink: #8a1c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
h1 { margin: 0 0 4px; font-size: 26px; }
h2 { margin: 0 0 10px; font-size: 18px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 18px; }
.clock { margin-left: auto; text-align: right; line-height: 1.15; }
.clock #now { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; display: block; }
.clock .muted { font-size: 13px; }

.banner { max-width: 1000px; margin: 12px auto 0; padding: 10px 14px; border-radius: 8px; }
.banner.ok { background: var(--ok); color: var(--ok-ink); }
.banner.warn { background: var(--warn); color: var(--warn-ink); }
.banner.err { background: var(--err); color: var(--err-ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; }
.card.narrow { max-width: 380px; margin: 12vh auto; }
.card.danger { border-style: dashed; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row label { display: flex; align-items: center; gap: 6px; }
.inline { display: inline; }

input, select, button { font: inherit; }
input[type=text], input:not([type]), input[type=password], input[type=date], input[type=time], select {
  padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; min-width: 0;
}
input[type=file] { max-width: 100%; }
.title-input { font-size: 20px; font-weight: 700; flex: 1; }
button { padding: 8px 14px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; cursor: pointer; }
button:hover { background: #f3f4f6; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.quiet { color: var(--muted); }
button.small { padding: 4px 10px; font-size: 13px; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }

.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; align-items: end; }
.week label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.week select { width: 100%; }
.week button { grid-column: 1 / -1; justify-self: start; }

.schedules { list-style: none; padding: 0; margin: 0 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: #f9fafb; color: var(--ink); font-weight: 600; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

table { border-collapse: collapse; width: 100%; }
td, th { padding: 6px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; border-top: none; }
tr:first-child td { border-top: none; }
td.t { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.r { text-align: right; white-space: nowrap; }
.bells td.t { font-weight: 600; width: 1%; }
.bells.edit input[type=time] { width: 120px; }
.bells.edit input[name=label] { width: 100%; }
.bells.edit select { max-width: 200px; }
tr.add td { background: #f9fafb; }
tr.bad td { background: var(--err); }
.err-text { color: var(--err-ink); font-size: 13px; }
.tag { font-size: 11px; background: var(--ok); color: var(--ok-ink); padding: 2px 6px; border-radius: 999px; vertical-align: middle; }

footer { max-width: 1000px; margin: 8px auto 32px; padding: 0 16px; font-size: 13px; }
body.login main.card form { display: flex; flex-direction: column; gap: 10px; }
