/* Mayflower portal — compact, calm, procurement-tool aesthetic */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #e2e8ef;
  --brand: #0b5fff;
  --brand-ink: #0846c2;
  --ok: #0d7a4f;
  --ok-bg: #e6f6ef;
  --warn: #9a6700;
  --warn-bg: #fff6e0;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --meta: #667085;
  --meta-bg: #f2f4f7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem;
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--ink); font-weight: 700; letter-spacing: -0.02em;
  text-decoration: none; font-size: 1.05rem;
}
.brand:hover { text-decoration: none; color: var(--brand); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #0b5fff, #00a3a1);
  display: grid; place-items: center; color: #fff; font-size: 0.85rem;
}
.nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav a {
  color: var(--muted); padding: 0.4rem 0.7rem; border-radius: 8px;
  font-weight: 500; font-size: 0.92rem; text-decoration: none;
}
.nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav a.active { background: #e8f0ff; color: var(--brand-ink); }

.userbox { display: flex; align-items: center; gap: 0.75rem; font-size: 0.88rem; }
.userbox .who { text-align: right; line-height: 1.25; }
.userbox .who strong { display: block; color: var(--ink); }
.userbox .who span { color: var(--muted); font-size: 0.8rem; }

.main {
  max-width: 1180px; width: 100%; margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem; flex: 1;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border: 1px solid transparent; border-radius: 9px;
  padding: 0.45rem 0.85rem; font: inherit; font-weight: 600; font-size: 0.88rem;
  cursor: pointer; text-decoration: none; background: var(--surface); color: var(--ink);
  border-color: var(--line); transition: 0.12s ease;
}
.btn:hover { text-decoration: none; border-color: #c5d0dc; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-ok:hover { filter: brightness(0.95); color: #fff; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f3c0bc; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ---------- cards / layout ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0; font-size: 1.45rem; letter-spacing: -0.02em; font-weight: 700;
}
.page-head p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; max-width: 40rem; }

