/* Creative Honduras — app de gestión. Mobile-first, sin dependencias. Colores tomados de creativehonduras.com. */
:root {
  --ch-blue: #195591;
  --ch-blue-dark: #103c69;
  --ch-teal: #01597a;
  --ch-green: #6db124;
  --ch-green-dark: #3e7212;
  --ch-sky: #0095eb;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --text: #1c2733;
  --muted: #56616f;
  --border: #d9e1ea;
  --danger: #b42318;
  --warning: #9a5b00;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 70, 0.06), 0 2px 8px rgba(16, 40, 70, 0.06);
  --font: "Nexa", "Segoe UI", "Helvetica Neue", Roboto, Arial, system-ui, sans-serif;
  --nav-w: 236px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: anywhere;
}

a {
  color: var(--ch-blue);
}

a:hover {
  color: var(--ch-blue-dark);
}

:focus-visible {
  outline: 3px solid var(--ch-sky);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  color: var(--ch-teal);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 0.75rem;
}

img {
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--surface);
  color: var(--ch-blue);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  z-index: 100;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ------------------------------------------------------------------ estructura */

.topbar {
  background: var(--ch-blue);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.brandmark:hover {
  color: #fff;
}

.brandmark svg {
  flex: none;
}

.brandmark-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.brandmark-text strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brandmark-text small {
  font-size: 0.75rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.userbox .who {
  display: none;
  text-align: right;
  line-height: 1.2;
}

.userbox .who small {
  display: block;
  opacity: 0.85;
}

.userbox form {
  margin: 0;
}

.btn-logout {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: inherit;
  cursor: pointer;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidenav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.5rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sidenav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.92rem;
}

.sidenav a:hover {
  background: #eaf1f8;
}

.sidenav a[aria-current="page"] {
  background: #e3edf8;
  color: var(--ch-blue);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--ch-green);
}

.sidenav svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.layout {
  display: block;
}

main {
  padding: 1rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.page-head p {
  color: var(--muted);
  margin: 0;
}

.footer {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 1.5rem 1rem 2rem;
}

@media (min-width: 900px) {
  .userbox .who {
    display: block;
  }

  .layout {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    min-height: calc(100vh - 56px);
  }

  .sidenav {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  .sidenav ul {
    flex-direction: column;
    position: sticky;
    top: 64px;
    padding: 1rem 0.75rem;
    overflow: visible;
  }

  main {
    padding: 1.5rem 2rem;
  }

  h1 {
    font-size: 1.75rem;
  }
}

/* ------------------------------------------------------------------ componentes */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 700px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .grid-detail {
    grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  }
}

.stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--ch-blue);
  min-width: 0;
}

.stat.accent {
  border-top-color: var(--ch-green);
}

.stat .label {
  color: var(--muted);
  font-size: 0.82rem;
  display: block;
}

.stat .value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ch-teal);
  display: block;
  line-height: 1.2;
}

.stat .hint {
  font-size: 0.8rem;
  color: var(--muted);
}

meter.budget {
  display: block;
  width: 100%;
  height: 10px;
  margin-top: 0.4rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.list li:first-child {
  border-top: 0;
}

.list .main {
  min-width: 0;
}

.list .meta,
.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  color: var(--muted);
  padding: 1rem 0;
  text-align: center;
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  background: #e8edf3;
  color: #33404f;
}

.badge.s-PENDING_REVIEW {
  background: #fff1d6;
  color: #7a4a00;
}

.badge.s-REVISION_REQUESTED {
  background: #ffe4dc;
  color: #8a2a10;
}

.badge.s-APPROVED,
.badge.s-SCHEDULED {
  background: #e2f2d3;
  color: var(--ch-green-dark);
}

.badge.s-PUBLISHED {
  background: #dcebf9;
  color: var(--ch-blue-dark);
}

.badge.s-REJECTED,
.badge.s-FAILED {
  background: #fde2e0;
  color: var(--danger);
}

.badge.s-AI_GENERATED {
  background: #e4f3f8;
  color: var(--ch-teal);
}

.badge.ch {
  background: #eef2f7;
  color: var(--ch-blue-dark);
}

/* tablas: en móvil cada fila es una tarjeta */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
}

.table td {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.5rem;
  vertical-align: top;
}

@media (max-width: 699px) {
  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }

  .table td {
    border: 0;
    padding: 0.15rem 0;
  }

  .table td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 0.8rem;
  }
}

/* ------------------------------------------------------------------ formularios */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: var(--ch-blue);
  color: #fff;
}

