:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1d292a;
  background: #f4f7f6;
  --line: #dce5e2;
  --muted: #667572;
  --green: #087f5b;
  --red: #b42318;
}

* { box-sizing: border-box; }
body { margin: 0; }
header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(18px, calc((100vw - 1040px) / 2));
  background: #fff;
  border-bottom: 1px solid var(--line);
}
header strong { font-size: 16px; }
nav { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
main { width: min(100% - 32px, 880px); margin: 32px auto 72px; }
h1, h2, p { margin-top: 0; }

button, input, select { font: inherit; }
button {
  min-height: 38px;
  border: 1px solid #bdcbcc;
  border-radius: 5px;
  padding: 8px 13px;
  color: #203436;
  background: #fff;
  cursor: pointer;
}
button:hover { background: #eef4f3; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.primary { color: #fff; background: var(--green); border-color: var(--green); }
button.primary:hover { background: #066c4e; }
.auth { max-width: 420px; margin: 48px auto; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.auth h1 { margin-bottom: 20px; font-size: 22px; }
.auth form, .auth label { display: grid; gap: 9px; }
.auth form { gap: 14px; }
.auth label { color: var(--muted); font-size: 13px; }
input:not([type="checkbox"]), select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #bdcbcc; border-radius: 5px; background: #fff; }
.auth details { margin-top: 18px; }
.auth details form { margin-top: 16px; }

.summary, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.summary { margin-bottom: 20px; }
.summary h1 { margin-bottom: 5px; font-size: 24px; }
.summary p { margin: 0; color: var(--muted); font-size: 14px; }
.account-list { display: grid; gap: 8px; }
.account-row {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.account-row input { width: 18px; height: 18px; accent-color: var(--green); }
.avatar { width: 36px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #e2f2ec; color: var(--green); font-weight: 700; }
.account-info { min-width: 0; flex: 1; display: grid; gap: 3px; }
.account-info small { color: var(--muted); overflow-wrap: anywhere; }
.icon-button { min-width: 34px; border: 0; color: var(--muted); font-size: 20px; }
.actions { padding: 14px 0 18px; border-bottom: 1px solid var(--line); }
.history { margin-top: 24px; }
.history h2 { margin: 0; font-size: 18px; }
.section-head { min-height: 42px; margin-bottom: 5px; }
.batch { padding: 15px 0 8px; border-top: 1px solid var(--line); }
.batch > header { min-height: 30px; justify-content: flex-start; padding: 0; border: 0; background: transparent; }
.batch > header strong { font-size: 15px; }
.batch-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.batch ol { margin: 8px 0 0; padding: 0; list-style: none; }
.batch-item { padding: 14px 0; border-top: 1px solid #e9eeee; }
.item-heading { display: flex; align-items: center; gap: 9px; }
.item-heading strong { font-size: 14px; }
.status { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 8px; border-radius: 4px; background: #edf2f2; color: #405052; font-size: 12px; white-space: nowrap; }
.status-running, .status-queued { background: #e9f2ff; color: #285b96; }
.status-completed, .status-no_win, .status-no_draws, .status-skipped { background: #eaf4ef; color: #226342; }
.status-review, .status-uncertain, .status-failed, .status-phone_required { background: #fff1df; color: #875315; }
.status-waiting_payment { background: #fff5d7; color: #755b00; }
.item-note { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.payment, .review-panel, .warning-panel { margin-top: 10px; padding: 12px 14px; border-radius: 5px; }
.payment { border-left: 3px solid #d6a019; background: #fff9e8; }
.review-panel { border-left: 3px solid #b98528; background: #fff8e9; }
.warning-panel { border-left: 3px solid #c06b22; background: #fff3e8; }
.retry-panel { margin-top: 10px; padding: 12px 14px; border-left: 3px solid #397d62; border-radius: 5px; background: #edf7f1; }
.retry-panel strong { font-size: 14px; }
.retry-panel p { margin: 4px 0 9px; color: #53615e; font-size: 13px; line-height: 1.6; }
.warning-panel strong { font-size: 14px; }
.payment p, .review-panel p, .warning-panel p { margin: 4px 0 9px; color: #53615e; font-size: 13px; line-height: 1.6; }
.pay-link { display: inline-block; margin: 4px 0; color: #075c92; overflow-wrap: anywhere; }
.review-form { display: flex; gap: 8px; margin: 10px 0; }
.review-form select { max-width: 180px; }
.secondary-action { margin-top: 6px; }
.admin-account-list { border-top: 1px solid var(--line); }
.admin-account { display: grid; grid-template-columns: minmax(100px, .8fr) minmax(130px, 1.5fr) 70px auto; align-items: center; gap: 12px; min-height: 44px; padding: 7px 10px; border-bottom: 1px solid #e9eeee; font-size: 13px; }
.admin-owner, .admin-account > span:nth-child(3) { color: var(--muted); }
.empty { padding: 16px; border: 1px dashed var(--line); border-radius: 5px; color: var(--muted); background: #fff; font-size: 14px; }
#notice, .notice { margin: 10px 0 14px; padding: 10px 12px; border-radius: 5px; background: #e8f5f0; color: #075c47; font-size: 14px; }
#notice.error, .error { color: var(--red); }
#notice.error { background: #fff0ee; }
dialog { width: min(92vw, 360px); border: 1px solid var(--line); border-radius: 7px; padding: 22px; text-align: center; }
dialog::backdrop { background: #101c1dcc; }
dialog img { display: block; width: min(72vw, 250px); height: auto; margin: 16px auto; }
dialog p { color: var(--muted); }

@media (max-width: 600px) {
  main { width: calc(100% - 24px); margin-top: 18px; }
  header { padding: 0 12px; }
  nav { gap: 6px; }
  nav button { padding: 7px 9px; }
  .summary { align-items: flex-start; }
  .summary h1 { font-size: 21px; }
  .summary p { max-width: 38ch; line-height: 1.5; }
  .account-row { padding: 10px; }
  .batch > header { flex-wrap: wrap; }
  .batch-meta { margin-left: auto; }
  .review-form { flex-direction: column; }
  .review-form select { max-width: none; }
  .admin-account { grid-template-columns: minmax(85px, 1fr) minmax(110px, 1.3fr); gap: 4px 10px; }
  .admin-account .status { justify-self: start; }
}
