:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #17202a;
  --muted: #66727f;
  --line: #dce2e7;
  --accent: #185f75;
  --accent-dark: #104657;
  --danger: #a62f2f;
  --success: #227a47;
  --warning: #9a6800;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { min-height: 64px; background: #17252c; color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; box-shadow: 0 2px 8px #0002; }
.topbar a { color: white; }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav form { margin: 0; }
.brand { font-weight: 750; font-size: 18px; }
.version, .mode { font-size: 12px; margin-left: 8px; padding: 3px 7px; border-radius: 4px; }
.version { background: #ffffff20; }
.mode-sample { background: #bc7600; }
.mode-firebird { background: #18834c; }
.link-button { appearance: none; background: transparent; border: 0; color: white; padding: 0; font: inherit; cursor: pointer; }
.container { max-width: 1320px; margin: 0 auto; padding: 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 22px; box-shadow: 0 2px 8px #1b27330c; margin-bottom: 20px; }
h1, h2 { margin-top: 0; }
h1 { margin-bottom: 6px; }
h2 { font-size: 19px; }
p { color: var(--muted); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.back { display: inline-block; margin-bottom: 10px; }
.order-summary { display: flex; gap: 12px; flex-wrap: wrap; }
.order-summary span { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; }
.search-row { display: flex; gap: 10px; }
input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #bac5cd; border-radius: 5px; font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid transparent; border-radius: 5px; padding: 9px 15px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { text-decoration: none; filter: brightness(.96); }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: white; color: var(--text); border-color: #b9c5cd; }
.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.wide { width: 100%; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.alert { border-radius: 6px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid; }
.alert.info { background: #eaf5f8; border-color: #a6d1dc; color: #164b59; }
.alert.error { background: #fff0f0; border-color: #e0a9a9; color: #7e2424; }
.alert.success { background: #edf8f1; border-color: #a9d5b9; color: #1f6039; }
.login-card { max-width: 430px; margin: 70px auto; }
.stack-form, .field { display: grid; gap: 8px; }
.stack-form { gap: 17px; }
.generation-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.generation-options { position: sticky; top: 20px; }
.section-title-row { display: flex; justify-content: space-between; gap: 15px; }
.inline-actions { display: flex; gap: 7px; }
.document-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.document-option { border: 1px solid var(--line); border-radius: 6px; padding: 13px; display: flex; gap: 11px; cursor: pointer; }
.document-option:hover { background: #f7fafb; }
.document-option input { width: 18px; min-height: auto; margin-top: 2px; }
.document-option span { display: grid; gap: 3px; }
.document-option small, .help, label small { color: var(--muted); font-size: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 18px; padding: 12px; }
legend { padding: 0 6px; font-weight: 650; }
.toggle { display: flex; gap: 9px; align-items: center; margin: 7px 0; }
.toggle input { width: 18px; min-height: auto; }
.field { margin: 16px 0; font-weight: 600; }
.name-preview { display: grid; gap: 7px; background: #f5f7f8; border-radius: 6px; padding: 12px; margin: 18px 0; }
code { background: #edf0f2; border-radius: 4px; padding: 2px 5px; word-break: break-all; }
.job-status-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.status { display: inline-block; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 750; text-transform: uppercase; background: #e6eaed; }
.status-completed { background: #dff3e7; color: var(--success); }
.status-failed { background: #f9dddd; color: var(--danger); }
.status-running { background: #fff0c9; color: var(--warning); }
.status-queued { background: #e6edf6; color: #31577f; }
.progress { height: 13px; border-radius: 999px; background: #e3e7ea; overflow: hidden; margin-bottom: 20px; }
.progress div { height: 100%; background: var(--accent); transition: width .3s ease; }
.details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.details div { background: #f7f8f9; border-radius: 6px; padding: 11px; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 4px 0 0; font-weight: 650; }
.details.vertical { grid-template-columns: 1fr; }
.server-path { margin-top: 14px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.button-stack { display: flex; gap: 10px; flex-wrap: wrap; }
.steps { line-height: 1.8; }
@media (max-width: 900px) {
  .generation-grid, .admin-grid { grid-template-columns: 1fr; }
  .generation-options { position: static; }
  .document-list { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px 18px; align-items: flex-start; }
  .topbar nav { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 600px) {
  .container { padding: 18px 12px; }
  .page-heading, .search-row, .section-title-row { flex-direction: column; align-items: stretch; }
  .details { grid-template-columns: 1fr; }
}

.button-stack input { width: 100%; padding: .8rem; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }

.document-option.disabled { opacity: .55; cursor: not-allowed; background: #f2f4f5; }
.document-option.disabled:hover { background: #f2f4f5; }
