:root {
  color-scheme: dark;
  --bg: #090c0b;
  --surface: #101513;
  --surface-2: #151b18;
  --line: #28312d;
  --line-soft: #1d2521;
  --text: #f3f5ef;
  --muted: #8f9d96;
  --accent: #bdfc63;
  --accent-2: #77e89a;
  --danger: #ff766c;
  --warning: #ffc65c;
  --radius: 18px;
  font-family: Inter, Pretendard, "Noto Sans KR", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 0 clamp(20px, 4vw, 64px); border-bottom: 1px solid rgba(255,255,255,.06); background: rgba(9,12,11,.88); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #0a0d0b; background: var(--accent); font-size: 13px; font-weight: 950; box-shadow: 0 0 28px rgba(189,252,99,.12); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-indicator { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 800; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.live-indicator.online i { background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
.live-indicator.offline i { background: var(--danger); }
.icon-button, .text-button { border: 1px solid var(--line); color: var(--text); background: var(--surface); cursor: pointer; }
.icon-button { width: 38px; height: 38px; border-radius: 11px; font-size: 21px; }
.text-button { border-radius: 10px; padding: 9px 12px; font-size: 11px; font-weight: 800; }

main { width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: 68px 0 96px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 40px; padding-bottom: 50px; border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 860px; margin: 0; font-size: clamp(38px, 5.4vw, 76px); line-height: 1.05; letter-spacing: -.065em; }
.hero h1 span { color: var(--muted); }
.hero-copy { max-width: 720px; margin: 25px 0 0; color: #a9b4ae; font-size: 15px; line-height: 1.75; }
.hero-action { display: grid; justify-items: end; gap: 12px; flex: none; }
.hero-action small { color: var(--muted); font-size: 11px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .19em; }
.muted { color: var(--muted); }
h2 { margin: 0; font-size: clamp(22px, 2.1vw, 30px); letter-spacing: -.035em; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 22px; min-height: 48px; border: 0; border-radius: 12px; padding: 0 20px; color: #0a0d0b; background: var(--accent); font-size: 13px; font-weight: 900; cursor: pointer; transition: transform .18s ease, filter .18s ease; }
.primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
.primary:disabled { cursor: wait; filter: grayscale(.6); opacity: .65; transform: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 28px 0 56px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.metric-grid article { min-height: 142px; padding: 25px 28px; background: var(--surface); border-right: 1px solid var(--line); }
.metric-grid article:last-child { border-right: 0; }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-grid strong { display: block; margin: 7px 0 12px; font-size: 38px; line-height: 1; letter-spacing: -.04em; }
.metric-grid .metric-alert strong { color: var(--danger); }

.system-panel { margin-bottom: 64px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading.compact { align-items: center; }
.section-heading.compact > p { margin: 0; font-size: 11px; }
.status-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.status-card { display: flex; gap: 13px; min-width: 0; min-height: 106px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.status-card > div { min-width: 0; }
.status-card strong { font-size: 12px; }
.status-card p { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.5; }
.status-icon { width: 9px; height: 9px; flex: none; margin-top: 4px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 12px rgba(255,118,108,.3); }
.status-card.ok .status-icon { background: var(--accent-2); box-shadow: 0 0 12px rgba(119,232,154,.38); }

.workspace-grid { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: clamp(30px, 5vw, 72px); align-items: start; }
.create-panel { position: sticky; top: 100px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #131a16, #0f1412); }
#job-form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #bec8c2; font-size: 11px; font-weight: 800; }
input, textarea, select { width: 100%; border: 1px solid #303a35; border-radius: 10px; padding: 12px 13px; color: var(--text); background: #090d0b; transition: border-color .15s ease; }
input:hover, textarea:hover, select:hover { border-color: #46554d; }
textarea { min-height: 112px; resize: vertical; line-height: 1.55; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 38px; }
.input-suffix span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 11px; }
fieldset { display: flex; gap: 20px; margin: 0; padding: 13px 0 2px; border: 0; border-top: 1px solid var(--line-soft); }
legend { float: left; width: 100%; margin-bottom: 11px; padding: 0; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; }
.toggle span { position: relative; width: 32px; height: 18px; border-radius: 99px; background: #303a35; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #8b9790; transition: .18s ease; }
.toggle input:checked + span { background: rgba(189,252,99,.3); }
.toggle input:checked + span::after { left: 17px; background: var(--accent); }
.toggle b { font-size: 11px; }
.form-message { min-height: 18px; margin: 13px 0 0; color: var(--accent); font-size: 11px; line-height: 1.5; }
.form-message.error { color: var(--danger); }

.jobs-heading { align-items: center; }
.filters { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.filters button { border: 0; border-radius: 8px; padding: 8px 10px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 900; cursor: pointer; }
.filters button.active { color: var(--text); background: #27312c; }
.filters span { display: inline-grid; place-items: center; min-width: 18px; margin-left: 3px; padding: 1px 4px; border-radius: 99px; color: #0a0d0b; background: var(--accent); }
.jobs { display: grid; gap: 12px; }
.job { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; transition: border-color .18s ease, transform .18s ease; }
.job:hover { border-color: #3a463f; transform: translateY(-1px); }
.job-main { padding: 21px 22px; }
.job-head { display: flex; justify-content: space-between; gap: 18px; }
.job-head h3 { margin: 0 0 7px; font-size: 16px; letter-spacing: -.02em; }
.job-meta { margin: 0; color: var(--muted); font-size: 10px; }
.badge { align-self: start; flex: none; padding: 6px 9px; border: 1px solid rgba(189,252,99,.25); border-radius: 99px; color: var(--accent); background: rgba(189,252,99,.04); font-size: 9px; font-weight: 950; letter-spacing: .04em; }
.badge.failed { color: var(--danger); border-color: rgba(255,118,108,.3); background: rgba(255,118,108,.05); }
.badge.review { color: var(--warning); border-color: rgba(255,198,92,.3); background: rgba(255,198,92,.05); }
.job-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 13px; margin-top: 19px; }
.progress { height: 5px; overflow: hidden; border-radius: 99px; background: #27302c; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.job-progress small { color: var(--muted); font-size: 9px; font-weight: 800; }
.job-error { margin: 13px 0 0; padding: 10px 12px; border-left: 2px solid var(--danger); color: #ffaaa4; background: rgba(255,118,108,.05); font-size: 11px; line-height: 1.5; }
.job-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.job-actions button, .job-actions a, .detail-toggle { border: 1px solid #344039; border-radius: 9px; padding: 8px 10px; color: #dfe5e1; background: #1a221e; text-decoration: none; font-size: 10px; font-weight: 850; cursor: pointer; }
.job-actions .approve { color: #0a0d0b; border-color: var(--accent); background: var(--accent); }
.job-actions .danger { color: #ffaaa4; }
.job-details { padding: 0 22px 20px; }
.job-details[hidden] { display: none; }
.task-list { display: grid; gap: 7px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.task-row { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.task-track { height: 3px; border-radius: 99px; background: #26302b; }
.task-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-2); }
.task-row.complete .task-track span { width: 100%; }
.task-row.active .task-track span { width: 58%; }
.task-row.failed { color: var(--danger); }
.empty { display: grid; place-items: center; min-height: 260px; padding: 30px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 8px; color: var(--text); }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px clamp(20px, 4vw, 64px); border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 360px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #19211d; box-shadow: 0 20px 60px rgba(0,0,0,.35); font-size: 11px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,118,108,.35); color: #ffbbb6; }

.login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, rgba(189,252,99,.08), transparent 36%), var(--bg); }
.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 28px 90px rgba(0,0,0,.4); }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card h1 { margin: 0 0 12px; font-size: 30px; letter-spacing: -.045em; }
.login-card > .muted { margin: 0 0 26px; font-size: 12px; line-height: 1.65; }
.login-card .primary { width: 100%; margin-top: 18px; }

@media (max-width: 1100px) {
  .status-grid { grid-template-columns: repeat(3, 1fr); }
  .workspace-grid { grid-template-columns: 330px minmax(0, 1fr); gap: 30px; }
  .filters { overflow-x: auto; max-width: 100%; }
}
@media (max-width: 820px) {
  main { width: min(100% - 28px, 680px); padding-top: 45px; }
  .hero { display: grid; }
  .hero-action { justify-items: start; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article:nth-child(2) { border-right: 0; }
  .metric-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
  .create-panel { position: static; }
  .jobs-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 540px) {
  .topbar { padding: 0 14px; }
  .brand small, .live-indicator span, #logout { display: none; }
  main { width: calc(100% - 22px); padding-top: 34px; }
  .hero h1 { font-size: 39px; }
  .metric-grid { margin-top: 20px; }
  .metric-grid article { min-height: 120px; padding: 20px; }
  .metric-grid strong { font-size: 32px; }
  .status-grid { grid-template-columns: 1fr; }
  .section-heading.compact { align-items: flex-start; flex-direction: column; }
  .create-panel, .job-main { padding: 19px; }
  .field-row { grid-template-columns: 1fr; }
  .job-head { display: grid; }
  .badge { justify-self: start; }
  .task-row { grid-template-columns: 74px 1fr; }
  .task-row > span:last-child { display: none; }
  footer { display: grid; }
}
