:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7c;
  --border: #dfe3e8;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #e8eefc;
  --ok: #157347;
  --ok-soft: #e7f4ec;
  --error: #b42318;
  --error-soft: #fdecea;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:not(pre) > code { background: var(--accent-soft); border-radius: 4px; font-size: 0.88em; padding: 1px 5px; }
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }

.wrap { margin: 0 auto; max-width: 1240px; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { align-items: center; display: flex; height: 56px; justify-content: space-between; }
.brand { align-items: center; display: flex; font-weight: 600; gap: 10px; }
.brand-mark {
  align-items: center; background: var(--accent); border-radius: 8px; color: #fff; display: inline-flex;
  font-size: 12px; font-weight: 700; height: 30px; justify-content: center; width: 30px;
}
.env-badge {
  background: #fff4e5; border: 1px solid #f5d19b; border-radius: 999px; color: #8a5300;
  font-size: 12px; font-weight: 600; padding: 2px 10px; text-transform: uppercase; letter-spacing: 0.04em;
}

.intro { padding: 28px 0 8px; max-width: 760px; }
.intro p { color: var(--muted); margin: 8px 0 0; }
.lead { color: var(--muted); margin: 0 0 16px; max-width: 760px; }

.notice { border-radius: var(--radius); margin-top: 16px; padding: 10px 14px; }
.notice-error { background: var(--error-soft); color: var(--error); }

.tabs { box-shadow: inset 0 -1px 0 var(--border); display: flex; gap: 4px; margin: 20px 0; overflow-x: auto; overflow-y: hidden; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-weight: 600; padding: 10px 14px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.tab:focus-visible, .btn:focus-visible, .link-btn:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .grid { grid-template-columns: minmax(0, 1fr) 380px; } }
.main-col, .side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { align-items: center; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 12px; }
details.card > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 13px; }

.embed { min-height: 480px; }
.embed-onboarding { height: 720px; position: relative; }
.placeholder {
  align-items: center; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted);
  display: flex; justify-content: center; min-height: 240px; padding: 24px; text-align: center;
}

.code {
  background: var(--code-bg); border-radius: 8px; color: var(--code-text); font-size: 12.5px; line-height: 1.55;
  margin: 0; overflow-x: auto; padding: 12px 14px; white-space: pre;
}
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.btn {
  background: var(--accent); border: 1px solid var(--accent); border-radius: 8px; color: #fff; cursor: pointer;
  font: inherit; font-weight: 600; min-height: 40px; padding: 8px 14px;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { cursor: progress; opacity: 0.6; }
.btn-secondary { background: var(--surface); color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-small { font-size: 13px; min-height: 32px; padding: 4px 12px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 4px; }

.row { display: flex; gap: 8px; margin-bottom: 12px; }
input {
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; min-height: 40px;
  padding: 8px 10px; width: 100%;
}
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; gap: 4px; }
.form input[name="rfc"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }

.status { color: var(--muted); font-size: 13px; min-height: 1.5em; }
.status-error { color: var(--error); }
.status-ok { color: var(--ok); }

.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; }
.table th { color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: 0.04em; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px 8px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.right { text-align: right; }
.company-name { font-weight: 600; }

.pill { background: #eef1f4; border-radius: 999px; font-size: 12px; font-weight: 600; padding: 2px 10px; white-space: nowrap; }
.pill-offered, .pill-accepted, .pill-won { background: var(--ok-soft); color: var(--ok); }
.pill-rejected, .pill-withdrawn { background: var(--error-soft); color: var(--error); }
.pill-in_review { background: var(--accent-soft); color: var(--accent); }

.log { list-style: none; margin: 0; max-height: 320px; overflow-y: auto; padding: 0; }
.log-empty { color: var(--muted); font-size: 13px; }
.log-item { border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; font-size: 13px; gap: 4px 8px; padding: 6px 0; }
.log-item:last-child { border-bottom: 0; }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-kind { background: #eef1f4; border-radius: 4px; color: var(--muted); font-size: 11px; font-weight: 600; padding: 1px 6px; text-transform: uppercase; }
.log-evento .log-kind { background: var(--accent-soft); color: var(--accent); }
.log-error .log-kind, .log-error .log-name { color: var(--error); }
.log-name { font-weight: 600; }
.log-detail { color: var(--muted); flex-basis: 100%; font-size: 12px; overflow-wrap: anywhere; }

.footer { color: var(--muted); font-size: 13px; padding: 32px 16px 40px; }
