:root {
  --green: #0e4429;
  --green-dark: #09301d;
  --green2: #007f5d;
  --emerald: #009870;
  --gold: #fdb813;
  --gold-dark: #945c00;
  --bg: #f4f7f5;
  --text: #16261e;
  --muted: #53665d;
  --line: #dce4df;
  --red: #b4232c;
  --white: #fff;
}

* { box-sizing: border-box; }

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

header {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: var(--white);
  padding: 12px max(20px, calc((100% - 1120px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 3px solid var(--gold);
}

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

.brand-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25));
}

.brand b {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  color: #cde3d7;
  font-size: 12px;
}

main {
  max-width: 1120px;
  margin: auto;
  padding: 26px 18px 55px;
  min-height: 75vh;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 20px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.2; margin-bottom: 12px; }
h2 { font-size: 21px; color: var(--green); }
h3 { font-size: 16px; color: var(--green); }
p { margin-bottom: 12px; }
.muted, small { color: var(--muted); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(14, 68, 41, .05);
}

.hero {
  background: linear-gradient(135deg, var(--green) 0%, #0b593c 100%);
  color: var(--white);
  padding: 26px;
  border-radius: 18px;
  margin-bottom: 16px;
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 8px 22px rgba(14, 68, 41, .14);
}

.hero .muted { color: #d6e9df; }
.hero h1 { color: var(--white); }
.hero strong { color: var(--gold); }

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

.hero-logo {
  width: 116px;
  height: 116px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .28));
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  padding: 15px;
  border-top: 3px solid var(--emerald);
}

.stat small { display: block; }
.stat b { font-size: 25px; color: var(--green); }

.layout {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 18px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: start;
  position: sticky;
  top: 10px;
}

.nav button {
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 0;
}

.nav button:hover {
  background: #e7f0eb;
  filter: none;
}

.nav button.active {
  background: var(--green);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--gold);
}

.row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.stack { display: grid; gap: 12px; }
.stack-tight { display: grid; gap: 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 6px 12px; padding: 8px 10px; background: #f8fbf9; border: 1px solid var(--line); border-radius: 8px; }

.field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.field small { font-weight: 400; }

input, textarea, select {
  font: inherit;
  width: 100%;
  border: 1px solid #c5d1ca;
  background: var(--white);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green2); }
label.check { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; }

button, .button {
  font: inherit;
  font-weight: 650;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--green2);
  color: var(--white);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
}

button:hover, .button:hover { filter: brightness(.93); }

button.secondary, .button.secondary {
  background: var(--white);
  color: var(--green);
  border-color: #c5d1ca;
}

button.danger {
  background: #fff4f4;
  color: var(--red);
  border-color: #f1c7c7;
}

button:disabled { opacity: .5; cursor: not-allowed; }

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

.badge {
  font-size: 12px;
  border-radius: 20px;
  background: #dff2ea;
  color: var(--green);
  padding: 4px 10px;
  font-weight: 650;
}

.hero .badge {
  background: var(--emerald);
  color: var(--white);
}

.badge.pending {
  background: #fff3d1;
  color: var(--gold-dark);
}

.tablewrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; }
td .actions { margin: 0; }

.person-row { border-bottom: 1px solid var(--line); padding: 14px 0; }
.person-row:last-child { border-bottom: 0; }
.narrow { max-width: 660px; margin: 0 auto; }

.alert {
  background: #fff6df;
  border: 1px solid #f0dfb3;
  color: #73511b;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}

.good { color: #0e6644; }
.bad { color: var(--red); }

#notice {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--white);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 18px;
  max-width: 90vw;
  z-index: 10;
  display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}

#notice.show { display: block; }
#notice.error { background: var(--red); border-color: #f6b8bc; }

.empty { padding: 22px 0; color: var(--muted); }
details { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 650; }
.result { border: 2px solid var(--gold); }
.result h2 { font-size: 29px; color: var(--green); }
.speech-box { background: #f4faf7; border: 1px solid #cce3d7; border-left: 4px solid var(--emerald); border-radius: 10px; padding: 14px 16px; white-space: pre-line; margin: 12px 0; font-size: 15px; line-height: 1.6; }
.eventlist button { width: 100%; justify-content: space-between; margin-bottom: 8px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-text { word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

@media (max-width: 720px) {
  header { padding: 12px 16px; }
  main { padding: 16px 12px 40px; }
  .layout { grid-template-columns: 1fr; }
  .nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 5px; white-space: nowrap; }
  .nav button { flex-shrink: 0; }
  .card { padding: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: 1fr; }
  .hero-login { flex-direction: column; text-align: center; }
  .hero-logo { width: 96px; height: 96px; }
  th, td { padding: 8px; }
  .stat b { font-size: 22px; }
}

@media print {
  header, footer, .nav, .actions, button, #notice { display: none !important; }
  .layout { display: block; }
  .card { border: 0; box-shadow: none; }
  main { padding: 0; }
}
