:root,
[data-theme="light"] {
  color-scheme: light;
  --y360-red: #f0b429;
  --y360-red-hover: #d99a12;
  --y360-red-soft: rgba(240, 180, 41, 0.16);
  --y360-yellow: #fff7e6;
  --y360-text: #0f172a;
  --y360-text-secondary: #475569;
  --y360-text-muted: #64748b;
  --y360-bg: #f3f4f6;
  --y360-surface: #ffffff;
  --y360-surface-elevated: #ffffff;
  --y360-border: rgba(15, 23, 42, 0.1);
  --y360-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --y360-header-bg: rgba(255, 255, 255, 0.92);
  --y360-hover: rgba(240, 180, 41, 0.1);
  --y360-field-bg: rgba(240, 180, 41, 0.05);
  --y360-input-bg: #ffffff;
  --y360-pill-bg: #ffffff;
  --y360-footer-bg: #ffffff;
  --y360-log-bg: #1f2937;
  --y360-log-text: rgba(248, 250, 252, 0.9);
  --y360-progress-bg: linear-gradient(180deg, #fff 0%, rgba(240, 180, 41, 0.05) 100%);
  --y360-toggle-track: #cbd5e1;
  --y360-toggle-track-active: #f0b429;
  --y360-toggle-thumb: #ffffff;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --running: #f0b429;
  --brand-on-primary: #1c1917;
  --sync: #6366f1;
  --sync-soft: rgba(99, 102, 241, 0.12);
  --track: rgba(15, 23, 42, 0.08);
  --y360-radius-lg: 20px;
  --y360-radius-md: 14px;
  --y360-radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --y360-red-soft: rgba(245, 196, 81, 0.18);
  --y360-text: rgba(248, 250, 252, 0.94);
  --y360-text-secondary: rgba(203, 213, 225, 0.82);
  --y360-text-muted: rgba(148, 163, 184, 0.88);
  --y360-bg: #0b1220;
  --y360-surface: #111827;
  --y360-surface-elevated: #1a2332;
  --y360-border: rgba(148, 163, 184, 0.14);
  --y360-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  --y360-header-bg: rgba(11, 18, 32, 0.92);
  --y360-hover: rgba(245, 196, 81, 0.1);
  --y360-field-bg: rgba(245, 196, 81, 0.06);
  --y360-input-bg: #0f172a;
  --y360-pill-bg: #1a2332;
  --y360-footer-bg: #0d1524;
  --y360-log-bg: #020617;
  --y360-log-text: rgba(248, 250, 252, 0.88);
  --y360-progress-bg: linear-gradient(180deg, #111827 0%, #0d1524 100%);
  --y360-toggle-track: #334155;
  --y360-toggle-track-active: #f5c451;
  --y360-toggle-thumb: #f8fafc;
  --sync-soft: rgba(129, 140, 248, 0.18);
  --sync: #818cf8;
  --running: #f5c451;
  --brand-on-primary: #1c1917;
  --track: rgba(248, 250, 252, 0.1);
}

* { box-sizing: border-box; }

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: var(--y360-bg);
  color: var(--y360-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--y360-header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--y360-border);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.header-actions .btn-sm {
  white-space: nowrap;
  padding: 0.35rem 0.7rem;
}

.help-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--y360-border);
  background: var(--y360-surface);
  color: var(--y360-text-secondary);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.help-btn:hover {
  color: var(--y360-text);
  border-color: color-mix(in srgb, var(--y360-red) 35%, var(--y360-border));
  background: var(--y360-hover);
  box-shadow: 0 0 0 3px var(--y360-red-soft);
}

.help-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--y360-red-soft);
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.help-modal.hidden {
  display: none;
}

.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

[data-theme="dark"] .help-modal-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.help-modal-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  background: var(--y360-surface);
  border: 1px solid var(--y360-border);
  border-radius: var(--y360-radius-lg);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--y360-border);
}

