/*
 * Poxi Studio — panel organizatora.
 * Jeden arkusz, jasny motyw Poxi (system "Lovable": biel + aurora + violet).
 * Sekcje: tokeny, reset, pomocnicze, powłoka, przyciski, karty,
 * logowanie, formularze, sektory, tabele, detal, skaner, RWD.
 */

/* ---------- Tokeny ---------- */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-deep: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f7f8;
  --line: rgba(15, 17, 20, 0.08);
  --line-soft: rgba(15, 17, 20, 0.06);
  --line-strong: rgba(15, 17, 20, 0.14);
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --text: #09090b;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --ok: #16a34a;
  --danger: #e11d48;
  --warn: #b45309;
  --radius: 20px;
  --shadow: 0 10px 40px rgba(15, 17, 20, 0.08);
  --shadow-sm: 0 4px 16px rgba(15, 17, 20, 0.06);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- Reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Miękka aurora przy dolnej krawędzi i narożnikach — bardzo niska alpha. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 46% at 88% 100%, rgba(168, 85, 247, 0.14) 0%, transparent 72%),
    radial-gradient(38% 42% at 6% 102%, rgba(56, 189, 248, 0.12) 0%, transparent 72%),
    radial-gradient(34% 44% at 52% 106%, rgba(236, 72, 153, 0.10) 0%, transparent 74%),
    radial-gradient(30% 34% at 96% 8%, rgba(129, 140, 248, 0.10) 0%, transparent 76%),
    radial-gradient(30% 34% at 0% 6%, rgba(244, 63, 94, 0.07) 0%, transparent 76%);
}

@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

h1,
h2,
h3,
p,
dl,
dd,
figure,
fieldset,
legend {
  margin: 0;
}

fieldset {
  padding: 0;
  border: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
}

a {
  color: var(--accent-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

img,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(139, 92, 246, 0.18);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Pomocnicze ---------- */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -72px;
  left: 12px;
  z-index: 200;
  padding: 11px 16px;
  border-radius: 10px;
  background: #09090b;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.skip-link:focus {
  top: 12px;
}

.skip-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.55;
}

.hint-warn {
  color: var(--warn);
  font-weight: 500;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------- Powłoka: sidebar + main ---------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 0 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 17, 20, 0.18) transparent;
}

