:root {
  color-scheme: light;
  --ink: #182639;
  --muted: #536477;
  --line: #dbe4ec;
  --paper: #fff;
  --canvas: #edf2f6;
  --accent: #075b68;
  --accent-dark: #03424c;
  --accent-soft: #e6f4f4;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3.5vw, 2.65rem); letter-spacing: -.042em; line-height: 1.15; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid #168795; outline-offset: 2px; }
button, input, select, textarea, .button { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .54rem .85rem;
  min-height: 39px; border-radius: 8px; border: 1px solid #c9d7e2; background: var(--paper);
  color: var(--ink); font-size: .9rem; font-weight: 650; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: #f1f6f8; }
button:disabled, .button:not([href]):not(.upload) { opacity: .53; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover, .button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
input:not([type="radio"]):not([type="file"]), select, textarea {
  display: block; min-width: 0; width: 100%; padding: .55rem .65rem; margin-top: .28rem; min-height: 42px;
  border: 1px solid #c8d6e0; border-radius: 8px; color: inherit; background: white; font-weight: 400;
}
textarea { resize: vertical; }
::placeholder { color: #67798b; }
label { display: block; font-size: .9rem; font-weight: 635; }
fieldset { padding: 0; margin: 0; border: 0; min-inline-size: 0; }
.topbar {
  min-height: 68px; display: flex; align-items: center; gap: 1.8rem; padding: .6rem clamp(1rem, 4vw, 3.6rem);
  background: #12253a; color: #f6fafc; position: relative; z-index: 2;
}
.brand { color: #f6fafc; text-decoration: none; display: inline-flex; align-items: center; gap: .7rem; white-space: nowrap; font-weight: 760; }
.brand-mark { width: 33px; height: 33px; background: #90ded4; border-radius: 9px; display: flex; align-items: end; justify-content: center; gap: 2px; padding: 7px; }
.brand-mark i { background: #15384a; border-radius: 2px; display: block; width: 4px; height: 8px; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 17px; }
#primary-nav { display: flex; align-items: center; gap: .23rem; flex: 1; }
#primary-nav a, .account-nav summary { text-decoration: none; color: #e1eaf3; padding: .58rem .68rem; font-size: .875rem; white-space: nowrap; border-radius: 8px; }
#primary-nav a:hover, #primary-nav a[aria-current], .account-nav summary:hover { background: #29445c; color: white; }
#primary-nav a[aria-current] { box-shadow: inset 0 -2px #90ded4; }
.account-nav { display: flex; gap: .35rem; margin-left: auto; }
.account-nav details { position: relative; }
.account-nav summary { cursor: pointer; }
.menu { position: absolute; top: 100%; right: 0; display: grid; min-width: 145px; padding: .35rem; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); box-shadow: 0 12px 30px #1b2b4020; }
.menu a, .menu button { padding: .54rem .65rem; color: var(--ink); text-decoration: none; text-align: left; border: 0; justify-content: start; background: transparent; }
.menu a:hover, .menu button:hover { background: var(--accent-soft); }
main { max-width: 1600px; margin: auto; padding: 2.1rem clamp(1rem, 4vw, 3.6rem) 3rem; }
.eyebrow { margin-bottom: .38rem; color: var(--accent); font-size: .81rem; font-weight: 750; }
.page-header { margin-bottom: 1.5rem; }
.page-heading, .sidebar-heading, .panel-header, .dialog-head, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.page-heading p, .panel-header p, .dialog-head h2 + p { margin-top: .35rem; color: var(--muted); }
.page-heading > button { flex-shrink: 0; }
.card { background: white; border: 1px solid var(--line); border-radius: 14px; }
.gate { width: min(100%, 475px); margin: clamp(1rem, 8vh, 5rem) auto; padding: clamp(1.25rem, 4vw, 2.4rem); }
.gate h1 { font-size: 1.75rem; }
#gate-message { margin: .7rem 0 1.1rem; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(202px, 248px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.sidebar { padding: .9rem .75rem; }
.sidebar h2 { padding-left: .45rem; }
.sidebar nav { display: grid; gap: .22rem; margin-top: .7rem; }
.side-link { display: flex; gap: .6rem; align-items: center; min-width: 0; padding: .62rem .55rem; border-radius: 8px; font-size: .88rem; color: var(--ink); text-decoration: none; }
.side-link:hover { background: #f0f5f7; }
.side-link[aria-current] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 750; }
.side-link small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.step { font-size: .73rem; font-weight: 750; padding: .15rem .35rem; color: var(--accent); background: #e4edef; border-radius: 5px; }
.queue-metrics { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .75rem; display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.queue-metrics strong, .queue-metrics small { display: block; }
.queue-metrics small { font-size: .72rem; color: var(--muted); }
.panel-header { padding: 1rem 1.25rem; }
.panel-header p, .muted { color: var(--muted); font-size: .86rem; }
.filters { display: flex; gap: .75rem; padding: .15rem 1.25rem 1rem; align-items: end; }
.search-label { width: min(100%, 350px); }
.filters select { min-width: 110px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th, td { padding: .75rem .8rem; font-size: .84rem; }
th { color: #3e5265; background: #f1f5f8; font-weight: 750; }
th:first-child, td:first-child { padding-left: 1.25rem; }
td { border-bottom: 1px solid #e7edf1; }
td:first-child { white-space: normal; min-width: 150px; max-width: 310px; overflow-wrap: anywhere; }
td small, td:first-child a { display: block; font-size: .76rem; color: var(--muted); }
.queue-footer { display: flex; justify-content: space-between; gap: .75rem; padding: .8rem 1.25rem; color: var(--muted); background: #f9fbfc; border-radius: 0 0 14px 14px; font-size: .78rem; }
.compact { padding: .32rem .55rem; min-height: 32px; font-size: .82rem; }
.progress { display: flex; gap: 3px; margin-bottom: .24rem; }
.progress i { width: 16px; height: 4px; background: #d8e1e9; border-radius: 3px; }
.progress .done { background: #087e71; }
.progress .current { background: #4e82a9; }
.state { display: inline-flex; padding: .18rem .55rem; border-radius: 999px; background: #ecf1f5; color: #435768; font-size: .78rem; font-weight: 750; white-space: nowrap; }
.state[data-state="approved"] { background: #e1f1e8; color: #185c40; }
.state[data-state="review"], .state[data-state="needs_input"] { background: #fff0cf; color: #744b15; }
.state[data-state="running"], .state[data-state="launching"] { background: #dfedf9; color: #235378; }
.state[data-state="failed"] { background: #fde4e0; color: #7f2424; }
.empty { padding: 2.75rem 1.1rem; text-align: center; }
.empty p { margin-top: .4rem; color: var(--muted); font-size: .88rem; }
.area-content { min-width: 0; display: grid; gap: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .75rem; }
.stat { display: grid; gap: .4rem; padding: .85rem 1rem; font-size: .86rem; color: var(--muted); }
.stat strong { font-size: 1.6rem; color: var(--ink); }
.icon-button { width: 39px; padding: 0; flex: none; font-size: 1.2rem; }
.notice { padding: .72rem 1rem; margin-bottom: .75rem; border: 1px solid #a8ded4; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); white-space: pre-line; font-size: .88rem; }
.notice[data-error="true"] { color: #7d2923; background: #fff1ee; border-color: #efc7bf; }
.in-dialog { margin: .65rem 1.25rem 0; }
dialog { padding: 0; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 90px #10253b45; }
dialog::backdrop { background: #152b40a5; }
.large-dialog { width: min(840px, calc(100% - 26px)); height: min(860px, calc(100% - 30px)); max-height: calc(100% - 30px); }
.result-dialog { width: min(1050px, calc(100% - 26px)); }
.small-dialog { width: min(480px, calc(100% - 26px)); }
#discard-dialog form { padding: 1.2rem; }
#discard-dialog p { margin-top: .35rem; }
#discard-dialog .dialog-actions { padding: .9rem 0 0; border: 0; }
.dialog-shell { display: flex; flex-direction: column; height: 100%; }
.dialog-head { padding: .85rem 1.2rem; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.28rem; overflow-wrap: anywhere; }
.dialog-head p { font-size: .83rem; }
.dialog-scroll { overflow: auto; min-height: 0; flex: 1; padding: 1rem 1.2rem; background: #f6f8fa; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; padding: .75rem 1.2rem; border-top: 1px solid var(--line); }
.form-section, .copy-group { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: white; margin-bottom: .8rem; }
.form-section:last-child { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .68rem; }
.wide { grid-column: 1 / -1; }
.required { color: #a44239; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.product-status, .task { margin-bottom: .7rem; }
.product-status { justify-content: space-between; }
.task { padding: .7rem; background: #e9f2fa; border-radius: 8px; color: #28516d; }
.task .row-actions, .imports { margin-top: .6rem; }
.skill { font-size: .78rem; min-height: 32px; }
.skill[data-ready="true"] { color: var(--accent-dark); background: #e6f4f0; }
.upload { position: relative; }
.upload input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 3px solid #168795; outline-offset: 2px; }
.source-choices { display: flex; flex-wrap: wrap; gap: .65rem; margin: .65rem 0; }
.source-choices label { padding: .35rem .65rem; border: 1px solid var(--line); border-radius: 8px; }
.source-choices input { accent-color: var(--accent); }
.photo-grid { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .55rem; }
.photo-tile { display: grid; width: 94px; gap: .25rem; }
.photo-tile img { display: block; width: 94px; height: 72px; object-fit: contain; background: #eef3f5; border-radius: 6px; }
.photo-tile button { min-height: 28px; padding: .17rem; font-size: .75rem; }
.attachment { border-top: 1px solid var(--line); padding: .45rem 0; overflow-wrap: anywhere; }
.attachments:not(:empty) { margin-top: .65rem; }
.attachment pre { padding: .65rem; background: #f1f5f8; white-space: pre-wrap; max-height: 230px; overflow: auto; }
.attachment summary, .review-history summary { cursor: pointer; color: var(--accent); font-size: .86rem; }
.tabs { display: flex; overflow-x: auto; padding-inline: 1.2rem; border-bottom: 1px solid var(--line); }
.tabs button { white-space: nowrap; border: 0; border-radius: 0; margin-right: .35rem; }
.tabs button[aria-selected="true"] { color: var(--accent-dark); box-shadow: inset 0 -3px var(--accent); }
.copy-group label { display: block; margin-top: .65rem; }
.count { float: right; color: var(--muted); font-size: .75rem; }
.copy-group ul { margin: .4rem 0 0; padding-left: 1.15rem; }
.preview-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-bottom: 0; }
.preview-fields dd { margin: 0; color: var(--muted); }
@media (max-width: 1030px) {
  .topbar { gap: .9rem; flex-wrap: wrap; }
  #primary-nav { order: 2; flex-basis: 100%; overflow-x: auto; padding-bottom: 2px; }
}
@media (max-width: 710px) {
  main { padding-top: 1.25rem; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar nav { display: flex; overflow-x: auto; }
  .side-link { white-space: nowrap; }
  .queue-metrics { display: none; }
  .filters { flex-wrap: wrap; }
  .search-label { width: 100%; }
}
@media (max-width: 520px) {
  button, .button, input:not([type="radio"]):not([type="file"]), select, textarea { min-height: 44px; }
  .page-heading { align-items: start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .dialog-head, .dialog-scroll, .dialog-actions { padding-inline: .75rem; }
  .dialog-actions { justify-content: start; }
  .topbar { column-gap: .35rem; }
  .brand { font-size: .875rem; }
  .account-nav summary { padding-inline: .4rem; }
}
