:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151c25;
  --surface-2: #1a2430;
  --line: #2a3949;
  --text: #e8edf3;
  --muted: #a5b2c0;
  --accent: #63d2bd;
  --accent-dark: #1c6f65;
  --warning: #ffd080;
  --danger: #ff8f8f;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 32px; border-bottom: 1px solid var(--line); background: #111820;
}
.topbar h1 { margin: 4px 0 0; font-size: 1.45rem; letter-spacing: -.02em; }
.eyebrow { color: var(--accent); font-size: .68rem; font-weight: 750; letter-spacing: .16em; }
.top-actions, .button-row, .subheading-row { display: flex; align-items: center; gap: 10px; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 86px); }
.side-nav { padding: 22px 14px; border-right: 1px solid var(--line); background: #111820; }
.nav-button {
  width: 100%; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  text-align: left; padding: 11px 13px; margin: 2px 0; font-weight: 650;
}
.nav-button:hover, .nav-button.active { color: var(--text); background: #203039; }
.nav-button.active { box-shadow: inset 3px 0 var(--accent); }
.side-note { border-top: 1px solid var(--line); margin: 28px 6px 0; padding: 18px 4px; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.side-note strong { color: var(--text); }
.main-content { min-width: 0; max-width: 1480px; width: 100%; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 20px; }
h2 { margin: 0 0 7px; font-size: 1.55rem; letter-spacing: -.02em; }
h3 { margin: 0 0 14px; font-size: 1.05rem; }
h4 { margin: 0; }
p { line-height: 1.5; }
.page-heading p, .muted, small { color: var(--muted); }
.page-heading p { margin: 0; }
small { display: block; margin-top: 5px; font-size: .78rem; line-height: 1.4; }
.panel {
  margin: 16px 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: 0 8px 24px #0002;
}
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid label, .panel > label, .login-card label { display: flex; flex-direction: column; gap: 7px; color: #d7e0e8; font-size: .86rem; font-weight: 650; }
.span-2 { grid-column: span 2; }
input:not([type=checkbox]):not([type=file]), textarea, select {
  width: 100%; border: 1px solid #405263; border-radius: 7px; padding: 10px 11px;
  color: var(--text); background: #0f151c; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #63d2bd26; }
textarea { resize: vertical; line-height: 1.45; }
input[type=file] { width: 100%; color: var(--muted); }
input[type=checkbox] { accent-color: var(--accent); }
button { border: 1px solid #435769; border-radius: 7px; padding: 9px 13px; font-weight: 700; color: var(--text); background: #202c38; }
button:hover { filter: brightness(1.14); }
button:disabled { opacity: .55; cursor: wait; }
button.primary { color: #09211f; background: var(--accent); border-color: var(--accent); }
button.secondary { background: #202c38; }
.preset-picker { min-width: 230px; color: var(--muted); font-size: .8rem; font-weight: 650; }
.preset-picker select { margin-top: 5px; }
.notice, .warning, .security-note {
  border: 1px solid #5b4a29; background: #302919; color: #f8deb0;
  border-radius: 9px; padding: 12px 14px; line-height: 1.45; font-size: .84rem;
}
.notice { display: flex; gap: 8px; }
.notice strong { white-space: nowrap; }
.notice.compact { margin-top: 14px; font-size: .78rem; }
.warning { margin: 12px 0 0; }
.subpanel { margin-top: 18px; padding: 15px; border: 1px solid #314353; border-radius: 9px; background: var(--surface-2); }
.subpanel > label { color: var(--muted); font-weight: 600; font-size: .85rem; }
.subpanel p { margin-bottom: 0; font-size: .82rem; }
.check-line { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; }
.header-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.header-control {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 8px; border: 1px solid #2b3b4b; border-radius: 8px; background: #111820;
}
.header-control > span { display: flex; align-items: center; gap: 7px; color: #cad5df; font-size: .78rem; }
.header-control input:not([type=checkbox]), .header-control select { min-width: 0; padding: 8px; font-size: .8rem; }
.subheading-row { justify-content: space-between; margin: 22px 0 12px; }
.custom-headers, .file-list { display: grid; gap: 10px; }
.custom-header-row, .file-card { padding: 12px; border: 1px solid #314353; border-radius: 8px; background: #111820; }
.custom-header-row { display: grid; grid-template-columns: 25px minmax(140px, .55fr) minmax(200px, 1fr) 85px; gap: 8px; align-items: start; }
.custom-header-row textarea { min-height: 42px; }
.custom-header-row button { padding: 8px; }
.file-card { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 1fr) repeat(3, minmax(100px, .8fr)) 75px; gap: 10px; align-items: end; }
.file-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .76rem; }
.file-card input, .file-card select { padding: 8px !important; font-size: .8rem; }
.file-name { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-weight: 700; font-size: .84rem; }
.inline-control { display: flex; flex-direction: column; justify-content: end; gap: 8px; }
.small-output { font-size: .8rem; color: var(--muted); white-space: pre-wrap; }
.action-panel { position: relative; }
.raw-output, .transcript, .log-output {
  min-height: 110px; max-height: 420px; overflow: auto; margin: 14px 0 0; padding: 13px;
  border: 1px solid #314353; border-radius: 8px; background: #0b1016; color: #cad8e4;
  font: .78rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.transcript { min-height: 0; }
.log-output { min-height: 320px; }
#htmlPreview { display: block; width: 100%; min-height: 220px; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 650px; font-size: .83rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; }
td { overflow-wrap: anywhere; }
td button { padding: 6px 9px; }
code { color: #b9e9dc; background: #152622; padding: 2px 5px; border-radius: 4px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 45px #0005; }
.login-card h1 { margin: 9px 0; }
.login-card form { display: grid; gap: 16px; margin-top: 22px; }
.login-card .security-note { margin-top: 20px; }
@media (max-width: 1050px) {
  .header-control { grid-template-columns: 125px minmax(0, 1fr); }
  .file-card { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .file-name { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .topbar { padding: 18px; }
  .layout { display: block; }
  .side-nav { display: flex; gap: 5px; padding: 9px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .nav-button { width: auto; white-space: nowrap; }
  .side-note { display: none; }
  .page-heading { align-items: start; flex-direction: column; }
  .form-grid, .header-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .header-control { grid-template-columns: 130px minmax(0, 1fr); }
  .subheading-row { align-items: start; flex-direction: column; }
  .button-row { flex-wrap: wrap; }
  .custom-header-row { grid-template-columns: 24px 1fr 70px; }
  .custom-header-row textarea { grid-column: 2 / -1; }
  .file-card { grid-template-columns: 1fr 1fr; }
  .file-name { grid-column: 1 / -1; }
  .notice { flex-direction: column; }
  .preset-picker { width: 100%; }
  .top-actions .muted { display: none; }
}

