:root {
  --ink: #172033;
  --muted: #687386;
  --line: #dce2e9;
  --paper: #ffffff;
  --canvas: #f4f6f8;
  --brand: #1358d8;
  --brand-dark: #0d42a6;
  --cyan: #12a8a0;
  --danger: #c43b42;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color: var(--ink); background: var(--canvas); letter-spacing: 0; }
button, input { font: inherit; }
a { color: inherit; }

.topbar { height: 64px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: var(--ink); color: #fff; border-radius: 6px; font-size: 13px; font-weight: 800; }
.page-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 36px 0 56px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 2px 0 8px; font-size: 30px; line-height: 1.25; }
.eyebrow { margin: 0; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: 1.8px; }
.muted { margin: 0; color: var(--muted); line-height: 1.7; }
.small { font-size: 13px; }

.btn { min-height: 38px; padding: 8px 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .18s, border-color .18s, color .18s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-quiet { background: #fff; border-color: var(--line); }
.btn-quiet:hover { background: #f1f4f7; border-color: #c9d1dc; }
.btn-danger { color: var(--danger); background: #fff; border-color: #efc8ca; }
.btn-danger:hover { background: #fff1f1; }
.btn-block { width: 100%; }

.project-list { display: grid; gap: 10px; }
.project-row { min-height: 132px; padding: 20px; display: grid; grid-template-columns: minmax(260px, 1.35fr) 105px minmax(280px, .95fr) auto; gap: 22px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.project-identity { min-width: 0; display: flex; align-items: center; gap: 15px; }
.project-avatar { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 7px; background: #e8effd; color: var(--brand); font-size: 20px; font-weight: 800; }
.project-copy { min-width: 0; }
.project-title-line { display: flex; align-items: center; gap: 8px; }
.project-title-line h2 { margin: 0 0 6px; max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.project-copy code { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; }
.status { padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-on { background: #e2f5ee; color: #157455; }
.status-off { background: #edf0f3; color: #687386; }
.project-meta { display: grid; gap: 5px; }
.project-meta span, .project-link label { color: var(--muted); font-size: 11px; }
.project-meta strong { font-size: 13px; }
.project-link { min-width: 0; display: grid; gap: 6px; }
.copy-field { display: flex; }
.copy-field input { min-width: 0; width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: 6px 0 0 6px; color: #445066; background: #f8f9fb; }
.copy-field .btn { border-radius: 0 6px 6px 0; }
.project-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.empty-state { padding: 80px 20px; text-align: center; background: #fff; border: 1px dashed #cbd3dd; border-radius: var(--radius); }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(330px, .7fr); gap: 20px; align-items: start; }
.panel { padding: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.panel h2 { margin: 4px 0 18px; font-size: 20px; }
.form-stack { display: grid; gap: 21px; }
.form-stack > label { display: grid; gap: 8px; }
.form-stack label > span, .form-stack strong { font-size: 13px; font-weight: 700; }
.form-stack input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid #cfd6df; border-radius: 6px; outline: none; background: #fff; }
.form-stack input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19,88,216,.1); }
.form-stack small { color: var(--muted); font-size: 12px; }
.prefix-input { display: flex; }
.prefix-input > span { height: 43px; padding: 0 12px; display: flex; align-items: center; border: 1px solid #cfd6df; border-right: 0; border-radius: 6px 0 0 6px; color: var(--muted); background: #f5f7f9; font-family: Consolas, monospace; }
.prefix-input input { border-radius: 0 6px 6px 0; font-family: Consolas, monospace; }
.switch-row { padding: 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid #edf0f3; }
.switch-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.switch { position: relative; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 42px; height: 24px; display: block; border-radius: 999px; background: #b9c1cb; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; width: 18px; height: 18px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.form-actions { padding-top: 4px; display: flex; justify-content: flex-end; gap: 8px; }
.video-preview { width: 100%; aspect-ratio: 16/9; overflow: hidden; display: grid; place-items: center; background: #070a10; border-radius: 6px; color: #dbe3ec; text-align: center; }
.video-preview video { width: 100%; height: 100%; object-fit: contain; }
.video-preview p { margin: 8px 0 0; color: #8e9aaa; font-size: 12px; }
.video-empty { background: #eef2f5; color: var(--ink); border: 1px dashed #c7d0da; }
.video-empty p { color: var(--muted); }
.video-actions { margin-top: 16px; display: flex; gap: 8px; }
.upload-progress { margin-top: 16px; }
.upload-progress > div { height: 6px; overflow: hidden; border-radius: 99px; background: #e1e6ec; }
.upload-progress span { height: 100%; width: 0; display: block; background: var(--cyan); transition: width .3s; }
.upload-progress p { margin: 7px 0; color: var(--muted); font-size: 12px; }

.alert { margin-bottom: 20px; padding: 14px 16px; border-radius: 6px; font-size: 13px; line-height: 1.6; }
.alert-error { color: #852c33; background: #fff0f1; border: 1px solid #efc8ca; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.toast { min-width: 190px; padding: 12px 16px; position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; border-radius: 6px; background: #182131; color: #fff; text-align: center; font-size: 13px; transition: .2s; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

.login-page, .error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf1f5; }
.login-shell { width: min(420px, 100%); }
.login-panel, .error-panel { padding: 36px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(24,33,49,.1); }
.login-panel .brand-mark { margin-bottom: 24px; }
.login-panel h1, .error-panel h1 { margin: 5px 0 10px; font-size: 27px; }
.login-panel .form-stack { margin-top: 25px; }
.error-panel { width: min(520px, 100%); text-align: center; }
.error-panel p { margin: 0 0 24px; color: var(--muted); line-height: 1.7; }
.error-code { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: 1.8px; }

@media (max-width: 1100px) {
  .project-row { grid-template-columns: 1fr 100px; }
  .project-link, .project-actions { grid-column: 1 / -1; }
  .project-actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .page-shell { width: calc(100% - 28px); padding-top: 24px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .project-row { grid-template-columns: 1fr; gap: 16px; }
  .project-link, .project-actions { grid-column: auto; }
  .editor-layout { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .brand > span:last-child { display: none; }
}
