/* Rdzeń – UKŁAD: boczne menu (komputer), dolny pasek + „Więcej” (telefon), górny pasek. Wspólny dla Kalibry, Kwerendy,
   Dziennika i Galerii (ten sam plik w każdej). Elementy stron (przyciski, karty, tabele…) – rdzen-ui.css. Tylko jasny motyw. */
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --surface-2: #F8F9FA; --surface-3: #EDEFF2;
  --ink: #1B2027; --ink-2: #39414C; --muted: #69727F; --line: #DDE1E6; --line-2: #EBEDF0;
  --nav-bg: #232A33; --nav-2: #2F3843; --nav-3: #1A2027; --nav-ink: #ECEFF3; --nav-muted: #9BA6B3; --nav-w: 240px;
  --nav-accent: var(--accent);   /* zaznaczenie w ciemnym menu (gdy --accent jest za ciemny na tle menu) */
  --accent: #D9792B; --accent-2: #C2661C; --accent-ink: #3A1E06; --accent-soft: #FBEBDC;
  --link: #A8531A;
  --ok: #1E7F55; --ok-soft: #DCF1E6; --bad: #C2402F; --bad-soft: #F9E2DD; --warn: #9A6512; --warn-soft: #F8ECD3;
  --info: #2F6BA8; --info-soft: #E1ECF8;
  --font: -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px; --tabbar-h: 62px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14.5px/1.45 var(--font); }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- marka --- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); font: 600 24px/1 var(--cond); letter-spacing: .01em; text-decoration: none !important; }
.brand svg { width: 30px; height: 30px; }
.brand.big { color: var(--ink); font-size: 34px; }
.brand.big svg { width: 42px; height: 42px; color: var(--nav-bg); }

/* --- ekran logowania / „otwórz z Konsoli” / wczytywanie --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--nav-bg) 16%, transparent), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; background: var(--surface); padding: 32px 28px; border-radius: 16px;
  border: 1px solid var(--line); box-shadow: 0 30px 60px -30px rgba(20, 30, 40, .35); }
.login-card p { margin: 0; }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.boot svg { width: 28px; height: 28px; color: var(--nav-bg); }

/* --- szkielet: boczne menu + treść --- */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--nav-bg); color: var(--nav-ink); display: flex; flex-direction: column;
  padding: 20px 14px 14px; gap: 16px; z-index: 30; }
.sidebar .brand { padding: 0 8px; }
.sheet-grip { display: none; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav .admin-only { display: flex; flex-direction: column; gap: 2px; }
.nav .admin-only[hidden] { display: none; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; color: var(--nav-ink); font-weight: 500;
  text-decoration: none; position: relative; }
.nav a svg { color: var(--nav-muted); width: 19px; height: 19px; }
.nav a:hover { background: var(--nav-2); }
.nav a.on { background: var(--nav-2); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--nav-accent); }
.nav a.on svg { color: var(--nav-accent); }
.nav-sep { margin: 12px 10px 4px; font-size: 12.5px; color: var(--nav-muted); }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 4px 0;
  border-top: 1px solid var(--nav-2); font-size: 13px; color: var(--nav-muted); }
.me { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); text-decoration: none !important; min-width: 0; padding: 4px; border-radius: 8px; }
a.me:hover { background: var(--nav-2); }
.me b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: block; color: var(--nav-muted); font-size: 12px; }
.me-av { width: 32px; height: 32px; border-radius: 50%; background: var(--nav-accent); color: var(--accent-ink); display: grid; place-items: center;
  font: 600 14px var(--cond); flex: 0 0 32px; }
.link-muted { border: 0; background: none; color: var(--nav-muted); cursor: pointer; padding: 6px 0; }
.link-muted:hover { color: var(--nav-ink); text-decoration: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-2); }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs span.cur { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs .sep { opacity: .5; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 34px; padding: 0 12px 0 8px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 14px; cursor: pointer; }
.back-btn[hidden] { display: none; }
.back-btn:hover { background: var(--surface-3); }
.back-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.top-title { display: none; }
.topbar.mobile-only { display: none; }          /* aplikacje bez ścieżki i wyszukiwarki: pasek tylko na telefonie */
.mini-brand { display: flex; align-items: center; gap: 8px; font: 600 19px/1 var(--cond); color: var(--ink); text-decoration: none !important; }
.mini-brand svg { width: 24px; height: 24px; color: var(--nav-bg); }
.topbar .search { position: relative; display: flex; align-items: center; gap: 8px; width: min(420px, 42vw); height: 38px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.topbar .search:focus-within { border-color: var(--accent); }
.topbar .search svg { width: 17px; height: 17px; color: var(--muted); }
.topbar .search input[type=search] { flex: 1; border: 0; outline: 0; background: none; min-width: 0; height: 100%; padding: 0; border-radius: 0; }
.topbar .search kbd { font: 500 12px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.search-results { position: absolute; top: 44px; right: 0; width: min(520px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .3); padding: 6px; z-index: 40; }
.sr-group { padding: 8px 10px 4px; font-size: 12.5px; color: var(--muted); }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none !important; }
.sr-item svg { width: 17px; height: 17px; color: var(--muted); }
.sr-item:hover, .sr-item.on { background: var(--surface-3); }
.sr-item .sub { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.sr-empty { padding: 12px; color: var(--muted); font-size: 14px; }
.page { padding: 26px 28px 60px; max-width: 1360px; width: 100%; outline: none; }
.scrim { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  /* menu: na dole pasek z najważniejszymi pozycjami, „Więcej” wysuwa całe menu od dołu */
  .sidebar { position: fixed; left: 0; right: 0; top: auto; bottom: 0; height: auto; max-height: 86vh; z-index: 60; border-radius: 18px 18px 0 0;
    padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .24s ease; gap: 12px; overflow-y: auto; }
  .shell.menu .sidebar { transform: none; box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .45); }
  .shell.menu .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 20, 25, .45); z-index: 55; }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--nav-2); margin: 2px auto 2px; flex: none; }
  .sidebar .brand { font-size: 20px; }
  .sidebar .brand svg { width: 26px; height: 26px; }
  .nav { overflow: visible; }
  .nav a { padding: 10px 10px; }
  .nav a.on::before { left: -6px; }
  .tabbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 5px 0; border: 0; background: none;
    color: var(--muted); font: 500 10.5px var(--font); text-decoration: none !important; cursor: pointer; }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .on { color: var(--accent); }
  .tabbar .on svg { color: var(--accent); }
  .tabbar a.cta { align-content: center; }
  .tabbar a.cta svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--accent); color: #fff; box-sizing: content-box; margin-top: -4px; }
  .tabbar a.cta span { display: none; }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
  .tabbar a { position: relative; }
  .topbar.mobile-only { display: flex; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 8px; }
  .topbar .crumbs { display: none; }
  .back-btn span { display: none; } .back-btn { padding: 0 8px; }
  .topbar .search { width: auto; flex: 1; min-width: 0; }
  .topbar .search input[type=search] { width: 100%; }
  .search-results { left: 0; right: auto; width: calc(100vw - 28px); }
  .page { padding: 18px 14px calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)); }
}
