:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --text: #0f201c;
  --muted: #4d615b;
  --accent: #1f7a57;
  --accent-strong: #14553c;
  --border: #d3ddd7;
  --shadow: 0 18px 40px rgba(14, 32, 28, 0.12);
  --radius: 8px;
}

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

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(31, 122, 87, 0.06), transparent 24%),
    radial-gradient(circle at 80% 10%, rgba(20, 85, 60, 0.08), transparent 18%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--accent-strong);
}

.lang-switch {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.lang-switch a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
}

.lang-switch a.is-active {
  border-color: var(--accent);
  background: #e6f2ec;
  color: var(--accent-strong);
}

.admin-body {
  background: #f8faf9;
}

.admin-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.ghost--light {
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: #0f201c;
  background: #ffffff;
}

.ghost,
.ghost--light,
.export-btn {
  border: 1px solid var(--border);
}

.admin-shell {
  padding-top: 40px;
  padding-bottom: 40px;
}

.admin-login-card {
  max-width: 420px;
  margin: 40px auto;
  text-align: left;
}

.admin-login-card h1 {
  margin-top: 0;
  margin-bottom: 16px;
}

.admin-login-form {
  gap: 16px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 32, 28, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.detail-overlay.is-open {
  display: flex;
}

.detail-card {
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 18px 40px rgba(14, 32, 28, 0.22);
}

.detail-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grid--three {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.detail-section h5 {
  margin: 16px 0 6px;
}

.detail-strong {
  font-weight: 700;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
}

.stat {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fdfdfc;
}

.stat__label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stat__value {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 800;
}

.tabs {
  margin-top: 18px;
}

.tab-headers {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--text);
  border-color: var(--accent);
}

.tab-actions {
  display: flex;
  gap: 8px;
  }

.tab-buttons {
  display: flex;
  gap: 8px;
}

.tab-panel {
  display: none;
  padding-top: 12px;
}

.tab-panel.active {
  display: block;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-weight: 700;
}

.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sort-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 4px;
}

.sorted-asc .sort-indicator::after {
  content: '▲';
  font-size: 11px;
}

.sorted-desc .sort-indicator::after {
  content: '▼';
  font-size: 11px;
}

.admin-chart {
  margin-bottom: 16px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  gap: 10px;
  align-items: end;
}

.line-chart {
  margin: 6px 0 12px;
}

.line-chart svg {
  width: 100%;
  height: auto;
}

.line-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.line-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.line-legend .legend-item {
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: 4px;
}

.line-legend .legend-item.off {
  opacity: 0.4;
}

.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar__fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 4px 4px 2px 2px;
  min-height: 4px;
}

.bar__label {
  font-size: 12px;
  color: var(--muted);
}

.bar__value {
  font-weight: 700;
  font-size: 13px;
}

.admin-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-filters select {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font: inherit;
}

.dropdown {
  position: relative;
}

.table-filter {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  min-width: 180px;
}

.dropdown .export-btn {
  padding: 8px 12px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 180px;
  z-index: 10;
  overflow: hidden;
}

.dropdown-menu a {
  display: block;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.dropdown-menu a:hover {
  background: #f2f6f4;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 280px;
}

.hero__image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

/* Admin hero height override */
.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 25, 20, 0.6), rgba(7, 25, 20, 0.9));
}

.hero__content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 24px 0 40px;
}

.hero__branding {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hero__logo-wrap {
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.hero-title {
  margin: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1.2;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  margin: 0 0 6px;
  color: #d6e6e1;
}

.sub {
  margin: 6px 0 0;
  color: #d6e6e1;
  max-width: 620px;
}

.shell {
  margin: 24px auto 40px;
  width: min(1200px, 94vw);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section__header h2 {
  margin: 0;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid--split {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid--two {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  padding: 12px;
  border: 1px solid var(--border);
  background: #fdfdfc;
  border-radius: 4px;
  font: inherit;
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
}

.required label::after {
  content: '*';
  color: #b5332e;
  margin-left: 6px;
}

.select-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select-card input[type='radio'] {
  margin-top: 4px;
}

.select-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-card__title {
  margin: 0;
  font-weight: 700;
}

.select-card__text {
  margin: 0;
  color: var(--muted);
}

.select-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(31, 122, 87, 0.1);
}

.select-card:has(input:checked) {
  border-color: var(--accent-strong);
  box-shadow: none;
}

.pill {
  background: #e6f2ec;
  color: var(--accent-strong);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  margin-left: 8px;
}

.fieldset {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fieldset__title {
  margin: 0 0 6px;
  font-weight: 700;
}

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.checkbox-pill input {
  width: 18px;
  height: 18px;
}

.currency-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.currency-input span {
  font-weight: 700;
  color: var(--accent-strong);
}

.currency-input input {
  width: 100%;
}

.summary {
  position: sticky;
  top: 20px;
}

.summary__list {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary__list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.summary__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
  font-weight: 800;
}

.summary__muted {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.alert {
  border-radius: 6px;
  padding: 12px;
  border: 1px solid var(--border);
}

.alert--error {
  border-color: #d64545;
  background: #fff0f0;
  color: #741b1b;
}

.alert--success {
  border-color: #2f9e44;
  background: #f1fbf4;
  color: #1d6c30;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  padding: 14px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.primary-btn:hover {
  filter: brightness(1.02);
}

.ghost {
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 700;
}

.family-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.is-hidden {
  display: none !important;
}

.site-footer {
  padding: 24px 0 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .hero__content {
    align-items: flex-end;
    padding: 18px;
  }
  .hero__logo-wrap {
    width: 120px;
    height: 120px;
  }
  .hero__logo {
    padding: 8px;
  }
}

@media (max-width: 768px) {
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
  }

  .table-wrap tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    background: #fff;
  }

  .table-wrap td {
    border: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
  }

  .table-wrap td:last-child {
    border-bottom: none;
  }

  .table-wrap td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    text-transform: none;
  }

  .tab-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .tab-buttons {
    flex-wrap: wrap;
  }
}
