:root {
  --bg: #0f1116;
  --bg-card: #191c24;
  --bg-input: #12141b;
  --border: #2a2e3a;
  --text: #e8eaf0;
  --text-muted: #8a90a0;
  --accent: #fe2c55;
  --accent-hover: #e0244a;
  --cyan: #25f4ee;
  --green: #2ecc71;
  --red: #e74c3c;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.55;
}

/* ── Boczne menu ── */
body.with-sidebar { display: flex; align-items: stretch; }
.sidebar {
  width: 252px;
  min-width: 252px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 12px 16px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}
.brand { font-weight: 800; font-size: 18px; letter-spacing: -0.5px; }
.brand span { color: var(--accent); }
.brand-big { font-size: 24px; text-align: center; margin-bottom: 18px; }
.sidebar .brand { padding: 0 10px 18px; }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.side-item, .side-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14.5px;
  cursor: pointer;
}
.side-item:hover, .side-sub:hover { background: rgba(255,255,255,0.05); }
.side-item.active, .side-sub.active { background: rgba(254,44,85,0.14); color: #fff; }
.side-sub { padding-left: 38px; font-size: 14px; color: var(--text-muted); }
.side-sub.active { color: #fff; }
.ico { width: 20px; text-align: center; font-size: 15px; flex: none; }
.ico-tt {
  background: #000;
  color: #fff;
  border-radius: 5px;
  font-size: 12px;
  line-height: 20px;
  height: 20px;
}
.ico-eye {
  background: #3aa; color: #fff; border-radius: 5px;
  font-size: 12px; line-height: 20px; height: 20px;
}
.side-nav details > summary { list-style: none; }
.side-nav details > summary::-webkit-details-marker { display: none; }
.side-nav details > summary::after {
  content: "⌃";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  transform: translateY(2px);
}
.side-nav details:not([open]) > summary::after { transform: rotate(180deg) translateY(2px); }

.side-user {
  border-top: 1px solid var(--border);
  padding: 14px 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.user-email {
  color: var(--text-muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Układ ── */
.container { flex: 1; max-width: 1100px; margin: 0 auto; padding: 32px 32px 64px; min-width: 0; }
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
h1 { font-size: 24px; letter-spacing: -0.4px; }
h2 { font-size: 17px; margin-bottom: 10px; }

/* ── Karty ── */
.card, .auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.auth-card h1 { text-align: center; margin-bottom: 20px; font-size: 20px; }
.form-card { max-width: 520px; }

/* ── Formularze ── */
label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--text-muted); }
label small { font-weight: normal; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(254,44,85,0.18);
}
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ── Przyciski ── */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: #262a35;
  transition: background 0.15s;
}
.btn:hover { background: #303542; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(231,76,60,0.4); }
.btn-danger:hover { background: rgba(231,76,60,0.12); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 6px; }

/* ── Komunikaty ── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14.5px;
  border: 1px solid;
}
.flash-error { background: rgba(231,76,60,0.1); border-color: rgba(231,76,60,0.4); color: #ff8a7a; }
.flash-success { background: rgba(46,204,113,0.1); border-color: rgba(46,204,113,0.35); color: #6de8a3; }

/* ── Tabela kampanii ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--bg-card); font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:last-child td { border-bottom: none; }
.camp-name { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text-muted); }
.actions-col { text-align: right; white-space: nowrap; }
.inline { display: inline-flex; gap: 6px; }

.status { padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.status-on { background: rgba(46,204,113,0.15); color: var(--green); }
.status-off { background: rgba(138,144,160,0.15); color: var(--text-muted); }
.status-wait { background: rgba(241,196,15,0.15); color: #f1c40f; }

/* ── Różne ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 18px; }

.mode-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
.mode-sandbox { background: rgba(37,244,238,0.1); color: var(--cyan); border: 1px solid rgba(37,244,238,0.3); }
.mode-prod { background: rgba(254,44,85,0.1); color: var(--accent); border: 1px solid rgba(254,44,85,0.35); }

.advertiser-picker { max-width: 380px; margin-bottom: 18px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.mt { margin-top: 14px; }
.tag {
  background: rgba(37,244,238,0.12);
  color: var(--cyan);
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}
/* ── Pasek filtrów ── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-bar label { margin-bottom: 0; }
.filter-bar input { margin-top: 4px; width: auto; }
.filter-bar .grow { flex: 1; min-width: 220px; }
.filter-bar button { margin-bottom: 1px; }

/* ── Kreator ── */
.form-card-wide { max-width: 760px; }
.form-card-wide h2 {
  margin: 22px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--cyan);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-card-wide h2:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.chk-group { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.chk-group legend { font-size: 13px; color: var(--text-muted); padding: 0 6px; }
.chk { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--text); font-size: 14px; }
.chk input { width: auto; margin: 0; accent-color: var(--accent); }
.steps { list-style: none; }
.steps li { padding: 6px 0; font-size: 14.5px; }
.step-err { color: #ff8a7a; }

.auth-switch { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 14px; }
.auth-switch a { color: var(--accent); text-decoration: none; }
details summary { cursor: pointer; color: var(--text-muted); font-size: 14px; }
details[open] summary { margin-bottom: 10px; }
