:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #25231f;
  --muted: #6f6a60;
  --line: #ded7ca;
  --accent: #187a62;
  --accent-strong: #0f5d49;
  --warm: #c95632;
  --blue: #386fa4;
  --shadow: 0 18px 50px rgba(50, 44, 33, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(24, 122, 98, 0.14), transparent 32rem),
    linear-gradient(135deg, #f6f2ea 0%, #eef4f0 52%, #f8efe8 100%);
  color: var(--ink);
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 18px;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 12px rgba(24, 122, 98, 0.22));
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--ink);
  font-size: 24px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 14px;
}

.select-field,
.field {
  display: grid;
  gap: 7px;
}

.select-field {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.84);
}

.select-field span,
.field span,
.location-choice legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
}

select,
input {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  min-height: 130px;
  padding: 12px;
  line-height: 1.55;
}

.feed {
  display: grid;
  gap: 12px;
}

.post-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(222, 215, 202, 0.82);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 8px 26px rgba(45, 39, 28, 0.08);
}

.post-meta,
.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.post-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.58;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8f3ee;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.badge.help {
  background: #e8f0fa;
  color: var(--blue);
}

.badge.idle {
  background: #fbefe8;
  color: var(--warm);
}

.badge.event {
  background: #f1ecfb;
  color: #6b4fa3;
}

.empty {
  min-height: 42vh;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.66);
  color: var(--muted);
  text-align: center;
}

.fab {
  position: fixed;
  right: max(18px, calc((100vw - 760px) / 2 + 18px));
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.fab span {
  font-size: 24px;
  line-height: 1;
}

.composer {
  width: min(calc(100vw - 24px), 560px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.composer::backdrop {
  background: rgba(28, 25, 20, 0.36);
  backdrop-filter: blur(8px);
}

.composer-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.composer-head,
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-head h2 {
  font-size: 20px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.location-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.location-choice legend {
  width: 100%;
  margin-bottom: 2px;
}

.location-choice label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.primary,
.secondary {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 8px;
  font-weight: 800;
}

.primary {
  border: 0;
  background: var(--accent);
  color: white;
}

.secondary {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.danger {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: #b3261e;
  color: white;
  font-weight: 800;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.admin-shell {
  padding-bottom: 32px;
}

.admin-login {
  display: grid;
  min-height: 52vh;
  place-items: center;
}

.admin-login .composer-panel {
  width: min(100%, 420px);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0 14px;
}

.stat-box {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.84);
}

.stat-box strong {
  font-size: 24px;
}

.stat-box span,
.admin-actions {
  color: var(--muted);
  font-size: 13px;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(222, 215, 202, 0.82);
  padding-top: 12px;
}

.error {
  min-height: 18px;
  color: #b3261e;
  font-size: 13px;
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  .app-shell {
    padding-inline: 12px;
  }

  h1 {
    font-size: 21px;
  }

  .control-row,
  .grid-two,
  .admin-stats {
    grid-template-columns: 1fr;
  }

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

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

  .primary,
  .secondary {
    width: 100%;
  }
}
