/* Admin-only, system-font interface. No external assets or game styles. */
:root { font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: #273831; background: #f6f7f8; color-scheme: light; --ink: #273831; --muted: #738078; --line: #e5e9e7; --accent: #316a53; --soft: #edf4ef; }
* { box-sizing: border-box; }
body { margin: 0; }
body > header { min-height: 72px; padding: 12px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand strong { display: block; font-size: 16px; letter-spacing: 1px; }
.brand span:not(.mark) { display: block; font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--soft); color: var(--accent); font-weight: 650; }
#identity { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
#username { max-width: 24ch; overflow-wrap: anywhere; font-size: 12px; }
main { min-height: calc(100vh - 134px); max-width: 1440px; margin: 0 auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 26px; font-weight: 650; line-height: 1.4; letter-spacing: -.4px; outline: none; }
h2 { margin-bottom: 0; font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; }
p { margin-bottom: 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #204f3b; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid #739d89; outline-offset: 3px; }
.muted, .footnote, .field-caption { color: var(--muted); }
.footnote, .field-caption { font-size: 12px; font-weight: 400; }
.footnote { margin: 10px 0 0; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 1px; }
.mono { font: 12px/1.6 ui-monospace, monospace; overflow-wrap: anywhere; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.auth { max-width: 440px; margin: 56px auto; padding: 32px; box-shadow: 0 8px 32px #20392e05; }
.auth h1 { font-size: 26px; }
.auth .primary { width: 100%; margin-top: 20px; }
.auth > .quiet { margin-top: 12px; }
label { display: block; margin-top: 20px; min-width: 0; font-size: 13px; font-weight: 600; }
input, select { display: block; width: 100%; min-width: 0; min-height: 42px; margin-top: 8px; padding: 9px 12px; font: inherit; font-weight: 400; color: inherit; border: 1px solid #ccd6d0; border-radius: 6px; background: #fff; }
input::placeholder { color: #8a968f; opacity: 1; }
input:focus, select:focus { outline: 2px solid #739d89; outline-offset: 2px; }
input:disabled { background: #f4f6f5; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; min-height: 24px; }
button { font: inherit; font-size: 13px; line-height: 1.5; font-weight: 600; cursor: pointer; border: 1px solid transparent; border-radius: 6px; padding: 10px 16px; min-height: 42px; flex-shrink: 0; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: #275940; }
.secondary { background: #fff; color: var(--ink); border-color: #ccd6d0; }
.secondary:hover:not(:disabled) { background: #f4f7f5; }
.quiet { background: transparent; color: var(--muted); padding: 8px 10px; font-weight: 500; }
.quiet:hover { background: var(--soft); color: var(--ink); }
.badge { padding: 3px 8px; border: 1px solid #dbe7df; border-radius: 4px; color: #486950; background: #f1f6f2; font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
#workspace { display: grid; grid-template-columns: 200px minmax(0,1fr); min-height: calc(100vh - 134px); }
.sidebar { padding: 36px 16px 20px; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; }
.nav-label { margin: 0 12px 12px; color: #909b95; font-size: 11px; letter-spacing: 1px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 46px; border-radius: 6px; font-size: 13px; color: #65716b; }
.sidebar nav a[aria-current=page] { background: #edf4ef; color: #285c42; font-weight: 600; }
.sidebar nav a:hover { background: #f3f7f4; }
.sidebar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace-main { min-width: 0; padding: 0 40px 48px; }
.context-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; min-height: 80px; padding: 16px 0; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.context-bar > label { display: flex; align-items: center; gap: 12px; white-space: nowrap; margin: 0; font-size: 12px; color: var(--muted); }
.context-bar select { margin: 0; width: 156px; min-height: 38px; font-size: 13px; padding: 7px 10px; }
.context-bar > .badge { max-width: 12ch; }
.context-details { margin-left: auto; font-size: 12px; min-width: 0; }
.context-details summary { color: var(--muted); }
.context-details[open] { flex-basis: 100%; order: 2; margin: 0; }
.context-details dl { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 12px 0 0; }
.context-details dl > div { display: flex; gap: 12px; min-width: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
#reload { font-size: 12px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 0 24px; }
.page-heading p { color: var(--muted); font-size: 13px; margin: 0; }
.record-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.page-note { font-size: 12px; color: var(--muted); margin: 16px 0 0; line-height: 1.8; }
.back-link { display: inline-flex; align-items: center; min-height: 40px; font-size: 12px; color: var(--muted); margin: -8px 0 12px; }
.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
th { color: var(--muted); font-size: 12px; font-weight: 500; background: #fafbfa; }
th, td { padding: 20px 24px; }
th:first-child { width: 34%; } th:nth-child(2) { width: 16%; } th:last-child { width: 84px; }
td { border-top: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
td strong { display: block; font-weight: 600; font-size: 14px; }
.ad-id { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); margin-top: 5px; font-size: 11px; }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: #77827b; font-size: 12px; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #aeb7b1; }
.status.enabled { color: #316a53; }.status.enabled::before { background: #4e9470; }
.rule { font-size: 12px; line-height: 1.9; }.rule small { font-size: 11px; color: var(--muted); }
.edit-link { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; white-space: nowrap; font-size: 13px; font-weight: 500; }
.draft-tag { display: block; margin-top: 5px; color: #9b7133; font-size: 11px; }
.empty-state { padding: 64px 24px; text-align: center; color: var(--muted); font-size: 13px; }
.editor, .version-card { max-width: 800px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.setting-section { padding: 20px 28px; border-bottom: 1px solid var(--line); }
.setting-section h2 { margin: 0 0 16px; font-size: 15px; }
.setting-section > label { margin-top: 18px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 16px; }
.field-row > div:first-child { min-width: 0; }
.field-row label { margin: 0; }
.field-row p { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.switch { display: flex; align-items: center; width: 40px; min-height: 44px; flex: 0 0 40px; position: relative; margin: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.switch > span { display: block; width: 40px; height: 22px; border-radius: 20px; background: #c6cfc9; pointer-events: none; }
.switch > span::after { content: ''; display: block; width: 16px; height: 16px; margin: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px #0002; }
.switch input:checked + span { background: var(--accent); }.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid #739d89; outline-offset: 3px; }.switch input:disabled + span { opacity: .5; }
.number-input { position: relative; width: 132px; flex: 0 0 132px; }
.number-input input { margin: 0; padding-right: 50px; }
.number-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.number-input input::-webkit-inner-spin-button { -webkit-appearance: none; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.delivery-notes { padding: 16px 28px; }.delivery-notes ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.editor-footer { padding: 16px 28px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-footer p { margin: 0; color: var(--muted); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
#draft-state.pending { color: #8b652e; }
.history-row { display: grid; grid-template-columns: 80px minmax(0,1fr) auto; gap: 24px; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row strong { font-size: 14px; }.history-row p { margin: 0 0 4px; font-size: 13px; }.history-row small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; display: block; }
.version-section { padding: 24px 28px; border-bottom: 1px solid var(--line); }.version-section:last-child { border: 0; }
.version-section h2 { font-size: 15px; margin-bottom: 16px; }.version-section dl { margin: 0; font-size: 13px; }.version-section dl > div { display: grid; grid-template-columns: 160px minmax(0,1fr); gap: 24px; margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#workspace-notice { padding: 12px 16px; border: 1px solid #c5d9ca; border-radius: 6px; margin-bottom: 20px; background: #edf6ef; font-size: 13px; overflow-wrap: anywhere; }
#workspace-notice.error { background: #fff0eb; border-color: #eac8bc; color: #984330; }
#notice { margin: 20px 24px; }
.qr { text-align: center; padding: 16px 0; }
.qr img { max-width: 100%; height: auto; display: inline-block; vertical-align: top; }
.secret { display: block; overflow-wrap: anywhere; background: var(--soft); border-radius: 8px; padding: 12px; margin-top: 12px; font-size: 15px; user-select: all; }
summary { cursor: pointer; color: var(--accent); font-size: 13px; }
#recovery-codes { display: grid; gap: 8px; margin: 20px 0; font: 13px ui-monospace, monospace; user-select: all; }
#recovery-codes code { padding: 10px; background: var(--soft); border-radius: 6px; overflow-wrap: anywhere; }
#notice { background: #e7f1e9; border: 1px solid #c5d9ca; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; overflow-wrap: anywhere; }
#notice.error { background: #fff0eb; border-color: #eac8bc; color: #984330; }
/* Native top layer covers the viewport; only the panel body may scroll. */
html.modal-open { overflow: hidden; }
dialog {
  position: fixed; inset: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; margin: 0;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  border: 0; background: transparent; color: var(--ink); overflow: hidden;
}
dialog[open] { display: grid; place-items: center; }
dialog::backdrop { background: #172b24a3; }
.dialog-panel {
  width: min(100%, 600px); max-height: 100%; min-height: 0; margin: 0;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; box-shadow: 0 24px 80px #10281c33;
}
#security-dialog .dialog-panel { width: min(100%, 520px); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.dialog-header h2 { margin-top: 4px; outline: none; }
.icon-button { background: #f2f5f3; color: var(--muted); width: 44px; height: 44px; padding: 0; font-size: 26px; line-height: 1; font-weight: 400; }
.icon-button:hover { background: #e5eee8; }
.dialog-body { padding: 24px; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.dialog-body > :first-child { margin-top: 0; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fafcfb; flex-shrink: 0; }
.dialog-footer button { min-width: 100px; }
.publish-context { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 20px; font-size: 13px; }
#publish-scope { margin: 0; overflow-wrap: anywhere; }
#changes { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.change-row { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.change-row:last-child { border-bottom: 0; }
.change-row strong { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.change-values { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 8px; align-items: start; }
.change-values > span { overflow-wrap: anywhere; min-width: 0; }
.change-old { color: var(--muted); }
.change-new { color: #205d41; font-weight: 500; }
.change-arrow { color: #8b9f92; text-align: center; }
.dialog-error { color: #a23d29; font-size: 13px; overflow-wrap: anywhere; margin: 12px 0 0; }
.dialog-error:empty { display: none; }
.security-intro { font-size: 13px; }
.security-section { border: 1px solid var(--line); border-radius: 10px; margin-top: 16px; }
.security-section > summary { padding: 16px; color: var(--ink); font-size: 14px; font-weight: 600; }
.security-section form { padding: 0 16px 16px; }
.security-section form > label:first-child { margin-top: 0; }
.security-section button { margin-top: 16px; }
body > footer { padding: 20px max(24px, calc((100vw - 1120px) / 2)); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; }
[hidden] { display: none !important; }
@media (max-width: 1100px) {
  #workspace { grid-template-columns: 168px minmax(0,1fr); }
  .workspace-main { padding: 0 24px 40px; }
  th, td { padding: 18px 16px; }
  th:first-child { width: 30%; } th:nth-child(2) { width: 20%; } th:last-child { width: 72px; }
}
@media (max-width: 800px) {
  #workspace { display: block; }
  .sidebar { padding: 8px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-label { display: none; }
  .sidebar nav { display: flex; gap: 8px; }.sidebar nav a { padding: 10px 16px; min-height: 42px; }
}
@media (max-width: 540px) {
  body > header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  #identity { width: 100%; justify-content: flex-start; gap: 8px; }
  #username { flex: 1; max-width: none; }
  #identity .quiet { padding: 8px; font-size: 12px; }
  .workspace-main { padding: 0 16px 32px; }.sidebar { padding: 6px 16px; }.sidebar nav a { padding: 10px 12px; }
  .context-bar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; margin-bottom: 22px; padding: 16px 0 10px; }
  .context-bar > label { gap: 10px; grid-column: 1; grid-row: 1; }.context-bar select { width: 100%; max-width: 170px; }
  .context-bar > .badge { grid-column: 2; grid-row: 1; justify-self: end; }.context-details, .context-details[open] { margin-left: 0; grid-column: 1; grid-row: 2; align-self: start; padding-top: 10px; }
  #reload { margin-left: auto; grid-column: 2; grid-row: 2; align-self: start; }.context-details dl { display: grid; gap: 10px; }.context-details dl > div { display: block; }.context-details dt { font-size: 11px; }.context-details dd { margin-top: 4px; }
  .page-heading { align-items: flex-start; gap: 12px; margin-bottom: 20px; }.page-heading h1 { font-size: 23px; }.record-count { font-size: 11px; padding-top: 8px; }
  table, tbody { display: block; } thead { display: none; }
  tr { display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 20px; gap: 8px 16px; border-bottom: 1px solid var(--line); }tr:last-child { border: 0; }
  td { padding: 0; border: 0; min-width: 0; }td:first-child { grid-row: 1; grid-column: 1; }td:nth-child(2) { grid-row: 1; grid-column: 2; padding-top: 2px; }td.rule { grid-row: 2; grid-column: 1; }td:last-child { grid-row: 2; grid-column: 2; align-self: end; }
  .rule { font-size: 12px; }.ad-id { max-width: 180px; }.edit-link { min-height: 44px; }
  .setting-section, .version-section { padding: 22px 20px; }.field-row { gap: 16px; }.number-input { flex-basis: 100px; width: 100px; }.field-row p { font-size: 11px; }
  .delivery-notes { padding: 20px; }.editor-footer { flex-direction: column; align-items: stretch; padding: 20px; gap: 14px; }.editor-footer .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.editor-footer button { padding-left: 10px; padding-right: 10px; }
  .history-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; padding: 20px; }.history-row > div { grid-row: 2; grid-column: 1 / -1; }.history-row > a { grid-column: 2; grid-row: 1; }.history-row p { font-size: 12px; }
  .version-section dl > div { grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); gap: 16px; font-size: 12px; }
  .auth { margin: 24px 16px; padding: 24px; }input, select { font-size: 16px; }.context-bar select { font-size: 16px; }
  dialog { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .dialog-header { padding: 16px 20px; }.dialog-body { padding: 20px; }.dialog-footer { padding: 14px 20px; }.dialog-footer button { flex: 1; min-width: 0; }
  .change-values { grid-template-columns: 20px minmax(0,1fr); gap: 6px; }.change-old { grid-column: 2; }.change-arrow { grid-row: 2; }.change-new { grid-column: 2; grid-row: 2; }
  body > footer { padding: 16px; }
}
@media (max-width: 360px) {
  .workspace-main { padding-left: 12px; padding-right: 12px; }.sidebar { padding-left: 12px; padding-right: 12px; }
  .setting-section, .version-section, .editor-footer, .delivery-notes { padding-left: 16px; padding-right: 16px; }.field-row { gap: 12px; }
  .frequency .field-row { display: block; }.number-input { width: 100%; margin-top: 10px; }
  .dialog-header, .dialog-body { padding: 16px; }.dialog-footer { padding: 12px 16px; }tr { padding: 18px 16px; }.ad-id { max-width: 150px; }
}
@media (max-height: 480px) { dialog { padding: 8px; }.dialog-header { padding-top: 10px; padding-bottom: 10px; }.dialog-footer { padding-top: 10px; padding-bottom: 10px; } }
