:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d9e2ec;
  --page: #f6f8fb;
  --panel: #ffffff;
  --green: #1f7a5a;
  --green-dark: #14513d;
  --yellow: #f3c44e;
  --red: #d94f45;
  --blue: #2867a6;
  --shadow: 0 18px 45px rgba(28, 42, 57, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(31, 122, 90, 0.08), rgba(40, 103, 166, 0.08)),
    var(--page);
  color: var(--ink);
  font-family:
    "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 86px;
  padding: 18px clamp(18px, 4vw, 52px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-mark {
  align-items: center;
  aspect-ratio: 1;
  background: conic-gradient(from 210deg, var(--green), var(--yellow), var(--blue), var(--green));
  border: 3px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 122, 90, 0.22);
  color: #ffffff;
  display: grid;
  flex: 0 0 48px;
  font-size: 1.35rem;
  font-weight: 800;
  place-items: center;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.2;
}

h2 {
  font-size: 1.1rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.02rem;
  line-height: 1.35;
}

.eyebrow,
.summary-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
}

.view-tabs,
.filter-group,
.button-row,
.toggle-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-button,
.chip,
.primary-button,
.ghost-button,
.icon-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.tab-button,
.chip,
.ghost-button,
.icon-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.tab-button.is-active,
.chip.is-active,
.primary-button {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.primary-button:hover,
.tab-button.is-active:hover,
.chip.is-active:hover {
  background: var(--green-dark);
}

.ghost-button:hover,
.tab-button:hover,
.chip:hover,
.icon-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 22px clamp(16px, 4vw, 36px) 42px;
}

.summary-band {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
  overflow: hidden;
}

.summary-band > div {
  background:
    linear-gradient(90deg, rgba(31, 122, 90, 0.08), transparent),
    #ffffff;
  padding: 16px 18px;
}

.summary-band strong {
  display: block;
  font-size: 1.65rem;
  line-height: 1.1;
  margin-top: 3px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.toolbar {
  align-items: end;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.search-field {
  flex: 1 1 360px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.14);
  outline: none;
}

.event-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.event-card,
.panel,
.admin-event {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(28, 42, 57, 0.08);
}

.event-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.event-card-header {
  display: grid;
  gap: 7px;
}

.event-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  gap: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: #eef7f3;
  border: 1px solid #cce6db;
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 8px;
}

.event-description {
  color: #3d4b59;
  font-size: 0.9rem;
  min-height: 58px;
}

.capacity-meter {
  display: grid;
  gap: 6px;
}

.meter-line {
  background: #edf2f7;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.meter-fill {
  background: linear-gradient(90deg, var(--green), var(--yellow));
  height: 100%;
  width: 0;
}

.meter-copy {
  color: var(--muted);
  font-size: 0.82rem;
}

.event-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.status-badge {
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
}

.status-open {
  background: #e7f6ef;
  color: var(--green-dark);
}

.status-full {
  background: #fff4d6;
  color: #7a5300;
}

.status-closed {
  background: #f7e8e7;
  color: #8d2d28;
}

.admin-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
}

.panel {
  padding: 18px;
}

.panel-heading {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.event-form {
  display: grid;
  gap: 13px;
}

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

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

.switch input {
  accent-color: var(--green);
  min-height: 18px;
  width: 18px;
}

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

.admin-event {
  overflow: hidden;
}

.admin-event-summary {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 14px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.mini-button {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 34px;
  padding: 6px 10px;
}

.mini-button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.danger-button:hover {
  border-color: var(--red);
  color: var(--red);
}

.guest-table {
  border-top: 1px solid var(--line);
  display: grid;
}

.guest-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 1.4fr 1.3fr 0.45fr 0.8fr auto;
  padding: 10px 14px;
}

.guest-row:last-child {
  border-bottom: 0;
}

.guest-row small {
  color: var(--muted);
  display: block;
}

.empty-state {
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(520px, calc(100vw - 28px));
  padding: 0;
  width: 100%;
}

dialog::backdrop {
  background: rgba(31, 41, 51, 0.42);
}

.dialog-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-note {
  background: #f2f7fa;
  border: 1px solid #d4e4ee;
  border-radius: 8px;
  color: #394b59;
  padding: 10px 12px;
}

.icon-button {
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 1.4rem;
  min-height: 38px;
  padding: 0;
  width: 38px;
}

.toast {
  background: var(--ink);
  border-radius: 8px;
  bottom: 18px;
  color: #ffffff;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 18px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 20;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 960px) {
  .event-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-header,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .view-tabs,
  .filter-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .view-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .form-row,
  .guest-row,
  .admin-event-summary {
    grid-template-columns: 1fr;
  }

  .admin-actions,
  .event-actions {
    justify-content: start;
  }
}