.help-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.help-modal-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--y360-text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.help-modal-close:hover {
  background: var(--y360-hover);
  color: var(--y360-text);
}

.help-modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--y360-text);
}

.help-modal-body h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.help-modal-body h3:first-child {
  margin-top: 0;
}

.help-modal-body ol {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.help-modal-body li + li {
  margin-top: 0.45rem;
}

.help-modal-body p {
  margin: 0 0 0.75rem;
}

.help-modal-body a {
  color: var(--y360-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.help-doc {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--y360-text);
}

.help-doc > h1:first-child {
  display: none;
}

.help-doc h2 {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.12rem;
  font-weight: 600;
}

.help-doc h2:first-child {
  margin-top: 0;
}

.help-doc h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.help-doc h4 {
  margin: 1rem 0 0.4rem;
  font-size: 0.96rem;
  font-weight: 600;
}

.help-doc p,
.help-doc ul,
.help-doc ol {
  margin: 0 0 0.75rem;
}

.help-doc ul,
.help-doc ol {
  padding-left: 1.35rem;
}

.help-doc li + li {
  margin-top: 0.35rem;
}

.help-doc blockquote {
  margin: 0 0 1rem;
  padding: 12px 14px;
  border-left: 3px solid var(--y360-red);
  border-radius: 0 var(--y360-radius) var(--y360-radius) 0;
  background: var(--y360-hover);
  color: var(--y360-text-secondary);
}

.help-doc blockquote p:last-child {
  margin-bottom: 0;
}

.help-doc pre {
  margin: 0 0 1rem;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: var(--y360-radius);
  border: 1px solid var(--y360-border);
  background: color-mix(in srgb, var(--y360-hover) 70%, var(--y360-surface));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.help-doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
}

.help-doc :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--y360-hover);
}

