/* Operational dashboard — shared chrome for Home / Checklist / WhatsApp.
   Reuses the warm brand tokens from styles.css (linked first): single-accent
   red on a parchment canvas, generous spacing, soft-elevated rounded cards. */

body.site {
  background: var(--bg);
  color: var(--text);
}

/* --- Top navigation --- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
  background: var(--surface-dark);
  color: #ffffff;
}

.site-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.site-nav .brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 4px;
  background: #ffffff;
  border-radius: 10px;
}

.site-nav .nav-brand strong {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.site-nav .nav-brand span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-link.is-active {
  background: #ffffff;
  color: var(--surface-dark);
  font-weight: 700;
}

/* --- Page scaffolding --- */
.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 44px 32px 72px;
}

.page-head {
  margin-bottom: 36px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 14px 0 0;
  max-width: 68ch;
  color: var(--body);
  font-size: 16px;
  line-height: 1.6;
}

.section-block {
  margin-top: 48px;
}

.section-block > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-block > h2 svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.section-block > p.section-lede {
  margin: 0 0 18px;
  max-width: 80ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* --- Cards --- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

/* --- Home: three context cards --- */
.context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.context-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 340px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.context-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(46, 30, 20, 0.13);
}

.context-card .ctx-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(124, 3, 3, 0.28);
}

.context-card .ctx-icon svg {
  width: 25px;
  height: 25px;
  stroke-width: 2;
}

.context-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.context-card .ctx-desc {
  margin: 0;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.55;
}

.context-card .ctx-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Stat rows --- */
.stat-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.stat-row:first-child {
  padding-top: 0;
}

.stat-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stat-row .stat-label {
  color: var(--muted);
  font-size: 13.5px;
}

.stat-row .stat-value {
  font-size: 18px;
  font-weight: 700;
}

.stat-row .stat-value.is-alert {
  color: var(--primary);
}

/* --- Metric strip --- */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 18px;
  margin-bottom: 8px;
}

.metric-card {
  position: relative;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}

.metric-card .m-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-card .m-value {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.metric-card .m-sub {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.metric-card.is-alert .m-value {
  color: var(--primary);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--body);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.badge.dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge--ok {
  color: #2f6b1f;
  border-color: #c5dcb8;
  background: #eef6ea;
}

.badge--info {
  color: #1f5a6b;
  border-color: #b3d2dc;
  background: #ebf4f6;
}

.badge--warn {
  color: #8a5200;
  border-color: #f0d4a8;
  background: #fdf3e3;
}

.badge--alert {
  color: var(--primary);
  border-color: #e6bcbc;
  background: var(--primary-soft);
}

.badge--neutral {
  color: var(--muted);
  border-radius: var(--radius);
}

/* Evidence chips (photo / audio / recurrence). */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--body);
  font-size: 12px;
  font-weight: 600;
}

.chip svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.chip--muted {
  color: var(--muted);
  border-style: dashed;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.data-table th,
.data-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}

.data-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #faf7f1;
}

.data-table td strong {
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

/* --- Buttons --- */
.button-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.button-outline:hover {
  background: var(--primary-soft);
}

a.button-primary {
  text-decoration: none;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius);
}

.button-primary svg,
.button-outline svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

/* --- WhatsApp list --- */
.wa-list {
  display: grid;
  gap: 16px;
}

.wa-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.wa-item[open] {
  box-shadow: 0 12px 28px rgba(46, 30, 20, 0.1);
}

.wa-item > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}

.wa-item > summary:hover {
  background: #faf7f1;
}

.wa-item > summary::-webkit-details-marker {
  display: none;
}

.wa-item > summary .wa-chevron {
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.wa-item[open] > summary .wa-chevron {
  transform: rotate(180deg);
}

.wa-date {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  line-height: 1.05;
}

.wa-date strong {
  font-size: 19px;
  font-weight: 700;
}

.wa-date span {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wa-head-main {
  min-width: 0;
}

.wa-head-main h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
}

.wa-head-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.wa-body {
  padding: 4px 22px 22px 90px;
  display: grid;
  gap: 18px;
}

.wa-body .wa-summary {
  margin: 0;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.65;
}

.wa-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.wa-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.wa-attach {
  display: block;
  width: 168px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.wa-attach img {
  display: block;
  width: 168px;
  height: 126px;
  margin-bottom: 8px;
  object-fit: cover;
  object-position: top;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.wa-attach span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--body);
}

.wa-attach span svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  color: var(--primary);
}

.wa-attach:hover img {
  border-color: var(--primary);
}

.wa-attach:hover span {
  color: var(--primary);
}

.wa-field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.alert-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid #e6bcbc;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13.5px;
  line-height: 1.45;
}

.alert-list li svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  stroke-width: 2;
  color: var(--primary);
}

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

.note {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--body);
  font-size: 13.5px;
  line-height: 1.55;
}

/* --- Responsive --- */
@media (max-width: 960px) {
  .context-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-nav {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 18px;
  }

  .nav-links {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .page {
    padding: 28px 18px 56px;
  }

  .wa-body {
    padding-left: 22px;
  }
}
