:root {
    --brand: #153eaf;
    --brand-2: #3b82f6;
    --ink: #101828;
    --muted: #667085;
    --line: #d0d5dd;
    --bg: #f4f7fb;
    --card: #ffffff;
    --danger-bg: #fef3f2;
    --danger: #b42318;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

/* ---------- 登录页 ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 420px);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.10);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand.small { margin-bottom: 0; gap: 8px; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}

.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; font-size: 14px; color: #344054; }
.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color .15s;
}
.field input:focus { border-color: var(--brand-2); }

.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: linear-gradient(145deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-block { width: 100%; }

.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fda29b; }

.footnote { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.footnote code { background: #eef2f7; padding: 1px 6px; border-radius: 6px; }

/* ---------- 应用框架 ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.app-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--muted); }
.app-nav a { color: var(--brand); text-decoration: none; }

.app-main { max-width: 1080px; margin: 0 auto; padding: 28px 24px; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
}
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 20px; }
.tile {
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 18px;
}
.tile h3 { margin: 0 0 6px; font-size: 15px; }
.tile p { margin: 0; font-size: 13px; color: var(--muted); }
.tile-link { color: inherit; text-decoration: none; transition: border-color .15s, background .15s; }
.tile-link:hover { border-color: var(--brand-2); background: #f8fafc; }

/* ---------- 数据表格 ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.row-active { background: #f0f6ff; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.adv-line { line-height: 1.9; }
.adv-name { margin-left: 8px; color: var(--ink); font-size: 13px; }

.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; vertical-align: middle; }
.tag-light { background: #eef2f7; color: var(--muted); margin-left: 4px; }
.tag-gray { background: #f2f4f7; color: #667085; }
.tag-green { background: #ecfdf3; color: #079455; }

.btn-small { padding: 5px 12px; font-size: 13px; border: 1px solid var(--line); background: #fff; }
.btn-small:hover { border-color: var(--brand-2); color: var(--brand); }
/* 主按钮缩小后仍保留渐变底与白字（.btn-small 的白底会覆盖 .btn-primary） */
.btn-primary.btn-small {
    background: linear-gradient(145deg, var(--brand), var(--brand-2));
    color: #fff;
    border-color: transparent;
}
.btn-primary.btn-small:hover { color: #fff; filter: brightness(1.06); }

.inline { display: inline; margin: 0; }

.alert-info { background: #eff8ff; color: #175cd3; border: 1px solid #b2ddff; }

/* ---------- 表单与上传 ---------- */
.panel-gap { margin-top: 16px; }
.small { font-size: 12px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 14px; color: #344054; }
.form-row select,
.form-row input[type="file"] {
    width: 100%;
    max-width: 720px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
}

.progress-list { margin-top: 16px; }
.progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    background: #fff;
}
.p-name { color: var(--ink); word-break: break-all; flex: 0 1 260px; min-width: 0; }
.p-bar {
    flex: 1 1 auto;
    min-width: 80px;
    height: 8px;
    background: #e8edf3;
    border-radius: 999px;
    overflow: hidden;
}
.p-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transition: width .2s linear;
}
.p-pct { color: var(--muted); width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.p-status { color: var(--muted); white-space: nowrap; }
.p-status.ok { color: #079455; }
.p-status.fail { color: var(--danger); }

/* ---------- 素材封面与播放 ---------- */
.thumb-btn {
    position: relative;
    display: block;
    width: 96px;
    height: 54px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}
.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 18px;
    background: rgba(0, 0, 0, .32);
}
.thumb-btn:hover .thumb-play { background: rgba(0, 0, 0, .5); }

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(16, 24, 40, .62);
}
.modal-mask[hidden] { display: none; }
.modal-box {
    width: min(100%, 860px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #0b0f19;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    color: #e6eaf2;
    font-size: 14px;
    background: #111827;
}
.modal-close {
    border: 0;
    background: transparent;
    color: #e6eaf2;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
#playerVideo,
#planPlayerVideo {
    width: 100%;
    max-height: 70vh;
    background: #000;
    display: block;
    object-fit: contain;
}
.modal-foot {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: #111827;
}
.modal-foot .btn { background: #1f2937; color: #e6eaf2; border-color: #374151; }

/* ---------- 计划编辑 ---------- */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 24px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
}
.meta-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 2px;
}
.edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.edit-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
}
.edit-card h3 { margin: 0; font-size: 15px; }
.edit-card input[type="text"],
.edit-card input[type="number"] {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
}
.edit-card .btn { align-self: flex-start; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }

/* ---------- 计划列表 ---------- */
.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.filter-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #344054;
}
.filter-grid select {
    min-width: 220px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
}
.filter-submit { justify-content: flex-end; }

.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}
.row-detail summary {
    cursor: pointer;
    color: var(--brand);
    font-size: 13px;
}
.row-detail pre {
    margin: 8px 0 0;
    max-height: 320px;
    max-width: 520px;
    overflow: auto;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}