.help-doc table {
  width: 100%;
  margin: 0 0 1rem;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.help-doc th,
.help-doc td {
  border: 1px solid var(--y360-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.help-doc th {
  background: var(--y360-hover);
  font-weight: 600;
}

.help-doc hr {
  margin: 1.5rem 0;
  border: none;
  border-top: 1px solid var(--y360-border);
}

.help-doc a {
  color: var(--y360-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.help-doc-loading,
.help-doc-error {
  margin: 0;
}

.help-modal-note {
  margin-top: 1rem;
  padding: 12px 14px;
  border-radius: var(--y360-radius);
  background: var(--y360-hover);
  font-size: 0.88rem;
  color: var(--y360-text-secondary);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-shrink: 0;
}

.brand-icon {
  display: block;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.brand-icon svg {
  display: block;
  width: 48px;
  height: 48px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-name {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.brand-tagline {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--y360-text-secondary);
  line-height: 1.35;
}

.theme-switch {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 6px 12px;
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--y360-border);
  background: var(--y360-surface);
  box-shadow: var(--y360-shadow);
  cursor: pointer;
  user-select: none;
  line-height: 1;
  transition: background 0.15s, box-shadow 0.15s;
}

.theme-switch:hover {
  background: var(--y360-hover);
}

.theme-switch-label {
  display: flex;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1;
  color: var(--y360-text-muted);
  transition: color 0.2s, font-weight 0.2s;
  min-width: 3.8rem;
}

.theme-switch-label-light { text-align: right; }
.theme-switch-label-dark { text-align: left; }

[data-theme="light"] .theme-switch-label-light,
:root:not([data-theme="dark"]) .theme-switch-label-light {
  color: var(--y360-text);
  font-weight: 600;
}

[data-theme="dark"] .theme-switch-label-dark {
  color: var(--y360-text);
  font-weight: 600;
}

.theme-switch-track {
  position: relative;
  width: 52px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--y360-toggle-track);
  border: 1px solid var(--y360-border);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.theme-switch-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.theme-switch-input:focus-visible + .theme-switch-knob {
  outline: 2px solid var(--y360-red);
  outline-offset: 2px;
}

.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--y360-toggle-thumb);
  color: #f5a623;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s, color 0.25s;
  pointer-events: none;
}

.theme-switch-input:checked ~ .theme-switch-knob {
  transform: translateX(26px);
  color: #c8d0e0;
}

.theme-switch-track:has(.theme-switch-input:checked) {
  background: var(--y360-toggle-track-active);
  border-color: var(--y360-toggle-track-active);
  box-shadow: 0 0 0 3px var(--y360-red-soft);
}

.theme-switch-track:has(.theme-switch-input:not(:checked)) {
  background: linear-gradient(180deg, #fffbeb 0%, var(--y360-toggle-track) 100%);
}

[data-theme="dark"] .theme-switch-track:has(.theme-switch-input:not(:checked)) {
  background: var(--y360-toggle-track);
}

.theme-knob-icon {
  position: absolute;
  transition: opacity 0.2s, transform 0.2s;
}

.theme-knob-icon-sun { opacity: 1; transform: scale(1); }
.theme-knob-icon-moon { opacity: 0; transform: scale(0.7); }

.theme-switch-input:checked ~ .theme-switch-knob .theme-knob-icon-sun {
  opacity: 0;
  transform: scale(0.7);
}

.theme-switch-input:checked ~ .theme-switch-knob .theme-knob-icon-moon {
  opacity: 1;
  transform: scale(1);
}

.header-nav {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  color: var(--y360-text-secondary);
  transition: background 0.15s, color 0.15s;
}

.header-nav a:hover,
.header-nav a.is-active {
  background: var(--y360-hover);
  color: var(--y360-text);
}

.header-nav a.is-active {
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--y360-border);
}

.page-main {
  flex: 1 0 auto;
  padding: 24px 0 48px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Cards / steps ── */

.step-card {
  display: none;
}

.step-card.is-visible {
  display: block;
}

.card {
  background: var(--y360-surface);
  border: 1px solid var(--y360-border);
  border-radius: var(--y360-radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--y360-shadow);
}

.step-card-accent {
  border-color: color-mix(in srgb, var(--y360-red) 15%, transparent);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--y360-red) 6%, transparent);
}

.step-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.step-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--y360-red);
  color: var(--brand-on-primary, #1c1917);
  font-size: 1rem;
  font-weight: 700;
}

.step-note {
  margin: 4px 0 0;
  grid-column: span 2;
  font-size: 0.86rem;
  color: var(--y360-text-muted);
  line-height: 1.5;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--y360-text-secondary);
  line-height: 1.55;
}

.grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.span-2 { grid-column: span 2; }

.org-fieldset,
fieldset.sync-settings {
  border: 1px solid var(--y360-border);
  border-radius: var(--y360-radius-md);
  padding: 16px 18px 18px;
  margin: 0;
  background: var(--y360-field-bg);
}

legend {
  padding: 0 8px;
  font-weight: 600;
  font-size: 0.92rem;
}

.step-card label:not(.checkbox-chip),
.upload-row label:not(.checkbox-chip) {
  display: block;
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--y360-text-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--y360-border);
  border-radius: var(--y360-radius-sm);
  font: inherit;
  color: var(--y360-text);
  background: var(--y360-input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--y360-red) 45%, transparent);
  box-shadow: 0 0 0 3px var(--y360-red-soft);
}

.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.input-with-button {
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

.input-with-button input {
  flex: 1;
  min-width: 0;
}

.input-with-button .btn {
  flex-shrink: 0;
  align-self: stretch;
  white-space: nowrap;
}

.export-dir-label {
  grid-column: 1 / -1;
}

.file-input-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
  margin: 0;
}

.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-input-label {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px dashed var(--y360-border);
  border-radius: var(--y360-radius-sm);
  background: var(--y360-input-bg);
  font-size: 0.9rem;
  color: var(--y360-text-secondary);
}

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--y360-border);
  background: var(--y360-pill-bg);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--y360-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.checkbox-chip:has(input:checked) {
  border-color: color-mix(in srgb, var(--y360-red) 35%, transparent);
  background: var(--y360-red-soft);
}

