/* Pesta Ria: full-screen app pages (account, dashboard, admin). The page itself never scrolls;
   long lists scroll inside their own panel. */
body { overflow: hidden; }

.page {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.page > .canopy { height: 22px; flex: none; }
.page > .canopy::after {
  height: 14px;
  background:
    radial-gradient(circle at 24px 0, var(--red) 23px, transparent 24px) 0 0 / 96px 14px repeat-x,
    radial-gradient(circle at 24px 0, var(--cream) 23px, transparent 24px) 48px 0 / 96px 14px repeat-x;
}

.pagebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 10px;
  flex-wrap: wrap;
}
.pagebar h1 { margin: 0; font-size: clamp(24px, 3vw, 38px); line-height: 1; }
.pagebar .spacer { flex: 1; }

/* account bar (rendered by account.js) */
.account-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.account-bar .who { font-weight: 800; opacity: .9; white-space: nowrap; }
.account-bar .who .role {
  font-size: 11px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase;
  background: var(--gold); color: var(--ink); padding: 1px 7px; border-radius: 999px; margin-left: 4px;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 16px;
  padding: 0 20px 18px;
}

.card {
  background: rgba(255, 244, 220, .07);
  border: 3px solid rgba(255, 244, 220, .2);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.card-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 3px dashed rgba(255, 244, 220, .15);
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 22px; color: var(--gold); }
.card-head .spacer { flex: 1; }
.card-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card-foot { flex: none; display: flex; gap: 8px; padding: 12px 14px; border-top: 3px dashed rgba(255, 244, 220, .15); flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  font-family: var(--font-display); font-size: 15px; border: 0; cursor: pointer;
  padding: 7px 12px; border-radius: 10px; background: rgba(255, 244, 220, .12); color: var(--cream);
}
.tabs button[aria-selected=true] { background: var(--gold); color: var(--ink); }

.hint { margin: 0; font-size: 14px; opacity: .8; font-weight: 700; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.error { color: #ff9aa5; font-weight: 800; margin: 0; min-height: 1.2em; }
.ok { color: #8ff0a4; font-weight: 800; margin: 0; }
.empty { text-align: center; opacity: .7; font-weight: 800; padding: 30px 10px; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-weight: 700; font-size: 14px; }
.table th {
  text-align: left; font-family: var(--font-display); font-weight: 400; color: var(--gold);
  padding: 8px; position: sticky; top: 0; background: #2b1660; z-index: 1;
}
.table td { padding: 8px; border-top: 1px solid rgba(255, 244, 220, .12); vertical-align: middle; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .btn.small { font-size: 13px; padding: 5px 9px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 900; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 244, 220, .2);
}
.badge.admin { background: var(--gold); color: var(--ink); }
.badge.off { background: var(--red); color: var(--white); }
.badge.on { background: var(--green); color: var(--ink); }

/* list of events */
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.event-list button {
  width: 100%; text-align: left; border: 0; cursor: pointer; border-radius: 14px;
  padding: 10px 12px; background: var(--cream); color: var(--ink); font-family: var(--font-body);
  display: flex; flex-direction: column; gap: 2px; border-left: 8px solid var(--teal);
}
.event-list button.active { border-left-color: var(--red); box-shadow: 0 0 0 3px var(--gold); }
.event-list strong { font-family: var(--font-display); font-weight: 400; font-size: 18px; }
.event-list small { font-weight: 800; opacity: .7; }

/* prize rows */
.prize-rows { display: flex; flex-direction: column; gap: 8px; }
.prize-row { display: grid; grid-template-columns: 28px 1fr 90px 40px; gap: 8px; align-items: center; }
.prize-row .n { font-family: var(--font-display); color: var(--gold); text-align: center; }
.icon-btn {
  border: 0; border-radius: 10px; height: 40px; cursor: pointer; font-size: 16px;
  background: rgba(255, 244, 220, .12); color: var(--cream);
}
.icon-btn:hover { background: var(--red); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat {
  background: var(--cream); color: var(--ink); border-radius: 16px; padding: 10px 14px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
}
.stat b { display: block; font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 2.6vw, 36px); color: var(--red-deep); line-height: 1.1; }
.stat span { font-weight: 800; font-size: 13px; opacity: .75; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 4, 30, .6); padding: 16px; }
.modal[hidden] { display: none; }
.modal .card { background: #2b1660; border-color: var(--gold); width: min(440px, 100%); max-height: 90vh; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--ink); color: var(--cream); border: 3px solid var(--gold);
  padding: 10px 18px; border-radius: 12px; font-weight: 800; z-index: 50; box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .pagebar { padding: 14px 12px 8px; gap: 8px; }
  .workspace { padding: 0 12px 12px; gap: 10px; }
  .card-head, .card-foot { padding: 8px 10px; }
  .card-body { padding: 10px; }
  .card-foot .btn { font-size: 14px; padding: 7px 10px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > :first-child { grid-column: 1 / -1; }
}
