/* ============================================================
   Scout Camp Poznań — layout aplikacji (server-rendered)
   Uzupełnia tokens.css o szkielet: sidebar, topbar, siatki.
   ============================================================ */

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.sidebar-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.sidebar-brand b { font-size: 14.5px; line-height: 1.1; }
.sidebar-brand span { font-size: 11.5px; color: var(--text-3); }
.nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; padding: 12px 12px 5px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--brand-50); color: var(--brand-700); }
.nav a .ic { width: 18px; height: 18px; flex: none; }
.nav-spacer { flex: 1; }

/* ---------- Main / topbar ---------- */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 14px;
  padding: 0 22px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar .userchip { display: flex; align-items: center; gap: 9px; }
.topbar .userchip .meta { text-align: right; line-height: 1.15; }
.topbar .userchip .meta b { font-size: 13px; }
.topbar .userchip .meta span { font-size: 11.5px; color: var(--text-3); }
.menu-btn { display: none; }

.content { padding: 22px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

.kpi { padding: 16px 18px; }
.kpi .k { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.kpi .v.sm { font-size: 20px; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 22px 0 10px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.fieldset > legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--text-2); }

/* ---------- Tabs (server) ---------- */
.tab-link { border: none; background: transparent; padding: 11px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-2); position: relative; white-space: nowrap; display:inline-flex; align-items:center; gap:7px; }
.tab-link:hover { color: var(--text); }
.tab-link.on { color: var(--brand-700); }
.tab-link.on::after { content:""; position:absolute; left: 8px; right: 8px; bottom: -1px; height: 2.5px; background: var(--brand); border-radius: 3px 3px 0 0; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { width: 270px; flex: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); display: flex; flex-direction: column; }
.kanban-col h4 { font-size: 12.5px; padding: 11px 13px; border-bottom: 1px solid var(--border); display:flex; justify-content:space-between; }
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 60px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px; box-shadow: var(--sh-xs); }
.kanban-card b { font-size: 13px; }
.kanban-card .meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.kanban-card { cursor: pointer; }
.kanban-card[draggable=true] { cursor: grab; }
.kanban-card[draggable=true]:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-status { width: 100%; }
.kanban-col.drop-target { outline: 2px dashed var(--brand); outline-offset: -4px; background: var(--brand-50); }
.kanban-col .col-hint { font-size: 11px; color: var(--text-3); padding: 0 13px 8px; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; padding: 4px; }
.cal-cell { min-height: 96px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px; }
.cal-cell.muted { background: var(--surface-2); opacity: .55; }
.cal-cell .d { font-size: 12px; font-weight: 700; color: var(--text-2); }
.cal-cell.today .d { color: var(--brand); }
.cal-cell[data-add] { cursor: pointer; }
.cal-cell[data-add]:hover { background: var(--brand-50); border-color: var(--brand-100); }
.cal-cell-top { display: flex; align-items: center; justify-content: space-between; }
.cal-add { width: 18px; height: 18px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1; color: var(--text-3); background: var(--surface-2); opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--brand); color: #fff; }
.cal-ev { font-size: 10.5px; padding: 2px 5px; border-radius: 5px; margin-top: 3px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display:block; }

/* ---------- Misc ---------- */
.flash-wrap { position: fixed; top: 70px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.flash { padding: 12px 14px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600; box-shadow: var(--sh); border: 1px solid; }
.flash.success { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.flash.error { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.flash.info { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-line); }
.flash.warning { background: var(--amber-bg); color: var(--amber-700); border-color: var(--amber-line); }

.row-actions { display: flex; gap: 6px; }
.stat-row { display:flex; justify-content:space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.stat-row:last-child { border-bottom: none; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow:hidden; }
.bar > span { display:block; height:100%; background: var(--brand); }
.inline-form { display: inline; }
.text-right { text-align: right; }
.gap-wrap { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.muted-box { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: 14px; color: var(--text-2); font-size: 13px; }

/* ---------- Login ---------- */
.login-page { display: flex; min-height: 100vh; }
.login-hero { flex: 1; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { color: #fff; font-size: 34px; line-height: 1.1; max-width: 460px; }
.login-hero p { color: rgba(255,255,255,.85); margin-top: 14px; max-width: 420px; }
.login-badge { display:inline-flex; align-items:center; gap:8px; background: rgba(255,255,255,.14); padding: 7px 13px; border-radius: 99px; font-size: 12.5px; font-weight: 600; width: fit-content; }
.login-panel { width: 460px; max-width: 100%; background: var(--surface); display: flex; align-items: center; padding: 40px; }
.login-form { width: 100%; max-width: 340px; margin: 0 auto; }

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dash-grid, .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; z-index: 70; box-shadow: var(--sh-pop); }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .login-hero { display: none; }
  .login-panel { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .hide-mobile { display: none !important; }
}
/* ---------- Kolory kategorii (cennik / oferta) ---------- */
.cat-dot { display:inline-block; width:10px; height:10px; border-radius:99px; flex:none; vertical-align:middle; box-shadow:0 0 0 2px rgba(255,255,255,.6); }
.cat-badge { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700;
  padding:3px 10px; border-radius:var(--r-pill); border:1px solid var(--border); white-space:nowrap; }
.cat-cell { border-left: 4px solid var(--cat, transparent); background: var(--cat-bg, transparent); }
.cat-pick { display:flex; align-items:center; gap:7px; }

.scrim-nav { display:none; }
@media (max-width: 760px){ .scrim-nav.open { display:block; position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:60; } }

/* Drugorzędne kolumny tabel ukrywane na wąskich ekranach (mniej przewijania w poziomie). */
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
}
