/* Ewidencja narzędzi — mobile-first.
   Uwaga: w menu NIE używamy klasy Bootstrapa .nav-link (jej zmienne CSS
   psuły kontrast w aplikacji UDT) — tylko własne .drawer-link / .bnav-item. */

:root {
  --c-bg: #f3f5f8;
  --c-surface: #ffffff;
  --c-text: #1c2430;
  --c-muted: #5d6b7c;
  --c-border: #dde3ea;
  --c-dark: #1f2a37;
  --c-dark-2: #2b394a;
  --c-accent: #e8590c;
  --c-accent-dark: #c44a08;
  --topbar-h: 56px;
  --bnav-h: 64px;
}

html, body { background: var(--c-bg); color: var(--c-text); }
body { font-size: 16px; -webkit-tap-highlight-color: transparent; }
a { color: #1d5fbf; }

/* ── górny pasek ── */
.topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--topbar-h); display: flex; align-items: center; gap: .5rem;
  padding: 0 .75rem; background: var(--c-dark); color: #fff;
  padding-top: env(safe-area-inset-top);
}
.topbar-btn { background: none; border: 0; color: #fff; font-size: 1.6rem; width: 44px; height: 44px; border-radius: 8px; }
.topbar-btn:hover, .topbar-btn:focus-visible { background: rgba(255,255,255,.12); }
.topbar-title { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title:hover { color: #fff; }
.topbar-title i { color: var(--c-accent); }
.topbar-user { color: #cfd8e3; font-size: .9rem; }

/* ── wysuwane menu ── */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1050;
  width: 290px; max-width: 85vw; overflow-y: auto;
  background: var(--c-dark); color: #fff;
  transform: translateX(-100%); transition: transform .22s ease;
  padding-bottom: 1.5rem;
}
.drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; gap: .75rem; align-items: center; padding: 1.25rem 1rem; background: var(--c-dark-2); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--c-accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.drawer-section { padding: 1rem 1rem .35rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #8fa0b3; }
.drawer-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1rem; color: #e9eef4; text-decoration: none; font-size: 1rem;
  border-left: 3px solid transparent;
}
.drawer-link i { font-size: 1.15rem; width: 1.3rem; text-align: center; color: #aab8c8; }
.drawer-link:hover, .drawer-link:focus-visible { background: rgba(255,255,255,.07); color: #fff; }
.drawer-link.active { background: rgba(232,89,12,.16); border-left-color: var(--c-accent); color: #fff; }
.drawer-link.active i { color: var(--c-accent); }

/* ── treść ── */
.page { max-width: 1100px; margin: 0 auto; padding: 1rem .75rem 1.5rem; }
.page.with-bnav { padding-bottom: calc(var(--bnav-h) + 1.5rem + env(safe-area-inset-bottom)); }
h1.page-title { font-size: 1.4rem; font-weight: 700; margin: .25rem 0 1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page-actions { margin-left: auto; display: flex; gap: .5rem; }

.card { border: 1px solid var(--c-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); font-weight: 600; border-radius: 12px 12px 0 0 !important; }
.form-label { font-weight: 600; font-size: .92rem; color: var(--c-text); }
.form-control, .form-select { min-height: 48px; font-size: 16px; border-radius: 10px; }
textarea.form-control { min-height: 80px; }
.btn { min-height: 46px; border-radius: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 36px; }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn-accent:hover, .btn-accent:focus { background: var(--c-accent-dark); border-color: var(--c-accent-dark); color: #fff; }
.text-muted { color: var(--c-muted) !important; }

/* kafelki statystyk */
.stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: .9rem; text-decoration: none; color: inherit; display: block; height: 100%; }
.stat:hover { border-color: #b7c2cf; color: inherit; }
.stat .num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--c-muted); font-size: .85rem; }

/* listy-karty (zamiast tabel na telefonie) */
.list-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.list-row { display: flex; gap: .75rem; align-items: center; padding: .8rem .9rem; border-bottom: 1px solid var(--c-border); color: inherit; text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #f8fafc; color: inherit; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { color: var(--c-muted); font-size: .88rem; overflow-wrap: anywhere; }
.list-row .end { text-align: right; flex-shrink: 0; font-size: .88rem; }
.list-row.warn { background: #fff7ed; }
.inw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: #eef2f6; border-radius: 6px; padding: .1rem .4rem; white-space: nowrap; }
.empty { padding: 1.5rem; text-align: center; color: var(--c-muted); }

/* wybór sprzętu */
.pick { display: flex; gap: .75rem; align-items: center; padding: .75rem .9rem; border-bottom: 1px solid var(--c-border); cursor: pointer; margin: 0; }
.pick:last-child { border-bottom: 0; }
.pick input { width: 1.4rem; height: 1.4rem; flex-shrink: 0; margin: 0; }
.pick:has(input:checked) { background: #fff1e8; }
.pick-list { max-height: 55vh; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #fff1e8; border: 1px solid #f6c7a8; color: #8a3505; border-radius: 999px; padding: .2rem .65rem; font-size: .85rem; margin: .15rem; }

/* tabele na telefonie → karty */
@media (max-width: 767.98px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--c-border); padding: .5rem .25rem; }
  table.responsive td { border: 0; padding: .2rem .5rem; display: flex; gap: .5rem; }
  table.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--c-muted); min-width: 7.5rem; flex-shrink: 0; }
  table.responsive td[data-label=""]::before { display: none; }
}

/* dl z danymi */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--c-muted); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* dolny pasek (telefon) */
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex; background: var(--c-surface); border-top: 1px solid var(--c-border);
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #4a5768; text-decoration: none; font-size: .72rem; background: none; border: 0;
}
.bnav-item i { font-size: 1.35rem; }
.bnav-item.active { color: var(--c-accent); }
.bnav-item:hover { color: var(--c-accent); }
.bnav-main i { background: var(--c-accent); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin-top: -18px; box-shadow: 0 3px 8px rgba(232,89,12,.4); }
.bnav-main.active i, .bnav-main:hover i { background: var(--c-accent-dark); color: #fff; }

@media (min-width: 992px) {
  .bnav { display: none; }
  .page.with-bnav { padding-bottom: 2rem; }
  .page { padding: 1.5rem 1.5rem 2rem; }
}

.app-footer { margin-top: 2rem; text-align: center; font-size: .8rem; color: var(--c-muted); }
.app-footer a { color: var(--c-muted); }

/* logowanie */
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; }
.login-logo { font-size: 2.5rem; color: var(--c-accent); }

.sticky-submit { position: sticky; bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom) + .5rem); z-index: 5; }
@media (min-width: 992px) { .sticky-submit { bottom: 1rem; } }
