:root {
  --bg: #0f1115;
  --bg-card: #181c24;
  --bg-card-2: #11141b;
  --border: #2a2f3a;
  --border-soft: #242833;
  --text: #e6e6e6;
  --text-dim: #8a8f98;
  --text-bright: #ffffff;
  --primary: #FC4C02;
  --primary-hover: #d83e00;
  --green: #15803d;
  --green-bright: #22c55e;
  --green-dim: #14532d;
  --red: #7f1d1d;
  --red-bright: #ef4444;
  --red-dim: #5b1818;
  --yellow: #ca8a04;
  --blue: #3b82f6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--green-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: #0a0c12;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}
.sidebar .role {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 24px;
}
.sidebar nav a {
  display: block;
  padding: 8px 10px;
  color: var(--text);
  border-radius: 6px;
  font-size: 14px;
  margin: 2px 0;
  text-decoration: none;
}
.sidebar nav a:hover { background: #1a1d24; text-decoration: none; }
.sidebar nav a.active { background: #1a1d24; color: var(--green-bright); }
.sidebar nav .group { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 4px 10px; }
.sidebar .user { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }

.main { flex: 1; padding: 28px 36px; max-width: 100%; overflow-x: auto; }
.main h1 { margin: 0 0 4px; font-size: 22px; }
.main .subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }

.center {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.center .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
}
.center h1 { font-size: 22px; margin: 0 0 6px; text-align: center; }
.center .lead { color: var(--text-dim); text-align: center; margin: 0 0 22px; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--primary); color: #fff; font-weight: 700;
  padding: 14px 22px; border-radius: 10px; border: 0;
  cursor: pointer; text-decoration: none; font-size: 14px;
  text-transform: uppercase; letter-spacing: .04em;
  width: 100%;
  transition: background .15s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn.btn-secondary { background: #2a2f3a; color: var(--text); }
.btn.btn-secondary:hover { background: #353b48; }
.btn.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.btn-ghost:hover { background: #1a1d24; }
.btn.btn-small { padding: 8px 14px; font-size: 12px; }
.btn.btn-danger { background: var(--red-bright); }
.btn.btn-danger:hover { background: #dc2626; }

input[type=email], input[type=text], input[type=password], input[type=number], textarea {
  width: 100%; background: #11141b; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 13px; font-size: 14px; font-family: inherit;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--green-bright); }
label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.field { margin-bottom: 14px; }

.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--green-bright); transform: translateY(-2px); }
.tile h3 { margin: 0 0 4px; font-size: 16px; }
.tile .meta { color: var(--text-dim); font-size: 12px; margin-bottom: 12px; }
.tile p { color: var(--text); font-size: 13px; margin: 0 0 14px; flex: 1; }
.tile .footer { display: flex; gap: 8px; margin-top: auto; align-items: center; justify-content: space-between; font-size: 12px; }
.tile .stat { color: var(--text-dim); }
.tile .stat strong { color: var(--text-bright); }

.section { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; margin-bottom: 16px; }
.section h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.section.ok { border-color: var(--green-dim); }
.section.no { border-color: var(--red-dim); }
.section ul { margin: 0; padding-left: 20px; font-size: 14px; }
.section li { margin: 4px 0; }

table.data { border-collapse: collapse; width: 100%; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
table.data th { color: var(--text-dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #11141b; }
table.data tr:hover { background: #11141b; }

.calendar { border-collapse: collapse; }
.calendar th, .calendar td { border: 1px solid var(--border); }
.calendar th.ath { text-align: left; padding: 8px 12px; background: var(--bg-card); font-weight: 500; white-space: nowrap; min-width: 200px; }
.calendar th.day { padding: 4px; font-size: 11px; text-align: center; background: var(--bg-card); min-width: 36px; }
.calendar th.day.we { background: #1f2330; }
.calendar th.day .dow { color: var(--text-dim); font-weight: 400; }
.calendar th.day .num { font-weight: 600; }
.calendar td.cell { width: 36px; height: 36px; padding: 0; text-align: center; font-size: 16px; line-height: 1; }
.calendar td.g { background: var(--green-dim); cursor: pointer; }
.calendar td.g:hover { background: #166534; }
.calendar td.r { background: var(--red-dim); }
.calendar th.ath .nm { margin-right: 8px; }
.calendar th.ath .st { font-size: 14px; }
.calendar th.ath .st.missing { cursor: pointer; opacity: .85; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.badge.pending { background: #422a00; color: var(--yellow); }
.badge.active { background: #052e16; color: var(--green-bright); }
.badge.suspended { background: #2a1212; color: var(--red-bright); }
.badge.invited { background: #1e293b; color: var(--blue); }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
.stat-card .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-card .value { font-size: 24px; font-weight: 700; }
.stat-card .change { font-size: 11px; color: var(--green-bright); margin-top: 4px; }

.note {
  background: #1a1410; border: 1px dashed var(--primary); border-radius: 8px;
  padding: 12px 16px; margin-top: 24px; font-size: 12px; color: var(--text-dim);
}
.note strong { color: var(--primary); }

.mockup-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(252, 76, 2, 0.95); color: #fff;
  padding: 6px 14px; font-size: 12px; text-align: center;
  border-top: 2px solid #d83e00; z-index: 1000;
}
.mockup-bar a { color: #fff; text-decoration: underline; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 12px; }
  .main { padding: 16px; }
}

/* ── Dolny dock demo (tylko w PWA / ?demo=1) ─────────────────────── */
html.demo-pwa body { padding-bottom: 78px; }   /* miejsce pod dock */
.demo-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: rgba(10,12,18,.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.4);
}
.demo-dock .demo-tag {
  display: flex; align-items: center; gap: 6px;
  align-self: center;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim);
  padding: 0 6px 0 2px;
}
.demo-dock .demo-tag .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
  animation: demo-pulse 1.6s ease-in-out infinite;
}
.demo-dock .demo-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.demo-dock .demo-btn .ic { font-size: 16px; line-height: 1; }
.demo-dock .demo-btn:hover { background: #1c212b; text-decoration: none; }
.demo-dock .demo-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
@keyframes demo-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (max-width: 380px) { .demo-dock .demo-tag { display: none; } }
