* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f5f7;
  color: #1c1c1e;
  font-size: 17px;
  line-height: 1.4;
  padding-bottom: 72px;
}

a { color: #2563eb; }

header.topbar {
  background: #fff;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.topbar h1 { font-size: 19px; margin: 0; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions .btn-sm { width: auto; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 0;
  max-width: 640px;
  margin: 0 auto;
}

.tabs a {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  color: #1c1c1e;
  font-size: 15px;
  white-space: nowrap;
}

.tabs a.active { background: #2563eb; border-color: #2563eb; color: #fff; }

.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.card a.card-link { text-decoration: none; color: inherit; display: block; }

.card h3 { margin: 0 0 6px; font-size: 17px; }

.card .meta { color: #6b7280; font-size: 14px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge.draft { background: #f3f4f6; color: #6b7280; }
.badge.published { background: #dcfce7; color: #16a34a; }
.badge.postponed { background: #fef3c7; color: #b45309; }
.badge.cancelled { background: #fee2e2; color: #dc2626; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.paid { background: #dcfce7; color: #16a34a; }

form.form-group { display: flex; flex-direction: column; gap: 14px; }

label { font-size: 14px; font-weight: 600; color: #374151; }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}

textarea { min-height: 100px; resize: vertical; }

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #fff; color: #1c1c1e; border: 1px solid #d1d5db; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { width: auto; padding: 8px 14px; font-size: 14px; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.actions-row { display: flex; gap: 10px; }
.actions-row .btn { flex: 1; }

.error { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.notice { background: #dbeafe; color: #1d4ed8; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.empty { color: #6b7280; text-align: center; padding: 32px 16px; }

.participant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

.participant-row:last-child { border-bottom: none; }

.participant-name { font-size: 15px; }
.participant-name .username { color: #6b7280; font-size: 13px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.checkbox-row:last-child { border-bottom: none; }

.checkbox-row input[type="checkbox"] { width: 22px; height: 22px; }

section.block { margin-top: 24px; }
section.block h2 { font-size: 16px; margin-bottom: 8px; color: #374151; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; margin-bottom: 24px; }

.poster-preview { width: 100%; border-radius: 12px; margin-bottom: 10px; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.bottom-nav a .icon { font-size: 20px; }

.bottom-nav a.active { color: #2563eb; }

.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input { flex: 1; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-row .meta { margin-top: 2px; }

.filters-row { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.filters-row input { flex: 1; min-width: 0; }

.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { color: #6b7280; font-size: 14px; margin-top: 2px; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* --- Desktop layout: sidebar nav + wide grid lists --- */

.sidebar { display: none; }
.view-toggle { display: none; gap: 8px; margin-bottom: 16px; }
.view-toggle a { width: auto; }

@media (min-width: 900px) {
  .shell { display: flex; align-items: flex-start; }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 20px 12px;
  }

  .sidebar-brand { font-size: 18px; font-weight: 700; padding: 8px 12px 20px; }

  .sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
  }

  .sidebar a.active { background: #eff6ff; color: #2563eb; }
  .sidebar-logout { margin-top: auto; padding-top: 12px; }

  .main-col { flex: 1; min-width: 0; }

  body { padding-bottom: 0; }
  header.topbar { display: none; }
  .bottom-nav { display: none; }

  main { padding: 32px 40px; max-width: 640px; }
  main.wide { max-width: 1100px; }

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

  .grid-list .card { margin-bottom: 0; }

  .view-toggle { display: inline-flex; }
}
