:root {
  color-scheme: dark;
  --bg: #07111d;
  --bg-soft: #0b1826;
  --panel: #102233;
  --panel-strong: #142b40;
  --line: rgba(190, 220, 236, 0.14);
  --text: #f3f8fb;
  --muted: #91a9b8;
  --accent: #42d3b2;
  --accent-strong: #20b99a;
  --blue: #62aef4;
  --warning: #f1bd65;
  --danger: #ff7b78;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(66, 211, 178, 0.16), transparent 32rem),
    radial-gradient(circle at 92% 12%, rgba(98, 174, 244, 0.12), transparent 32rem),
    var(--bg);
}

a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%, 520px); }
.login-card {
  padding: clamp(30px, 7vw, 54px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(16, 34, 51, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  color: #03241d;
  background: var(--accent);
  font-size: 27px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(66, 211, 178, 0.24);
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; flex: 0 0 auto; }
.eyebrow {
  margin: 24px 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(30px, 6vw, 44px); line-height: 1.05; letter-spacing: -0.035em; }
h2 { margin-bottom: 0; font-size: 23px; letter-spacing: -0.02em; }
.login-lead { color: var(--muted); line-height: 1.65; }
.pin-form { margin-top: 32px; }
.pin-form > label, .field-grid label { display: grid; gap: 8px; color: #c9d8e1; font-size: 13px; font-weight: 750; }
.pin-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 9px; }
input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: #091827;
  transition: border-color 160ms, box-shadow 160ms, opacity 160ms;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66, 211, 178, 0.13); }
