/* Papilón — portal styles. Plain CSS, no framework, no external fonts. */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #1d211d;
  --muted: #676d66;
  --line: #e3e1da;
  --brand: #2f6b4f;
  --brand-dark: #24523d;
  --brand-soft: #e8f0ea;
  --warn: #8a5a00;
  --warn-soft: #fdf3e1;
  --danger: #9c2f2f;
  --danger-soft: #fbeceb;
  --info: #2b5b7a;
  --info-soft: #e9f1f6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 33, 29, 0.05), 0 8px 24px rgba(29, 33, 29, 0.04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--brand-dark); text-underline-offset: 2px; }
a:hover { color: var(--brand); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.35em; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
.center { text-align: center; }
.mt { margin-top: 1.5rem; }
.inline { display: inline; }

/* ---------------------------------------------------------------- banner */

.demo-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid #f0d9ab;
  padding: 0.45rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.8rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--muted); font-size: 0.75rem; }

.nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav-link {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}
.nav-link:hover { background: var(--brand-soft); color: var(--brand-dark); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-link.is-soon { opacity: 0.45; cursor: not-allowed; }

.account { display: flex; align-items: center; gap: 0.6rem; }
.account-name { font-weight: 600; font-size: 0.9rem; }
.account-role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
button.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px;
  font: inherit;
}

/* ---------------------------------------------------------------- layout */

.main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.crumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
.crumb a { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.narrow { max-width: 520px; margin: 3rem auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- stats */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 0.2rem;
}
.stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-ok { border-left-color: var(--brand); }
.stat-warn { border-left-color: #c98a1b; }
.stat-info { border-left-color: var(--info); }
.stat-muted { border-left-color: #9aa09a; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: #cfccc4; background: #faf9f6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--danger-soft); border-color: #eccaca; color: var(--danger); }
.btn-danger:hover { background: #f7dedc; }

/* ---------------------------------------------------------------- forms */

.form .card { margin-bottom: 1rem; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
@media (max-width: 760px) { .fields { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-weight: 600; font-size: 0.88rem; }
.req { color: var(--danger); }
.field-help { color: var(--muted); font-size: 0.8rem; margin: 0; }
.field-error { color: var(--danger); font-size: 0.8rem; margin: 0; font-weight: 600; }
.has-error .input { border-color: var(--danger); }

.input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cfccc4;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.textarea { resize: vertical; min-height: 74px; }

.field.checkbox { flex-direction: row; }
.check-label { display: flex; gap: 0.55rem; align-items: flex-start; font-weight: 500; }
.check-label input { margin-top: 0.2rem; width: 1.05rem; height: 1.05rem; accent-color: var(--brand); }

.consents { display: flex; flex-direction: column; gap: 0.9rem; }

.form-actions {
  display: flex; justify-content: flex-end; gap: 0.6rem;
  padding: 0.5rem 0 0;
}

.toolbar { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar .input { width: auto; min-width: 240px; }
.toolbar .count { margin-left: auto; }

/* ---------------------------------------------------------------- table */

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
  background: #fbfaf7; white-space: nowrap;
}
.table td { padding: 0.7rem 1rem; border-bottom: 1px solid #efeee9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfcfa; }

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em;
}
.badge-ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #efeee9; color: var(--muted); }

/* ---------------------------------------------------------------- flash */

.flash {
  border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 1rem;
  border: 1px solid var(--line); font-weight: 500;
}
.flash-ok { background: var(--brand-soft); border-color: #cfe0d4; color: var(--brand-dark); }
.flash-error { background: var(--danger-soft); border-color: #eccaca; color: var(--danger); }
.flash-warn { background: var(--warn-soft); border-color: #f0d9ab; color: var(--warn); }

/* ---------------------------------------------------------------- details */

.details { margin: 0; }
.details .row { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px dashed #efeee9; }
.details .row:last-child { border-bottom: 0; }
.details dt { color: var(--muted); font-size: 0.85rem; }
.details dd { margin: 0; }

/* ---------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 0.65rem; padding: 0.45rem 0; }
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  margin-top: 0.45rem; flex: none;
}
.timeline-body { display: flex; flex-direction: column; }
.timeline-body small { color: var(--muted); font-size: 0.78rem; }

/* ---------------------------------------------------------------- login */

.auth { display: grid; place-items: center; min-height: 70vh; }
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 2rem;
}
.auth-card h1 { font-size: 1.4rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.demo-hint {
  margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.8rem; font-family: ui-monospace, Menlo, monospace;
}

/* ---------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--line);
  padding: 1rem 1.25rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}
