:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #1d2524;
  --muted: #66726f;
  --line: #d9dfda;
  --brand: #1d6b5f;
  --brand-dark: #124a42;
  --accent: #c67b2b;
  --danger: #a33a32;
  --shadow: 0 18px 45px rgba(28, 43, 39, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(246, 247, 244, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--ink);
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.narrow {
  width: min(700px, calc(100% - 32px));
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  align-items: start;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: start;
}

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

.row-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
}

h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.section-title {
  margin-top: 32px;
}

.meta {
  color: var(--muted);
  margin: 4px 0;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 18px;
}

.event-card,
.panel,
.empty-state,
.success-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.event-card {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
}

.panel,
.empty-state,
.success-box {
  padding: 24px;
}

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

.task-list.compact {
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.counter {
  min-width: 96px;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4faf7;
}

.counter strong {
  display: block;
  color: var(--brand-dark);
  font-size: 1.7rem;
  line-height: 1;
}

.counter span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stack-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd4cf;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check-row {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  font-weight: 500;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: #fff;
  color: var(--brand);
}

.button.secondary:hover,
button.secondary:hover {
  background: #eef6f3;
}

.button.danger,
button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button-full {
  width: 100%;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form,
.status-actions form {
  display: inline-flex;
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 500;
}

.link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-tabs a,
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.badge {
  min-height: 24px;
  font-size: 0.78rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
}

.table-actions {
  white-space: nowrap;
}

.table-actions a {
  margin-left: 10px;
}

.status-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.flash-list {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.flash,
.form-errors {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash-success {
  border-color: #9cc8a7;
  background: #eff9f0;
}

.flash-error,
.form-errors {
  border-color: #dfa29d;
  background: #fff4f3;
}

.flash-info {
  border-color: #9bbfd3;
  background: #eef7fb;
}

.form-errors p {
  margin: 0 0 4px;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
}

.danger-form {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.error-debug {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #18201e;
  color: #f4faf7;
}

.footer {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .two-column,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .row-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .task-row {
    grid-template-columns: 1fr;
  }

  .counter {
    width: 100%;
  }
}
