/* Evento — application stylesheet */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --border: #e3e6ec;
  --text: #1c2330;
  --muted: #6b7385;
  --primary: #F26522;
  --primary-dark: #D9531A;
  --primary-soft: #FDECE2;
  --ink: #23262B;
  --ok: #12805c;
  --ok-soft: #e3f5ee;
  --warn: #9a6700;
  --warn-soft: #fdf3d8;
  --error: #b42318;
  --error-soft: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --sidebar-w: 244px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
code { background: #eef0f4; padding: .1em .35em; border-radius: 5px; font-size: .85em; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1px solid transparent; border-radius: 9px; padding: .55rem 1rem;
  font-size: .9rem; font-weight: 600; cursor: pointer; background: #fff; color: var(--text);
  transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #fff; border-color: #cfd4de; }
.btn-danger { background: var(--error); color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert { padding: .7rem .9rem; border-radius: 10px; margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent; }
.alert-error { background: var(--error-soft); color: var(--error); border-color: #f6cfcb; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: #c3e9d9; }
.alert-warning { background: var(--warn-soft); color: var(--warn); border-color: #f0e0a8; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border-color: #d5d9fb; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 9px; font-size: .92rem;
  background: #fff; color: var(--text); font-family: inherit; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field input:disabled { background: #f4f5f8; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: .5rem; }
.field.inline > span { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

/* ---------- Auth screens ---------- */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-shell { width: 360px; max-width: 92vw; }
.auth-back { display: inline-block; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: .7rem; }
.auth-back:hover { color: var(--primary); text-decoration: none; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 2rem; width: 100%; max-width: 92vw; }
.auth-card.center { text-align: center; }
.auth-brand { font-size: 1.5rem; margin-bottom: .1rem; }
.auth-sub { color: var(--muted); margin: 0 0 1.3rem; text-align: center; }
.auth-links { text-align: center; margin: 1rem 0 0; font-size: .9rem; }

/* ---------- App shell ---------- */
body.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--ink); color: #c7ccd8; display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; }
.sidebar .brand { padding: 1.1rem 1.2rem; font-weight: 700; font-size: 1.15rem; }
.sidebar .brand a { color: #fff; }
.sidebar .brand a:hover { text-decoration: none; }

/* ---------- Brand lockup ---------- */
.brand-link { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.brand-link:hover { text-decoration: none; }
.brand-logo { display: block; width: auto; }
.brand-logo.on-dark { background: #fff; border-radius: 8px; padding: 3px 6px; }
.brand-text { font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; color: var(--text); }
.sidebar .brand-text { color: #fff; }
.auth-brand { text-align: center; margin-bottom: .3rem; }
.auth-brand .brand-link { justify-content: center; }
.logo-preview { display: flex; align-items: center; gap: .8rem; background: #f7f8fa; border: 1px solid var(--border);
  border-radius: 10px; padding: .7rem .9rem; }
.nav { display: flex; flex-direction: column; padding: .5rem .6rem; gap: 2px; flex: 1; }
.nav-link { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px;
  color: #c7ccd8; font-size: .9rem; }
.nav-link:hover { background: #31353d; color: #fff; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-icon { width: 1.2em; text-align: center; opacity: .9; }
.sidebar-foot { padding: 1rem; border-top: 1px solid #343841; display: flex; flex-direction: column; gap: .6rem; }
.user-badge .user-name { color: #fff; font-weight: 600; font-size: .9rem; }
.user-badge .user-role { color: #8b92a5; font-size: .78rem; }
.content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.scanner-card { display: flex; align-items: center; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap; }
.scanner-card-text { flex: 1 1 320px; }
.scanner-card-text .card-title { margin-bottom: .3rem; }
.scanner-card-qr { flex: 0 0 auto; text-align: center; }
.scanner-card-qr svg { width: 120px; height: 120px; display: block; }
.impersonation-bar { background: #9a6700; color: #fff; padding: .6rem 1.6rem; display: flex;
  align-items: center; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.impersonation-bar .btn { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.impersonation-bar .btn:hover { background: rgba(255,255,255,.32); }
.page-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 1.1rem 1.6rem; }
.page-head h1 { margin: 0; font-size: 1.3rem; }
.page-body { padding: 1.6rem; max-width: 1100px; }

/* ---------- Cards / stats / tables ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.2rem; margin-bottom: 1.2rem; }
.card-title { font-size: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.card-head .card-title { margin: 0; }
.grid { display: grid; gap: 1rem; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1.2rem; }
.two-col { grid-template-columns: 1fr 1fr; }
.stat { margin: 0; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.7rem; font-weight: 700; margin-top: .2rem; }
.stat-sub { color: var(--muted); font-size: .8rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-muted { background: #eceef2; color: var(--muted); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }

/* ---------- Public site ---------- */
.public-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.public-head-inner, .hero-inner, .events-wrap, .event-detail {
  max-width: 1080px; margin: 0 auto; padding: 0 1.2rem; }
.public-head-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.public-brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.public-brand:hover { text-decoration: none; }
.public-main { min-height: 60vh; }
.public-flashes:not(:empty) { max-width: 1080px; margin: 1rem auto 0; padding: 0 1.2rem; }
.public-flashes .alert { margin-bottom: .8rem; }
.public-foot { border-top: 1px solid var(--border); color: var(--muted); text-align: center; padding: 1.8rem 1.2rem; margin-top: 3rem; font-size: .85rem; }
.foot-links { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center; margin-bottom: .8rem; }
.foot-links a { color: var(--muted); font-weight: 600; }
.foot-links a:hover { color: var(--primary); text-decoration: none; }
.foot-company { color: var(--muted); font-size: .82rem; }

/* ---------- Legal / content pages ---------- */
.legal-wrap { padding-top: 2rem; padding-bottom: 3rem; }
.legal { max-width: 780px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem 2.4rem; box-shadow: var(--shadow); line-height: 1.7; }
.legal h1 { margin-bottom: 1rem; }
.legal h3 { margin-top: 1.7rem; font-size: 1.1rem; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin: .3rem 0; }
.hero { background: linear-gradient(120deg, #F26522 0%, #E24E12 42%, #23262B 100%); color: #fff; padding: 2.6rem 0; }
.hero h1 { font-size: 2rem; margin-bottom: .2rem; }
.hero-sub { opacity: .9; margin: 0 0 1.4rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; background: rgba(255,255,255,.14);
  padding: .7rem; border-radius: 12px; }
.filter-bar .field.inline > span { color: #fff; }
.filter-bar input { min-width: 150px; }
.search-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  background: rgba(255,255,255,.16); padding: .7rem; border-radius: 12px; }
.search-bar input, .search-bar select { padding: .58rem .7rem; border: 1px solid transparent;
  border-radius: 8px; font-size: .9rem; background: #fff; color: var(--text); }
.search-kw  { flex: 1 1 240px; }
.search-loc { flex: 1 1 130px; }
.search-cat { flex: 1 1 150px; }
.search-bar input[type="date"] { flex: 0 1 150px; }
.cat-strip { border-bottom: 1px solid var(--border); background: var(--surface); }
.cat-strip-inner { max-width: 1080px; margin: 0 auto; padding: .7rem 1.2rem; display: flex; gap: .5rem; overflow-x: auto; }
.cat-chip { flex: 0 0 auto; padding: .35rem .85rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: .85rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.cat-chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.cat-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.results-count { color: var(--muted); margin: 0 0 1rem; }
.events-wrap { padding-top: 2rem; padding-bottom: 2rem; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.event-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); color: var(--text); transition: transform .12s, box-shadow .12s; }
.event-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.1); }
.event-banner { height: 148px; background: linear-gradient(135deg,#e9ebf5,#dfe3f3); background-size: cover;
  background-position: center; display: flex; align-items: center; justify-content: center; }
.event-banner-fallback { color: #9aa1b8; font-weight: 700; }
.event-body { padding: .9rem 1rem 1.1rem; }
.event-date { color: var(--primary); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.event-date.big { font-size: .95rem; }
.event-title { font-size: 1.05rem; margin: .3rem 0 .3rem; }
.event-meta { color: var(--muted); font-size: .85rem; }
.event-price { margin-top: .6rem; font-weight: 700; }
.event-cta { margin-top: .25rem; color: var(--primary); font-weight: 600; font-size: .78rem; }
.event-card:hover .event-cta { text-decoration: underline; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.section-title { margin: 0 0 1rem; font-size: 1.3rem; }

/* ---------- Public nav ---------- */
.public-nav { display: flex; align-items: center; gap: 1.1rem; }
.public-nav > a { color: var(--text); font-weight: 600; font-size: .92rem; }
.public-nav > a:hover { text-decoration: none; color: var(--primary); }

/* ---------- Organizer directory ---------- */
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.org-card { display: flex; gap: .9rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); color: var(--text);
  transition: transform .12s, box-shadow .12s; }
.org-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.1); }
.org-logo { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, #F26522, #23262B); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; }
.org-logo.lg { flex-basis: 88px; width: 88px; height: 88px; border-radius: 18px; font-size: 2.2rem; }
.org-body { min-width: 0; }
.org-name { font-size: 1.05rem; margin: 0 0 .1rem; }
.org-desc { color: var(--muted); font-size: .85rem; margin: .4rem 0; }
.org-count { color: var(--primary-dark); font-weight: 700; font-size: .85rem; }

/* ---------- Organizer profile ---------- */
.org-profile { background: linear-gradient(135deg, #FDECE2, #FFF4EE); border-bottom: 1px solid var(--border); }
.org-profile-inner { max-width: 1080px; margin: 0 auto; padding: 2rem 1.2rem; display: flex; gap: 1.4rem; align-items: center; }
.org-profile-inner h1 { margin: .3rem 0 .1rem; }
.org-profile-desc { color: var(--text); max-width: 640px; margin: .6rem 0 0; }

/* ---------- Event detail ---------- */
.event-detail { padding-top: 1.6rem; padding-bottom: 3rem; }
.detail-banner { height: 300px; border-radius: 16px; background-size: cover; background-position: center; margin-bottom: 1.6rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 2rem; }
.detail-meta { color: var(--text); margin: 1rem 0; display: flex; flex-direction: column; gap: .3rem; }
.detail-meta strong { color: var(--muted); font-weight: 600; }
.detail-desc { margin-top: 1.2rem; }
.detail-desc img { max-width: 100%; border-radius: 8px; }
.ticket-box { position: sticky; top: 1rem; }
.ticket-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--border); }
.ticket-row.sold-out { opacity: .55; }
.ticket-name { font-weight: 600; }
.ticket-desc { color: var(--muted); font-size: .82rem; }
.ticket-price { color: var(--primary-dark); font-weight: 700; margin-top: .1rem; }
.ticket-qty select { padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 8px; }
.fineprint { color: var(--muted); font-size: .78rem; text-align: center; margin: .4rem 0 0; }

/* Honeypot: off-screen (not display:none) so it's invisible to real users
   and screen readers, but still present for bots that auto-fill every field. */
.hp-field { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consent-line { margin: 0 0 .6rem; }
.consent-line a { color: var(--primary); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.inline-form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.inline-form select, .inline-form input { padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 7px; font-size: .85rem; }

/* ---------- Charts ---------- */
.bar-chart { display: block; overflow: visible; }
.bar-chart .bar { fill: var(--primary); transition: fill .12s; }
.bar-chart .bar:hover { fill: var(--primary-dark); }
.bar-chart .bar-label { fill: var(--muted); font-size: 3px; }
.chart-empty { color: var(--muted); padding: 1.5rem 0; text-align: center; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; }
.chart-total { font-size: 1.3rem; font-weight: 700; }
.meter { height: 10px; background: #eceef2; border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: linear-gradient(90deg, #F26522, #FF8A3D); border-radius: 999px; }
.meter-label { color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.dash-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.activity-list li:last-child { border-bottom: none; }
.activity-when { color: var(--muted); white-space: nowrap; font-size: .82rem; }

/* ---------- Printable tickets ---------- */
.ticket-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin: 1.4rem 0; }
.ticket-stub { display: flex; justify-content: space-between; align-items: center; gap: 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem 1.4rem;
  margin-bottom: 1rem; box-shadow: var(--shadow); }
.ticket-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.35rem; font-weight: 700;
  color: var(--primary-dark); letter-spacing: 1px; margin: .2rem 0; }
.ticket-stub-qr svg { width: 150px; height: 150px; display: block; }
@media print {
  .no-print, .public-head, .public-foot { display: none !important; }
  body { background: #fff; }
  .ticket-stub { break-inside: avoid; box-shadow: none; }
}

/* ---------- Mobile chrome (hidden on desktop) ---------- */
.mobile-topbar { display: none; }
.nav-backdrop { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  /* Admin: off-canvas sidebar + top bar with hamburger */
  .mobile-topbar {
    display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 60;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem .9rem; height: 56px;
  }
  .hamburger { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 42px; height: 42px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px;
    background: #fff; cursor: pointer; }
  .hamburger span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
  .mobile-brand .brand-logo { height: 30px; }
  .mobile-brand .brand-text { font-size: 1.05rem; }

  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 258px; height: 100dvh;
    transform: translateX(-100%); transition: transform .25s ease; z-index: 100;
    box-shadow: 2px 0 18px rgba(0,0,0,.25); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }
  .nav { overflow-y: auto; }

  .content { margin-left: 0; }
  .page-head { padding: 1rem 1.1rem; }
  .page-head h1 { font-size: 1.2rem; }
  .page-body { padding: 1.1rem; }

  /* Stack multi-column layouts */
  .two, .two-col, .detail-grid, .dash-cols { grid-template-columns: 1fr; }

  /* Wide admin tables scroll horizontally inside their card */
  .app .card { overflow-x: auto; }
  .app .table th, .app .table td { white-space: nowrap; }

  .impersonation-bar { flex-wrap: wrap; }

  /* Public header wraps neatly */
  .public-head-inner { height: auto; padding: .6rem 1rem; flex-wrap: wrap; gap: .5rem .8rem; }
  .public-nav { gap: .9rem; margin-left: auto; }
  .hero { padding: 1.9rem 0; }
  .hero h1 { font-size: 1.55rem; }
  .filter-bar { width: 100%; }
  .detail-banner { height: 190px; }
  .legal { padding: 1.4rem 1.2rem; }
  .ticket-page-head { flex-wrap: wrap; }
  .ticket-stub { flex-direction: column; align-items: flex-start; text-align: left; }
  .card-head { flex-wrap: wrap; gap: .6rem; }
}

@media (max-width: 480px) {
  .page-body { padding: .8rem; }
  .card { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 1.35rem; }
  .btn { padding: .55rem .85rem; }
  .public-brand .brand-text { font-size: 1.05rem; }
  .field.inline { flex-direction: column; align-items: stretch; }
  .field.inline > span { white-space: normal; }
}