.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem; margin-bottom: 1.25rem;
}
@media (max-width: 800px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem; box-shadow: var(--shadow);
}
.kpi .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.15rem; }
.kpi.urgent .value { color: var(--danger); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 0.75rem;
}
.card-row { display: flex; gap: 1rem; align-items: stretch; }
.card-main { flex: 1; min-width: 0; }
.card-actions {
  display: flex; flex-direction: column; gap: 0.4rem; min-width: 7.5rem;
  justify-content: flex-start;
}
.card-top {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; align-items: center;
  font-size: 0.82rem; color: var(--muted); margin-bottom: 0.35rem;
}
.card-top .score {
  font-weight: 700; color: var(--brand-ink); font-variant-numeric: tabular-nums;
}
.card h2, .card .objeto {
  margin: 0 0 0.4rem; font-size: 1rem; font-weight: 600; line-height: 1.35;
  color: var(--ink);
}
.card .meta {
  font-size: 0.84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem;
}
.card .orgao { font-size: 0.82rem; color: var(--meta); margin-top: 0.35rem; }
.card .alerta {
  margin-top: 0.55rem; padding: 0.4rem 0.6rem; border-radius: 8px;
  background: var(--warn-bg); color: var(--warn); font-size: 0.84rem; font-weight: 500;
}
.card .alerta.hot { background: var(--danger-bg); color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; padding: 0.12rem 0.45rem;
  border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  background: var(--meta-bg); color: var(--meta);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.docs { background: #e8f0ff; color: var(--brand-ink); }
.badge.meta { background: var(--meta-bg); color: var(--meta); }
.badge.me { background: #f4ebff; color: #6941c6; }

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------- detail ---------- */
.detail-head { margin-bottom: 1rem; }
.detail-kicker {
  font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.2rem;
}
.detail-title {
  font-size: 1.2rem; font-weight: 700; line-height: 1.35; margin: 0 0 0.35rem;
  letter-spacing: -0.015em;
}
.detail-sub {
  font-size: 0.82rem; color: var(--muted); margin-bottom: 0.75rem;
}
.detail-sub code {
  font-family: var(--mono); font-size: 0.78rem; background: var(--meta-bg);
  padding: 0.1rem 0.35rem; border-radius: 4px;
}
.meta-row {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.4rem;
  padding: 0.75rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}
.meta-row .cell .lbl {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.meta-row .cell .val { font-size: 0.95rem; font-weight: 600; }

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start;
}
@media (max-width: 960px) { .detail-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-h {
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  font-weight: 650; font-size: 0.92rem;
}
.panel-b { padding: 0.9rem 1rem; }
.pdf-frame {
  width: 100%; height: min(78vh, 820px); border: 0; background: #525659;
}
.doc-list { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.75rem; }
.doc-list a {
  font-size: 0.84rem; padding: 0.4rem 0.55rem; border-radius: 8px; color: var(--ink);
  border: 1px solid transparent;
}
.doc-list a:hover { background: var(--bg); text-decoration: none; }
.doc-list a.active { background: #e8f0ff; border-color: #c9dbff; color: var(--brand-ink); }

.req-block { margin-bottom: 0.85rem; }
.req-block h3 {
  margin: 0 0 0.4rem; font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); font-weight: 700;
}
.cite {
  font-size: 0.88rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line);
  line-height: 1.4;
}
.cite:last-child { border-bottom: 0; }
.cite .pg {
  font-family: var(--mono); font-size: 0.75rem; color: var(--brand-ink);
  font-weight: 600; margin-right: 0.35rem;
}
.resumo { font-size: 0.95rem; margin-bottom: 0.85rem; line-height: 1.5; }

.decision-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem;
  align-items: center;
}
.decision-bar .state {
  font-size: 0.85rem; font-weight: 600; padding: 0.3rem 0.6rem; border-radius: 8px;
}
.decision-bar .state.accept { background: var(--ok-bg); color: var(--ok); }
.decision-bar .state.reject { background: var(--danger-bg); color: var(--danger); }
.decision-bar .state.pending { background: var(--meta-bg); color: var(--meta); }

table.data {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
table.data th, table.data td {
  text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- stats ---------- */
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 800px) { .stat-grid { grid-template-columns: 1fr; } }
.bar-list { display: flex; flex-direction: column; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: 0.6rem; align-items: center; font-size: 0.85rem; }
.bar-row .name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #00a3a1); border-radius: 99px; }
.bar-row .n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); min-width: 4rem; text-align: right; }

/* ---------- login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, #d6e6ff 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #d9f5f3 0%, transparent 50%),
    var(--bg);
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 1.75rem 1.6rem 1.4rem;
}
.login-card h1 { margin: 0.6rem 0 0.2rem; font-size: 1.5rem; letter-spacing: -0.02em; }
.login-card .sub { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.92rem; }
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--muted); }
.field input {
  width: 100%; padding: 0.6rem 0.7rem; border-radius: 9px;
  border: 1px solid var(--line); font: inherit; background: #fff;
}
.field input:focus { outline: 2px solid #c9dbff; border-color: var(--brand); }
.error {
  background: var(--danger-bg); color: var(--danger); padding: 0.55rem 0.7rem;
  border-radius: 8px; font-size: 0.88rem; margin-bottom: 0.85rem;
}
.demo-list {
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--muted);
}
.demo-list h3 {
  margin: 0 0 0.45rem; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--meta);
}
.demo-list li { margin: 0.25rem 0; }
.demo-list code {
  font-family: var(--mono); font-size: 0.78rem; background: var(--meta-bg);
  padding: 0.05rem 0.3rem; border-radius: 4px; color: var(--ink);
}

/* ---------- forms ---------- */
.search-bar {
  display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem; box-shadow: var(--shadow);
}
.search-bar input[type="text"], .search-bar select {
  padding: 0.5rem 0.65rem; border-radius: 8px; border: 1px solid var(--line);
  font: inherit; min-width: 12rem; flex: 1;
}
.search-bar label.chk {
  display: flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; color: var(--muted);
}

.flash-ok {
  background: var(--ok-bg); color: var(--ok); padding: 0.5rem 0.75rem;
  border-radius: 8px; font-size: 0.88rem; margin-bottom: 0.75rem;
}

.footer-note {
  margin-top: 2rem; text-align: center; color: var(--muted); font-size: 0.78rem;
}
