:root {
  --bg: #000;
  --surface: #121428;
  --surface-2: #181b33;
  --surface-3: #1f2140;
  --border: #343767;
  --text: #f6f7ff;
  --text-2: #c8cbf5;
  --muted: #9aa0d4;
  --placeholder: #7e86bc;
  --blue: #4f8cff;
  --purple: #8a5cff;
  --pink: #ff5cb8;
  --cyan: #42d3ff;
  --aqua: #2de2a6;
  --warning: #ffd166;
  --danger: #ff6b7a;
  --orange: #ff6958;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(138, 92, 255, .25), transparent 60%),
    radial-gradient(800px 500px at -10% 10%, rgba(79, 140, 255, .18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
h1, h2 { font-family: "Outfit", sans-serif; margin: 0; }

.portal-header { position: sticky; top: 0; z-index: 20; background: rgba(23, 19, 32, .97); border-bottom: 1px solid #ffffff1c; }
.portal-header-inner { max-width: 1100px; min-height: 68px; margin: auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand img { width: 160px; height: auto; display: block; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: 12px; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; transition: filter .2s, background .2s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(90deg, var(--blue), var(--purple)); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-outline { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: #272a52; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 122, .12); }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 8px 0; color: var(--cyan); font-weight: 700; cursor: pointer; }

.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { margin: 0 0 6px; color: var(--orange); font-size: .76rem; font-weight: 800; letter-spacing: .15em; }
.form-error { margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--danger); border-radius: 12px; background: rgba(255, 107, 122, .1); color: #ffc2c9; font-size: .92rem; }
.banner { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--warning); border-radius: 12px; background: rgba(255, 209, 102, .1); color: var(--warning); font-size: .92rem; line-height: 1.5; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.counter { margin: 4px 0 0; text-align: right; color: var(--muted); font-size: .78rem; }
.req { color: var(--danger); }

label { display: block; margin: 16px 0 6px; color: var(--text-2); font-size: .9rem; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  color-scheme: dark;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(66, 211, 255, .2); }
.invalid { border-color: var(--danger) !important; }

.login-view { display: flex; align-items: center; justify-content: center; padding: 32px 16px; min-height: calc(100svh - 68px); }
.login-card { width: 100%; max-width: 420px; padding: 28px 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 16px rgba(0, 0, 0, .45); }
.login-card h1 { font-size: 1.7rem; margin-bottom: 8px; }
.login-card form { margin-top: 8px; }
.login-card .btn-block { margin-top: 20px; }
.password-field { position: relative; }
.password-field input { padding-right: 88px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--cyan); font-weight: 700; cursor: pointer; }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: .8rem; text-align: center; line-height: 1.5; }

.panel-view, .form-view { max-width: 1100px; margin: 0 auto; padding: 28px 20px 64px; }
.form-view { max-width: 760px; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h1 { font-size: 1.9rem; line-height: 1.15; overflow-wrap: anywhere; }
.hero-note { margin: 0 0 16px; line-height: 1.55; }

.tabs { display: flex; gap: 8px; margin: 18px 0; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); width: fit-content; max-width: 100%; }
.tab { min-height: 40px; padding: 8px 20px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; }
.tab[aria-selected="true"] { background: linear-gradient(90deg, var(--blue), var(--purple)); color: #fff; }

.events-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.event-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 16px rgba(0, 0, 0, .45); }
.event-cover { width: 100%; aspect-ratio: 2 / 1; object-fit: contain; background: #000; display: block; }
.event-body { display: flex; flex-direction: column; gap: 6px; padding: 16px; flex: 1; }
.event-title { font: 700 1.15rem "Outfit", sans-serif; overflow-wrap: anywhere; }
.event-meta { color: var(--text-2); font-size: .9rem; overflow-wrap: anywhere; }
.event-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); font-size: .78rem; font-weight: 600; }
.event-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }
.event-actions .btn { flex: 1; min-height: 42px; }
.participants { min-width: 0; }
.participants-title { font-weight: 700; margin-bottom: 8px; }
.participants-state { margin: 0; color: var(--text-2); font-size: .9rem; }
.participant-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .9rem; }
.participant-head { color: var(--text-2); font-size: .78rem; font-weight: 700; }
.participant-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participant-status { width: 72px; text-align: center; font-weight: 700; }
.participant-status.yes { color: var(--cyan); }
.participant-status.no { color: var(--text-2); }

.card { margin: 0 0 18px; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); min-width: 0; }
.card legend { float: left; width: 100%; padding: 0; margin: 0 0 4px; font: 700 1.2rem "Outfit", sans-serif; }
.card legend + * { clear: both; }
.copy-card { background: var(--surface-2); }
.copy-card label { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 > div { min-width: 0; }
.extra-schedule { margin-top: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.extra-schedule-head { display: flex; justify-content: space-between; align-items: center; }
.extra-schedule-head strong { font-size: .9rem; }
.extra-schedule .link-button { color: var(--danger); }
#add-schedule { margin-top: 16px; }

.image-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.file-button { margin: 0; }
.image-preview { display: block; width: 100%; max-height: 360px; margin-top: 14px; border-radius: 14px; object-fit: contain; aspect-ratio: 2 / 1; background: #000; }
.artwork-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 10px; }
.artwork-option { padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: var(--surface-3); cursor: pointer; aspect-ratio: 1; }
.artwork-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.artwork-option[aria-pressed="true"] { border-color: var(--cyan); }

.tag-category h3 { margin: 16px 0 8px; color: var(--text-2); font-size: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { min-height: 38px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .88rem; font-weight: 600; cursor: pointer; }
.tag[aria-pressed="true"] { border-color: var(--cyan); background: rgba(66, 211, 255, .15); color: var(--cyan); }

.form-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.form-actions .btn { width: 100%; }

.dialog { width: min(92vw, 420px); padding: 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dialog h2 { font-size: 1.3rem; margin-bottom: 10px; }
.dialog p { margin: 0 0 20px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.main-nav { display: flex; gap: 6px; margin-left: auto; }
.main-nav[hidden] { display: none; }
.nav-link { min-height: 40px; padding: 8px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; }
.nav-link[aria-current="page"] { background: linear-gradient(90deg, var(--blue), var(--purple)); color: #fff; }
.billing-filters { display: flex; gap: 12px; margin-bottom: 16px; }
.billing-filters > div { flex: 1; min-width: 0; }
.billing-filters label { margin-top: 0; }
.billing-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.summary-card { padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.summary-label { color: var(--text-2); font-size: .85rem; font-weight: 600; }
.summary-value { margin-top: 4px; font: 700 1.35rem "Outfit", sans-serif; }
.summary-meta { margin-top: 2px; color: var(--muted); font-size: .8rem; }
.billing-section-title { margin: 0 0 12px; font: 700 1.2rem "Outfit", sans-serif; }
.billing-invoices { display: flex; flex-direction: column; gap: 12px; }
.invoice-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.invoice-card.open { border-color: var(--warning); }
.invoice-card.paid { border-color: var(--aqua); }
.invoice-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 16px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.invoice-title { font-weight: 700; }
.invoice-meta, .invoice-hint { color: var(--text-2); font-size: .85rem; }
.invoice-hint { color: var(--muted); font-size: .78rem; }
.invoice-amount { text-align: right; }
.invoice-amount strong { display: block; margin-bottom: 4px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); font-size: .75rem; font-weight: 700; }
.badge.open { color: var(--warning); border-color: var(--warning); }
.badge.paid { color: var(--aqua); border-color: var(--aqua); }
.invoice-details { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.invoice-event { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.invoice-event-title { font-weight: 600; overflow-wrap: anywhere; }
.invoice-details .btn { margin-top: 14px; width: 100%; }
.invoice-locked { margin: 14px 0 0; color: var(--text-2); font-size: .88rem; }
.pix-info { white-space: pre-line; }
.pix-qr { display: block; width: 220px; max-width: 100%; margin: 0 auto 16px; background: #fff; border-radius: 12px; }
.pix-payload { margin-bottom: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.pix-payload-label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: .8rem; font-weight: 600; }
.pix-payload code { display: block; max-height: 90px; overflow: auto; font-size: .78rem; overflow-wrap: anywhere; }

@media (min-width: 640px) {
  .form-actions { flex-direction: row; }
  .form-actions .btn { width: auto; min-width: 200px; }
}

@media (max-width: 560px) {
  .portal-header-inner { padding: 0 16px; }
  .brand img { width: 136px; }
  .panel-view, .form-view { padding: 20px 14px 56px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head h1 { font-size: 1.55rem; }
  .panel-head .btn { width: 100%; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 8px 10px; }
  .events-list { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .grid-2 { gap: 10px; }
  .login-card { padding: 24px 18px; }
}
