/* Akwaaba Care — Modern Responsive Theme (modern-web-guidance compliant) */
:root {
  color-scheme: dark;
  --bg: #07111a;
  --surface: #0f1d2b;
  --surface-alt: #142638;
  --border: #233b52;
  --text: #edf4fa;
  --muted: #9eb3c7;
  --brand: #10b981;
  --brand-strong: #059669;
  --gold: #f59e0b;
  --danger: #ef4444;
  --sky: #38bdf8;
  --wa-bg: #0b141a;
  --wa-in: #1f2c34;
  --wa-out: #005c4b;
  --radius: 14px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: clip;
}

a { color: var(--sky); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Sticky Responsive Site Navigation (modern-web-guidance: navbar) */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 40;
  background: rgba(7, 17, 26, 0.94);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--border);
}

.header-inner {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-inner > * {
  flex-shrink: 0;
  white-space: nowrap;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.badge-env {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

.site-header .menu-button {
  anchor-name: --menu-button;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.site-header .site-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  position: fixed;
  inset: auto;
  inset-block-start: 4.25rem;
  inset-block-start: anchor(--menu-button bottom);
  inset-inline-end: 1rem;
  inline-size: min(82dvw, 18rem);
  max-inline-size: calc(100dvw - 2rem);
  max-block-size: calc(100dvh - 5.5rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

@supports not selector(:popover-open) {
  [popover]:not(.\:popover-open) { display: none; }
}
[popover]:is(:popover-open, .\:popover-open) { display: block; }

.site-header .site-menu a,
.site-header .site-menu button.nav-action {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  inline-size: 100%;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.site-header .site-menu a[aria-current="page"] {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border-inline-start: 3px solid var(--brand);
}

.site-header.is-wide .menu-button { display: none; }
.site-header.is-wide .site-menu {
  position: static;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  inline-size: auto;
  max-inline-size: none;
  max-block-size: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.site-header.is-wide .site-menu a,
.site-header.is-wide .site-menu button.nav-action {
  inline-size: auto;
  min-block-size: 40px;
}
.site-header.is-wide .site-menu a[aria-current="page"] {
  border-inline-start: 0;
  border-block-end: 2px solid var(--brand);
  border-radius: 8px 8px 2px 2px;
}
.site-header.is-measuring * { transition: none !important; }

/* Main Containers & Cards */
.page-wrap {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding: 1.25rem 1rem 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-block-end: 1rem;
}

.card-accent {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.08), var(--surface) 45%);
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 0.75rem; }

.kpi {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.kpi-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-val { font-size: 1.45rem; font-weight: 800; margin-block-start: 0.2rem; }
.kpi-sub { font-size: 0.8rem; color: var(--muted); margin-block-start: 0.15rem; }

/* Forms & Buttons */
label.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
input, select, textarea {
  min-block-size: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #08131e;
  color: var(--text);
  font-size: 0.92rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-block-size: 44px;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #04130d; }
.btn-primary:hover { background: #34d399; }
.btn-warn { background: rgba(245, 158, 11, 0.18); border-color: var(--gold); color: #fde68a; }
.btn-danger { background: rgba(239, 68, 68, 0.18); border-color: var(--danger); color: #fecaca; }
.btn-sm { min-block-size: 38px; padding: 0.35rem 0.75rem; font-size: 0.82rem; }

.pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--border);
}
.pill-ok { background: rgba(16, 185, 129, 0.18); border-color: rgba(16, 185, 129, 0.55); color: #6ee7b7; }
.pill-warn { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.55); color: #fde68a; }
.pill-danger { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }

/* Responsive Data Tables (modern-web-guidance: responsive-table) */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 75dvh);
  container-type: inline-size;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: #102436;
}

.data-table th, .data-table td {
  text-align: start;
  padding: 0.65rem 0.75rem;
  border-block-end: 1px solid var(--border);
  vertical-align: top;
}

.data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: var(--surface);
  z-index: 1;
}

@container (width < 600px) {
  .data-table, .data-table thead, .data-table tbody, .data-table tr, .data-table th, .data-table td {
    display: block;
  }
  .data-table thead { display: none; }
  .data-table tr {
    margin: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    overflow: hidden;
  }
  .data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    background: #102436;
    z-index: 2;
  }
  .data-table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--muted);
  }
}

/* Native Modal Dialog (modern-web-guidance: light-dismiss-a-dialog) */
dialog.akw-dialog {
  inline-size: min(94dvw, 760px);
  max-block-size: 88dvh;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  overflow: auto;
}
dialog.akw-dialog::backdrop {
  background: rgba(3, 8, 14, 0.74);
  backdrop-filter: blur(3px);
}

/* Multi-Persona WhatsApp Simulator Phone Frames */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1rem;
}

.wa-phone {
  display: flex;
  flex-direction: column;
  block-size: min(640px, 76dvh);
  background: var(--wa-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.wa-phone-hdr {
  background: #1f2c34;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-block-end: 1px solid #2a3942;
}

.wa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.wa-bubble {
  max-inline-size: 90%;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  font-size: 0.86rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-bubble-in {
  align-self: flex-end;
  background: var(--wa-out);
  border-end-end-radius: 3px;
}
.wa-bubble-out {
  align-self: flex-start;
  background: var(--wa-in);
  border-end-start-radius: 3px;
}
.wa-meta {
  font-size: 0.72rem;
  color: #a9c1cf;
  margin-block-start: 0.35rem;
}
.wa-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-block-start: 0.45rem;
}
.wa-quick-btn {
  min-block-size: 36px;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.wa-composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem;
  background: #1f2c34;
  border-block-start: 1px solid #2a3942;
}
.wa-composer input { flex: 1; min-inline-size: 0; }

.quote-pre {
  background: #060e16;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 12px;
  padding: 0.85rem;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: #d1fae5;
  margin: 0;
}

.footer-legal {
  margin-block-start: 2rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}
