:root {
  color-scheme: light;
  font-family: Inter, 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  --bg: #f6f5f1;
  --surface: #fffefa;
  --line: #e9e5dc;
  --ink: #302f29;
  --muted: #686558;
  --accent: #815f39;
  --accent-hover: #694b2e;
  --accent-soft: #f1ebe0;
  --green: #365c4c;
  --green-soft: #eaf1e9;
  --red: #933b36;
  --red-soft: #fbefec;
  --shadow: 0 3px 16px #5040260a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55; }
h1, h2, p, dl, dd { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
.topbar { border-bottom: 1px solid var(--line); background: #faf9f5; }
.top-inner { max-width: 1160px; margin: auto; min-height: 62px; padding: 0 28px; display: flex; align-items: center; gap: 34px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 700; white-space: nowrap; }
.brand-mark, .number { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 8px; font-weight: 650; }
.brand-mark { width: 32px; height: 32px; font-size: 12px; }
nav { display: flex; gap: 4px; align-items: center; }
nav a, summary { padding: 7px 11px; border-radius: 7px; color: var(--muted); text-decoration: none; white-space: nowrap; }
nav a[aria-current='page'] { color: var(--accent-hover); background: var(--accent-soft); font-weight: 650; }
nav a:hover, summary:hover { background: var(--accent-soft); }
.account { position: relative; margin-left: auto; min-width: 0; }
summary { cursor: pointer; max-width: 235px; overflow: hidden; text-overflow: ellipsis; }
.menu-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); position: absolute; z-index: 2; right: 0; top: calc(100% + 8px); width: 190px; padding: 8px; }
.menu-panel span { display: block; padding: 7px 9px; overflow-wrap: anywhere; }
.menu-panel button { width: 100%; justify-content: flex-start; border-color: transparent; }
main { max-width: 1160px; margin: auto; padding: 32px 28px 55px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 1px 0 23px; }
h1 { font-size: 25px; line-height: 1.25; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(248px, 304px); gap: 20px; align-items: start; }
.form-column { display: grid; gap: 17px; min-width: 0; }
.panel, .history-item { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.section { padding: 19px 21px; min-width: 0; }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.number { width: 31px; height: 31px; font-size: 12px; }
.status-mark { width: 9px; height: 9px; border-radius: 50%; background: #7e9687; margin: 0 5px; }
.section-heading .badge { margin-left: auto; }
label, .field-title { display: block; font-weight: 600; }
label small, .field-title small { font-weight: 400; color: var(--muted); margin-left: 4px; }
input:not([type='file']), select, textarea { box-sizing: border-box; width: 100%; min-width: 0; color: var(--ink); background: #fff; border: 1px solid #dedacf; border-radius: 7px; padding: 9px 10px; min-height: 40px; }
textarea { resize: vertical; }
label :is(input,select,textarea), .inline-form { margin-top: 5px; }
::placeholder { color: #767267; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset { border: 0; display: grid; gap: 13px; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled :is(input,select,textarea), button:disabled { opacity: .57; }
button:disabled, fieldset:disabled .button { cursor: default; }
button, .button { min-height: 36px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 7px; padding: 6px 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: 550; text-decoration: none; white-space: nowrap; }
button:not(:disabled):hover, .button:hover { background: var(--accent-soft); }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:not(:disabled):hover { background: var(--accent-hover); }
.link { border-color: transparent; color: var(--accent); }
.inline-form, .source-summary, .two { display: flex; gap: 10px; align-items: center; }
.source-summary a { overflow-wrap: anywhere; }
.two > * { flex: 1; min-width: 0; }
.cover-field { display: grid; justify-items: start; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.cover-actions, .draft-actions, .dialog-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#cover-preview { display: block; width: min(100%, 320px); height: auto; max-height: 300px; object-fit: contain; background: var(--surface); border-radius: 6px; border: 1px solid var(--line); }
#cover-retry { margin-top: 8px; }
.segments { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; width: fit-content; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #f6f4ef; }
.segments label { position: relative; cursor: pointer; }
.segments input:not([type='file']) { position: absolute; opacity: 0; width: 1px; min-height: 0; padding: 0; }
.segments span { display: block; padding: 5px 8px; border-radius: 5px; color: var(--muted); }
.segments input:checked + span { background: var(--accent-soft); color: var(--accent-hover); }
.segments input:focus-visible + span { outline: 2px solid var(--accent); }
#source-form .segments { margin-bottom: 12px; }
#clip-form, #clip-summary, #vod-duration { margin-top: 12px; }
.clip-times { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 8px 0; }
.clip-times fieldset { display: flex; gap: 5px; min-width: 0; }
.clip-times legend { font-weight: 600; padding: 0; }
.clip-times label { font-size: 12px; text-align: center; color: var(--muted); }
.clip-times input:not([type='file']) { display: block; width: 56px; padding: 6px; }
.clip-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.tag-box { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 3px 5px; border: 1px solid #dedacf; border-radius: 7px; background: #fff; min-height: 40px; }
.tag-box:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-box ul { list-style: none; display: contents; }
.tag-box li { display: flex; gap: 3px; align-items: center; padding-left: 6px; background: var(--accent-soft); color: var(--accent-hover); border-radius: 4px; overflow-wrap: anywhere; max-width: 100%; }
.tag-box input:not([type='file']) { flex: 1; min-width: 72px; width: auto; padding: 3px; min-height: 30px; border: none; outline: none; }
.tag-box button { padding: 0 4px; min-height: 26px; }
.draft-actions { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 14px; justify-content: flex-end; }
.draft-actions span { margin-right: auto; }
.muted, dt, .empty-inline { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; padding: 3px 8px; color: var(--accent-hover); background: var(--accent-soft); font-size: 12px; border-radius: 5px; white-space: nowrap; font-weight: 600; }
.badge.neutral { background: #f2f0eb; color: var(--muted); }
.badge.good { background: var(--green-soft); color: var(--green); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.phase { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 27px; font-variant-numeric: tabular-nums; }
.progress-panel { margin: 0; }
progress { width: 100%; height: 9px; accent-color: var(--accent); display: block; margin: 11px 0 16px; }
.metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
dd { font-weight: 650; overflow-wrap: anywhere; }
.aside-footer { display: grid; gap: 5px; border-top: 1px solid var(--line); padding-top: 11px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.aside-footer div, .history-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history-toolbar { flex-wrap: wrap; justify-content: flex-end; }
.aside-footer strong { color: var(--ink); }
.progress-panel :is(a,button) { margin-top: 12px; }
.empty-inline { padding: 10px 0; }
.notice { background: var(--accent-soft); border-radius: 7px; padding: 8px 10px; margin-bottom: 15px; overflow-wrap: anywhere; }
.error { color: var(--red); margin-top: 8px; overflow-wrap: anywhere; }
.error:empty { display: none; }
.history-list { display: grid; gap: 10px; }
.history-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px 17px; }
.history-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.history-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.history-detail { margin-top: 4px; overflow-wrap: anywhere; }
.history-empty { border: 1px dashed #dcd6c9; border-radius: 8px; padding: 28px 18px; color: var(--muted); }
.login { width: min(100%, 390px); margin: 32px auto; padding: 23px; }
.login form { display: grid; gap: 12px; margin-top: 15px; }
dialog { width: min(420px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 21px; }
dialog::backdrop { background: #312b2280; }
dialog p { margin-top: 8px; overflow-wrap: anywhere; }
.dialog-actions { justify-content: flex-end; margin-top: 15px; }
.qr-frame { margin-top: 12px; text-align: center; min-height: 208px; }
.qr-frame img { border: 1px solid var(--line); border-radius: 7px; }
.visually-hidden { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.cover-actions label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .form-column { display: contents; }
  .source-section { grid-row: 1; }
  .progress-panel { grid-row: 2; }
  .draft-section { grid-row: 3; }
}
@media (max-width: 560px) {
  .top-inner { padding: 8px 14px 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
  nav { grid-row: 2; grid-column: 1 / -1; padding-bottom: 7px; }
  .account { grid-row: 1; grid-column: 2; max-width: 100%; }
  summary { max-width: 100%; }
  main { padding: 18px 13px 30px; }
  .page-heading { margin-bottom: 12px; }
  h1 { font-size: 21px; }
  .section { padding: 13px; }
  .two, .history-item { display: grid; grid-template-columns: minmax(0, 1fr); }
  .inline-form { align-items: stretch; }
  .cover-field { align-items: flex-start; }
}
