:root {
  color-scheme: light;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #202624;
  background: #f4f6f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #202624;
  --muted: #707b77;
  --line: #e2e8e5;
  --paper: #fff;
  --wash: #f4f6f5;
  --green: #23765f;
  --green-dark: #185b49;
  --green-soft: #e8f3ef;
  --red: #b74646;
  --amber: #a76d22;
}
* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--wash); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.admin-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; display: flex; width: 244px; flex-direction: column; padding: 24px 16px 17px; border-right: 1px solid var(--line); background: #fff; }
.sidebar-brand, .login-brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; font-size: 14px; font-weight: 750; }
.sidebar-brand small, .login-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.brand-mark { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: var(--green); color: white; font-size: 17px; }
.side-nav { display: grid; gap: 4px; margin-top: 42px; }
.side-nav button { display: flex; min-height: 43px; align-items: center; gap: 12px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: #56615d; text-align: left; cursor: pointer; }
.side-nav button:hover { background: #f5f8f7; color: var(--ink); }
.side-nav button.is-active { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.nav-mark { width: 22px; color: #93a09a; font-family: ui-monospace, monospace; font-size: 10px; }
.side-nav button.is-active .nav-mark { color: var(--green); }
.nav-caption { margin: 22px 11px 5px; color: #929c98; font-size: 10px; }
.sidebar-bottom { display: grid; gap: 4px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-bottom a, .sidebar-bottom button { display: flex; min-height: 39px; align-items: center; justify-content: space-between; padding: 0 11px; border: 0; background: transparent; color: #63706b; font-size: 12px; cursor: pointer; }
.sidebar-bottom a:hover, .sidebar-bottom button:hover { color: var(--green); }
.main-area { min-height: 100vh; margin-left: 244px; padding: 0 34px 22px; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; min-height: 96px; align-items: center; justify-content: space-between; gap: 20px; margin: 0 -34px; padding: 15px 34px; border-bottom: 1px solid var(--line); background: rgba(244,246,245,.94); backdrop-filter: blur(10px); }
.topbar-kicker { color: #87928d; font-size: 9px; font-weight: 650; }
.topbar h1 { margin: 5px 0 0; font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.save-state { color: var(--muted); font-size: 11px; }
.save-state.is-dirty { color: var(--amber); }
.primary-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--green); border-radius: 4px; background: var(--green); color: white; font-size: 12px; font-weight: 650; cursor: pointer; }
.primary-button:hover { border-color: var(--green-dark); background: var(--green-dark); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.page-content { width: min(1060px, 100%); margin: 0 auto; padding: 27px 0 30px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.page-heading h2 { margin: 0; font-size: 15px; }
.page-heading p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.section-block { margin-bottom: 28px; }
.section-block > h2 { margin: 0 0 12px; font-size: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); }
.metric { min-height: 100px; padding: 18px 19px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 11px; font-size: 25px; font-weight: 650; }
.metric strong small { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .72fr); gap: 28px; margin-top: 29px; }
.overview-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.overview-list li { display: flex; min-height: 45px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); font-size: 12px; }
.overview-list span { color: var(--muted); }
.overview-list strong { font-weight: 600; text-align: right; }
.preview-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; color: var(--green); font-size: 12px; font-weight: 650; }
.edit-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; max-width: 820px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field > span, .field-label { color: #4c5853; font-size: 11px; font-weight: 650; }
.field input, .field textarea, .field select { width: 100%; min-width: 0; border: 1px solid #d8e0dc; border-radius: 4px; outline: 0; background: #fff; color: var(--ink); font-size: 12px; }
.field input, .field select { height: 39px; padding: 0 10px; }
.field textarea { min-height: 83px; resize: vertical; padding: 10px; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #579b84; box-shadow: 0 0 0 2px rgba(35,118,95,.1); }
.field-help { color: #929c98; font-size: 10px; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 12px; }
.editor-count { color: var(--muted); font-size: 11px; }
.secondary-button { min-height: 33px; padding: 0 12px; border: 1px solid #d4ded9; border-radius: 4px; background: #fff; color: var(--green-dark); font-size: 11px; cursor: pointer; }
.secondary-button:hover { border-color: var(--green); background: var(--green-soft); }
.editor-list { border-top: 1px solid var(--line); }
.editor-row { position: relative; display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 1fr) minmax(100px, .65fr) auto; gap: 12px; align-items: end; padding: 17px 0; border-bottom: 1px solid var(--line); }
.editor-row--faq { grid-template-columns: minmax(190px, .85fr) minmax(240px, 1.5fr) auto; }
.editor-row--task { grid-template-columns: minmax(160px, 1fr) minmax(200px, 1.4fr) 110px auto; }
.editor-row--plan { grid-template-columns: minmax(140px, .8fr) minmax(100px, .55fr) minmax(100px, .55fr) minmax(220px, 1.4fr) auto; }
.row-title { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin-bottom: -3px; color: #46524d; font-size: 11px; font-weight: 700; }
.row-number { color: #98a39e; font-family: ui-monospace, monospace; font-weight: 500; }
.field--compact input, .field--compact textarea, .field--compact select { height: 35px; font-size: 11px; }
.field--compact textarea { min-height: 58px; }
.row-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 35px; }
.switch-label { display: inline-flex; align-items: center; gap: 7px; color: #5c6863; font-size: 10px; white-space: nowrap; cursor: pointer; }
.switch-label input { width: 15px; height: 15px; accent-color: var(--green); }
.delete-button { min-height: 30px; padding: 0 7px; border: 0; background: transparent; color: var(--red); font-size: 10px; cursor: pointer; }
.delete-button:hover { text-decoration: underline; }
.empty-state { padding: 25px 0; color: var(--muted); font-size: 12px; }
.notice-strip { display: flex; align-items: start; gap: 10px; padding: 13px 15px; border-left: 3px solid #77a994; background: #ebf3ef; color: #53625c; font-size: 11px; line-height: 1.7; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; padding: 17px 0 0; border-top: 1px solid var(--line); color: #909a95; font-size: 10px; }
.login-view { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: #f1f5f3; }
.login-form { width: min(390px, 100%); padding: 29px 30px 30px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 12px 42px rgba(22,55,43,.07); }
.login-form .login-brand { padding: 0; }
.login-form h1 { margin: 31px 0 21px; font-size: 20px; }
.login-form label { display: grid; gap: 7px; margin: 13px 0; color: #4c5853; font-size: 11px; font-weight: 650; }
.login-form input { width: 100%; height: 41px; padding: 0 11px; border: 1px solid #d8e0dc; border-radius: 4px; outline: 0; font-size: 13px; }
.login-form input:focus { border-color: #579b84; box-shadow: 0 0 0 2px rgba(35,118,95,.1); }
.login-form .primary-button { width: 100%; margin-top: 6px; }
.form-error { min-height: 18px; margin: 4px 0 7px; color: var(--red); font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 23px; z-index: 8; max-width: min(420px, calc(100vw - 32px)); padding: 11px 15px; border-radius: 4px; background: #26332e; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.sidebar { overflow-y: auto; }
.editor-row--drama, .editor-row--ad, .editor-row--source { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px; margin: 12px 0; border: 1px solid var(--line); border-radius: 7px; background: white; }
.row-controls--wide { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 3px; }
.row-controls--wide .delete-button { margin-left: auto; }
.asset-control { display: flex; gap: 6px; min-width: 0; }
.asset-control > input { flex: 1; min-width: 0; }
.upload-button { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 51px; height: 35px; border: 1px solid #d4ded9; border-radius: 4px; color: var(--green); font-size: 11px; cursor: pointer; overflow: hidden; }
.upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.source-mapping { display: block; padding: 12px 0 0; border-top: 1px solid var(--line); }
.source-mapping summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.mapping-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 15px; }
.result-panel { margin: 22px 0; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.preview-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; }
.preview-item { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.preview-item strong { font-size: 12px; }
.preview-item span { color: var(--muted); font-size: 10px; }
.log-section { margin-top: 28px; }
.log-list { border-top: 1px solid var(--line); }
.log-row { display: grid; grid-template-columns: 1fr 110px 190px; gap: 8px 15px; padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.log-row strong { font-weight: 600; }
.log-row span, .log-row small { color: var(--muted); overflow-wrap: anywhere; }
.log-row small { grid-column: 1 / -1; line-height: 1.7; }
.config-state { margin-left: 12px; color: var(--muted); font-size: 11px; }
.script-list { display: grid; gap: 10px; }
.script-item { padding: 16px 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.script-item summary { display: flex; justify-content: space-between; align-items: center; gap: 15px; cursor: pointer; font-size: 12px; font-weight: 650; }
.script-item summary small { color: var(--muted); font-size: 10px; font-weight: 400; }
.script-item pre { font: inherit; font-size: 12px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 600px; overflow-y: auto; padding: 14px 0; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .sidebar { width: 205px; }
  .main-area { margin-left: 205px; padding-right: 23px; padding-left: 23px; }
  .topbar { margin-right: -23px; margin-left: -23px; padding-right: 23px; padding-left: 23px; }
  .editor-row, .editor-row--plan { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-row--faq, .editor-row--task { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-controls { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .sidebar { position: sticky; inset: 0 0 auto; width: 100%; height: auto; padding: 10px 12px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 0 2px 9px; }
  .brand-mark { width: 31px; height: 31px; font-size: 14px; }
  .side-nav { display: flex; gap: 3px; overflow-x: auto; margin: 0 -12px; padding: 0 10px 8px; }
  .side-nav button { min-height: 36px; flex: 0 0 auto; gap: 6px; padding: 0 9px; font-size: 11px; }
  .side-nav button .nav-mark, .nav-caption { display: none; }
  .sidebar-bottom { position: absolute; top: 11px; right: 11px; display: flex; margin: 0; padding: 0; border: 0; }
  .sidebar-bottom a { display: none; }
  .sidebar-bottom button { min-height: 31px; padding: 0 5px; font-size: 10px; }
  .main-area { min-height: calc(100vh - 85px); margin-left: 0; padding: 0 16px 18px; }
  .topbar { position: static; min-height: 78px; margin: 0 -16px; padding: 13px 16px; }
  .topbar-kicker { font-size: 8px; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions { gap: 8px; }
  .save-state { max-width: 70px; font-size: 9px; }
  .primary-button { min-height: 35px; padding: 0 11px; font-size: 11px; }
  .page-content { padding-top: 20px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric { min-height: 83px; padding: 14px; }
  .metric strong { margin-top: 8px; font-size: 22px; }
  .overview-grid { grid-template-columns: 1fr; gap: 23px; }
  .edit-form { grid-template-columns: 1fr; gap: 13px; }
  .field--wide { grid-column: auto; }
  .editor-row, .editor-row--faq, .editor-row--task, .editor-row--plan { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 0; }
  .row-title { margin-bottom: 0; }
  .row-controls { justify-content: space-between; }
  .page-footer { flex-direction: column; gap: 5px; }
  .login-form { padding: 25px 21px; }
  .editor-row--drama, .editor-row--ad, .editor-row--source { grid-template-columns: minmax(0, 1fr); padding: 15px; }
  .mapping-grid, .preview-items { grid-template-columns: minmax(0, 1fr); }
  .log-row { grid-template-columns: minmax(0, 1fr) auto; }
  .log-row span:nth-child(3), .log-row span:nth-child(4) { grid-column: 1 / -1; }
  .script-item summary { align-items: flex-start; flex-direction: column; gap: 6px; }
}