.btn:hover {
  background: var(--ch-blue-dark);
  color: #fff;
}

.btn.secondary {
  background: var(--surface);
  color: var(--ch-blue);
  border-color: #a9bfd6;
}

.btn.secondary:hover {
  background: #eef4fa;
}

.btn.success {
  background: var(--ch-green-dark);
}

.btn.success:hover {
  background: #2f5a0c;
}

.btn.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: #efb3ad;
}

.btn.danger:hover {
  background: #fdecea;
}

.btn.small {
  min-height: 34px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 700px) {
  .form-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid .span-2 {
    grid-column: span 2;
  }
}

.field label,
.field legend {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: #243241;
}

.field .help {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid #b9c6d4;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 42px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 2px;
  border: 1px solid #b9c6d4;
  border-radius: 8px;
  background: #fff;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 1rem;
  min-width: 0;
}

legend {
  padding: 0 0.3rem;
  font-weight: 700;
  color: var(--ch-teal);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.3rem 0;
}

.check input {
  width: 20px;
  height: 20px;
}

.filters {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

@media (min-width: 800px) {
  .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.flash {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
}

.flash.ok {
  background: #eef8e6;
  border-color: #b6dc94;
  color: #264a0b;
}

.flash.error {
  background: #fdecea;
  border-color: #f2b8b2;
  color: #7a1a12;
}

details.disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 1rem;
}

details.disclosure > summary {
  cursor: pointer;
  padding: 0.8rem 1rem;
  font-weight: 700;
  color: var(--ch-blue);
}

details.disclosure > div {
  padding: 0 1rem 1rem;
}

/* ------------------------------------------------------------------ contenido */

.preview {
  background: #0e2238;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.preview img {
  display: block;
  width: 100%;
  height: auto;
}

.preview .no-image {
  color: #c9d6e4;
  padding: 2rem;
  text-align: center;
}

.copy-block {
  white-space: pre-wrap;
  background: #f7f9fb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 0.9rem;
  margin: 0;
  font-size: 0.92rem;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tags li {
  background: #eef3f8;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.82rem;
}

.findings li {
  margin-bottom: 0.3rem;
}

.score {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ch-teal);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}

.timeline li {
  position: relative;
  padding: 0 0 0.8rem 0.5rem;
  font-size: 0.9rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -1.4rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ch-green);
  border: 2px solid #fff;
}

.swatches {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-block;
}


/* ------------------------------------------------------------------ calendario */

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
}

.calendar th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  padding: 0.25rem;
}

.calendar td {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  vertical-align: top;
  height: 110px;
  padding: 0.3rem;
  min-width: 0;
  overflow: hidden;
}

.calendar td.out {
  background: transparent;
  border-color: transparent;
}

.calendar td.today {
  border-color: var(--ch-blue);
  box-shadow: inset 0 0 0 1px var(--ch-blue);
}

.calendar .daynum {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.calendar .ev {
  display: block;
  font-size: 0.75rem;
  line-height: 1.25;
  padding: 0.2rem 0.3rem;
  margin-top: 0.2rem;
  border-radius: 5px;
  background: #e3edf8;
  color: var(--ch-blue-dark);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar .ev.idea {
  background: #eef7e5;
  color: var(--ch-green-dark);
}

.calendar .ev.PUBLISHED {
  background: #dcebf9;
}

.cal-list {
  display: none;
}

@media (max-width: 699px) {
  .calendar {
    display: none;
  }

  .cal-list {
    display: block;
  }
}

.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 0.3rem;
  background: #e3edf8;
  border: 1px solid #a9bfd6;
}

.dot.idea {
  background: #eef7e5;
  border-color: #a6d27d;
}

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

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: linear-gradient(160deg, var(--ch-blue) 0%, var(--ch-teal) 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.auth-card .logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.auth-card .logo strong {
  color: var(--ch-blue);
  font-size: 1.1rem;
  display: block;
}

.auth-card .logo small {
  color: var(--muted);
}

.auth-card .btn {
  width: 100%;
  margin-top: 0.75rem;
}

.auth-foot {
  color: #e6eef7;
  font-size: 0.8rem;
  margin-top: 1rem;
  text-align: center;
}

.auth-foot a {
  color: #fff;
}

.htmx-request .btn,
.btn.htmx-request {
  opacity: 0.7;
}

a.stat,
a.brand-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.stat:hover,
a.brand-card:hover {
  border-color: #a9bfd6;
  color: inherit;
}

.h3 {
  font-size: 1rem;
  margin-top: 1rem;
}

.card h3 {
  margin-top: 1rem;
}
