:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --line: #d8dedb;
  --line-strong: #b9c4bf;
  --text: #17201c;
  --muted: #65716b;
  --green: #126447;
  --green-dark: #0c4b35;
  --green-soft: #e7f3ed;
  --amber: #9a5b0b;
  --amber-soft: #fff4dc;
  --red: #a4342b;
  --red-dark: #7f241e;
  --shadow: 0 16px 40px rgba(20, 35, 28, .09);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.hidden { display: none !important; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e9eeeb; }
.login-panel { width: min(100%, 380px); padding: 32px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); border-radius: 6px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; color: white; background: var(--green); }
.brand-mark svg { width: 24px; height: 24px; }
.brand-mark.small { width: 36px; height: 36px; }
.brand-mark.small svg { width: 20px; }
.brand { margin: 20px 0 2px; color: var(--green); font-size: 13px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0 0 28px; font-size: 30px; line-height: 1.1; }
h2 { margin: 2px 0 0; font-size: 22px; line-height: 1.2; }
label { display: block; margin: 0 0 7px; color: #3f4a45; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text); background: white; outline: none; }
input, select { height: 42px; padding: 0 11px; }
textarea { padding: 11px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18, 100, 71, .12); }
.password-field { position: relative; margin-bottom: 16px; }
.password-field input { padding-right: 44px; }
.password-field .icon-button { position: absolute; right: 3px; top: 3px; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.icon-button:hover { background: #edf1ef; color: var(--text); }
.icon-button svg { width: 18px; height: 18px; }
.primary, .secondary, .danger { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 4px; font-weight: 750; }
.primary { border: 1px solid var(--green); color: white; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { border: 1px solid var(--line-strong); color: var(--text); background: white; }
.secondary:hover { background: #f2f5f3; }
.danger { border: 1px solid var(--red); color: white; background: var(--red); }
.danger:hover { background: var(--red-dark); }
.primary svg, .secondary svg, .danger svg { width: 18px; height: 18px; }
.wide { width: 100%; }
.error { min-height: 19px; margin: 12px 0 0; color: var(--red); font-size: 13px; }
.app-shell { min-height: 100vh; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100vw - 1160px) / 2)); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-brand { display: flex; align-items: center; gap: 11px; }
.topbar-brand strong, .topbar-brand span { display: block; }
.topbar-brand strong { font-size: 15px; }
.topbar-brand span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 9px; border-radius: 4px; font-size: 12px; font-weight: 750; }
.status svg { width: 14px; height: 14px; }
.status.secure { color: var(--green-dark); background: var(--green-soft); }
.status.pending { color: var(--amber); background: var(--amber-soft); }
.workflow-tabs { height: 58px; display: flex; align-items: stretch; justify-content: center; gap: 36px; border-bottom: 1px solid var(--line); background: #fafbfa; }
.workflow-tab { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 4px; border: 0; color: var(--muted); background: transparent; font-weight: 700; }
.workflow-tab span { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 11px; }
.workflow-tab.active { color: var(--green); }
.workflow-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--green); }
.workflow-tab.active span { border-color: var(--green); color: white; background: var(--green); }
.workspace { width: min(100% - 32px, 1040px); margin: 28px auto 60px; }
.step { display: none; }
.step.active { display: block; }
.section-heading { min-height: 52px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.limit { align-self: center; color: var(--muted); font-size: 12px; }
.drop-zone { min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0; border: 1px dashed #93a59c; border-radius: 6px; color: var(--muted); background: var(--surface); cursor: pointer; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--green); background: #f8fbf9; }
.drop-zone svg { width: 42px; height: 42px; margin-bottom: 18px; color: var(--green); }
.drop-zone strong { color: var(--text); font-size: 17px; }
.drop-zone span { margin-top: 5px; font-size: 13px; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.selected-file { min-height: 62px; display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.selected-file > svg { color: var(--green); }
.selected-file div { min-width: 0; flex: 1; }
.selected-file strong, .selected-file span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.command-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.command-row.end { justify-content: flex-end; }
.operation-status { margin: 0; color: var(--muted); font-size: 13px; }
.metrics { display: flex; align-items: center; gap: 8px; }
.metrics span { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: white; font-size: 11px; font-weight: 700; }
.document-editor { min-height: 360px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.prompt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.span-2 { grid-column: 1 / -1; }
.payload-preview { min-height: 380px; max-height: 58vh; overflow: auto; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; color: #27322d; background: #fff; font: 12px/1.55 "SFMono-Regular", Consolas, monospace; }
.hash-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 4px; background: white; font-size: 11px; }
.hash-row span { color: var(--muted); font-weight: 800; }
.hash-row code { overflow-wrap: anywhere; }
.approval-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 18px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.approval-bar strong, .approval-bar span { display: block; }
.approval-bar span { margin-top: 4px; color: #71552c; font-size: 12px; }
.approval-actions { display: flex; align-items: center; gap: 8px; }
.final-result { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line); }
.section-heading.compact { min-height: 40px; margin-bottom: 14px; }
.document-editor.final { min-height: 300px; background: #fbfcfb; }
.quarantine-result { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line); }
.eyebrow.warning { color: var(--amber); }
.finding-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.finding-list span { padding: 5px 8px; border: 1px solid #e5c98f; border-radius: 4px; color: #704b13; background: var(--amber-soft); font-size: 11px; font-weight: 750; }
.history-dialog { width: min(760px, calc(100vw - 32px)); max-height: min(680px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: white; box-shadow: var(--shadow); }
.history-dialog::backdrop { background: rgba(16, 27, 22, .38); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.history-table-wrap { max-height: 520px; overflow: auto; }
.history-dialog table { width: 100%; border-collapse: collapse; font-size: 12px; }
.history-dialog th, .history-dialog td { padding: 12px 20px; border-bottom: 1px solid var(--line); text-align: left; }
.history-dialog th { position: sticky; top: 0; color: var(--muted); background: #f8faf9; }
.history-dialog td:nth-child(2) { font-weight: 750; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(400px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 4px; color: white; background: #25332d; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 700px) {
  .topbar { padding: 0 14px; }
  .status.secure { width: 34px; padding: 0; justify-content: center; font-size: 0; }
  .workflow-tabs { gap: 6px; justify-content: space-around; }
  .workflow-tab { font-size: 12px; }
  .workspace { width: min(100% - 24px, 1040px); margin-top: 20px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .limit { align-self: flex-start; }
  .drop-zone { min-height: 230px; }
  .command-row, .approval-bar { align-items: stretch; flex-direction: column; }
  .command-row button, .approval-actions, .approval-actions button { width: 100%; }
  .approval-actions { flex-direction: column; }
  .prompt-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .document-editor { min-height: 310px; }
  .payload-preview { min-height: 320px; }
}
