:root {
  color-scheme: light;
  --ink: #182538;
  --muted: #66758a;
  --line: #dfe5ed;
  --paper: #f4f6f9;
  --card: #ffffff;
  --navy: #14263d;
  --blue: #2e64b5;
  --blue-dark: #244f90;
  --teal: #168b79;
  --soft-blue: #edf4ff;
  --shadow: 0 8px 24px rgba(22, 38, 61, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
.topbar { min-height: 92px; display: flex; align-items: center; gap: 16px; padding: 18px clamp(18px, 4vw, 48px); color: white; background: linear-gradient(115deg, #122238, #203c5c); box-shadow: 0 3px 12px rgba(15, 31, 51, .18); }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.34); border-radius: 13px; color: #d9e9ff; font-size: 14px; font-weight: 800; letter-spacing: .05em; }
.title-block h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.title-block p { margin: 5px 0 0; color: #c6d2e0; font-size: 13px; }
.local-badge { margin-left: auto; padding: 8px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: #e1ecf7; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.local-badge span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #62d2a5; box-shadow: 0 0 0 3px rgba(98,210,165,.14); }
.topbar-button { margin-left: 0; border-color: rgba(255,255,255,.24); color: #e1ecf7; }
.app-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; max-width: 1600px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 38px) 50px; }
.sidebar, .main-panel { min-width: 0; }
.sidebar { align-self: start; padding: 18px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); position: sticky; top: 16px; }
.side-heading, .editor-heading, .outputs-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.side-heading h2, .editor-heading h2, .outputs-heading h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.search-label { display: block; margin: 22px 0 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.search-input, .field input, .field textarea { width: 100%; border: 1px solid #d7dee8; border-radius: 8px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.search-input { padding: 10px 11px; font-size: 13px; }
.search-input:focus, .field input:focus, .field textarea:focus { border-color: #6b9de1; box-shadow: 0 0 0 3px rgba(67, 128, 210, .13); }
.saved-list { display: grid; gap: 7px; max-height: 54vh; overflow: auto; margin-top: 14px; }
.record-item { width: 100%; padding: 10px 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; }
.record-item:hover { background: #f4f7fb; }
.record-item.active { border-color: #c8daf4; background: var(--soft-blue); }
.record-title { display: block; overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.record-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.empty-list { margin: 15px 2px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.sidebar-note { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.5; }
.main-panel { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.editor-heading { margin-bottom: 14px; }
.state-pill { padding: 6px 9px; border-radius: 999px; background: #f2f4f7; color: #687589; font-size: 11px; font-weight: 700; white-space: nowrap; }
.state-pill.saved { background: #e8f7f1; color: #16735f; }
.state-pill.changed { background: #fff5de; color: #9b6511; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.action-divider { width: 1px; height: 26px; margin: 0 4px; background: var(--line); }
.button { padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 700; transition: background .15s, transform .15s; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover:not(:disabled) { background: var(--blue-dark); }
.button-secondary { border-color: #cfd9e6; color: #29425e; background: #fff; }
.button-secondary:hover:not(:disabled) { background: #f3f7fc; }
.button-quiet { border-color: #e0e6ee; color: #4d5d72; background: transparent; }
.button-quiet:hover:not(:disabled) { background: #f5f7fa; }
.status-message { min-height: 20px; margin: 10px 0 16px; color: var(--muted); font-size: 12px; }
.status-message.error { color: #ad3838; }
.status-message.success { color: #16735f; }
.form-sections { display: grid; gap: 13px; }
.form-section { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.form-section h3 { margin: 0 0 14px; color: #223a56; font-size: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 16px; }
.field { display: block; min-width: 0; }
.field.full-width { grid-column: 1 / -1; }
.field-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: #41536b; font-size: 11px; font-weight: 700; }
.required-mark { color: #b54848; }
.field input, .field textarea { padding: 9px 10px; font-size: 13px; }
.field textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.field-help { display: block; margin-top: 5px; color: #7a8798; font-size: 10px; line-height: 1.4; }
.outputs { margin-top: 20px; padding-top: 19px; border-top: 1px solid var(--line); }
.outputs-heading { align-items: end; margin-bottom: 12px; }
.outputs-help { max-width: 340px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: right; }
.output-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.output-card { min-width: 0; }
.output-title { display: block; margin: 0 0 7px; color: #41536b; font-size: 11px; font-weight: 750; }
.output-card textarea { width: 100%; min-height: 230px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; color: #35445a; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.fine-print { margin: 10px 0 0; color: #7a8798; font-size: 10px; line-height: 1.45; }
@media (max-width: 900px) { .app-grid { grid-template-columns: 1fr; } .sidebar { position: static; } .saved-list { max-height: 220px; } }
@media (max-width: 650px) { .topbar { align-items: flex-start; flex-wrap: wrap; } .local-badge { margin-left: 60px; } .field-grid, .output-grid { grid-template-columns: 1fr; } .outputs-heading { align-items: flex-start; flex-direction: column; } .outputs-help { text-align: left; } .action-divider { display: none; } .main-panel { padding: 14px; } }
.login-wrap { display: grid; min-height: calc(100vh - 92px); place-items: center; padding: 28px 16px; }
.login-card { width: min(100%, 430px); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.login-card h2 { margin: 5px 0 8px; color: var(--ink); font-size: 24px; }
.login-copy { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.login-label { display: block; margin: 14px 0 7px; color: #41536b; font-size: 12px; font-weight: 700; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid #d7dee8; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; outline: none; }
.login-card input:focus { border-color: #6b9de1; box-shadow: 0 0 0 3px rgba(67,128,210,.13); }
.login-button { width: 100%; margin-top: 14px; padding: 11px 14px; }
.login-card .status-message { margin: 14px 0 0; line-height: 1.5; }
.login-card [hidden] { display: none; }
