:root {
  color-scheme: light;
  --ink: #1b2330;
  --muted: #758092;
  --line: #e5e9ef;
  --surface: #ffffff;
  --canvas: #f7f8fa;
  --accent: #3459e6;
  --accent-dark: #2746bf;
  --accent-soft: #eef1ff;
  --success: #198b65;
  --shadow: 0 18px 50px rgba(31, 45, 73, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.auth-gate { display: grid; min-height: 100vh; place-items: center; padding: 28px 18px; background: radial-gradient(circle at top right, #eef1ff, transparent 42%), var(--canvas); }
.auth-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 70px rgba(31, 45, 73, .12); }
.auth-brand { margin-bottom: 46px; padding: 0; }
.auth-card h1 { margin-bottom: 9px; font-size: 31px; }
.auth-intro { margin-bottom: 25px; color: var(--muted); font-size: 13px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-submit { width: 100%; margin-top: 9px; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 238px;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 22px;
  background: #202a39;
  color: #dce3ef;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: #6e82ed;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  transform: rotate(-8deg);
}
.brand strong, .brand span { display: block; }
.brand strong { color: #fff; font-size: 16px; letter-spacing: .04em; }
.brand span { margin-top: 1px; color: #9eacc2; font-size: 12px; }

.nav-list { display: grid; gap: 8px; margin-top: 55px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 45px;
  padding: 0 13px;
  border-radius: 10px;
  color: #9eacc2;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.nav-item:hover, .nav-item.active { background: #303c50; color: #fff; }
.nav-icon { width: 20px; text-align: center; color: #9cadf3; font-size: 17px; }

.sidebar-note {
  display: flex;
  gap: 10px;
  margin: auto 8px 0;
  padding: 15px 12px;
  border: 1px solid #364257;
  border-radius: 11px;
  background: #263144;
}
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note strong { color: #dfe6f1; font-size: 12px; }
.sidebar-note span { margin-top: 2px; color: #8f9db1; font-size: 11px; }
.status-dot { width: 8px; height: 8px; margin-top: 5px; flex: 0 0 auto; border-radius: 50%; background: #e3a13e; box-shadow: 0 0 0 4px rgba(227, 161, 62, .12); }

.main-content { width: min(100%, 1120px); margin-left: 238px; padding: 44px 54px 42px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.eyebrow { margin: 0 0 6px; color: #71809a; font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 3.5vw, 38px); letter-spacing: -.04em; line-height: 1.1; }
h2 { margin-bottom: 4px; font-size: 17px; letter-spacing: -.02em; }
.page-intro { margin-bottom: 0; color: var(--muted); }
.operator-chip { display: flex; align-items: center; gap: 9px; padding: 7px 11px 7px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: #536178; font-size: 13px; box-shadow: 0 4px 16px rgba(31, 45, 73, .04); }
.operator-chip:hover { border-color: #b9c3f5; color: var(--accent); }
.operator-avatar { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 50%; background: #dfe5ff; color: var(--accent); font-size: 12px; font-weight: 700; }
.chevron { color: #9aa5b5; font-size: 11px; }

.notice-banner { display: flex; gap: 10px; align-items: center; margin: 30px 0 20px; padding: 12px 15px; border: 1px solid #dfe5ff; border-radius: 10px; background: #f4f6ff; color: #57668a; font-size: 13px; }
.notice-icon { display: grid; width: 19px; height: 19px; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #dce3ff; color: var(--accent); font-size: 12px; font-weight: 800; }

.panel, .review-panel { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.panel { padding: 27px 30px 29px; }
.panel-heading { display: flex; gap: 15px; margin-bottom: 25px; }
.panel-heading p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.panel-heading.compact { align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.step-number { width: 38px; height: 38px; padding-top: 8px; flex: 0 0 auto; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; text-align: center; letter-spacing: .04em; }

.target-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 23px; }
.target-tab { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-align: left; transition: border .18s ease, background .18s ease; }
.target-tab:hover { border-color: #b9c3f5; }
.target-tab.active { border-color: #9eafff; background: #f7f8ff; box-shadow: inset 0 0 0 1px #d4dcff; }
.target-tab strong, .target-tab small { display: block; }
.target-tab strong { font-size: 13px; }
.target-tab small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.tab-symbol { display: grid; width: 31px; height: 31px; place-items: center; flex: 0 0 auto; border-radius: 9px; background: #edf0ff; color: var(--accent); font-size: 17px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.field-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-wide { grid-column: 1 / -1; }
.field { display: grid; gap: 8px; align-content: start; }
.field-label { display: flex; justify-content: space-between; color: #3e4c62; font-size: 12px; font-weight: 700; }
.field-label em { color: #9aa5b5; font-size: 11px; font-style: normal; font-weight: 500; }
input, textarea, select { width: 100%; border: 1px solid #dfe4eb; border-radius: 9px; outline: none; background: #fff; color: var(--ink); transition: border .18s ease, box-shadow .18s ease; }
input, select { height: 43px; padding: 0 13px; }
textarea { min-height: 91px; padding: 11px 13px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #aeb7c5; }
input:focus, textarea:focus, select:focus { border-color: #8fa1f2; box-shadow: 0 0 0 3px rgba(52, 89, 230, .1); }
.field-help { color: #98a3b2; font-size: 11px; }
.inline-error { min-height: 0; margin: 10px 0 0; color: #c64949; font-size: 12px; }
.inline-error:not(:empty) { min-height: 18px; }

.review-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 23px 26px; background: #232f42; color: #fff; }
.review-copy h2 { color: #fff; }
.review-copy .eyebrow { color: #9eafff; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 0; padding: 0; list-style: none; color: #aeb9ca; font-size: 12px; }
.check-list li { display: flex; align-items: center; gap: 6px; }
.check-list li span { color: #87d7ba; font-weight: 800; }
.review-actions { display: flex; flex: 0 0 auto; gap: 10px; }
.button { min-height: 41px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; transition: transform .15s ease, background .15s ease, border .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { border-color: #dfe4eb; background: #fff; color: #526176; }
.review-panel .button-secondary { border-color: #47566d; background: transparent; color: #d7deea; }
.button span { margin-left: 6px; font-size: 17px; line-height: 0; }

.history-panel { padding-bottom: 18px; }
.history-caption { color: #a0aab8; font-size: 11px; }
.history-empty { padding: 30px 20px 32px; border: 1px dashed #dfe4eb; border-radius: 11px; text-align: center; }
.empty-icon { display: grid; width: 34px; height: 34px; margin: 0 auto 10px; place-items: center; border-radius: 50%; background: #f1f3f6; color: #9ba6b5; font-size: 18px; }
.history-empty p { margin-bottom: 3px; color: #536178; font-weight: 700; }
.history-empty span { color: #a0aab8; font-size: 12px; }
.history-list { display: grid; gap: 9px; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; }
.history-row-main { min-width: 0; }
.history-row-title { overflow: hidden; color: #3e4c62; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.history-row-meta { margin-top: 4px; color: #9aa5b5; font-size: 11px; }
.status-badge { padding: 4px 8px; border-radius: 999px; background: #ecf8f3; color: var(--success); font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-badge.pending { background: #fff7e8; color: #a96e11; }
.status-badge.failed { background: #fff0f0; color: #bd4d4d; }

.page-footer { display: flex; justify-content: space-between; padding: 19px 3px 0; color: #a0aab8; font-size: 11px; }
.page-footer span:last-child { color: #6a7993; }

.confirm-dialog { width: min(470px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 16px; background: transparent; box-shadow: 0 26px 90px rgba(20, 29, 44, .24); }
.confirm-dialog::backdrop { background: rgba(21, 30, 45, .52); backdrop-filter: blur(4px); }
.dialog-card { position: relative; padding: 31px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.dialog-card h2 { margin-bottom: 8px; font-size: 21px; }
.dialog-description { margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.dialog-close { position: absolute; top: 13px; right: 16px; width: 30px; height: 30px; border: 0; background: transparent; color: #9aa5b5; font-size: 24px; line-height: 1; }
.summary-list { display: grid; gap: 11px; margin: 0 0 24px; padding: 15px; border-radius: 10px; background: #f7f8fa; }
.summary-list div { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.summary-list dt { color: #8994a5; }
.summary-list dd { max-width: 65%; margin: 0; overflow: hidden; color: #435169; font-weight: 700; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.toast { position: fixed; right: 26px; bottom: 24px; z-index: 5; max-width: min(390px, calc(100% - 52px)); padding: 13px 16px; border: 1px solid #cfe7dc; border-radius: 10px; background: #f2fbf7; color: #26775b; box-shadow: 0 12px 30px rgba(31, 45, 73, .12); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #f0caca; background: #fff5f5; color: #b04b4b; }

@media (max-width: 850px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 16px 20px; }
  .app-shell { display: block; }
  .brand { padding: 0; }
  .nav-list { display: flex; margin-top: 14px; }
  .nav-item { min-height: 38px; padding: 0 10px; }
  .sidebar-note { display: none; }
  .main-content { margin-left: 0; padding: 31px 22px 35px; }
}

@media (max-width: 620px) {
  .topbar, .review-panel, .panel-heading.compact { display: block; }
  .operator-chip { width: fit-content; margin-top: 18px; }
  .notice-banner { align-items: flex-start; }
  .panel { padding: 22px 18px; }
  .field-grid, .field-grid.two-columns, .target-tabs { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .review-actions { margin-top: 22px; }
  .review-actions .button { flex: 1; }
  .history-caption { display: block; margin-top: 8px; }
  .page-footer { display: block; }
  .page-footer span { display: block; margin-top: 5px; }
  .dialog-card { padding: 27px 20px 21px; }
}
