/* --primary is set per installation (UI_PRIMARY_COLOR) in base.html. */
:root {
  --primary: #1f5fa8;
  --primary-strong: color-mix(in srgb, var(--primary) 80%, black);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, white);
  --text: #1d2430;
  --muted: #5d6676;
  --border: #dde2ea;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ok: #1e7a46;
  --ok-soft: #e3f4ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --error: #b42318;
  --error-soft: #fde8e6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary-strong); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .6rem; }
main { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem;
  padding: .6rem 1.25rem; background: var(--primary); color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1.05rem; }
.topbar .brand img { height: 32px; width: auto; background: #fff; border-radius: 4px; padding: 2px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
.topbar nav a { padding: .35rem .65rem; border-radius: 4px; opacity: .9; }
.topbar nav a:hover, .topbar nav a[aria-current] { background: rgb(255 255 255 / .18); opacity: 1; }
.topbar .session { display: flex; align-items: center; gap: .5rem; }
.topbar .session form { margin: 0; }
button.link { background: none; border: 0; color: #fff; padding: .3rem .5rem; cursor: pointer; text-decoration: underline; font: inherit; }

.heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.heading form { margin: 0; }

button, .button {
  background: var(--primary); color: #fff; border: 0; border-radius: 5px;
  padding: .5rem 1rem; font: inherit; cursor: pointer;
}
a.button { display: inline-block; text-decoration: none; padding: .35rem .8rem; font-size: .9rem; }
button:hover, a.button:hover { background: var(--primary-strong); }
button:disabled { opacity: .55; cursor: default; }
button.secondary { background: var(--surface); color: var(--error); border: 1px solid var(--border); padding: .35rem .8rem; font-size: .9rem; }
button.secondary:hover { background: var(--error-soft); }
td.actions { white-space: nowrap; }
td.actions form { display: inline-block; margin: 0 0 0 .4rem; vertical-align: middle; }
td.actions a.button { vertical-align: middle; }

input, select {
  font: inherit; padding: .4rem .55rem; border: 1px solid var(--border);
  border-radius: 5px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin: 1rem 0; }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.stacked { display: flex; flex-direction: column; gap: 1rem; max-width: 520px; }
.stacked label { display: flex; flex-direction: column; gap: .3rem; }
.stacked button { align-self: flex-start; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin: 1rem 0; }
.card {
  display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); text-decoration: none;
}
a.card:hover { border-color: var(--primary); }
.card .label { font-size: .85rem; color: var(--muted); }
.card strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.card.alert { border-color: var(--error); background: var(--error-soft); }
.card.alert strong { color: var(--error); }
.card.highlight { border-color: var(--primary); background: var(--primary-soft); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--primary-soft); font-size: .82rem; font-weight: 600; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
tr.stale td, tr.failed td { background: var(--error-soft); }
ul.lines { margin: 0; padding: 0; list-style: none; }
.detail { font-size: .82rem; color: var(--error); margin-top: .2rem; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.error { background: var(--error-soft); color: var(--error); }

.status { font-weight: 600; }
.status.success { color: var(--ok); }
.status.failed, .status.interrupted { color: var(--error); }
.status.running { color: var(--warn); }

.kind { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.kind.linx { color: var(--primary-strong); }
.kind.reserva { color: var(--warn); }
.kind.liberacao { color: var(--ok); }
.kind.publicacao { color: var(--muted); }

.flash { padding: .65rem .9rem; border-radius: 6px; margin: 0 0 1rem; background: var(--ok-soft); color: var(--ok); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.error { background: var(--error-soft); color: var(--error); }
.error-text { color: var(--error); font-size: .88rem; }
.hint { color: var(--muted); font-size: .88rem; margin: .2rem 0 .6rem; }
.empty { color: var(--muted); padding: 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: 8px; }

.channel-options { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .25rem 1.25rem 1.25rem; margin: 1.25rem 0; }
.options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.5rem; }
.options-grid > label:not(.check) { display: flex; flex-direction: column; gap: .3rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: .25rem; width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
label.check span { display: flex; flex-direction: column; gap: .15rem; font-weight: 600; }
label.check small { font-weight: 400; color: var(--muted); font-size: .84rem; }
label.check.unsupported { opacity: .55; cursor: default; }
.example { grid-column: 1 / -1; margin: 0; color: var(--muted); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.25rem; margin: 1rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.footer { text-align: center; padding: 0 1rem 1.5rem; font-size: .82rem; color: var(--muted); }
.footer a { color: var(--muted); font-weight: 600; }
.footer a:hover { color: var(--primary-strong); }

.login { max-width: 380px; margin: 8vh auto 0; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: 8px; }
.login .logo { max-height: 72px; max-width: 100%; display: block; margin-bottom: 1rem; }
.login .stacked { max-width: none; }
.login input { width: 100%; }