.sidebar-top {
  padding: 0 18px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.sidebar-top .org-name {
  margin-top: 18px;
}

.org-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.nav-link.is-active {
  border-color: rgba(139, 92, 246, 0.18);
  background: rgba(139, 92, 246, 0.07);
  box-shadow: inset 2px 0 0 var(--accent);
  color: var(--text);
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 16px 20px;
  border-top: 1px solid var(--line-soft);
}

.sidebar-note {
  margin-bottom: 10px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(22px, 3vw, 34px) clamp(16px, 3vw, 34px) 80px;
  scroll-margin-top: 80px;
}

.main:focus,
.page-title:focus {
  outline: none;
}

.mobile-bar {
  display: none;
}

.mobile-nav {
  display: none;
}

/* ---------- Marka ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.brand-word {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.brand-tag {
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* ---------- Przyciski ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: #09090b;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(139, 92, 246, 0.45);
  background: var(--panel-2);
}

.btn-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  border-color: rgba(139, 92, 246, 0.35);
  background: var(--panel-2);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
}

@media (hover: hover) {
  .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(15, 17, 20, 0.16);
  }
}

/* ---------- Karty, sekcje, stany ---------- */

.card {
  position: relative;
  min-width: 0;
  padding: clamp(16px, 2.4vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head h2 {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-transform: uppercase;
}

.section-head .hint {
  margin-top: 6px;
}

.section-head > .count {
  flex: 0 0 auto;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: clamp(28px, 5vw, 44px);
  border-style: dashed;
  background: var(--panel-2);
}

.empty h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.empty p {
  max-width: 54ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.empty .btn {
  margin-top: 14px;
}

.empty-inline {
  margin: 0;
  padding: 16px 2px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.state-card {
  max-width: 620px;
  padding: clamp(24px, 4vw, 36px);
}

.state-text {
  max-width: 60ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 240px;
  padding: 40px 20px;
}

.loading-text {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-align: center;
}

.spinner {
  display: inline-block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(139, 92, 246, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: poxi-spin 0.8s linear infinite;
}

@keyframes poxi-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Odznaki i tagi ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-live {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
}

.badge-live::before {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.badge-draft {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-ok {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
}

.tag-used {
  border-color: rgba(225, 29, 72, 0.22);
  background: rgba(225, 29, 72, 0.07);
  color: #be123c;
}

.tag-neutral {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--muted);
}

/* ---------- Strony i nagłówki ---------- */

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-narrow {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}

.page-head-main {
  flex: 1 1 320px;
  min-width: 0;
}

.page-title {
  font-size: clamp(1.85rem, 3.2vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-wrap: balance;
}

.page-sub {
  max-width: 68ch;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.back-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

/* ---------- Logowanie i rejestracja ---------- */

.auth {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  min-height: 100vh;
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  overflow: hidden;
  padding: clamp(28px, 4vw, 56px);
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: auto -20% -32% -20%;
  height: 62%;
  pointer-events: none;
  background:
    radial-gradient(46% 62% at 34% 100%, rgba(168, 85, 247, 0.14), transparent 72%),
    radial-gradient(40% 58% at 78% 96%, rgba(56, 189, 248, 0.12), transparent 72%);
}

.auth-brand > * {
  position: relative;
  z-index: 1;
}

.auth-brand-top {
  align-self: flex-start;
}

.auth-poster {
  max-width: 520px;
  padding: clamp(12px, 5vh, 48px) 0;
}

.auth-headline {
  margin: 0 0 18px;
  font-size: clamp(2.3rem, 4.2vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.auth-headline em {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  letter-spacing: -0.03em;
}

.auth-lede {
  max-width: 42ch;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.auth-foot {
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ticket-stub {
  display: inline-flex;
  align-items: stretch;
  margin-top: 30px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: rotate(-1.5deg);
}

.ticket-stub-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 18px;
}

.ticket-stub-label {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.ticket-stub-main strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.ticket-stub-side {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-left: 1px dashed var(--line-strong);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
}

.auth-main {
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 56px);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.55), transparent);
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.auth-mobile-brand .brand-word {
  font-size: 18px;
}

.auth-title {
  margin-top: 4px;
  font-size: clamp(1.6rem, 1.2rem + 1.3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.auth-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.auth-notice {
  margin-top: 18px;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.auth-switch {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-switch a {
  color: var(--accent-2);
  font-weight: 600;
  text-underline-offset: 3px;
}

.auth-switch a:hover {
  color: var(--accent);
}

/* ---------- Formularze ---------- */

.form {
  display: grid;
  gap: 18px;
  align-content: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-2);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: rgba(15, 17, 20, 0.22);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14);
}

.field.has-error input,
.field input[aria-invalid="true"],
.field.has-error select,
.field.has-error textarea {
  border-color: rgba(225, 29, 72, 0.55);
}

.field.has-error input:focus-visible {
  outline-color: var(--danger);
}

.field-error {
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.45;
}

.field-error:empty {
  display: none;
}

.form-alert:empty,
.alert:empty {
  display: none;
}

.form-alert:not(:empty) {
  padding: 10px 12px;
  border: 1px solid rgba(225, 29, 72, 0.22);
  border-radius: 10px;
  background: rgba(225, 29, 72, 0.06);
  color: #be123c;
  font-size: 12px;
  line-height: 1.5;
}

.form-alert:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.alert {
  padding: 12px 14px;
  border: 1px solid rgba(225, 29, 72, 0.22);
  border-radius: 12px;
  background: rgba(225, 29, 72, 0.06);
  color: #be123c;
  font-size: 12.5px;
  line-height: 1.55;
}

.alert-error {
  border-color: rgba(225, 29, 72, 0.22);
  background: rgba(225, 29, 72, 0.06);
  color: #be123c;
}

.alert-ok {
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(22, 163, 74, 0.07);
  color: #15803d;
}

.alert-info {
  border-color: rgba(139, 92, 246, 0.22);
  background: rgba(139, 92, 246, 0.06);
  color: #5b21b6;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Kreator: sektory ---------- */

.sector-section {
  display: grid;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

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

.sector {
  position: relative;
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
}

.sector legend {
  padding: 0 8px;
  margin-left: -8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.sector-remove {
  display: flex;
  margin: 0 0 10px auto;
}

.sector-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.sector-actions .hint {
  margin: 0;
}

.seats-total {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Tabele ---------- */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 17, 20, 0.2) transparent;
}

.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(15, 17, 20, 0.03);
}

.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 17, 20, 0.18);
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card .table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
  background: rgba(15, 17, 20, 0.025);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 18px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 18px;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

.events-table {
  min-width: 720px;
}

.admin-orders-table {
  min-width: 640px;
}

.orders-table {
  min-width: 460px;
}

.tickets-table {
  min-width: 440px;
}

.cell-action {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.cell-email {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cell-strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.row-title {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.row-title:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.th-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* ---------- Statystyki ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 104px;
  padding: 18px;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.28), transparent);
}

.stat-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.stat-value {
  color: var(--text);
  font-size: clamp(1.8rem, 2.6vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-money {
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(1.5rem, 2.2vw, 1.95rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* ---------- Szczegół eventu ---------- */

.detail-page {
  gap: 18px;
}

.detail-head {
  align-items: flex-end;
}

.detail-title {
  min-width: 0;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.slug-chip {
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
  padding: 3px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.detail-main,
.detail-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.detail-card .facts {
  margin-top: 4px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 0;
}

.facts > div {
  min-width: 0;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.facts dt {
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.facts dd {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.public-link {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.link-block {
  flex: 1 1 220px;
  min-width: 0;
}

.link-code {
  display: block;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-decoration: none;
  word-break: break-all;
}

.link-code:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.detail-card > .hint {
  margin-top: 10px;
}

/* ---------- Ceny sektorów ---------- */

.sector-price-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.sector-price {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.sector-price:focus-within {
  border-color: rgba(139, 92, 246, 0.4);
}

.sector-price-info {
  display: flex;
  flex: 1 1 220px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.sector-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.sector-price-info .hint {
  margin: 0;
  font-size: 11px;
}

.sector-price-info .hint-warn {
  flex-basis: 100%;
  padding-left: 8px;
  border-left: 2px solid rgba(180, 83, 9, 0.4);
}

.price-control {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
}

.price-control .field {
  gap: 4px;
}

.price-control .field label {
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.price-control input {
  width: 128px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Skaner biletów ---------- */

.scan-card h2 {
  margin-top: 4px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.scan-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.scan-form .field {
  margin: 0;
}

.scan-result {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  animation: none;
}

.scan-result:empty {
  display: none;
}

.scan-verdict {
  margin: 0 0 6px;
  color: var(--text);
  font-size: clamp(1.25rem, 1rem + 1.2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.scan-details {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.scan-details > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.scan-details dt {
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.4;
}

.scan-details dd {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: right;
}

.scan-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* Trzy stany wyniku: zielony (ok), czerwony (użyty/nieprawidłowy), szary (brak/błąd). */
.scan-result.is-ok {
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(22, 163, 74, 0.06);
  box-shadow: inset 3px 0 0 var(--ok);
}

.scan-result.is-ok .scan-verdict {
  color: #15803d;
}

.scan-result.is-used,
.scan-result.is-invalid {
  border-color: rgba(225, 29, 72, 0.24);
  background: rgba(225, 29, 72, 0.05);
  box-shadow: inset 3px 0 0 var(--danger);
}

.scan-result.is-used .scan-verdict,
.scan-result.is-invalid .scan-verdict {
  color: #be123c;
}

.scan-result.is-missing,
.scan-result.is-error {
  border-color: var(--line-strong);
  background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--muted-2);
}

.scan-result.is-missing .scan-verdict,
.scan-result.is-error .scan-verdict {
  color: var(--muted);
}

/* ---------- Toast i ekran startowy ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 120;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 24px;
  background:
    radial-gradient(46% 40% at 50% 100%, rgba(168, 85, 247, 0.12), transparent 72%),
    radial-gradient(38% 34% at 12% 100%, rgba(56, 189, 248, 0.10), transparent 74%),
    var(--bg);
  text-align: center;
}

.boot-brand {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.boot-brand .brand-word {
  font-size: 26px;
}

.boot-line {
  display: block;
  width: 120px;
  height: 1px;
  margin: 18px auto;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent);
}

.boot p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

body.is-booting {
  overflow: hidden;
}

.noscript {
  margin: 0;
  padding: 28px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.copy-proxy {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Responsywność ---------- */

@media (max-width: 1150px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    width: 100%;
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
  }

  .mobile-bar .brand {
    justify-self: start;
  }

  .mobile-nav {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 6px;
  }

  .mobile-nav .nav-link {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
  }

  .main {
    width: 100%;
    max-width: none;
    padding: 20px 16px 72px;
  }

  .auth {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-brand {
    display: none;
  }

  .auth-main {
    min-height: 100vh;
    padding: 24px 18px;
  }

  .auth-mobile-brand {
    display: flex;
  }
}

@media (max-width: 640px) {
  .page-head {
    align-items: flex-start;
    gap: 14px;
  }

  .page-actions {
    width: 100%;
    margin-left: 0;
  }

  .page-title {
    font-size: 1.7rem;
  }

  .form-grid,
  .sector-grid,
  .facts,
  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-wide {
    grid-column: auto;
  }

  .sector {
    padding: 16px 14px 14px;
  }

  .price-control {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
  }

  .price-control .field {
    flex: 1 1 auto;
  }

  .price-control input {
    width: 100%;
  }

  .public-link {
    align-items: stretch;
  }

  .public-link .btn {
    width: 100%;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }

  .detail-head {
    align-items: flex-start;
  }

  .card {
    padding: 16px;
  }

  .table-card {
    padding: 0;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 13.5px;
  }

  .main {
    padding: 18px 14px 64px;
  }

  .page {
    gap: 16px;
  }

  .page-title {
    font-size: 1.55rem;
  }

  .page-actions {
    gap: 8px;
  }

  .page-actions .btn {
    flex: 1 1 auto;
  }

  .card {
    padding: 14px;
  }

  .table-card {
    padding: 0;
  }

  .auth-main {
    padding: 20px 14px;
  }

  .auth-card {
    padding: 20px 16px;
  }

  .empty {
    padding: 24px 18px;
  }

  .stat-card {
    min-height: 96px;
    padding: 16px;
  }

  .toast {
    bottom: 12px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}

/* ---------- Ograniczenie animacji ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .spinner {
    animation: none;
    border-top-color: var(--accent);
  }

  .btn-primary:hover:not(:disabled) {
    transform: none;
  }

  .ticket-stub {
    transform: none;
  }
}

/* end of studio.css */

