:root {
  color-scheme: light dark;
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-soft: #e9edf0;
  --ink: #182129;
  --muted: #5f6972;
  --line: #d4dbe0;
  --accent: #e65c1a;
  --accent-hover: #b9410b;
  --accent-soft: #fff0e7;
  --action: #c4470b;
  --action-hover: #9f3507;
  --on-accent: #ffffff;
  --input-bg: #ffffff;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --danger-line: #e4a7a2;
  --on-danger: #ffffff;
  --success: #176447;
  --success-soft: #edf9f3;
  --success-line: #a8dcc5;
  --neutral-soft: #eef1f3;
  --neutral-line: #cbd3d9;
  --shadow: rgb(32 42 49 / 14%);
  --radius: 6px;
  --panel-radius: 8px;
  --control-height: 42px;
  --input-padding: 9px 11px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
a { color: var(--accent-hover); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.brand {
  display: inline-block;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  color: var(--accent-hover);
  font-weight: 700;
  text-decoration: none;
}
label { display: grid; gap: 7px; color: var(--ink); font-weight: 600; }
input:not([type="checkbox"]):not([type="hidden"]) {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--ink);
  padding: var(--input-padding);
  font: inherit;
}
input:not([type="checkbox"]):not([type="hidden"]):hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--danger); }
button {
  min-height: var(--control-height);
  border: 1px solid var(--action);
  border-radius: var(--radius);
  background: var(--action);
  color: var(--on-accent);
  padding: 8px 15px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
button:hover { border-color: var(--action-hover); background: var(--action-hover); }
button:active { box-shadow: inset 0 2px 4px rgb(0 0 0 / 18%); }
button:disabled { cursor: wait; opacity: .72; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}
.notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 12px;
  align-items: start;
  padding: 11px 11px 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.notice-message { min-width: 0; padding-top: 3px; overflow-wrap: anywhere; }
.notice-error { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.notice-success { border-color: var(--success-line); background: var(--success-soft); color: var(--success); }
.notice-close {
  width: 30px;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 21px;
  font-weight: 400;
  line-height: 1;
}
.notice-close:hover { border: 0; background: rgb(127 127 127 / 12%); color: inherit; }
.confirm-dialog {
  width: min(420px, calc(100% - 28px));
  max-width: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 22px 64px rgb(18 25 30 / 30%);
}
.confirm-dialog::backdrop { background: rgb(17 22 26 / 62%); }
.confirm-dialog-surface { padding: 24px; border-top: 4px solid var(--accent); }
.confirm-dialog h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.confirm-dialog p { margin: 10px 0 0; color: var(--muted); line-height: 1.7; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.confirm-cancel { border-color: var(--line); background: var(--surface); color: var(--ink); }
.confirm-cancel:hover { border-color: var(--muted); background: var(--surface-soft); color: var(--ink); }
.confirm-danger { border-color: var(--danger); background: var(--danger); color: var(--on-danger); }
.confirm-danger:hover { border-color: var(--danger); background: var(--danger); color: var(--on-danger); filter: brightness(.9); }
.portal-toast-region {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
}
.portal-toast { box-shadow: 0 12px 32px var(--shadow); }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161a;
    --surface: #181e23;
    --surface-soft: #20272d;
    --ink: #f1f4f5;
    --muted: #acb5bc;
    --line: #39434a;
    --accent: #ff8140;
    --accent-hover: #ffab7d;
    --accent-soft: #3a241a;
    --action: #ff8140;
    --action-hover: #ffab7d;
    --on-accent: #1e1009;
    --input-bg: #11161a;
    --danger: #ff9c91;
    --danger-soft: #3a1d1a;
    --danger-line: #70413c;
    --on-danger: #2a0d0a;
    --success: #83d7ad;
    --success-soft: #173329;
    --success-line: #356d56;
    --neutral-soft: #20272d;
    --neutral-line: #4b565e;
    --shadow: rgb(0 0 0 / 35%);
  }
}
@media (max-width: 520px) {
  .confirm-dialog-surface { padding: 22px 18px 18px; }
  .confirm-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .confirm-dialog-actions button { width: 100%; }
  .portal-toast-region { right: 12px; bottom: 12px; width: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}