/* Shared look for every portal page: brand tokens, buttons in the style of
   our offers, the orange header with the offer wave, panels, form fields,
   toasts and dialogs. Page-specific styles stay in each page. */
:root {
  /* Gangaru: offer orange. --g-orange-ui is the same hue darkened to pass
     AA contrast for small text and white-on-orange buttons. */
  --g-orange: #F04E23;
  --g-orange-ui: #D63E17;
  --g-orange-deep: #C03A14;
  --g-ember: #FF6B42;
  --g-tint: #FFF3EE;
  --g-line: #F8D5C8;

  /* Gazelt: offer navy */
  --gz-navy: #1B3A5C;
  --gz-navy-deep: #142C47;
  --gz-tint: #F1F4F8;
  --gz-line: #D6DFEA;

  /* EDUball: ball colours from the logo */
  --edu-ink: #0E1116;
  --edu-yellow: #F7B32B;
  --edu-green: #37B34A;
  --edu-blue: #00ADEE;
  --edu-red: #EC1C24;
  --edu-orange: #F28322;
  --edu-tint: #FFF9EC;
  --edu-line: #F1E2BE;

  /* Warm neutrals from the Gangaru generator */
  --ink: #1A1A1A;
  --ink-2: #4A4742;
  --ink-3: #6B6762;
  --paper: #FFFFFF;
  --paper-2: #F8F8F8;
  --line: #EDEDED;
  --line-2: #DAD7D2;
  --ok: #15803D;
  --ok-tint: #EAF7EE;
  --bad: #B91C1C;
  --bad-tint: #FDECEC;
  --wait: #9A5B00;
  --wait-tint: #FFF4DC;

  --font-display: 'Poppins', 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-gazelt: 'Montserrat', 'Poppins', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --shadow-1: 0 1px 2px rgba(26, 26, 26, 0.04), 0 4px 14px rgba(26, 26, 26, 0.05);
  --shadow-2: 0 2px 6px rgba(26, 26, 26, 0.06), 0 18px 40px rgba(26, 26, 26, 0.10);
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--edu-blue); outline-offset: 3px; border-radius: 6px; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--g-orange-ui); }