.pin-row input { padding: 14px 15px; font-size: 21px; letter-spacing: 0.24em; }
.pin-row button, .button.primary {
  border: 0;
  border-radius: 12px;
  color: #02231d;
  background: var(--accent);
  font-weight: 850;
}
.pin-row button { padding: 0 20px; }
.pin-row button:hover, .button.primary:hover { background: #62e3c5; }
.security-note { display: flex; gap: 9px; align-items: center; margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.security-note span { color: var(--accent); }

.alert { margin: 20px 0; padding: 13px 15px; border-radius: 12px; font-size: 14px; }
.alert-error { border: 1px solid rgba(255, 123, 120, 0.35); color: #ffd4d3; background: rgba(255, 123, 120, 0.1); }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px max(22px, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 29, 0.88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.button { border: 1px solid var(--line); border-radius: 11px; padding: 11px 15px; color: var(--text); background: transparent; font-weight: 750; }
.button.ghost:hover { border-color: rgba(190, 220, 236, 0.32); background: rgba(255,255,255,0.04); }
.button.wide { display: flex; width: 100%; justify-content: space-between; padding: 15px 18px; font-size: 15px; }

.dashboard { width: min(1220px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 80px; }
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: end;
  gap: 36px;
  padding: clamp(28px, 5vw, 52px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(20, 43, 64, 0.98), rgba(11, 24, 38, 0.98));
  box-shadow: var(--shadow);
}
.hero-panel .eyebrow { margin-top: 0; }
.hero-panel h1 { max-width: 780px; }
.hero-panel p:not(.eyebrow) { max-width: 780px; margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.hero-stat { padding: 22px; border: 1px solid rgba(66, 211, 178, 0.22); border-radius: 20px; background: rgba(66, 211, 178, 0.07); }
.hero-stat span, .hero-stat small { display: block; color: var(--muted); }
.hero-stat span { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
.hero-stat strong { display: block; margin: 7px 0 3px; font-size: 48px; letter-spacing: -0.05em; }
.hero-stat small { line-height: 1.45; }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.8fr); gap: 20px; margin-top: 20px; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: rgba(16, 34, 51, 0.9); box-shadow: 0 16px 54px rgba(0,0,0,0.16); }
.create-panel, .history-panel, .result-panel { padding: clamp(22px, 4vw, 34px); }
.panel-heading, .result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.panel-heading .eyebrow, .result-head .eyebrow { margin-top: 0; }
.private-badge { padding: 7px 10px; border: 1px solid rgba(66, 211, 178, 0.22); border-radius: 999px; color: var(--accent); background: rgba(66, 211, 178, 0.07); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.job-form { margin-top: 28px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 0; border: 0; }
.mode-grid legend { width: 100%; margin-bottom: 9px; color: #c9d8e1; font-size: 13px; font-weight: 750; }
.mode-card { position: relative; display: grid; gap: 4px; min-height: 126px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #0b1b29; cursor: pointer; }
.mode-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-card:has(input:checked) { border-color: var(--accent); background: rgba(66, 211, 178, 0.08); box-shadow: 0 0 0 2px rgba(66, 211, 178, 0.08); }
.mode-icon { display: grid; width: 32px; height: 32px; place-items: center; margin-bottom: 10px; border-radius: 9px; color: var(--accent); background: rgba(66, 211, 178, 0.1); font-size: 11px; font-weight: 900; }
.mode-card strong { font-size: 14px; }
.mode-card small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 22px; }
.field-grid input { width: 100%; padding: 12px 13px; }
.field-help { color: var(--muted); font-size: 10px; font-weight: 500; }
.muted-field { opacity: 0.42; }
.option-row { display: flex; flex-wrap: wrap; gap: 18px; margin: 22px 0; }
.check { display: flex; gap: 8px; align-items: center; color: #c9d8e1; font-size: 12px; }
.check input { accent-color: var(--accent); }
.check:has(input:disabled) { opacity: 0.4; }
.form-note { margin: 11px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.history-panel { min-height: 100%; }
.job-list { display: grid; gap: 8px; margin-top: 22px; }
.job-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid transparent; border-radius: 13px; color: inherit; text-decoration: none; background: rgba(7, 17, 29, 0.45); }
.job-item:hover, .job-item.active { border-color: var(--line); background: rgba(255,255,255,0.035); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status-dot.running { background: var(--blue); box-shadow: 0 0 0 5px rgba(98,174,244,0.08); }
.status-dot.complete { background: var(--accent); }
.status-dot.warning { background: var(--warning); }
.status-dot.error { background: var(--danger); }
.job-copy strong, .job-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-copy strong { font-size: 12px; }
.job-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.job-status { color: var(--muted); font-size: 10px; }
.empty-state { display: grid; place-items: center; min-height: 180px; color: var(--muted); text-align: center; }
.empty-state span { color: var(--accent); font-size: 30px; }

.result-panel { margin-top: 20px; }
.result-head p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.status-pill { padding: 8px 12px; border-radius: 999px; color: var(--muted); background: rgba(145,169,184,0.1); font-size: 11px; font-weight: 850; }
.status-pill.running { color: var(--blue); background: rgba(98,174,244,0.1); }
.status-pill.complete { color: var(--accent); background: rgba(66,211,178,0.1); }
.status-pill.warning { color: var(--warning); background: rgba(241,189,101,0.1); }
.status-pill.error { color: var(--danger); background: rgba(255,123,120,0.1); }
.progress-track { height: 5px; margin-top: 24px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.06); }
.progress-track span { display: block; width: 12%; height: 100%; border-radius: inherit; background: var(--accent); transition: width 400ms ease; }
.progress-track span.active { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.52; } }
.progress-copy { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 9px; margin-top: 20px; }
.downloads:empty { display: none; }
.downloads a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: #dbe8ef; text-decoration: none; background: rgba(7,17,29,0.45); }
.downloads a:hover { border-color: rgba(66,211,178,0.35); }
.downloads span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.downloads small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.result-output { min-height: 160px; max-height: 520px; margin: 20px 0 0; padding: 18px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; color: #cfe0e8; background: #07131f; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
.info-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(11,24,38,0.7); }
.info-grid article > span { color: var(--accent); font-size: 11px; font-weight: 900; }
.info-grid h3 { margin: 13px 0 8px; font-size: 15px; }
.info-grid p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 900px) {
  .hero-panel { grid-template-columns: 1fr; }
  .hero-stat { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 12px; }
  .hero-stat strong { font-size: 34px; }
  .layout-grid { grid-template-columns: 1fr; }
  .history-panel { min-height: auto; }
}

@media (max-width: 650px) {
  .dashboard { width: min(100% - 24px, 1220px); padding-top: 18px; }
  .topbar { padding: 11px 12px; }
  .brand small { display: none; }
  .button.ghost { padding: 9px 11px; font-size: 12px; }
  .hero-panel, .create-panel, .history-panel, .result-panel { border-radius: 18px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { grid-template-columns: auto 1fr; min-height: 0; align-items: center; }
  .mode-icon { grid-row: span 2; margin: 0 7px 0 0; }
  .field-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .pin-row { grid-template-columns: 1fr; }
  .pin-row button { min-height: 48px; }
}
