:root {
  --bg: #f6f7f9;
  --text: #1f2933;
  --muted: #64748b;
  --line: #d9e2ec;
  --primary: #176b5b;
  --primary-dark: #0f4f43;
  --danger: #b42318;
  --panel: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}
a { color: var(--primary); }
input, textarea, select, button {
  width: 100%;
  font: inherit;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
input[readonly] { background: #f8fafc; color: var(--muted); }
.copy-field {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
button, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  cursor: pointer;
}
button:hover, .primary:hover { background: var(--primary-dark); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary {
  color: var(--text);
  background: #e5e7eb;
}
button.secondary:hover { background: #d1d5db; }
.big { width: 100%; min-height: 54px; font-size: 1.1rem; }
.public-page {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px 16px 56px;
}
.narrow { max-width: 460px; }
.public-title h1, .public-page h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 8px; }
.lead, .hint, .public-title p { color: var(--muted); }
.simple-form, .form-grid, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.simple-form label, .form-grid label { display: grid; gap: 6px; font-weight: 700; }
.simple-form { display: grid; gap: 16px; margin-top: 20px; }
.alert {
  border: 1px solid #fda29b;
  background: #fff1f0;
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
}
.notice {
  border: 1px solid #8bd0bd;
  background: #eaf8f4;
  padding: 12px;
  border-radius: 8px;
}
.install-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.app-icon-preview {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  border-radius: 20px;
}
.install-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.install-steps article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.install-steps h2 { margin-top: 0; }
.personal-link-note { margin: 0 0 16px; }
.notification-panel { display: grid; gap: 8px; }
.notification-panel h2 { margin: 0; font-size: 1.1rem; }
.year-section h2 { margin: 28px 0 12px; }
.event-list { display: grid; gap: 14px; }
.event-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.event-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}
.event-card time { color: var(--muted); font-weight: 700; }
.event-card h3 { margin: 4px 0; font-size: 1.35rem; }
.new-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #7a3b00;
  background: #ffe8a3;
  font-size: .82rem;
  font-weight: 800;
  vertical-align: middle;
}
.empty { background: #fff; padding: 20px; border: 1px solid var(--line); border-radius: 8px; }
.admin-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.admin-header nav { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-header nav a { text-decoration: none; color: var(--text); }
.admin-main { width: min(1120px, 100%); margin: 0 auto; padding: 24px 16px 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stats strong { display: block; font-size: 2rem; line-height: 1; }
.stats span { color: var(--muted); }
.panel { margin: 18px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full { grid-column: 1 / -1; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check input { width: auto; min-height: auto; }
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.option-group legend { font-weight: 800; padding: 0 6px; }
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.status-grid div {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px;
}
.status-grid strong, .status-grid span { display: block; }
.status-grid span { color: var(--muted); }
.form-actions { display: flex; align-items: center; gap: 12px; }
.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: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions button { min-height: 34px; padding: 6px 10px; background: #6b7280; }
button.danger { background: var(--danger); }
button.danger:hover { background: #8a1c13; }
button.status-on,
button.status-off {
  min-width: 72px;
  min-height: 34px;
  padding: 6px 12px;
}
button.status-on { background: var(--primary); }
button.status-off { background: #6b7280; }
.audience-table { min-width: 980px; table-layout: fixed; }
.audience-name-col { width: 10em; }
.audience-status-col { width: 8em; }
.audience-state-col { width: 6.5em; }
.audience-url-col { width: auto; }
.thumbnail-preview {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: center;
}
.paste-thumbnail {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: text;
}
.paste-thumbnail:focus {
  outline: 3px solid rgba(23, 107, 91, .22);
  border-color: var(--primary);
}
.paste-thumbnail span {
  color: var(--muted);
}
.paste-thumbnail img {
  width: min(260px, 100%);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.paste-thumbnail.has-image {
  border-style: solid;
  background: #eef8f5;
}
.paste-thumbnail.is-dragover {
  border-color: var(--primary);
  background: #eef8f5;
}
.paste-thumbnail.is-busy {
  opacity: .72;
  pointer-events: none;
}
.thumbnail-preview img {
  width: 180px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.message-preview { white-space: pre-wrap; background: #f8fafc; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.setup-error { max-width: 760px; margin: 40px auto; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 720px) {
  .admin-header { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .public-title h1, .public-page h1 { font-size: 1.7rem; }
  .thumbnail-preview { grid-template-columns: 1fr; }
  .thumbnail-preview img { width: 100%; }
}
