:root {
  --ink: #182536;
  --navy: #0d2f4f;
  --blue: #1f5c88;
  --teal: #137c7a;
  --gold: #e7b75f;
  --paper: #ffffff;
  --soft: #f4f7f9;
  --line: #dce5ec;
  --muted: #657487;
  --danger: #aa2e25;
  --shadow: 0 16px 38px rgba(18, 37, 54, .09);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.58;
  background: var(--paper);
  overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.site-header,
.admin-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 5vw, 56px);
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.admin-top {
  box-shadow: 0 10px 30px rgba(13, 47, 79, .05);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 0;
}

.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }

.site-nav,
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 14px;
  font-weight: 700;
}

.site-nav a,
.admin-nav a { color: var(--ink); }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--navy);
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  gap: 44px;
  align-items: center;
  padding: clamp(48px, 8vw, 90px) clamp(18px, 6vw, 72px);
  background: linear-gradient(180deg, #f9fcff 0%, #eef5f8 100%);
}

.hero h1,
.page-hero h1,
.guide-hero h1,
.admin-heading h1 {
  margin: 0 0 14px;
  color: var(--navy);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero h1 { font-size: clamp(42px, 6vw, 70px); }
.hero p,
.page-hero p,
.guide-hero p { max-width: 720px; font-size: 18px; color: #344256; }

.hero-visual {
  min-height: 320px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(13,47,79,.96), rgba(19,124,122,.92)),
    url("/assets/img/credencewriters-og.svg");
  background-size: cover;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  box-shadow: var(--shadow);
}

.hero-visual span {
  display: grid;
  place-items: center;
  min-height: 116px;
  border: 1px solid rgba(255,255,255,.24);
  color: white;
  font-weight: 800;
  border-radius: 8px;
  background: rgba(255,255,255,.09);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { text-decoration: none; }
.btn.primary { color: #fff; background: var(--teal); }
.btn.secondary { color: #fff; background: var(--navy); }
.btn.ghost { color: var(--navy); background: #fff; border-color: var(--line); }
.btn.danger { color: #fff; background: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.cta-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.content-band,
.content-page,
.guide-layout {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0;
}

.content-band.muted {
  width: 100%;
  max-width: none;
  padding-inline: max(16px, calc((100vw - 1120px) / 2));
  background: var(--soft);
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2,
.guide-section h2,
.summary-box h2,
.toc h2,
.panel h2 {
  margin: 0 0 14px;
  color: var(--navy);
  line-height: 1.2;
  letter-spacing: 0;
}

.card-grid,
.guide-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-card,
.guide-card,
.metric,
.panel,
.summary-box,
.toc,
.cta-panel,
.install-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.info-card,
.guide-card {
  padding: 20px;
  color: var(--ink);
}

.info-card h3,
.guide-card h2 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.25;
}

.guide-card p,
.info-card p { margin: 0 0 14px; color: #3d4a5a; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #edf6f5;
  color: #0b615f;
  font-size: 12px;
  font-weight: 800;
}
.tag.warn { background: #fff4de; color: #815500; }

.meta { color: var(--muted); font-size: 13px; }

.page-hero {
  padding: 48px clamp(18px, 6vw, 72px);
  background: var(--soft);
}

.search-form,
.filter-bar {
  display: flex;
  gap: 10px;
  max-width: 780px;
  margin-top: 20px;
}

.queue-filter {
  max-width: none;
  margin: 18px 0 12px;
}

.queue-bulk-actions {
  margin: 0 0 12px;
}

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0;
}

.queue-toolbar p {
  margin: 0;
}

.queue-select-cell {
  width: 92px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #c9d5de;
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

textarea { resize: vertical; }
label { display: grid; gap: 6px; font-weight: 700; color: #27364a; }

.guide-layout {
  display: grid;
  gap: 24px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.guide-hero {
  padding: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f6fbff, #edf7f4);
  border: 1px solid var(--line);
}

.summary-box,
.toc,
.guide-section,
.cta-panel {
  padding: 24px;
}

.summary-box dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.summary-box div {
  padding: 14px;
  background: var(--soft);
  border-radius: 6px;
}

dt { color: var(--muted); font-size: 13px; font-weight: 800; }
dd { margin: 2px 0 0; }

.toc ol { margin-bottom: 0; }
.guide-section {
  border-top: 1px solid var(--line);
}

.guide-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.guide-section th,
.guide-section td {
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.guide-section th { background: var(--soft); color: var(--navy); }
.checklist ul { padding-left: 0; list-style: none; }
.checklist li {
  margin: 10px 0;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  position: relative;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 17px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--teal);
  border-radius: 3px;
}

details {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0;
  background: #fff;
}

summary { cursor: pointer; font-weight: 800; color: var(--navy); }

.cta-panel {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: #f7fbff;
}

.cta-panel p { margin: 0; max-width: 720px; }

.site-footer {
  padding: 34px clamp(16px, 6vw, 72px) 86px;
  background: var(--navy);
  color: #eaf4fb;
}

.site-footer a { color: #fff; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0; }
.copyright { color: #c5d8e7; font-size: 13px; }

.sticky-cta {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  gap: 8px;
  padding: 10px;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 25px rgba(18, 37, 54, .12);
}

.sticky-cta .btn { flex: 1; min-height: 44px; }

.whatsapp-float {
  position: fixed;
  bottom: 82px;
  z-index: 29;
  padding: 10px 13px;
  border-radius: 999px;
  color: white;
  background: #128c7e;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.whatsapp-float.right { right: 16px; }
.whatsapp-float.left { left: 16px; }

.pagination {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}
.pagination a {
  min-width: 38px;
  padding: 7px 10px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.pagination .current { background: var(--navy); color: white; }

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

.install-body,
.admin-body { background: #f3f7fa; }

.install-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.install-card {
  width: min(820px, 100%);
  padding: 28px;
}
.install-card.small { width: min(460px, 100%); }

.grid-form,
.stack-form,
.admin-form {
  display: grid;
  gap: 16px;
}

.grid-form h2 {
  margin: 18px 0 0;
  color: var(--navy);
}

.notice {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #cfe5d8;
  border-radius: 6px;
  background: #effaf3;
  color: #205d36;
}
.notice.error {
  border-color: #f1c9c5;
  background: #fff1ef;
  color: #8a241c;
}
.notice.success {
  border-color: #cfe5d8;
  background: #effaf3;
}

.admin-main {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 70px;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f7fb 100%);
  box-shadow: var(--shadow);
}

.dashboard-hero h1 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 42px;
  line-height: 1.05;
}

.dashboard-hero p {
  max-width: 720px;
  margin: 0;
  color: #405168;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dashboard-metrics {
  margin-bottom: 18px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.status-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.status-card.warning {
  border-left-color: var(--gold);
}

.status-kicker {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  margin: 6px 0;
  color: var(--navy);
  font-size: 36px;
  line-height: 1;
}

.status-card p {
  margin: 0;
  color: #405168;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.dashboard-panel {
  min-height: 360px;
}

.panel-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-heading-row h2 {
  margin-bottom: 0;
}

.dashboard-list {
  display: grid;
  gap: 12px;
}

.dashboard-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow-wrap: anywhere;
}

.dashboard-list-item p {
  margin: 8px 0 4px;
}

.dashboard-list-item .meta {
  display: block;
  margin-top: 4px;
}

.mini-link,
.mini-danger {
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.mini-danger {
  color: var(--danger);
}

.admin-error-panel {
  max-width: 880px;
  margin: 30px auto;
}

.admin-error-panel h1 {
  color: var(--navy);
  margin-top: 0;
}

.sql-snippet {
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10243a;
  color: #eff8ff;
  white-space: pre-wrap;
}

.admin-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.admin-heading.compact { margin-bottom: 8px; }

.metric {
  padding: 20px;
}
.metric strong {
  display: block;
  color: var(--navy);
  font-size: 32px;
  line-height: 1;
}
.metric span { color: var(--muted); font-weight: 800; }

.admin-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.admin-two-col.wide { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); }

.panel {
  padding: 20px;
  min-width: 0;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
th {
  color: var(--navy);
  background: var(--soft);
}

.actions {
  white-space: nowrap;
}
.actions a { margin-right: 8px; }

.clip {
  display: inline-block;
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.progress {
  height: 8px;
  overflow: hidden;
  background: #e7edf2;
  border-radius: 999px;
  margin: 6px 0 14px;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check input { width: auto; }
.check.compact {
  font-size: 13px;
  white-space: nowrap;
}

.queue-pages {
  align-items: center;
}

.section-editor {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  background: #fbfdff;
}
.section-editor label + label { margin-top: 10px; }

.danger-zone { border-color: #efd1cd; }
.inline-form { display: inline; }
.inline-form button {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf2f6;
}

@media (max-width: 920px) {
  .site-nav,
  .admin-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }
  .site-nav.open,
  .admin-nav.open { display: flex; }
  .nav-toggle { display: inline-flex; }
  .hero { grid-template-columns: 1fr; padding-top: 38px; }
  .hero-visual { min-height: 230px; }
  .card-grid,
  .guide-grid,
  .metric-grid,
  .dashboard-status-grid,
  .dashboard-panels,
  .admin-two-col,
  .admin-two-col.wide,
  .summary-box dl {
    grid-template-columns: 1fr;
  }
  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .dashboard-actions {
    justify-content: flex-start;
  }
  .cta-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .hero p,
  .page-hero p,
  .guide-hero p { font-size: 16px; }
  .search-form,
  .filter-bar {
    flex-direction: column;
  }
  .queue-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .content-band,
  .content-page,
  .guide-layout {
    width: min(100% - 24px, 1120px);
    padding: 34px 0;
  }
  .guide-hero,
  .summary-box,
  .toc,
  .guide-section,
  .cta-panel,
  .panel,
  .install-card {
    padding: 18px;
  }
  .form-grid { grid-template-columns: 1fr; }
  .sticky-cta { display: flex; }
}
