:root {
  --bg: #f2f7f2;
  --surface: #ffffff;
  --text: #16321f;
  --muted: #3d5d46;
  --accent: #2f8f3b;
  --accent-2: #25742f;
  --border: #bcd5c2;
  --error-bg: #ffe8e8;
  --error-text: #842029;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.45;
  color: var(--text);
  background: radial-gradient(circle at top right, #e0efdf, var(--bg));
  background-repeat: no-repeat;
  background-size: cover;
  background-color: var(--bg);
  min-height: 100dvh;
}

body.admin-light {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1f2a3d;
  --muted: #5a667a;
  --accent: #1f6fff;
  --accent-2: #1758c7;
  --border: #d8deea;
  --error-bg: #ffe9ea;
  --error-text: #8a1d2b;
  background: radial-gradient(circle at top right, #edf1fb, #f6f7fb 65%);
  background-repeat: no-repeat;
  background-size: cover;
  background-color: var(--bg);
}

body.public-theme {
  --bg: #f7f8ef;
  --surface: #ffffff;
  --text: #12301c;
  --muted: #355642;
  --accent: #1c8f43;
  --accent-2: #157338;
  --border: #cfe0c9;
  background: radial-gradient(circle at top right, #e3efdc, #f7f8ef 68%);
  background-repeat: no-repeat;
  background-size: cover;
  background-color: var(--bg);
}

.container {
  max-width: 980px;
  margin: 4vh auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(13, 38, 48, 0.08);
}

.hint {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.admin-container {
  max-width: 1120px;
}

.public-shell {
  max-width: 760px;
  margin-top: 9vh;
  border-top: 8px solid #f4d900;
}

.public-header {
  margin-bottom: 0.7rem;
}

.public-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.public-footer {
  margin-top: 1.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.public-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

h1,
h2,
h3 {
  margin-top: 0;
}

p {
  color: var(--muted);
}

form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

label {
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}

button,
.button-link {
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.button-link:hover {
  background: var(--accent-2);
}

.error {
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
}

.nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.inline-form {
  grid-template-columns: minmax(260px, 1fr) 140px;
  align-items: end;
}

.inline-form button {
  grid-column: 1 / -1;
  justify-self: start;
}

@media (max-width: 720px) {
  .inline-form {
    grid-template-columns: 1fr;
  }
}

.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.pager {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

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

.table-wrap table {
  min-width: 700px;
}

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

@media (max-width: 900px) {
  .container {
    margin: 2vh 0.7rem;
    padding: 1.15rem;
    border-radius: 12px;
  }

  .public-shell {
    margin-top: 3vh;
  }

  .nav {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .nav a {
    padding: 0.38rem 0.62rem;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .pager {
    flex-wrap: wrap;
  }

  .button-link,
  button {
    min-height: 44px;
  }

  input,
  textarea,
  select {
    min-height: 44px;
    padding: 0.75rem 0.85rem;
  }

  textarea {
    min-height: 140px;
  }

  h1 {
    font-size: 1.45rem;
    line-height: 1.2;
  }
}

@media (max-width: 560px) {
  .public-footer {
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    justify-content: center;
  }

  .table-wrap table {
    min-width: 620px;
  }
}
