:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f1f33;
  --muted: #5d6b80;
  --primary: #0d3b66;
  --primary-dark: #0a2746;
  --primary-soft: #e7eef6;
  --accent: #d97706;
  --accent-soft: #fff4e6;
  --border: #d6e0ea;
  --shadow: 0 8px 24px rgba(10, 27, 48, 0.12);
  --shadow-strong: 0 10px 28px rgba(10, 27, 48, 0.18);
  --danger: #b42318;
  --text-on-primary: #ffffff;
}

html {
  color-scheme: light;
  overflow-x: clip;
}

@supports not (overflow-x: clip) {
  html {
    overflow-x: hidden;
  }
}

* {
  box-sizing: border-box;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Debug helper: add .debug-overflow to <body> to outline elements. */
.debug-overflow * {
  outline: 1px solid rgba(255, 0, 0, 0.2);
}

.debug-overflow-banner {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 9999;
  background: rgba(13, 59, 102, 0.92);
  color: #ffffff;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  pointer-events: none;
  max-width: calc(100% - 16px);
}

.container {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  padding-inline: clamp(16px, 2vw, 24px);
}

.container,
.card,
.counter,
.share,
.share a,
.media,
.hero {
  min-width: 0;
}

.hero {
  text-align: center;
  padding: 18px 12px 8px;
}

.logo-image-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.logo-image {
  width: 120px;
  max-width: 45vw;
  height: auto;
  display: block;
}

.logo-large {
  font-size: 2rem;
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.1rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--primary-dark);
}

.logo-small {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 4px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.hero-divider {
  height: 1px;
  background: var(--border);
  margin: 12px auto 0;
  width: 70%;
  max-width: 320px;
}

.headline {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-size: clamp(1.35rem, 1.1rem + 1.6vw, 1.75rem);
  font-weight: 800;
  text-align: center;
  color: var(--primary-dark);
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-wrap: break-word;
  width: 100%;
}

.counter,
.share a,
.demand-note,
.card {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card.primary {
  position: relative;
  max-width: 640px;
  margin: 10px auto;
  padding: 12px;
  border-color: var(--border);
  box-shadow: var(--shadow-strong);
}

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

.card.primary .media {
  padding: 8px;
  min-height: 180px;
}

.card.primary .media-asset {
  max-width: 320px;
  max-height: 320px;
}

.card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}

.media {
  text-align: center;
  margin-bottom: 10px;
  padding: 10px;
  background: var(--primary-soft);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  min-height: 200px;
}

.media-asset {
  width: 100%;
  max-width: 360px;
  height: auto;
  max-height: 360px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

@supports not (aspect-ratio: 1 / 1) {
  .media {
    min-height: 200px;
  }
}

.counter-wrap {
  text-align: center;
}

.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
  flex-wrap: wrap;
  text-align: center;
  color: var(--primary-dark);
}

.count-number {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  margin: 0 4px;
}

.section-title {
  font-size: 0.95rem;
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--primary-dark);
}

.demand-note {
  background: var(--primary-soft);
  border: 1px dashed var(--border);
  padding: 12px;
  border-radius: 12px;
}

.demand-note p {
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-line;
  overflow-wrap: break-word;
}

.field {
  margin-bottom: 12px;
}

.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--primary-dark);
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 59, 102, 0.18);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.helper-text {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.cta {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-size: clamp(0.95rem, 0.85rem + 0.6vw, 1.05rem);
  font-weight: 700;
  background: var(--primary);
  color: var(--text-on-primary);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(13, 59, 102, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

@media (hover: hover) {
  .cta:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(13, 59, 102, 0.35);
  }
}

.cta:active {
  transform: translateY(1px);
}

.cta:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  box-shadow: none;
}

.cta-trust {
  margin-top: 8px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.form-error {
  color: var(--danger);
  font-weight: 600;
  min-height: 20px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.success {
  margin-top: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  animation: fadeIn 0.5s ease;
}

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.share a {
  text-decoration: none;
  text-align: center;
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex: 1 1 100%;
}

@media (hover: hover) {
  .share a:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(10, 27, 48, 0.12);
  }
}

.share a.whatsapp {
  background: var(--primary-soft);
  color: var(--primary);
}

.share a.facebook {
  background: var(--primary-soft);
  color: var(--primary);
}

.share a.x {
  background: var(--primary-soft);
  color: var(--primary);
}

.share-icon {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.share-icon svg {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  overflow: hidden;
}

.admin-header .logo-large {
  font-size: 1.6rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.admin-actions form {
  margin: 0;
}

.admin-logout {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.admin-logout .button {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 10px 14px;
  background: var(--primary);
  color: var(--text-on-primary);
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.button.secondary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--border);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pager-info {
  font-weight: 600;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--primary-soft);
}

tbody tr:nth-child(even) {
  background: var(--bg);
}

td:nth-child(2) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@supports (position: sticky) {
  thead th {
    position: sticky;
    top: 0;
    z-index: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@supports (display: grid) {
  .share {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .share a {
    flex: initial;
  }
  .share a.x {
    grid-column: 1 / -1;
  }
  @media (min-width: 720px) {
    .share {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .share a.x {
      grid-column: auto;
    }
  }
  @media (max-width: 360px) {
    .share {
      grid-template-columns: 1fr;
    }
    .share a.x {
      grid-column: auto;
    }
  }
}

@supports not (gap: 1rem) {
  .share a {
    margin-top: 8px;
  }
  .share a:first-child {
    margin-top: 0;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 24px;
  }
  .headline {
    font-size: 1.65rem;
  }
  .cta {
    font-size: 1.05rem;
  }
}

@media (max-width: 480px) {
  table {
    font-size: 0.82rem;
  }
  th,
  td {
    padding: 8px 6px;
  }
}