.checkbox-chip input { margin: 0; accent-color: var(--y360-red); }

.sync-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.sync-settings legend { color: var(--y360-text-secondary); }

/* ── Buttons ── */

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 11px 20px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary {
  background: var(--y360-red);
  color: var(--brand-on-primary, #1c1917);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--y360-red) 28%, transparent);
}

.btn-primary:hover:not(:disabled) { background: var(--y360-red-hover); }

.btn-lg {
  padding: 13px 24px;
  font-size: 1rem;
  border-radius: 14px;
}

.btn-secondary {
  background: var(--y360-surface);
  color: var(--y360-text);
  border: 1px solid var(--y360-border);
}

.btn-secondary:hover:not(:disabled) { background: var(--y360-hover); }

button:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Status / info ── */

.status { font-size: 0.9rem; color: var(--y360-text-muted); }
.status.ok { color: var(--ok); font-weight: 500; }
.status.bad { color: var(--bad); font-weight: 500; }

.info-box,
.summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--y360-field-bg);
  border-radius: var(--y360-radius-md);
  border: 1px solid var(--y360-border);
  font-size: 0.9rem;
}

.muted { color: var(--y360-text-muted); }

code {
  background: var(--y360-red-soft);
  color: var(--y360-red-hover);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.88em;
}

/* ── Progress panel ── */

.progress-panel {
  margin-top: 4px;
  padding: 20px;
  border: 1px solid var(--y360-border);
  border-radius: var(--y360-radius-md);
  background: var(--y360-progress-bg);
}

.progress-panel.running {
  border-color: color-mix(in srgb, var(--y360-red) 25%, transparent);
  box-shadow: 0 0 0 3px var(--y360-red-soft);
}

.progress-panel.completed,
.progress-panel.partial { border-color: rgba(5, 150, 105, 0.25); }

.progress-panel.failed { border-color: rgba(220, 38, 38, 0.25); }

.progress-panel.cancelled { border-color: rgba(0, 0, 0, 0.12); }

.progress-panel.sync { border-color: color-mix(in srgb, var(--sync) 25%, transparent); }

.progress-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.progress-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.progress-badge.idle { background: rgba(0, 0, 0, 0.06); color: var(--y360-text-muted); }
.progress-badge.running { background: var(--y360-red-soft); color: var(--y360-red); animation: pulse-badge 1.6s ease-in-out infinite; }
.progress-badge.ok { background: rgba(5, 150, 105, 0.12); color: var(--ok); }
.progress-badge.warn { background: rgba(217, 119, 6, 0.12); color: var(--warn); }
.progress-badge.bad { background: rgba(220, 38, 38, 0.12); color: var(--bad); }
.progress-badge.cancelled,
.progress-panel.cancelled .progress-badge.idle { background: rgba(0, 0, 0, 0.06); color: var(--y360-text-secondary); }
.progress-badge.sync { background: var(--sync-soft); color: var(--sync); }

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.progress-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.progress-subtitle { font-size: 0.88rem; margin-top: 2px; }

.progress-percent {
  font-size: 1.4rem;
  font-weight: 700;
  min-width: 4rem;
  text-align: right;
  letter-spacing: -0.02em;
}

.progress-track {
  height: 10px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #fcd34d 0%, var(--y360-red) 55%, #f59e0b 100%);
  transition: width 0.4s ease;
}

.progress-panel.running .progress-bar.indeterminate {
  width: 35% !important;
  animation: progress-indeterminate 1.4s ease-in-out infinite;
}

