:root {
  color-scheme: light;
  --background: #f8f9fa;
  --surface: #ffffff;
  --surface-low: #f3f4f5;
  --surface-mid: #edeeef;
  --surface-high: #e7e8e9;
  --surface-highest: #e1e3e4;
  --text: #191c1d;
  --text-muted: #505f76;
  --text-soft: #737686;
  --outline: #c3c6d7;
  --outline-strong: #9ca0b1;
  --primary: #004ac6;
  --primary-hover: #003ea8;
  --primary-soft: #dbe1ff;
  --secondary-soft: #d0e1fb;
  --success: #087443;
  --success-soft: #d8f5e5;
  --warning: #943700;
  --warning-soft: #ffeadf;
  --error: #ba1a1a;
  --error-soft: #ffdad6;
  --focus: #0053db;
  --shadow-popover: 0 14px 36px rgba(25, 28, 29, 0.16);
  --header-height: 64px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.app-body {
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; inset-inline-start: 12px; top: -50px; z-index: 200; background: var(--primary); color: white; padding: 9px 14px; border-radius: 4px; }
.skip-link:focus { top: 8px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus) !important; box-shadow: 0 0 0 2px rgba(0, 83, 219, .14) !important; outline: none; }

.material-symbols-outlined { font-size: 20px; line-height: 1; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; }

.app-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-height);
  display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); align-items: center;
  gap: 24px; padding: 0 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--outline); backdrop-filter: blur(10px);
}
.brand-lockup, .heading-start, .heading-line, .heading-actions, .header-actions, .toolbar-actions, .panel-heading, .section-heading, .form-footer, .drawer-title-line, .footer-action-group { display: flex; align-items: center; }
.brand-lockup { gap: 10px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--primary); color: white; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: inherit; }
.brand-title, .brand-subtitle, .import-intro p, .panel-heading p, .section-heading p, .heading-start p, .drawer-header p, .toast p { margin: 0; }
.brand-title { font-size: 16px; line-height: 20px; font-weight: 700; }
.brand-subtitle { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); font-size: 11px; line-height: 16px; }
.header-actions { justify-content: flex-end; }

.workflow-steps { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--text-soft); }
.workflow-step { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.step-number { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--outline); border-radius: 50%; background: var(--surface); font: 600 11px/1 JetBrains Mono, monospace; }
.step-connector { width: 44px; height: 1px; background: var(--outline); }
body[data-stage="import"] .workflow-step[data-step="import"], body[data-stage="review"] .workflow-step[data-step="review"], body[data-stage="export"] .workflow-step[data-step="export"] { color: var(--primary); }
body[data-stage="import"] .workflow-step[data-step="import"] .step-number, body[data-stage="review"] .workflow-step[data-step="review"] .step-number, body[data-stage="export"] .workflow-step[data-step="export"] .step-number { color: white; border-color: var(--primary); background: var(--primary); }
body[data-stage="review"] .workflow-step[data-step="import"] .step-number, body[data-stage="export"] .workflow-step[data-step="import"] .step-number, body[data-stage="export"] .workflow-step[data-step="review"] .step-number { color: var(--success); border-color: var(--success); background: var(--success-soft); }

.app-main { min-height: calc(100vh - var(--header-height)); }
.stage-view { width: 100%; }
.fade-in { animation: fade-in .28s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.button, .icon-button, .filter-tab, .segment, .button-link { border: 0; transition: background-color .15s, border-color .15s, color .15s, opacity .15s; }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 13px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.button-primary { color: white; background: var(--primary); border: 1px solid var(--primary); }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-secondary { color: var(--text); background: var(--surface); border: 1px solid var(--outline); }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: var(--surface-low); border-color: var(--outline-strong); }
.button-quiet { color: var(--text-muted); background: transparent; border: 1px solid transparent; }
.button-danger-quiet { color: var(--error); background: transparent; border: 1px solid transparent; }
.button-danger-quiet:hover { background: var(--error-soft); }
.button-small { min-height: 32px; padding: 5px 10px; }
.button-large { min-height: 44px; padding-inline: 18px; font-size: 13px; }
.button:disabled { opacity: .5; }
.button.is-loading .material-symbols-outlined { animation: spin .8s linear infinite; }
.button-link { padding: 3px; color: var(--primary); background: transparent; font-size: 11px; font-weight: 600; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; color: var(--text-muted); background: transparent; border-radius: 4px; }
.icon-button:hover { background: var(--surface-high); color: var(--text); }
.icon-button.danger { color: var(--error); }
