/* Dev Santuy backoffice. One plain stylesheet, no framework (design D26). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #5d6675;
  --line: #d9dde3;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #1e7b45;
  --warn: #8a5a00;
  --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --text: #e6e8eb;
    --muted: #9aa3b0;
    --line: #2f3540;
    --accent: #6ea2ff;
    --accent-text: #0b1220;
    --danger: #ff8a80;
    --ok: #6fd39a;
    --warn: #f0c060;
  }
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.who form { margin: 0; }

main { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.narrow { max-width: 26rem; margin: 2rem auto; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.muted { color: var(--muted); }

label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
input, select, textarea {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus, button:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }
button.danger { background: var(--danger); border-color: var(--danger); }

.flash { padding: 0.6rem 0.8rem; border-left: 4px solid var(--ok); background: var(--surface); }
.error { color: var(--danger); font-weight: 500; }

.role { font-size: 0.8rem; padding: 0.05rem 0.4rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.role-admin { color: var(--warn); border-color: var(--warn); }

h3 { font-size: 1rem; margin: 1rem 0 0.25rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.small { font-size: 0.85rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.row form { margin: 0; }
label.inline { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
button.secondary { background: var(--surface); color: var(--accent); }
.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; background: var(--surface); margin: 0.5rem 0 1rem; }
th, td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
tbody th { font-weight: 500; }
tr.behind td, tr.behind th { background: color-mix(in srgb, var(--warn) 10%, transparent); }
tr.inactive { color: var(--muted); }
table.grid td { min-width: 9rem; }
table.targets { width: auto; min-width: min(24rem, 100%); }

.group { margin: 1.5rem 0; }
.key { border-top: 1px solid var(--line); padding-top: 0.25rem; }
.cell { display: flex; flex-direction: column; gap: 0.15rem; }
.cell .val { font-weight: 600; }
.cell.pending .val { color: var(--warn); }
.missing { color: var(--danger); font-weight: 500; }
.badge { display: inline-block; font-size: 0.75rem; padding: 0.05rem 0.45rem; border-radius: 999px; border: 1px solid var(--warn); color: var(--warn); text-decoration: none; }
.badge.ok { border-color: var(--ok); color: var(--ok); }
.problems { border-left: 4px solid var(--danger); background: var(--surface); padding: 0.5rem 1rem; margin: 1rem 0; }
.problems h2 { margin-top: 0.25rem; color: var(--danger); }
.card { margin: 1rem 0; }
.edit textarea { min-width: min(36rem, 100%); }
.reset { margin-top: 0.75rem; }
.actions { display: flex; flex-direction: column; gap: 0.4rem; }
.actions form { margin: 0; }
.payload { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; font-size: 0.85rem; }
.filters { margin: 0.5rem 0 1rem; }