.progress-panel.completed .progress-bar,
.progress-panel.partial .progress-bar.ok {
  background: linear-gradient(90deg, #34d399 0%, var(--ok) 100%);
}

.progress-panel.partial .progress-bar.warn {
  background: linear-gradient(90deg, #fbbf24 0%, var(--warn) 100%);
}

.progress-panel.failed .progress-bar {
  background: linear-gradient(90deg, #f87171 0%, var(--bad) 100%);
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.progress-detail {
  margin-top: 12px;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.progress-folders.hidden { display: none; }
.hidden { display: none !important; }

.mode-bar {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0;
  position: relative;
  z-index: 2;
}

.mode-toggle .mode-chip {
  cursor: pointer;
  user-select: none;
}

.subsection-title {
  font-size: 1rem;
  font-weight: 500;
  margin: 1rem 0 0.5rem;
}

textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--y360-border);
  border-radius: 8px;
  background: var(--y360-surface);
  color: var(--y360-text);
  resize: vertical;
}

.progress-pairs {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.pair-card {
  border: 1px solid var(--y360-border);
  border-radius: var(--y360-radius-md);
  padding: 14px 16px;
  background: var(--y360-surface-elevated);
}

.pair-card.running {
  border-color: color-mix(in srgb, var(--y360-red) 25%, transparent);
}

.pair-card.ok { border-color: rgba(5, 150, 105, 0.25); }
.pair-card.warn,
.pair-card.bad { border-color: rgba(217, 119, 6, 0.35); }

.pair-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.pair-card-email {
  font-size: 0.86rem;
  font-weight: 600;
  word-break: break-all;
}

.pair-card-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--y360-text-muted);
}

.pair-card-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--y360-radius-sm);
  background: rgba(220, 38, 38, 0.08);
  color: var(--bad);
  font-size: 0.84rem;
  line-height: 1.45;
}

.progress-folders {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.folder-row {
  display: grid;
  grid-template-columns: 120px 1fr 72px;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
}

.folder-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row-track {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.folder-row-bar {
  height: 100%;
  background: var(--y360-red);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.folder-row-count {
  text-align: right;
  color: var(--y360-text-muted);
  font-variant-numeric: tabular-nums;
}

.log {
  margin-top: 16px;
  background: var(--y360-log-bg);
  color: var(--y360-log-text);
  padding: 16px;
  border-radius: var(--y360-radius-md);
  min-height: 240px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.8rem;
  line-height: 1.55;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ── Footer ── */

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--y360-border);
  background: var(--y360-footer-bg);
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px;
}

.site-footer p {
  margin: 0;
  font-size: 0.88rem;
}

.site-footer .footer-muted {
  margin-top: 4px;
  color: var(--y360-text-muted);
  font-size: 0.82rem;
}

/* ── Responsive ── */

[data-theme="dark"] .file-input-label {
  border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .progress-panel.cancelled { border-color: rgba(255, 255, 255, 0.12); }

@media (max-width: 1100px) {
  .theme-switch-label {
    display: none;
  }

  .theme-switch {
    padding: 6px 8px;
    gap: 0;
  }
}

@media (max-width: 960px) {
  .brand-lockup {
    display: none;
  }

  .brand {
    gap: 0;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .header-nav {
    flex: none;
    justify-content: flex-start;
    order: 3;
  }

  .header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    order: 2;
  }

  .brand {
    flex-wrap: wrap;
    order: 1;
  }

  .brand-lockup {
    flex: 1;
    min-width: 0;
  }

  .grid.two-col { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }

  .sync-settings { grid-template-columns: 1fr; }

  .progress-header {
    grid-template-columns: 1fr;
  }

  .progress-percent { text-align: left; }

  .upload-row { flex-direction: column; }
  .upload-row .btn { width: 100%; }
}

/* ── Login ── */

body.auth-locked .site-header,
body.auth-locked .page-main,
body.auth-locked .site-footer {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--y360-bg);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(100%, 24rem);
  display: grid;
  gap: 1rem;
}

.login-brand {
  display: grid;
  gap: 0.35rem;
}

.login-lead {
  margin: 0;
  color: var(--y360-text-secondary);
  font-size: 0.95rem;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
