:root {
  --bg: #0b0b14;
  --surface: #14142a;
  --border: #2a2a4a;
  --text: #ecebf7;
  --muted: #a6a4c4;
  --accent: #7c5cff;
  --accent-text: #ffffff;
  --danger-bg: #3a1020;
  --danger-text: #ffc2d1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { display: grid; place-items: start center; padding: 24px 16px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--accent); color: var(--accent-text); padding: 8px 12px; z-index: 10; }

.card {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card--narrow { max-width: 420px; margin-top: 8vh; }

h1 { margin: 0 0 8px; font-size: 1.5rem; }
.muted { color: var(--muted); }

label { display: block; margin: 16px 0 6px; font-weight: 600; }
input[type="email"], input[type="password"] {
  width: 100%;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

button {
  margin-top: 20px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }

:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }

.alert {
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* ---------- Painel administrativo ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: #b7a1ff; }
.card--wide { max-width: 1100px; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.admin-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.admin-bar__brand img { display: block; }
.admin-bar nav { display: flex; gap: 16px; flex: 1; }
.admin-bar nav a { color: var(--text); text-decoration: none; padding: 6px 2px; }
.admin-bar nav a:hover { text-decoration: underline; }
.admin-bar__logout { margin: 0; }

.link-button { margin: 0; padding: 6px 2px; background: none; border: 0; color: var(--muted); font-weight: 400; text-decoration: underline; }

.button, a.button {
  display: inline-block; margin-top: 0; padding: 10px 18px; font: inherit; font-weight: 600;
  color: var(--accent-text); background: var(--accent); border: 1px solid var(--accent);
  border-radius: 8px; text-decoration: none; cursor: pointer;
}
.button--secondary { background: transparent; color: var(--text); border-color: var(--border); }
.button--danger { background: #b4234a; border-color: #b4234a; }

.notice { margin: 12px 0; padding: 12px; border-radius: 8px; background: #1b2a2a; color: #bff0e0; border: 1px solid #2c4a47; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert a { color: inherit; }
.callout { margin: 16px 0; padding: 16px; border: 2px solid var(--accent); border-radius: 10px; background: #1a1636; }
.callout h2 { margin-top: 0; }
.choices { border: 0; padding: 0; margin: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-weight: 400; }
.choice input { margin-top: 5px; }

fieldset { margin: 20px 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
legend { padding: 0 8px; font-weight: 700; }
.grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { margin: 0 0 8px; }
.field label { margin: 12px 0 4px; }
.field--check label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.field--check input { width: 20px; height: 20px; }
.req { color: #ffd166; font-weight: 400; font-size: .85rem; }
.opt { color: var(--muted); font-weight: 400; font-size: .85rem; }
.hint { margin: 0 0 6px; color: var(--muted); font-size: .9rem; }
.error { margin: 6px 0 0; color: var(--danger-text); font-size: .9rem; }
.field--error input, .field--error select, .field--error textarea { border-color: #ff6b8b; }

input[type="text"], select, textarea {
  width: 100%; padding: 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
textarea { resize: vertical; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.actions form { margin: 0; }
.actions--aside { margin: 8px 0 0; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.tabs a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; }
.tabs a.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .85rem; font-weight: 600; }
td .muted { display: block; font-size: .9rem; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid var(--border); }
.badge--active { background: #12301f; color: #9ff0bd; border-color: #1f6b3e; }
.badge--expired, .badge--ended { background: #2a2233; color: #cbb8e8; }
.badge--draft { background: #2b2a14; color: #f1e08c; border-color: #6b6420; }

.history { padding-left: 20px; }
.history li { margin: 6px 0; }

/* ---------- Origem dos dados e prévia ---------- */
.card--narrow-ish { max-width: 640px; }
.src { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid var(--border); vertical-align: middle; }
.src--informado { background: #14243a; color: #a9d0ff; border-color: #25476f; }
.src--extraido { background: #2b2a14; color: #f1e08c; border-color: #6b6420; }
.src--calculado { background: #2a1d3d; color: #d9c2ff; border-color: #5b3d8f; }
.src--nao { background: #3a1020; color: #ffc2d1; border-color: #7a2a44; }
.preview { margin-top: 12px; }
.preview img { display: block; max-width: 160px; height: auto; border-radius: 8px; border: 1px solid var(--border); background: #fff; object-fit: contain; }
.label-like { margin: 12px 0 6px; font-weight: 600; }

/* ---------- Anúncio WhatsApp ---------- */
.announcement { min-height: 22rem; line-height: 1.5; white-space: pre-wrap; }
[hidden] { display: none !important; }

input[type="url"] { width: 100%; padding: 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
input[aria-invalid="true"] { border-color: #ff6b8b; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.field-error { display: block; margin-top: 4px; color: var(--danger-text); }
.notice--error { background: var(--danger-bg); color: var(--danger-text); border-color: #6b2036; }
fieldset small { display: block; margin-top: 4px; }
.announcement-image { display: block; max-width: 20rem; width: 100%; height: auto; background: #fff; border-radius: 8px; margin: .5rem 0 1rem; object-fit: contain; }

/* Cadastro em lote e botão de republicar */
.row__actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; margin-left: 6px; }
.button--small { padding: 4px 12px; font-size: .85rem; }
.batch-table td, .batch-table th { padding: 6px; vertical-align: top; }
.batch-in { width: 100%; padding: 6px 8px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.batch-in--wide { min-width: 240px; }
.batch-in--mid { min-width: 110px; }
.batch-in--num { min-width: 86px; }
.batch-in--tiny { min-width: 56px; }
.batch-state { min-width: 190px; font-size: .9rem; color: var(--muted, #b9b4d6); }
.batch-state--ok { color: #9ff0bd; }
.batch-state--warn { color: #f1e08c; }
.batch-state--bad { color: #ff9bb3; }
.batch-url { font-size: .8rem; color: var(--muted, #b9b4d6); word-break: break-all; }
