:root {
  --bg: #0a0e1a;
  --panel: rgba(17, 24, 39, 0.82);
  --surface: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.09);
  --border-active: rgba(99, 102, 241, 0.55);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-family: Inter, system-ui, sans-serif; letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
[hidden] { display: none !important; }
.page-shell { width: min(1100px, calc(100% - 48px)); margin: 0 auto; padding: 40px 0 80px; }
.page-header { margin-bottom: 48px; text-align: center; }
.environment-badge { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 16px; padding: 6px 15px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: #818cf8; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.environment-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px rgba(16, 185, 129, 0.8); }
.page-header h1 { margin: 0 0 8px; color: #8b7cf7; font-size: 36px; line-height: 1.2; font-weight: 800; }
.page-header p { max-width: 580px; margin: 0 auto; color: var(--text-secondary); font-size: 15px; line-height: 1.6; }
.glass-panel { margin-bottom: 32px; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--panel); }
.panel-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.panel-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: var(--radius-sm); color: white; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.panel-icon svg { width: 19px; height: 19px; }
.panel-heading h2, .section-title h3, .download-panel h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.panel-heading p, .section-title p, .download-panel p { margin: 5px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.drop-zone { position: relative; display: block; min-height: 210px; padding: 46px 24px; overflow: hidden; border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface); text-align: center; transition: border-color 160ms ease, background 160ms ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: rgba(99, 102, 241, 0.07); }
.drop-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone .drop-icon { display: block; width: 48px; height: 48px; margin: 0 auto 18px; color: #a5b4fc; }
.drop-zone strong { color: #818cf8; font-size: 15px; }
.drop-zone span { color: var(--text-secondary); font-size: 15px; }
.drop-zone small { display: block; margin-top: 8px; color: var(--text-muted); font-size: 12px; }
.file-list { display: grid; gap: 8px; margin-top: 16px; max-height: 250px; overflow-y: auto; }
.file-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 34px; align-items: center; gap: 10px; min-height: 54px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.file-item.is-invalid { border-color: rgba(239, 68, 68, 0.35); }
.file-kind { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 7px; color: #c7d2fe; background: rgba(99, 102, 241, 0.16); }
.file-kind svg { width: 17px; }
.file-name { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.icon-button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 6px; color: var(--text-muted); background: transparent; }
.icon-button:hover { color: var(--error); background: rgba(239, 68, 68, 0.1); }
.icon-button svg { width: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
.form-field { display: grid; gap: 8px; min-width: 0; }
.form-field-wide { grid-column: 1 / -1; }
.form-field > span:first-child { color: var(--text-secondary); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.form-field em { color: var(--text-muted); font-style: normal; font-weight: 500; text-transform: none; }
.form-field b { color: var(--error); }
.form-field input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; color: var(--text); background: var(--surface); }
.form-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.11); }
.form-field input::placeholder { color: #475569; }
.secret-control { position: relative; display: block; }
.secret-control input { padding-right: 46px; }
.secret-control button { position: absolute; top: 3px; right: 3px; display: grid; width: 40px; height: 40px; place-items: center; border: 0; color: var(--text-muted); background: transparent; }
.secret-control button svg { width: 17px; }
.action-row { display: flex; gap: 12px; margin-top: 24px; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 0 22px; border: 1px solid transparent; border-radius: var(--radius-sm); color: white; font-size: 13px; font-weight: 700; }
.button svg { width: 17px; }
.button-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.button-primary:not(:disabled):hover { filter: brightness(1.08); }
.button-secondary { border-color: var(--border); color: var(--text-secondary); background: var(--surface); }
.button-secondary:not(:disabled):hover { color: var(--text); border-color: rgba(255, 255, 255, 0.16); }
.batch-lookup { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 12px; }
.status-banner { margin-top: 18px; padding: 13px 15px; border: 1px solid rgba(59, 130, 246, 0.2); border-radius: var(--radius-sm); color: #93c5fd; background: rgba(59, 130, 246, 0.08); font-size: 13px; line-height: 1.5; }
.status-banner.is-success { color: #6ee7b7; border-color: rgba(16, 185, 129, 0.25); background: rgba(16, 185, 129, 0.08); }
.status-banner.is-error { color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.08); }
.status-banner strong { display: block; margin-bottom: 2px; color: inherit; }
.status-tracker { margin-top: 26px; }
.tracker-bar { display: flex; align-items: flex-start; margin: 0 8px 24px; }
.tracker-step { display: grid; width: 88px; flex: 0 0 88px; justify-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.tracker-step span { display: grid; width: 38px; height: 38px; place-items: center; border: 2px solid var(--border); border-radius: 50%; background: #111827; }
.tracker-step svg { width: 17px; }
.tracker-step.is-active { color: #a5b4fc; }
.tracker-step.is-active span { border-color: var(--accent); background: rgba(99, 102, 241, 0.18); }
.tracker-step.is-complete { color: #6ee7b7; }
.tracker-step.is-complete span { border-color: var(--success); background: rgba(16, 185, 129, 0.16); }
.tracker-step.is-failed { color: #fca5a5; }
.tracker-step.is-failed span { border-color: var(--error); background: rgba(239, 68, 68, 0.14); }
.tracker-line { height: 2px; flex: 1; margin-top: 19px; background: var(--border); }
.tracker-line.is-active { background: var(--accent); }
.tracker-line.is-complete { background: var(--success); }
.download-panel, .summary-panel, .results-preview { margin-top: 24px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.download-panel { border-color: rgba(16, 185, 129, 0.2); background: rgba(16, 185, 129, 0.045); }
.download-panel h3 { color: #6ee7b7; }
.download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.download-button { display: grid; grid-template-columns: 34px minmax(0, 1fr) 20px; align-items: center; gap: 10px; min-height: 68px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: #111827; text-align: left; }
.download-button:hover { border-color: var(--accent); }
.download-button > svg { width: 20px; color: #a5b4fc; }
.download-button span { display: grid; gap: 3px; }
.download-button strong { font-size: 13px; }
.download-button small { color: var(--text-muted); font-size: 10px; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-title h3 { font-size: 15px; }
.summary-count { padding: 5px 9px; border-radius: 999px; color: #c7d2fe; background: rgba(99, 102, 241, 0.14); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.summary-table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.summary-table { width: 100%; min-width: 880px; border-collapse: collapse; background: #111827; }
.summary-table th, .summary-table td { padding: 10px 11px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: 11px; text-align: left; vertical-align: top; }
.summary-table th { color: #cbd5e1; background: #171f2e; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.summary-table td:first-child { max-width: 230px; color: var(--text); font-weight: 600; }
.summary-table tr:last-child td { border-bottom: 0; }
.status-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status-pill.is-success { color: #6ee7b7; background: rgba(16, 185, 129, 0.12); }
.status-pill.is-error { color: #fca5a5; background: rgba(239, 68, 68, 0.12); }
.results-container { display: grid; gap: 8px; }
.result-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #111827; }
.result-header { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 14px; border: 0; color: var(--text); background: transparent; text-align: left; }
.result-header svg { width: 15px; color: var(--text-muted); transition: transform 160ms ease; }
.result-header.is-open svg { transform: rotate(90deg); }
.result-file-name { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.result-body { display: none; max-height: 480px; overflow: auto; border-top: 1px solid var(--border); background: #080c16; }
.result-body.is-open { display: block; }
.result-body pre { margin: 0; padding: 16px; color: #cbd5e1; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(420px, calc(100vw - 44px)); padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: #172033; box-shadow: 0 16px 42px rgba(0, 0, 0, 0.35); font-size: 12px; }
.toast.is-error { color: #fecaca; border-color: rgba(239, 68, 68, 0.35); }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 28px, 1100px); padding-top: 28px; }
  .page-header { margin-bottom: 30px; }
  .page-header h1 { font-size: 29px; }
  .glass-panel { padding: 22px; border-radius: var(--radius-lg); }
  .form-grid, .download-grid { grid-template-columns: 1fr; }
  .form-field-wide { grid-column: auto; }
  .batch-lookup { grid-template-columns: 1fr 1fr; }
  .batch-lookup .form-field { grid-column: 1 / -1; }
  .batch-lookup .button { width: 100%; }
  .action-row { display: grid; grid-template-columns: 1fr 1fr; }
  .drop-zone { min-height: 190px; padding: 38px 18px; }
}

@media (max-width: 430px) {
  .page-shell { width: min(100% - 20px, 1100px); }
  .glass-panel { padding: 18px; }
  .action-row, .batch-lookup { grid-template-columns: 1fr; }
  .tracker-step { width: 70px; flex-basis: 70px; }
  .file-item { grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .file-meta { display: none; }
}
