:root {
  --ink: #17211d;
  --muted: #66736d;
  --line: #dce3df;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --canvas: #e9efec;
  --green: #145c43;
  --green-dark: #0d4431;
  --mint: #dff2e8;
  --amber: #a45e09;
  --red: #9d332d;
  --shadow: 0 16px 45px rgba(25, 49, 39, 0.09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.shell { min-height: 100vh; }

.topbar {
  height: 72px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: #10251d;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-weight: 800; font-size: 21px; color: #10251d; background: #a7e6c5; }
.brand strong { display: block; font-size: 18px; letter-spacing: .01em; }
.brand small { display: block; margin-top: 2px; color: #a9bab2; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-status { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.environment { padding: 6px 9px; border: 1px solid rgba(167,230,197,.35); border-radius: 999px; color: #b9ebd1; font: 700 11px/1 ui-monospace, monospace; letter-spacing: .1em; }

.auth-panel { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 70px; align-items: center; max-width: 1120px; margin: auto; padding: 64px 28px; }
.auth-panel h1 { max-width: 720px; margin: 10px 0 18px; font-size: clamp(38px, 6vw, 70px); line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 650px; color: var(--muted); font-size: 18px; line-height: 1.65; }
.auth-form { padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.auth-form label, .stack label, .form-pane > label, .content-card > label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.inline-control { display: flex; gap: 8px; }
input, textarea { width: 100%; border: 1px solid #cbd5d0; border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
input { height: 44px; padding: 0 12px; }
textarea { padding: 14px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,92,67,.12); }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--red); font-size: 13px; }

.application { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { padding: 30px 24px; background: #f8faf9; border-right: 1px solid var(--line); }
.sidebar-heading h2 { margin: 5px 0 24px; font-size: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.compact { gap: 8px; }
.file-drop { min-height: 130px; display: flex !important; flex-direction: column; justify-content: center; gap: 8px; padding: 18px; border: 1px dashed #9eb1a8; border-radius: 14px; background: var(--surface); cursor: pointer; }
.file-drop:hover { border-color: var(--green); background: #fbfdfc; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop-title { font-weight: 750; }
.file-drop .muted { font-size: 12px; line-height: 1.45; }
.divider { display: flex; align-items: center; gap: 10px; margin: 24px 0; color: #8c9993; font-size: 11px; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.policy-note { margin-top: 28px; padding: 16px; border-radius: 14px; color: #385047; background: var(--mint); font-size: 13px; }
.policy-note p { margin: 6px 0 0; line-height: 1.5; }

.workspace { min-width: 0; padding: 26px; }
.empty-state { min-height: calc(100vh - 124px); display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-symbol { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 24px; color: var(--green); background: var(--mint); font-size: 36px; font-weight: 850; }
.empty-state h2 { margin: 18px 0 6px; color: var(--ink); }
.empty-state p { margin: 0; }
.document-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.document-header h1 { margin: 2px 0 0; font-size: 30px; letter-spacing: -.025em; }
.header-actions, .action-row, .section-heading, .pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-pill { padding: 8px 11px; border-radius: 999px; color: var(--green-dark); background: var(--mint); font: 750 12px/1 ui-monospace, monospace; }
.stepper { display: flex; gap: 4px; padding: 5px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.62); overflow-x: auto; }
.step { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; white-space: nowrap; }
.step span { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid #bbc8c1; border-radius: 50%; font-size: 11px; }
.step.active { color: #fff; background: var(--green); }
.step.active span { border-color: rgba(255,255,255,.5); }
.stage-panel { display: none; }
.stage-panel.active { display: block; }
.split-view { display: grid; grid-template-columns: minmax(380px, .95fr) minmax(440px, 1.05fr); gap: 16px; }
.source-pane, .form-pane, .content-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 30px rgba(31,51,43,.05); }
.pane-heading h2, .section-heading h2, .content-card h2 { margin: 2px 0 0; font-size: 21px; }
.source-frame { min-height: 660px; margin-top: 16px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: #eef2f0; }
.source-frame iframe { width: 100%; height: 660px; border: 0; background: #fff; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.55; }
.code-editor { min-height: 390px; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.action-row { justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.action-row .muted { margin-right: auto; font-size: 12px; }
.content-card.narrow { max-width: 930px; margin: 0 auto; }
.result-box { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--surface-soft); font: 12px/1.55 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.commands-list { display: grid; gap: 14px; margin-top: 18px; }
.command-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.command-summary { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; }
.command-summary strong { display: block; }
.command-summary code { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.command-body { padding: 0 18px 18px; }
.payload { max-height: 440px; margin: 0; padding: 16px; overflow: auto; border-radius: 12px; color: #d9eee4; background: #12231c; font: 12px/1.55 ui-monospace, monospace; white-space: pre-wrap; }
.command-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.audit-list { margin-top: 18px; border-top: 1px solid var(--line); }
.audit-event { display: grid; grid-template-columns: 180px minmax(180px, 1fr) 160px; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); font-size: 12px; }
.audit-event code { overflow-wrap: anywhere; }

.button { min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 720; font-size: 13px; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--green-dark); border-color: #a9bbb2; background: #fff; }
.button.ghost { color: inherit; border-color: rgba(117,137,127,.35); background: transparent; }
.topbar .button.ghost { color: #dbe6e0; }
.button.danger { color: #fff; background: var(--red); }
.button.wide { width: 100%; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 420px; padding: 14px 18px; border-radius: 12px; color: #fff; background: #15241e; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: var(--red); }

@media (max-width: 1050px) {
  .application { grid-template-columns: 250px minmax(0, 1fr); }
  .split-view { grid-template-columns: 1fr; }
  .source-frame, .source-frame iframe { min-height: 520px; height: 520px; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 68px; padding: 14px 18px; }
  .topbar-status .muted, .environment { display: none; }
  .auth-panel { grid-template-columns: 1fr; gap: 28px; padding: 40px 18px; }
  .auth-panel h1 { font-size: 42px; }
  .inline-control { flex-direction: column; }
  .application { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace { padding: 18px 12px; }
  .document-header, .section-heading { align-items: stretch; flex-direction: column; }
  .command-summary { grid-template-columns: 1fr; }
  .audit-event { grid-template-columns: 1fr; gap: 4px; }
}
