:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  --text: #202634;
  --muted: #626d7d;
  --line: #dfe4eb;
  --line-soft: #e8ecf1;
  --accent: #2267dd;
  --accent-dark: #1856bf;
  --accent-pale: #edf4ff;
  --canvas: #f5f7fa;
  --table-head: #f5f7fa;
  --white: #fff;
  --sidebar: 190px;
  --topbar: 47px;
  color: var(--text);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 310px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.muted { color: var(--muted); }
.mono, .path-code { font-family: "IBM Plex Mono", SFMono-Regular, Consolas, monospace; }
.nowrap { white-space: nowrap; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 0 0 10px;
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: var(--topbar);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--white);
}

.brand-mark .icon { width: 15px; height: 15px; }
.brand strong { display: inline-block; font-size: 15px; font-weight: 700; vertical-align: baseline; }
.brand small { display: inline-block; margin-left: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }

.workspace-selector { min-width: 0; margin: 12px 12px 13px; }
.workspace-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 33px;
  padding: 0 7px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.workspace-button:hover { border-color: #aebdce; }
.workspace-button > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-sign { display: grid; place-items: center; flex: 0 0 auto; width: 21px; height: 21px; color: #58708b; }
.nav-group + .nav-group { margin-top: 15px; }
.nav-group h2 { margin: 0 14px 4px; color: var(--muted); font-size: 11px; font-weight: 500; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 35px;
  padding: 0 14px;
  text-align: left;
  background: transparent;
  border: 0;
}

.nav-item .icon { width: 15px; height: 15px; color: #657388; }
.nav-item:hover { background: #f3f6fa; }
.nav-item[aria-current="page"] { background: var(--accent-pale); color: var(--accent-dark); font-weight: 650; }
.nav-item[aria-current="page"]::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); content: ""; }
.nav-item[aria-current="page"] .icon { color: var(--accent); }
.nav-item .nav-count { min-width: 18px; margin-left: auto; color: var(--muted); font-size: 11px; text-align: center; }
.sidebar-end { margin-top: auto; padding-top: 16px; }
.profile { display: flex; align-items: center; gap: 8px; padding: 10px 14px 3px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex: 0 0 27px; height: 27px; border-radius: 50%; background: #e8eef6; color: #375275; font-size: 12px; }
.profile strong, .profile small { display: block; }
.profile strong { font-weight: 600; }
.profile small { color: var(--muted); font-size: 11px; }
.body-shell, .page { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--topbar);
  padding: 0 17px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.breadcrumbs, .top-tools { display: flex; align-items: center; gap: 7px; min-width: 0; }
.breadcrumbs strong { font-weight: 600; white-space: nowrap; }
.demo-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.mobile-menu { display: none !important; }
.page { padding: 15px 17px 28px; }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 12px; }
.page-title { font-size: 21px; line-height: 1.25; font-weight: 700; }
.page-caption { margin-top: 4px; color: var(--muted); font-size: 12px; }

.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d2dae4;
  border-radius: 3px;
  background: var(--white);
  font-weight: 500;
  white-space: nowrap;
}

.button:not(:disabled):hover, .icon-button:not(:disabled):hover { border-color: #9eb7d9; background: #f5f8fc; color: var(--accent-dark); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--white); }
.button.primary:not(:disabled):hover { border-color: var(--accent-dark); background: var(--accent-dark); color: var(--white); }
.button.small { min-height: 25px; padding: 0 7px; font-size: 12px; }
.icon-button { min-height: 28px; width: 28px; padding: 0; }
.icon-button.flat { border-color: transparent; background: transparent; color: var(--muted); }
.text-button { appearance: none; padding: 2px 0; border: 0; background: transparent; color: var(--accent-dark); font-weight: 500; }
.text-button:not(:disabled):hover { color: #124aab; text-decoration: underline; }
.text-button:disabled { color: var(--muted); }

.tabs {
  display: flex;
  gap: 18px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 2px 2px 0 0;
  background: var(--white);
}

.tab { min-width: 48px; padding: 0 3px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); white-space: nowrap; }
.tab:hover { color: var(--accent-dark); }
.tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent-dark); font-weight: 650; }
.tab sup { margin-left: 4px; color: var(--muted); font-size: 10px; }
.filters, .toolstrip { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; }
.filters {
  min-height: 46px;
  margin: 0 0 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
}

.tabs + .filters { border-top: 0; border-radius: 0 0 2px 2px; }
.toolstrip { min-height: 35px; }
.toolstrip > label { display: inline-flex; align-items: center; gap: 6px; }
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(248px, 100%);
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid #d2dae4;
  border-radius: 3px;
  background: var(--white);
  color: var(--muted);
}

