:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  background: #080d14;
  color: #eef6ff;
  --line: rgba(151, 187, 221, 0.18);
  --muted: #8193a8;
  --blue: #8fd3ff;
  --green: #73e3b1;
  --danger: #ff8f96;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% 8%, rgba(55, 131, 190, 0.18), transparent 30%),
    radial-gradient(circle at 4% 42%, rgba(51, 101, 141, 0.12), transparent 26%),
    #080d14;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sync-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 72px; }
.sync-head { display: flex; justify-content: space-between; align-items: center; min-height: 54px; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid rgba(143,211,255,.45); border-radius: 13px; color: var(--blue); font-weight: 800; }
.brand span:last-child { display: grid; gap: 2px; }
.brand small, .eyebrow { color: var(--blue); font-size: 10px; letter-spacing: .2em; }
.brand strong { font-size: 15px; }
.sync-head nav { display: flex; gap: 10px; }
.sync-head nav a { padding: 9px 13px; color: #aebed0; text-decoration: none; border-radius: 999px; border: 1px solid var(--line); }

.hero { max-width: 850px; padding: 88px 0 58px; }
.hero h1 { margin: 12px 0 18px; font-size: clamp(36px, 6vw, 72px); line-height: 1.02; letter-spacing: -.045em; font-weight: 650; }
.hero > p:last-child { max-width: 680px; color: #97a9bd; font-size: 17px; line-height: 1.8; }

.panel { margin-top: 18px; padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: rgba(13, 21, 31, .78); box-shadow: 0 24px 70px rgba(0,0,0,.22); backdrop-filter: blur(16px); }
.panel[hidden], [hidden] { display: none !important; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.panel-head > div { display: flex; gap: 14px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.step { display: grid; place-items: center; min-width: 36px; height: 28px; border-radius: 999px; background: rgba(143,211,255,.1); color: var(--blue); font: 700 11px/1 ui-monospace, monospace; }
.state-pill { padding: 7px 11px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.04); font-size: 12px; white-space: nowrap; }
.state-pill.running { color: var(--blue); background: rgba(143,211,255,.1); }
.state-pill.completed { color: var(--green); background: rgba(115,227,177,.1); }
.state-pill.failed, .state-pill.cancelled { color: var(--danger); background: rgba(255,143,150,.1); }

label { display: grid; gap: 8px; color: #aebed0; font-size: 12px; }
input, select { width: 100%; min-height: 46px; padding: 0 14px; color: #eef6ff; background: #0a121c; border: 1px solid var(--line); border-radius: 12px; outline: none; }
input:focus, select:focus { border-color: rgba(143,211,255,.72); box-shadow: 0 0 0 3px rgba(143,211,255,.08); }
button, .link-button { min-height: 44px; padding: 0 17px; color: #d7e3ef; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.04); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .link-button:hover { border-color: rgba(143,211,255,.45); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { color: #07111b; background: var(--blue); border-color: var(--blue); font-weight: 700; }
.url-form > label { margin-bottom: 8px; }
.url-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.url-row input { min-height: 54px; font-size: 16px; }
.url-row button { min-width: 132px; }
.status-line { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.status-line.error { color: var(--danger); }

.inspection-grid { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; }
.inspection-grid article { min-height: 118px; padding: 17px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.inspection-grid span, .inspection-grid small { color: var(--muted); font-size: 11px; }
.inspection-grid strong { margin: 8px 0 3px; font-size: 26px; }
.source-card strong { font-size: 20px; }
.source-card small { word-break: break-all; }
.create-form { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(190px, 1fr) auto; gap: 14px; align-items: end; margin-top: 20px; }
.visible-toggle { min-height: 46px; display: flex; flex-direction: row; align-items: center; gap: 9px; padding: 0 4px; }
.visible-toggle input { width: 18px; min-height: 18px; accent-color: var(--blue); }
#replace-confirm-wrap { grid-column: 1 / 3; }

.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.06); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5ba9dc, #8fd3ff, #73e3b1); transition: width .35s ease; }
.progress-meta { display: grid; grid-template-columns: 1fr auto auto auto; gap: 18px; margin-top: 15px; color: var(--muted); font-size: 12px; }
.progress-meta strong { color: #d9e7f4; }
.current-file { min-height: 18px; color: #708397; font: 11px/1.6 ui-monospace, monospace; word-break: break-all; }
.job-error { padding: 14px; color: #ffb4b9; border: 1px solid rgba(255,143,150,.24); border-radius: 12px; background: rgba(255,143,150,.06); white-space: pre-wrap; }
.job-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.job-history { display: grid; gap: 8px; }
.job-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) 120px 120px auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; }
.job-row strong, .job-row small { display: block; }
.job-row small { margin-top: 4px; color: var(--muted); }
.job-row > span { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); }
.locked { padding: 36px; text-align: center; }

@media (max-width: 820px) {
  .sync-shell { width: min(100% - 24px, 720px); padding-top: 12px; }
  .sync-head nav a:first-child { display: none; }
  .hero { padding: 58px 0 34px; }
  .hero h1 { font-size: clamp(38px, 12vw, 58px); }
  .panel { padding: 20px; border-radius: 20px; }
  .inspection-grid { grid-template-columns: 1fr 1fr; }
  .source-card { grid-column: 1 / -1; }
  .create-form { grid-template-columns: 1fr; }
  #replace-confirm-wrap { grid-column: auto; }
  .job-row { grid-template-columns: 1fr auto; }
  .job-row > span:nth-child(3) { display: none; }
}

@media (max-width: 520px) {
  .sync-head nav { display: none; }
  .url-row { grid-template-columns: 1fr; }
  .url-row button { width: 100%; }
  .inspection-grid { grid-template-columns: 1fr; }
  .source-card { grid-column: auto; }
  .progress-meta { grid-template-columns: 1fr auto; }
  #progress-eta { grid-column: 1 / -1; }
  #progress-bytes { grid-column: 1 / -1; }
}
