:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #17212b;
  --muted: #667085;
  --line: #dfe5ec;
  --primary: #0b7a53;
  --primary-dark: #086342;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --info: #175cd3;
  --nav: #102a43;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
html { font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .58; cursor: not-allowed; }

.topbar { background: var(--nav); color: white; padding: 12px 0; box-shadow: var(--shadow); }
.container { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.topbar-inner { display: flex; align-items: center; gap: 18px; }
.brand { color: white; font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; }
.brand small { display: block; color: #cbd5e1; font-weight: 400; font-size: 11px; margin-top: 3px; }
.main-nav { display: flex; align-items: center; gap: 3px; flex: 1; overflow-x: auto; }
.nav-link { color: #dbe7f3; text-decoration: none; padding: 8px 9px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.nav-link:hover, .nav-link.active { background: rgba(255, 255, 255, .13); color: white; }

main { padding: 26px 0 48px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; }
.card h1, .card h2, .card h3 { margin-top: 0; }
.card h2 { font-size: 19px; margin-bottom: 14px; }
.card h3 { font-size: 16px; }
.card-narrow { max-width: 720px; margin: 0 auto; }
.space-14 { height: 14px; }
.space-18 { height: 18px; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-heading h1 { margin: 0 0 6px; font-size: 28px; }
.page-heading p { margin: 0; color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.section-heading h2 { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.mono { font-family: Consolas, Monaco, monospace; word-break: break-all; }
.wrap-text { white-space: normal; overflow-wrap: anywhere; max-width: 380px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.badge-success { background: #dcfae6; color: var(--success); }
.badge-warning { background: #fef0c7; color: var(--warning); }
.badge-danger { background: #fee4e2; color: var(--danger); }
.badge-neutral { background: #eef2f6; color: #344054; }
.badge-info { background: #dbeafe; color: var(--info); }

.summary-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.summary-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); min-height: 96px; }
.summary-label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.summary-card strong { display: block; font-size: 24px; line-height: 1.15; }
.summary-card small { display: block; color: var(--muted); font-size: 11px; margin-top: 6px; }

label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="datetime-local"], input[type="file"], select, textarea {
  width: 100%; border: 1px solid #cdd5df; border-radius: 9px; padding: 10px 12px; background: white; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 122, 83, 0.12); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox input { margin: 0; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 0; border-radius: 9px; padding: 10px 14px; font-weight: 700; text-decoration: none; cursor: pointer; background: #e8edf3; color: #253b53; }
.btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fee4e2; color: var(--danger); }
.btn-dark { background: rgba(255,255,255,.14); color: white; }
.btn-small { padding: 7px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }
.compact-form { display: inline-flex; gap: 6px; align-items: center; }
.compact-form select { width: auto; min-width: 90px; padding: 7px 9px; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid; }
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.alert-error { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }

.qr-wrap { text-align: center; padding: 20px; }
.qr-wrap img { width: min(340px, 100%); height: auto; border: 10px solid white; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.1); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 11px 9px; vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-soft); }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }

.code-block { background: #101828; color: #f2f4f7; border-radius: 10px; padding: 14px; overflow-x: auto; white-space: pre-wrap; font: 12px/1.5 Consolas, Monaco, monospace; }
.caption-preview { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.45 Arial, Helvetica, sans-serif; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #102a43 0%, #0b7a53 100%); }
.login-card { width: min(420px, 100%); background: white; border-radius: 16px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-card p { margin-top: 0; color: var(--muted); }

.queue-controls { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.queue-controls h2 { margin-bottom: 5px; }
.queue-controls p { margin: 0; }
.queue-list { display: grid; gap: 14px; }
.queue-request { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; }
.queue-request-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.queue-request-title { min-width: 0; flex: 1; }
.queue-request-title h3 { margin: 8px 0 6px; font-size: 18px; }
.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.priority { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 4px 8px; }
.priority-high { color: #9a3412; background: #ffedd5; }
.priority-normal { color: #344054; background: #eef2f6; }
.priority-low { color: #475467; background: #f2f4f7; }
.request-actions { justify-content: flex-end; max-width: 520px; }
.progress { display: block; width: 100%; height: 10px; margin: 14px 0 7px; accent-color: var(--primary); }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 700; color: #344054; padding: 7px 0; }
.empty-state { text-align: center; padding: 35px; }

.filters { display: flex; align-items: end; gap: 12px; }
.filters .field { margin: 0; min-width: 170px; }
.filter-grow { flex: 1; }
.filter-actions { display: flex; gap: 8px; }

.compact-list { display: grid; gap: 8px; }
.compact-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); }
.compact-item:hover { background: var(--surface-soft); }
.compact-item strong, .compact-item small { display: block; }
.compact-item small { color: var(--muted); margin-top: 4px; }

.help-list { padding-left: 20px; color: #344054; line-height: 1.65; }
.definition-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; }
.definition-list dt { font-weight: 700; }
.definition-list dd { margin: 0; color: var(--muted); }
.method { display: inline-block; min-width: 58px; text-align: center; font-weight: 800; font-size: 11px; border-radius: 6px; padding: 5px 7px; }
.method-get { color: #175cd3; background: #eff8ff; }
.method-post { color: #067647; background: #ecfdf3; }
.method-patch { color: #b54708; background: #fffaeb; }
.footer-note { margin-top: 24px; color: var(--muted); font-size: 12px; text-align: center; }


.form-grid { gap: 14px; }
.field-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 15px; margin: 0 0 16px; }
.fieldset legend { font-weight: 700; font-size: 13px; padding: 0 7px; }
.test-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 20px; align-items: start; }
.test-preview-card { position: sticky; top: 20px; }
.destination-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.choice-card, .channel-check { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface); font-weight: 400; }
.choice-card:has(input:checked), .channel-check.is-selected, .channel-check:has(input:checked) { border-color: var(--primary); background: #f0fdf7; box-shadow: 0 0 0 2px rgba(11, 122, 83, .08); }
.choice-card input, .channel-check input { margin-top: 3px; }
.choice-card strong, .choice-card small, .channel-check strong, .channel-check small { display: block; }
.choice-card small, .channel-check small { color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.channel-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.channel-check.is-disabled { opacity: .52; }
.image-preview-shell { min-height: 260px; border: 1px dashed #b8c4d1; border-radius: 12px; background: var(--surface-soft); display: grid; place-items: center; overflow: hidden; margin-bottom: 14px; }
.image-preview-shell img { display: block; max-width: 100%; max-height: 480px; object-fit: contain; }
.image-preview-empty { color: var(--muted); text-align: center; padding: 30px; font-size: 13px; }
.test-caption-preview { min-height: 110px; }
.test-summary { margin-top: 16px; }

@media (max-width: 1150px) {
  .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topbar-inner { flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; }
}

@media (max-width: 850px) {
  .grid-2, .grid-3, .summary-grid { grid-template-columns: 1fr 1fr; }
  .test-layout { grid-template-columns: 1fr; }
  .test-preview-card { position: static; }
  .queue-request-head, .queue-controls, .page-heading { flex-direction: column; align-items: stretch; }
  .request-actions { justify-content: flex-start; max-width: none; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; }
}

@media (max-width: 560px) {
  .destination-modes, .channel-check-grid { grid-template-columns: 1fr; }
  .field-meta { flex-direction: column; gap: 3px; }
  .container { width: min(100% - 20px, 1240px); }
  .grid-2, .grid-3, .summary-grid { grid-template-columns: 1fr; }
  .brand { white-space: normal; }
  .compact-form { width: 100%; }
  .compact-form select { flex: 1; }
}
