:root {
  --navy-950: #06142e;
  --navy-900: #0a1d3e;
  --navy-800: #123366;
  --navy-700: #194b91;
  --blue-600: #2468c9;
  --blue-500: #3b82e6;
  --blue-100: #e8f1ff;
  --ink: #152238;
  --muted: #66758c;
  --line: #dbe4f0;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --success: #168354;
  --warning: #b56a07;
  --danger: #c43f4e;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(8, 29, 62, 0.12);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue-600); }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 28px;
  color: white;
  background: linear-gradient(115deg, var(--navy-950), var(--navy-800));
  box-shadow: 0 8px 24px rgba(4, 17, 41, 0.18);
}
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 11px;
  background: rgba(255,255,255,.12);
  font-weight: 800;
}
.brand-title { font-size: 18px; font-weight: 750; letter-spacing: .02em; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-user { color: #d8e7ff; font-size: 13px; }

.page-shell { width: min(1480px, calc(100% - 40px)); margin: 28px auto 48px; }
.page-heading { margin-bottom: 20px; }
.page-heading h1 { margin: 0 0 6px; font-size: clamp(24px, 3vw, 32px); }
.page-heading p { margin: 0; color: var(--muted); }
.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(14, 44, 88, .06);
}
.panel + .panel { margin-top: 20px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-title-row h2 { margin: 0; font-size: 18px; }

.btn {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .file-drop:focus-within { outline: 3px solid rgba(59,130,230,.28); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { color: white; background: linear-gradient(135deg, var(--navy-700), var(--blue-600)); box-shadow: 0 8px 18px rgba(36,104,201,.22); }
.btn-secondary { color: var(--navy-800); border-color: #cbd9ea; background: white; }
.btn-ghost { min-height: 36px; padding: 0 12px; color: #e7f0ff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.btn-link { color: var(--blue-600); border: 0; background: transparent; cursor: pointer; font-weight: 700; }
.btn-small { min-height: 32px; padding: 0 11px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(340px, 1.4fr) auto; gap: 16px; align-items: end; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 750; color: #31415a; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.optional-label { color: var(--muted); font-weight: 500; }
.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #c8d5e5;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}
.field input::placeholder { color: #9aa7b9; }
.field-hint { min-height: 20px; color: var(--muted); font-size: 12px; }
.field-error { color: var(--danger); }
.file-drop {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px dashed #9db5d1;
  border-radius: 10px;
  background: #f8fbff;
}
.file-drop input { max-width: 100%; }
.asin-list-field { grid-column: span 2; }
.asin-rows { display: grid; gap: 8px; }
.asin-row { display: grid; grid-template-columns: minmax(180px, 1fr) 92px 56px; gap: 8px; align-items: center; }
.asin-row input, .asin-row select { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid #cbd9ea; border-radius: 9px; color: var(--ink); background: white; }
.remove-asin-row { min-height: 36px; border: 0; border-radius: 8px; color: #bd3144; background: #fff0f2; cursor: pointer; font-size: 12px; font-weight: 700; }
.remove-asin-row:disabled { color: #a7b1c0; background: #f1f4f8; cursor: not-allowed; }

.notice { margin-top: 14px; padding: 11px 13px; border-radius: 9px; font-size: 14px; }
.notice-info { color: #174b84; background: #eaf3ff; }
.notice-success { color: #11613f; background: #e7f7ef; }
.notice-error { color: #9f2f3b; background: #fdecee; }

.preflight-note {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #c8dcf5;
  border-radius: 10px;
  color: #244b78;
  background: #eef6ff;
  font-size: 13px;
}
.preflight-note strong { color: var(--navy-800); }

.confirm-dialog {
  width: min(92vw, 560px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: transparent;
  box-shadow: var(--shadow);
}
.confirm-dialog::backdrop { background: rgba(4, 17, 41, .58); backdrop-filter: blur(3px); }
.confirm-card { padding: 24px; border-radius: 16px; background: white; }
.confirm-heading { display: flex; align-items: flex-start; gap: 14px; }
.confirm-heading h2 { margin: 0 0 4px; font-size: 21px; }
.confirm-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.confirm-icon {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--blue-600);
  font-weight: 900;
}
.confirm-summary { display: grid; gap: 0; margin: 20px 0 14px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.confirm-summary div { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 11px 13px; }
.confirm-summary div + div { border-top: 1px solid var(--line); }
.confirm-summary dt { color: var(--muted); }
.confirm-summary dd { margin: 0; font-weight: 800; text-align: right; }
.confirm-call-count { color: #b45414; }
.confirm-warning { margin: 0; color: #6b4a1f; font-size: 13px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.task-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.task-table th { padding: 11px 12px; color: #3b4b63; background: #edf3fb; text-align: left; white-space: nowrap; }
.task-table td { padding: 11px 12px; border-top: 1px solid #e4ebf4; vertical-align: middle; }
.task-table tbody tr:hover { background: #f9fbfe; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font-weight: 750; white-space: nowrap; }
.status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.status-pending { color: #8b5a09; background: #fff5d8; }
.status-running { color: #185fa7; background: #e8f2ff; }
.status-done { color: #157047; background: #e4f6ec; }
.status-failed { color: #aa3542; background: #fde9ec; }
.failure-text { max-width: 290px; color: var(--danger); }
.empty-state { padding: 36px 16px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; }

.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
  background: radial-gradient(circle at 20% 20%, #1c4e91 0, transparent 30%), linear-gradient(135deg, #06142e 0%, #0b2852 55%, #123a75 100%);
}
.auth-intro { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 7vw, 100px); color: white; }
.auth-intro .eyebrow { color: #91bfff; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.auth-intro h1 { max-width: 700px; margin: 18px 0; font-size: clamp(40px, 6vw, 76px); line-height: 1.05; }
.auth-intro p { max-width: 620px; margin: 0; color: #d3e4fb; font-size: 17px; }
.auth-feature-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.auth-feature-list span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.07); }
.auth-side { display: grid; place-items: center; padding: 28px; background: rgba(4,16,38,.38); backdrop-filter: blur(10px); }
.auth-card { width: min(100%, 460px); padding: 30px; border: 1px solid rgba(255,255,255,.15); border-radius: 20px; background: rgba(255,255,255,.98); box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 5px; font-size: 27px; }
.auth-card > p { margin: 0 0 22px; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 20px; border-radius: 11px; background: #edf3fa; }
.auth-tab { min-height: 40px; border: 0; border-radius: 8px; color: #53627a; background: transparent; cursor: pointer; font-weight: 750; }
.auth-tab.active { color: var(--navy-800); background: white; box-shadow: 0 2px 10px rgba(12,40,78,.1); }
.auth-form { display: grid; gap: 15px; }
.auth-form .btn { margin-top: 4px; }
.auth-note { margin-top: 16px; color: var(--muted); font-size: 12px; }

.report-shell { width: min(1800px, calc(100% - 28px)); margin: 20px auto 40px; }
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.report-toolbar h1 { margin: 0; font-size: 22px; }
.report-frame { width: 100%; min-height: calc(100vh - 180px); border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 8px 30px rgba(14,44,88,.08); }
.loading-card { display: grid; min-height: 320px; place-items: center; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; background: white; }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border: 4px solid #dbe7f7; border-top-color: var(--blue-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-footer { padding: 24px 20px 34px; color: #77859a; text-align: center; font-size: 12px; }
.site-footer a { color: #5d7090; text-decoration: none; }

@media (max-width: 880px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-intro { min-height: 360px; padding: 48px 26px; }
  .auth-intro h1 { font-size: clamp(38px, 13vw, 60px); }
  .auth-side { padding: 24px 16px 36px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .btn { width: 100%; }
  .asin-list-field { grid-column: auto; }
  .asin-row { grid-template-columns: minmax(0, 1fr) 82px 52px; }
  .confirm-summary div { grid-template-columns: 1fr; gap: 3px; }
  .confirm-summary dd { text-align: left; }
  .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .site-header { padding: 0 16px; }
  .header-user { display: none; }
  .page-shell { width: min(100% - 24px, 1480px); margin-top: 18px; }
  .panel { padding: 16px; }
  .panel-title-row { align-items: flex-start; flex-direction: column; }
  .report-toolbar { align-items: flex-start; flex-direction: column; }
  .report-frame { min-height: calc(100vh - 230px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
