:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --border: #e2e5ea;
  --accent: #e8492e;
  --accent-text: #ffffff;
  --ok: #1b7f3b;
  --error: #b42318;
  --warn-bg: #fff6e5;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #eceef2;
    --muted: #9aa1ad;
    --border: #2c3039;
    --accent: #ff6a4d;
    --ok: #4cc27a;
    --error: #ff7a6b;
    --warn-bg: #2d2615;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }
h1 { font-size: 1.75rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { font-size: .85em; word-break: break-all; }

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 1.25rem; text-decoration: none; color: var(--text); }
.brand b { color: var(--accent); }
.brand span { font-size: .8rem; color: var(--muted); margin-left: .25rem; }

.tabs { display: flex; gap: .25rem; overflow-x: auto; flex: 1; }
.tabs a {
  padding: .45rem .8rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}
.tabs a:hover { background: var(--bg); color: var(--text); }
.tabs a.active { background: var(--bg); color: var(--text); font-weight: 600; }

.account { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.pill {
  padding: .3rem .75rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
}

main { max-width: 64rem; margin: 0 auto; padding: 2rem 1rem 4rem; }

/* Controls */
button, .button {
  display: inline-block;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }

label { display: block; margin-bottom: 1rem; font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .6rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > label { flex: 1 1 10rem; }
.row > label.grow { flex: 3 1 14rem; }
textarea { resize: vertical; }
.field { margin-bottom: 1rem; }
.field-label { display: block; font-weight: 600; margin-bottom: .35rem; }
.choices { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.choices label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; font-weight: 400; }
.choices input { width: auto; margin: 0; }
.price { font-weight: 600; margin-top: .35rem; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: .3rem;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.3rem; font-weight: 600; margin: .1rem 0 .5rem; }
.huge { font-size: 3rem; font-weight: 700; margin: 0; line-height: 1.1; }
.status { min-height: 1.5em; margin: .75rem 0 0; }
.error { color: var(--error); }
.ok { color: var(--ok); }
.section-title { margin-top: 2.5rem; }

/* Landing */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2.5rem; align-items: start; }
.hero h1 { font-size: 2.4rem; line-height: 1.15; }
.lead { font-size: 1.1rem; color: var(--muted); }
.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: .4rem; }
.login button { width: 100%; }

.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.package { display: flex; flex-direction: column; gap: .25rem; }
.package .price { font-size: 1.8rem; font-weight: 700; }
.package button, .package .button { margin-top: auto; }
.package .spacer { flex: 1; min-height: .75rem; }

/* Portal */
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.view-head h1 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.event { padding: 0; overflow: hidden; }
.event .photo { aspect-ratio: 4 / 3; background: var(--bg); display: grid; place-items: center; color: var(--muted); }
.event img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event .body { padding: .9rem 1rem 1rem; }
.event h3 { margin: .35rem 0 .25rem; font-size: 1.05rem; overflow-wrap: anywhere; }
.event .lead-text { margin: .5rem 0 0; font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.empty { text-align: center; padding: 3rem 1rem; }
.notice { background: var(--warn-bg); border-radius: 8px; padding: .6rem .9rem; }
.form { max-width: 40rem; }

.profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.credits .button { margin-top: 1rem; }

.table-wrap { overflow-x: auto; padding: .5rem 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; background: var(--bg); }
.badge.paid, .badge.published { color: var(--ok); }
.badge.queued { color: var(--muted); }
.badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.tags { display: flex; flex-wrap: wrap; gap: .25rem .6rem; margin-top: .6rem; font-size: .8rem; color: var(--muted); }
.badge.cancelled { color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: .75rem 1.1rem;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 6px 24px rgb(0 0 0 / .2);
}
.toast.error { background: var(--error); color: #fff; }

/* Mock bramka */
.gateway { max-width: 26rem; margin: 3rem auto; }
.gateway .mock-banner { background: var(--warn-bg); border-radius: 8px; padding: .5rem .75rem; font-size: .85rem; margin-bottom: 1rem; }
.gateway dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 1rem 0 1.5rem; }
.gateway dt { color: var(--muted); }
.gateway dd { margin: 0; font-weight: 600; text-align: right; }
.gateway .actions { display: flex; gap: .75rem; }
.gateway .actions button { flex: 1; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero h1 { font-size: 1.9rem; }
  .tabs { order: 3; flex-basis: 100%; }
}
