:root {
  color-scheme: light;
  --ink: #171714;
  --muted: #6f6f68;
  --line: #e5e4de;
  --soft: #f6f6f2;
  --paper: #ffffff;
  --green: #19764b;
  --green-soft: #e8f6ee;
  --amber: #a55c00;
  --amber-soft: #fff4dc;
  --red: #b12a2a;
  --red-soft: #fff0ef;
  --blue: #3158c9;
  --shadow: 0 18px 48px rgba(24, 24, 20, 0.09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f7f6f1; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.hidden { display: none !important; }
.visually-hidden { position: fixed; left: -10000px; opacity: 0; }

.batch-app-shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 72%), rgb(247 247 245 / 0%) 36%),
    #f7f6f1;
}
.batch-page .app-nav { border-bottom: 1px solid rgb(222 222 216 / 74%); }
.batch-page .brand-lockup { text-decoration: none; }
.batch-page .product-nav { margin-left: auto; }
.batch-page .user-badge { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-trigger { display: inline-flex; align-items: center; gap: 4px; }
.balance-badge { padding: 8px 12px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 700; }
.icon-button, .secondary-button, .primary-button, .ghost-button, .danger-button {
  min-height: 38px;
  border-radius: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
}
.primary-button { background: var(--ink); color: white; border-color: var(--ink); }
.ghost-button { background: var(--soft); }
.danger-button { color: var(--red); border-color: #ecc8c4; background: var(--red-soft); }
.full { width: 100%; }
.count { margin-left: 5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--red); color: white; font-size: 11px; line-height: 19px; }

.notification-panel {
  position: absolute;
  right: 28px;
  top: 72px;
  width: min(390px, calc(100vw - 32px));
  max-height: 420px;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 8px;
}
.notification-item { padding: 12px; border-radius: 10px; }
.notification-item + .notification-item { border-top: 1px solid var(--line); }
.notification-item.unread { background: #f3f6ff; }
.notification-item strong, .notification-item span { display: block; }
.notification-item span { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.batch-shell { min-height: calc(100vh - 86px); display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.batch-sidebar { padding: 20px 16px; border-right: 1px solid var(--line); background: rgb(251 251 248 / 88%); min-height: calc(100vh - 86px); }
.sidebar-heading { margin: 24px 4px 10px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 800; }
.sidebar-heading button { border: 0; background: none; color: var(--muted); font-size: 12px; }
.batch-list { display: grid; gap: 7px; }
.batch-list-item { width: 100%; text-align: left; border: 1px solid transparent; border-radius: 11px; background: transparent; padding: 11px; }
.batch-list-item:hover { background: var(--soft); }
.batch-list-item.active { border-color: #cfcfc7; background: white; box-shadow: 0 5px 18px rgba(0,0,0,.04); }
.batch-list-item strong, .batch-list-item span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.batch-list-item strong { font-size: 14px; }
.batch-list-item span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.sidebar-note { margin: 18px 8px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.batch-workspace { min-width: 0; padding: 28px clamp(20px, 4vw, 58px) 70px; }
.loading-card, .empty-workspace { min-height: 440px; border: 1px dashed #cecec6; border-radius: 18px; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.5); }
.empty-inner { text-align: center; max-width: 560px; padding: 40px; }
.empty-inner .upload-icon { width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 27px; }
.empty-inner h1 { margin: 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.04em; }
.empty-inner p { margin: 14px auto 22px; color: var(--muted); line-height: 1.7; }
.format-example { margin: 20px auto; text-align: left; background: #20201d; color: #f8f8f2; border-radius: 12px; padding: 15px 18px; font: 13px/1.7 ui-monospace, monospace; }

.workspace-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.workspace-head-main { min-width: 0; flex: 1; }
.workspace-head h1 { margin: 0; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.035em; }
.workspace-head p { margin: 8px 0 0; color: var(--muted); }
.workspace-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.batch-name-input { width: min(520px, 100%); border: 0; border-bottom: 1px solid transparent; background: transparent; font-size: clamp(24px, 3vw, 36px); font-weight: 800; letter-spacing: -.035em; padding: 0 0 3px; }
.batch-name-input:focus { outline: 0; border-bottom-color: var(--ink); }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 22px; }
.step { padding: 12px; border-radius: 10px; background: #ecece6; color: var(--muted); font-size: 12px; font-weight: 800; }
.step.active { color: white; background: var(--ink); }
.step.done { color: var(--green); background: var(--green-soft); }

.summary-strip { display: grid; grid-template-columns: repeat(5, minmax(100px, 1fr)); gap: 10px; margin-bottom: 18px; }
.metric { border: 1px solid var(--line); border-radius: 13px; background: white; padding: 14px; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 7px; font-size: 23px; }

.toolbar { position: sticky; top: 86px; z-index: 10; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 10px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.toolbar .spacer { flex: 1; }
.toolbar small { color: var(--muted); }

.material-list, .review-list { display: grid; gap: 12px; }
.material-card, .review-card { border: 1px solid var(--line); border-radius: 14px; background: white; padding: 14px; box-shadow: 0 3px 12px rgba(0,0,0,.025); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.order-chip { flex: 0 0 auto; min-width: 34px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 12px; font-weight: 800; }
.card-head input[type="text"] { min-width: 0; flex: 1; border: 0; font-weight: 800; font-size: 15px; }
.card-head input[type="text"]:focus { outline: 0; }
.card-tools { display: flex; align-items: center; gap: 6px; }
.card-tools button { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.material-card textarea, .review-card textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  line-height: 1.7;
  background: #fdfdfb;
}
.review-card textarea { min-height: 210px; }
.card-foot { display: flex; align-items: center; gap: 9px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.card-foot .spacer { flex: 1; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 800; }
.tag.risk, .tag.failed { color: var(--red); background: var(--red-soft); }
.tag.warning { color: var(--amber); background: var(--amber-soft); }
.tag.success { color: var(--green); background: var(--green-soft); }
.risk-confirm { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: 12px; font-weight: 800; }
.review-card.excluded { opacity: .55; }

.progress-panel { min-height: 420px; border: 1px solid var(--line); border-radius: 18px; background: white; padding: clamp(24px, 5vw, 58px); display: grid; place-items: center; }
.progress-inner { width: min(660px, 100%); text-align: center; }
.progress-ring { width: 78px; height: 78px; margin: 0 auto 20px; border: 7px solid #ebebe7; border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { height: 10px; border-radius: 999px; overflow: hidden; background: #ecece6; margin: 20px 0 10px; }
.progress-bar span { display: block; height: 100%; background: var(--ink); border-radius: inherit; transition: width .35s ease; }

.config-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.config-panel, .selection-panel { border: 1px solid var(--line); border-radius: 15px; background: white; padding: 16px; }
.config-panel h2, .selection-panel h2 { margin: 0 0 12px; font-size: 17px; }
.range-card { display: grid; grid-template-columns: 86px 86px minmax(150px, 1.2fr) repeat(3, minmax(120px, 1fr)) 36px; gap: 9px; align-items: end; padding: 12px; border-radius: 12px; background: var(--soft); }
.range-card + .range-card { margin-top: 10px; }
.range-card label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.range-card input, .range-card select, .retention-select, .filter-select { min-height: 38px; width: 100%; border: 1px solid #d8d8d1; border-radius: 8px; background: white; padding: 0 9px; color: var(--ink); }
.range-card .remove-range { height: 38px; border: 0; border-radius: 8px; color: var(--red); background: var(--red-soft); }
.voice-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; grid-column: 1 / -1; }
.selected-preview { max-height: 520px; overflow: auto; display: grid; gap: 6px; }
.selected-preview div { display: flex; gap: 8px; padding: 8px; border-radius: 8px; background: var(--soft); font-size: 12px; }
.selected-preview b { min-width: 26px; }
.estimate-box { margin-top: 14px; padding: 13px; border-radius: 10px; background: #20201d; color: white; line-height: 1.6; font-size: 13px; }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.video-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; text-align: left; padding: 0; }
.video-thumb { aspect-ratio: 9 / 11; display: grid; place-items: center; position: relative; background: radial-gradient(circle at 50% 28%, #555 0, #252522 45%, #171715 100%); color: white; }
.video-thumb .play { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.9); color: var(--ink); font-size: 20px; }
.video-thumb .video-status { position: absolute; top: 10px; left: 10px; }
.video-body { padding: 12px; }
.video-body strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.video-body span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 20px; }
.pagination button { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; padding: 0 12px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 70; max-width: 430px; padding: 13px 16px; border-radius: 11px; background: #20201d; color: white; box-shadow: var(--shadow); }
.toast.error { background: #8f2020; }
.video-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.video-backdrop { position: absolute; inset: 0; border: 0; background: rgba(10,10,9,.68); }
.video-dialog { position: relative; z-index: 1; width: min(880px, 100%); max-height: 92vh; overflow: auto; border-radius: 16px; background: white; padding: 16px; box-shadow: var(--shadow); }
.video-dialog header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.video-dialog header span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.video-dialog header button { border: 0; background: var(--soft); width: 34px; height: 34px; border-radius: 9px; font-size: 20px; }
.video-dialog video { width: 100%; max-height: 62vh; border-radius: 12px; background: #111; }
.video-script { margin-top: 12px; padding: 14px; border-radius: 10px; background: var(--soft); white-space: pre-wrap; line-height: 1.7; font-size: 13px; }

@media (max-width: 1050px) {
  .batch-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .config-layout { grid-template-columns: 1fr; }
  .range-card { grid-template-columns: repeat(2, 1fr); }
  .range-card label:nth-of-type(n+3) { grid-column: span 2; }
  .range-card .remove-range { grid-column: 2; }
}
@media (max-width: 760px) {
  .batch-page .balance-badge, .batch-page .user-badge { display: none; }
  .batch-shell { display: block; }
  .batch-sidebar { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .batch-list { display: flex; overflow: auto; }
  .batch-list-item { min-width: 190px; }
  .batch-workspace { padding: 20px 14px 60px; }
  .workspace-head { display: block; }
  .workspace-actions { margin-top: 14px; justify-content: flex-start; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .range-card { grid-template-columns: 1fr; }
  .range-card label:nth-of-type(n) { grid-column: auto; }
  .range-card .remove-range { grid-column: auto; }
  .voice-fields { grid-template-columns: 1fr; }
}