/* ===== Buttons (shapes taken from the offers) ===== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 22px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .18s, color .18s, border-color .18s, box-shadow .18s, transform .18s;
}
.btn .chev { font-size: 19px; line-height: 0; transform: translateY(-1px); transition: transform .18s; }
.btn:hover .chev { transform: translate(3px, -1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 13px; }

/* Gangaru: pill, like "Zobacz realizacje" in the offer */
.btn-gangaru { border-radius: 999px; background: var(--g-orange-ui); color: #FFFFFF; box-shadow: 0 6px 16px rgba(214, 62, 23, 0.28); }
.btn-gangaru:hover:not(:disabled) { background: var(--g-orange-deep); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(214, 62, 23, 0.32); }
.btn-gangaru-outline { border-radius: 999px; border: 2px solid var(--g-orange-ui); color: var(--g-orange-ui); background: var(--paper); }
.btn-gangaru-outline:hover:not(:disabled) { background: var(--g-orange-ui); color: #FFFFFF; }

/* Gazelt: square-ish navy block, Montserrat caps like the offer headers */
.btn-gazelt, .btn-gazelt-outline {
  border-radius: 8px;
  font-family: var(--font-gazelt);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.btn-gazelt { background: var(--gz-navy); color: #FFFFFF; }
.btn-gazelt:hover { background: var(--gz-navy-deep); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(20, 44, 71, 0.25); }
.btn-gazelt-outline { border: 2px solid var(--gz-navy); color: var(--gz-navy); background: var(--paper); }
.btn-gazelt-outline:hover { background: var(--gz-navy); color: #FFFFFF; }

/* EDUball: black pill like the active tab in the sales map, with the four balls */
.btn-eduball { border-radius: 999px; background: var(--edu-ink); color: #FFFFFF; padding-left: 16px; }
.btn-eduball:hover { background: #262C35; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(14, 17, 22, 0.22); }
.balls { display: inline-flex; gap: 3px; }
.balls i { width: 9px; height: 9px; border-radius: 50%; display: block; transition: transform .25s; }
.balls i:nth-child(1) { background: var(--edu-red); }
.balls i:nth-child(2) { background: var(--edu-blue); }
.balls i:nth-child(3) { background: var(--edu-yellow); }
.balls i:nth-child(4) { background: var(--edu-green); }
.btn-eduball:hover .balls i:nth-child(odd) { transform: translateY(-3px); }

/* Neutral and destructive */
.btn-neutral { border-radius: 999px; border: 1.5px solid var(--line-2); color: var(--ink); background: var(--paper); min-height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn-neutral:hover:not(:disabled) { border-color: var(--g-orange-ui); color: var(--g-orange-ui); }
.btn-danger { border-radius: 999px; border: 1.5px solid #E7B4B4; color: var(--bad); background: var(--paper); min-height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn-danger:hover:not(:disabled) { background: var(--bad-tint); border-color: var(--bad); }
.btn-danger-solid { border-radius: 999px; background: var(--bad); color: #FFFFFF; }
.btn-danger-solid:hover:not(:disabled) { background: #991B1B; transform: translateY(-1px); }

/* On the orange header */
.btn-light { border-radius: 999px; background: #FFFFFF; color: var(--g-orange-deep); min-height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn-light:hover { box-shadow: 0 6px 16px rgba(120, 30, 5, 0.25); transform: translateY(-1px); }
.btn-ghost-light { border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, 0.55); color: #FFFFFF; min-height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.14); border-color: #FFFFFF; }

/* Whole card clickable through its main button */
.stretch::after { content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }

/* ===== Orange header with the offer wave ===== */
.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; pointer-events: none; }
.topbar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar-brand { display: inline-flex; align-items: center; gap: 14px; color: #FFFFFF; }
.topbar-brand img { height: 34px; width: auto; }
.topbar-sep { width: 1.5px; height: 26px; background: rgba(255, 255, 255, 0.5); }
.topbar-label { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: 0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Signed-in person on the orange header */
.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  margin-right: 4px;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: #FFFFFF; color: var(--g-orange-deep);
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
}
.user-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; opacity: 0.85; }
/* Compact header for inner pages (admin, settings, help) */
.page-hero {
  position: relative;
  overflow: hidden;
  color: #FFFFFF;
  background: linear-gradient(118deg, var(--g-orange-ui) 0%, var(--g-orange) 55%, var(--g-ember) 100%);
  padding-top: 18px;
  padding-bottom: 104px;
}
.page-hero .hero-wave { height: 90px; }
.page-hero-body { position: relative; z-index: 2; margin-top: 40px; max-width: 760px; }
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.crumbs a { opacity: 0.85; }
.crumbs a:hover { opacity: 1; text-decoration: underline; }
.crumbs .sep { opacity: 0.6; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.02em; margin-top: 10px; text-wrap: balance; }
.page-sub { font-size: 16.5px; font-weight: 500; line-height: 1.55; margin-top: 10px; max-width: 58ch; }
.page-main { position: relative; z-index: 3; margin-top: -64px; padding-bottom: 72px; }

/* ===== Panels and fields ===== */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.panel-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.panel-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: var(--g-tint); color: var(--g-orange-ui); }
.panel-icon svg { width: 22px; height: 22px; }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1.25; }
.panel-sub { color: var(--ink-2); font-size: 14px; line-height: 1.55; margin-top: 4px; max-width: 64ch; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.input {
  width: 100%;
  min-height: 46px;
  padding: 0 15px;
  border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.input:hover { border-color: #C9C5BF; }
.input:focus { outline: none; background: var(--paper); border-color: var(--g-orange-ui); box-shadow: 0 0 0 4px rgba(240, 78, 35, 0.14); }
input[type=checkbox] { accent-color: var(--g-orange-ui); width: 16px; height: 16px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-wait { background: var(--wait-tint); color: var(--wait); }
.badge-off { background: var(--bad-tint); color: var(--bad); }
.badge-admin { background: var(--ink); color: #FFFFFF; }

/* ===== Toasts ===== */
.toast-stack {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: #FFFFFF;
  box-shadow: var(--shadow-2);
  font-size: 14.5px;
  line-height: 1.45;
  animation: toast-in .22s ease-out both;
}
.toast-icon { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--edu-green); color: #FFFFFF; }
.toast-icon svg { width: 14px; height: 14px; }
.toast.error .toast-icon { background: var(--edu-red); }
.toast-text { flex: 1; min-width: 0; padding-top: 1px; }
.toast-close { flex-shrink: 0; width: 28px; height: 28px; margin: -3px -3px -3px 0; border-radius: 50%; display: grid; place-items: center; color: rgba(255, 255, 255, 0.7); }
.toast-close:hover { background: rgba(255, 255, 255, 0.12); color: #FFFFFF; }
.toast-close svg { width: 14px; height: 14px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Dialogs ===== */
dialog.modal {
  margin: auto;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 0;
  border-radius: 24px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(26, 26, 26, 0.28);
  overflow: auto;
}
dialog.modal[open] { animation: modal-in .2s ease-out both; }
dialog.modal::backdrop { background: rgba(26, 26, 26, 0.48); backdrop-filter: blur(3px); }
.modal-body { padding: 28px 28px 8px; display: flex; flex-direction: column; gap: 10px; }
.modal-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--g-tint); color: var(--g-orange-ui); margin-bottom: 6px; }
.modal-icon svg { width: 24px; height: 24px; }
.modal.danger .modal-icon { background: var(--bad-tint); color: var(--bad); }
.modal-title { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.25; text-wrap: balance; }
.modal-text { color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.modal-text strong { color: var(--ink); font-weight: 600; word-break: break-all; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 20px 28px 26px; }
.copy-box {
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px dashed var(--line-2);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
  user-select: all;
}
@keyframes modal-in { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 760px) {
  .user-text { display: none; }
  .user-chip { padding-right: 4px; }
  .page-hero { padding-bottom: 92px; }
  .page-hero-body { margin-top: 28px; }
  .page-sub { font-size: 15.5px; }
  .page-main { margin-top: -56px; }
  .panel { padding: 20px 18px; border-radius: 18px; }
  .modal-body { padding: 24px 22px 6px; }
  .modal-actions { padding: 18px 22px 22px; }
  .modal-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 420px) {
  .topbar-sep, .topbar-label { display: none; }
  .btn-light, .btn-ghost-light { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