.search input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.search:focus-within { border-color: var(--accent); }
.select, .field input, .field select, .field textarea {
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid #d2dae4;
  border-radius: 3px;
  background: var(--white);
  color: var(--text);
}

.select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.select { max-width: 100%; }
.asset-placement-filter { max-width: min(100%, 11rem); }
.spacer { flex: 1 1 auto; }
.grid-switch { display: inline-flex; padding: 1px; border: 1px solid #d2dae4; border-radius: 3px; background: var(--white); }
.grid-switch button { display: grid; place-items: center; width: 26px; height: 25px; padding: 0; border: 0; border-radius: 2px; background: transparent; color: var(--muted); }
.grid-switch button:hover, .grid-switch [aria-pressed="true"] { background: var(--accent-pale); color: var(--accent-dark); }
.results-label, .table-count { color: var(--muted); font-size: 12px; white-space: nowrap; }

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  scrollbar-color: #bac6d6 transparent;
}

table { width: 100%; min-width: 620px; border-collapse: separate; border-spacing: 0; text-align: left; white-space: nowrap; }
th, td { padding: 7px 9px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
th { height: 34px; background: var(--table-head); color: #4b586a; font-size: 12px; font-weight: 600; }
td:last-child, th:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f5f8fd; }
tbody tr[aria-selected="true"] td { background: var(--accent-pale); }
th input[type="checkbox"], td input[type="checkbox"] { vertical-align: middle; margin: 0; }
.library-table { min-width: 910px; }
.library-table td { height: 48px; }
.asset-library-table { min-width: 1030px; }
.asset-placement-cell { max-width: 11rem; white-space: normal; overflow-wrap: anywhere; }
.row-media { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-open { padding: 0; text-align: left; }
.row-image { display: block; flex: 0 0 auto; width: 44px; height: 32px; border: 1px solid var(--line-soft); border-radius: 2px; background: var(--canvas); object-fit: cover; }
.media-placeholder, .cover-placeholder { display: grid; place-items: center; color: var(--muted); }
.cover-placeholder { width: 100%; height: 100%; background: var(--canvas); }
.row-main { min-width: 0; }
.row-label { display: block; color: var(--text); font-weight: 600; }
.text-button.row-label, .row-label.text-button, .text-button .row-label { color: var(--accent-dark); }
.row-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.row-actions { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.row-actions .text-button { font-size: 12px; }
.row-total td, tbody .row-total:hover td { background: #f7f9fc; font-weight: 650; }
.cell-numeric, .row-total td { font-variant-numeric: tabular-nums; }
.cell-numeric { text-align: right; }
.list-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 40px; padding: 5px 9px; border: 1px solid var(--line); border-top: 0; background: var(--white); }
.page-controls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.page-controls .button, .page-controls .select { min-height: 25px; }
.page-controls [aria-current="page"] { border-color: #a2bce9; background: var(--accent-pale); color: var(--accent-dark); }

.status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.status-dot::before { flex: 0 0 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-dot.green, .status-dot.success { color: #21704f; }
.status-dot.amber, .status-dot.warning { color: #835713; }
.status-dot.blue, .status-dot.info, .status-dot.progress { color: var(--accent-dark); }
.status-dot.red, .status-dot.danger { color: #a43d3b; }
.pill { display: inline-flex; align-items: center; padding: 1px 5px; border: 1px solid #dfe4eb; border-radius: 2px; background: #f6f7f9; color: #515d6d; font-size: 11px; white-space: nowrap; }
.pill.green { border-color: #c9e6d7; background: #f1f9f4; color: #20684a; }
.pill.amber { border-color: #ebd6a8; background: #fffbf1; color: #825515; }
.pill.blue { border-color: #cbdcf9; background: #f2f7ff; color: #255cac; }
.pill.red { border-color: #f0cfcd; background: #fff4f3; color: #a43d3b; }
.empty { display: grid; align-content: center; justify-items: center; gap: 6px; min-height: 145px; border: 1px solid var(--line); background: var(--white); color: var(--muted); }
.empty strong { color: var(--text); font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 10px; }
.drama-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; background: var(--white); }
.drama-card:hover { border-color: #aec4e4; }
.cover { position: relative; display: block; width: 100%; aspect-ratio: 2.35; padding: 0; overflow: hidden; border: 0; background: #e9edf2; text-align: left; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover[data-drama="DR-002"] img, .cover[data-drama="DR-004"] img { object-position: 50% 23%; }
.cover-label { position: absolute; top: 6px; left: 6px; padding: 1px 4px; border-radius: 2px; background: #fffffff0; color: var(--text); font-size: 11px; }
.cover-episodes { position: absolute; right: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px; padding: 2px 5px; border-radius: 2px; background: #111827cc; color: var(--white); font-size: 11px; }
.card-body { padding: 8px; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.card-title h2 { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.card-title .mono { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.card-meta { display: flex; align-items: center; gap: 6px; margin: 3px 0 6px; color: var(--muted); font-size: 12px; }
.card-meta span + span::before { margin-right: 6px; content: "·"; }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 5px; padding-top: 5px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.card-footer span { display: inline-flex; align-items: center; gap: 4px; }
.card-footer .button { color: var(--accent-dark); }

.dialog {
  width: 535px;
  max-width: calc(100vw - 22px);
  max-height: calc(100dvh - 22px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 8px 24px #17223821;
}

.dialog::backdrop { background: #15203770; }
.dialog.dialog-wide { width: 680px; }
.dialog.drawer { width: 590px; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border-width: 0 0 0 1px; border-radius: 0; }
.dialog-layout { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.drawer .dialog-layout { height: 100%; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex: 0 0 auto; min-height: 48px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-bottom: 2px; font-size: 17px; font-weight: 650; }
.dialog-body { flex: 1; min-width: 0; min-height: 0; padding: 12px 13px; overflow: auto; }
.dialog-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; flex: 0 0 auto; min-height: 47px; padding: 8px 13px; border-top: 1px solid var(--line); }
.stack { display: grid; gap: 10px; min-width: 0; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .field-title { font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; }
.field input[type="file"] { padding: 4px 6px; font-size: 12px; }
.field input[type="checkbox"], .field input[type="radio"] { width: auto; min-height: auto; }
.field textarea { min-height: 56px; padding: 6px 7px; resize: vertical; }
.inline-fields { display: flex; align-items: end; flex-wrap: wrap; gap: 7px; min-width: 0; }
.inline-fields .field { flex: 1; min-width: 65px; }
.episode-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; max-height: 270px; padding: 2px; overflow: auto; }
.episode-option { display: flex; justify-content: center; align-items: center; gap: 4px; padding: 5px 2px; border: 1px solid var(--line); border-radius: 2px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.episode-option:has(:checked) { border-color: #a9c2ec; background: var(--accent-pale); color: var(--accent-dark); }
.episode-option input { margin: 0; }
.episode-scroll { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 2px; }
.episode-scroll > .table-wrap { width: max-content; max-width: none; min-width: 100%; overflow: visible; border: 0; }
.episode-table { min-width: 410px; font-size: 12px; }
.episode-table td, .episode-table th { padding: 5px 7px; }
.episode-table thead th { position: sticky; top: 0; z-index: 1; }
.episode-table input[type="checkbox"] { margin: 0; }
.episode-table tr:has(input[type="checkbox"]:checked) td { background: #f3f7ff; }
.detail-cover { padding: 7px; border: 1px solid var(--line); border-radius: 2px; background: var(--table-head); }
.detail-cover .row-image { width: 64px; height: 42px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; min-height: 32px; }
.section-head h2, .section-head h3, h2.section-head, h3.section-head { font-size: 14px; font-weight: 650; }
.section-head > .muted { font-size: 12px; font-weight: 400; }
.path-code { color: #3f4e66; font-size: 11px; overflow-wrap: anywhere; }
.dialog-note, .form-hint, .field-note { color: var(--muted); font-size: 12px; }
#source-file-names { max-height: 140px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#busy-status:empty { display: none; }
.dialog a.button, .dialog a.text-button { text-decoration: none; }
.error { color: #a43d3b; font-size: 12px; }
.error:empty { display: none; }
.details { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 7px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.upload-progress { width: 100%; max-width: 230px; height: 6px; accent-color: var(--accent); }
.toast { position: fixed; right: 13px; bottom: 13px; z-index: 8; display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 26px); padding: 8px 11px; border: 1px solid #d3deed; border-radius: 3px; background: var(--white); color: var(--text); box-shadow: 0 3px 12px #1829451a; }
.toast .icon { color: var(--accent); }
.side-overlay { position: fixed; inset: 0; z-index: 4; background: #17243859; }

@media (max-width: 1050px) {
  :root { --sidebar: 175px; }
  .page { padding-inline: 12px; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; display: none; width: 188px; }
  .sidebar.is-open { display: flex; }
  .mobile-menu { display: inline-flex !important; }
  .topbar { z-index: 3; padding-inline: 9px; }
  .page { padding: 12px 9px 19px; }
  .page-title { font-size: 19px; }
  .breadcrumbs .workspace-crumb { display: none; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-title .mono { display: none; }
  .card-footer .button { padding-inline: 4px; }
  .dialog.drawer { max-width: 100vw; }
}

@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
  .episode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
