:root {
  --bg: #f4f6fa; --card: #fff; --fg: #121826; --mut: #5b6475; --line: #e2e6ee; --soft: #eef2f8;
  --acc: #1d4ed8; --acc-fg: #fff; --navy: #14213d; --ok: #0f7a3d; --ok-bg: #e3f4ea; --warn: #9a4b00; --warn-bg: #fff1e0;
  --bad: #b42318; --pass: #fff8e1; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --card: #161b24; --fg: #e7eaf0; --mut: #9aa3b2; --line: #273041; --soft: #1c2330;
    --acc: #6b9bff; --acc-fg: #0d1117; --navy: #c9d6f2; --ok: #5dd393; --ok-bg: #12301f; --warn: #ffb35c; --warn-bg: #33230f;
    --bad: #ff7b72; --pass: #2a2410;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 80px; }
main.wide { max-width: 1180px; }
a { color: var(--acc); }
h1 { font-size: 24px; margin: 16px 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0; }
.mut { color: var(--mut); }
.bad { color: var(--bad); }
.mono { font-variant-numeric: tabular-nums; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.stack { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > label { flex: 1 1 200px; }
.row.end { justify-content: flex-end; }
.inline { display: inline; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
label { display: grid; gap: 4px; font-weight: 500; font-size: 14px; }
input, select, textarea {
  font: inherit; font-weight: 400; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--fg); min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
button, .button {
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--acc); background: var(--acc);
  color: var(--acc-fg); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; min-height: 40px;
}
button.ghost, .button.ghost { background: transparent; color: var(--acc); border-color: var(--line); }
button.small { min-height: 30px; padding: 3px 10px; font-size: 13px; margin-left: 6px; }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: none; color: var(--mut); padding: 6px; min-height: 0; font-weight: 500; }
button:disabled { opacity: .6; cursor: progress; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0 4px; border-bottom: 1px solid var(--line); }
.top nav { color: var(--mut); }
.top nav a { color: var(--mut); text-decoration: none; }
.top nav strong { color: var(--fg); }
.top-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.top-actions .button { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.notice { background: var(--ok-bg); color: var(--ok); padding: 10px 14px; border-radius: 9px; }

.login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login form { text-align: left; }
.login h1 { margin-bottom: 4px; }
.login-logo { width: 96px; height: 96px; object-fit: contain; }
.brand { display: inline-flex; vertical-align: middle; margin-right: 10px; }
.brand img { height: 32px; width: auto; max-width: 120px; object-fit: contain; display: block; }
.logo-preview img { max-height: 120px; max-width: 240px; object-fit: contain; }

.team-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.team-card:hover { border-color: var(--acc); }
.team-card p { margin: 6px 0 0; }

.status { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 14px; padding: 10px 16px; }
.legend { font-size: 13px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 1px 7px; border-radius: 99px; vertical-align: 1px; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.assumed { background: var(--warn-bg); color: var(--warn); }
.warn { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 9px; margin: 10px 0 0; }

.event { padding: 0; overflow: hidden; scroll-margin-top: 12px; }
.event.gone { opacity: .7; }
.event > .warn, .event > details { margin: 10px 16px; }
.event-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--soft); border-bottom: 1px solid var(--line); }
.event-head h2 { font-size: 18px; }
.event-head h2::first-letter { text-transform: uppercase; }
.event-head p { margin: 2px 0 0; font-size: 14px; }
.progress {
  --p: 0; width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0);
}
.progress span { width: 42px; height: 42px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 12px; font-weight: 700; }

.rows { display: grid; }
.srow { display: grid; grid-template-columns: 64px minmax(200px, 1.1fr) 2fr; gap: 10px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.srow:last-child { border-bottom: none; }
.srow.pass { background: var(--pass); }
.srow .when { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; padding-top: 2px; }
.srow .label { font-weight: 600; }
.srow.own .label { color: var(--navy); }
.srow .meta { font-size: 12.5px; color: var(--mut); margin-top: 2px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.slot { gap: 2px; }
.slot .role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.slot select { min-height: 38px; padding: 6px 8px; font-size: 14px; }
.slot.filled select { border-color: var(--ok); background: var(--ok-bg); }
details summary { cursor: pointer; color: var(--acc); font-size: 14px; }
details.other ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
details.note form { margin-top: 8px; }
.danger-zone summary { color: var(--bad); }

fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: grid; gap: 8px; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.checks { display: grid; gap: 4px; max-height: 360px; overflow: auto; }
.checks label { display: flex; gap: 8px; align-items: baseline; font-weight: 500; }
.checks input { width: auto; min-height: 0; }

table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th, table.log td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log th { color: var(--mut); font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--navy); color: var(--card); padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 14px;
  transition: all .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 720px) {
  main { padding: 8px 12px 80px; }
  .srow { grid-template-columns: 52px 1fr; }
  .slots { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .event-head h2 { font-size: 16px; }
  table.log thead { display: none; }
  table.log tr { display: grid; grid-template-columns: 1fr 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.log td { border: none; padding: 2px 4px; }
}
@media (max-width: 380px) { .slots { grid-template-columns: 1fr; } }
