/* Kustos – panel webowy. Motyw jak w aplikacji: grafit + limonka, zdjęcie magazynu w tle, jasne panele. */
:root {
  --lime: #b5e61d;
  --lime-dark: #8db80f;
  --lime-text: #4f6e00;
  --on-lime: #1a1d22;
  --graphite: #2a3038;
  --graphite-2: #2e343d;
  --graphite-3: #363d47;
  --on-dark: #e4e7eb;
  --on-dark-muted: #a3acb8;
  --panel: rgba(238, 241, 244, 0.95);
  --panel-stroke: #9aa3ae;
  --field: #ffffff;
  --field-stroke: #6b7480;
  --text: #151a20;
  --muted: #2f363e;
  --line: #c4cbd3;
  --ok: #17713e;
  --warn: #9a5800;
  --err: #b3261e;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background:
    linear-gradient(rgba(214, 218, 223, 0.80), rgba(185, 191, 199, 0.80)),
    url("img/bg.jpg") center / cover fixed,
    #c9ced4;
}
a { color: var(--graphite); }
h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.err { color: var(--err); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- logowanie ---------- */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 380px; max-width: 100%;
  background: var(--panel); border: 1px solid var(--panel-stroke); border-radius: 20px;
  padding: 28px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand .logo {
  width: 44px; height: 44px; border-radius: 12px; background: var(--lime);
  display: flex; align-items: center; justify-content: center;
}
.brand .logo svg { width: 30px; height: 30px; }
.brand .name { font-size: 22px; font-weight: 700; }
.brand .tag { font-size: 12px; color: var(--lime-text); font-weight: 600; }

/* ---------- układ ---------- */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--graphite); color: var(--on-dark);
  border-right: 3px solid var(--lime); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 16px 6px; margin: 0; }
.sidebar .brand .name { color: var(--on-dark); }
.sidebar .brand .tag { color: var(--lime); }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--on-dark); text-decoration: none; font-weight: 600;
}
.nav a:hover { background: var(--graphite-3); }
.nav a.active { background: var(--lime); color: var(--on-lime); }
.nav a .ico { width: 20px; text-align: center; }
.sidebar .foot { padding: 12px 16px; font-size: 12px; color: var(--on-dark-muted); border-top: 1px solid var(--graphite-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--graphite); color: var(--on-dark); border-bottom: 3px solid var(--lime);
  padding: 10px 20px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5;
}
.topbar .title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar select { min-width: 220px; }
.topbar .user { font-size: 13px; color: var(--on-dark-muted); }
.content { padding: 20px; max-width: 1400px; width: 100%; }

.panel {
  background: var(--panel); border: 1px solid var(--panel-stroke); border-radius: 18px;
  padding: 18px; margin-bottom: 16px;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 200px !important; }
.spacer { flex: 1; }

/* ---------- pola i przyciski ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; color: var(--text); background: var(--field);
  border: 1px solid var(--field-stroke); border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--graphite); box-shadow: 0 0 0 2px var(--lime); }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--graphite); }

.btn {
  font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--graphite); background: var(--field); color: var(--graphite);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: #f3f5f7; }
.btn.primary { background: var(--lime); border-color: var(--lime-dark); color: var(--on-lime); }
.btn.primary:hover { background: #c3ee3a; }
.btn.dark { background: var(--graphite); color: var(--on-dark); }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { background: none; border: none; color: var(--graphite); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button {
  font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--field-stroke); background: var(--field); color: var(--graphite);
}
.tabs button.on { background: var(--lime); border-color: var(--lime-dark); color: var(--on-lime); }

/* ---------- tabele ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--graphite-2); color: var(--on-dark); font-size: 13px; font-weight: 700; position: sticky; top: 0; }
tr:hover td { background: #f6f9ec; }
td .sub { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; background: #e3e7eb; color: var(--muted); }
.badge.lime { background: var(--lime); color: var(--on-lime); }
.badge.ok { background: #d6f0e0; color: var(--ok); }
.badge.warn { background: #fbe9c8; color: var(--warn); }
.badge.err { background: #f8d9d6; color: var(--err); }

/* ---------- kafelki pulpitu ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--graphite-2); color: var(--on-dark); border-radius: 18px; padding: 16px;
  border-bottom: 4px solid var(--lime); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.kpi .v { font-size: 30px; font-weight: 800; color: var(--lime); }
.kpi .l { font-size: 13px; color: var(--on-dark-muted); font-weight: 600; }

/* ---------- okna (modal) ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 24, 30, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--panel-stroke); border-radius: 18px; padding: 20px; width: 720px; max-width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.type-card { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--lime); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--graphite); color: var(--on-dark); padding: 12px 18px; border-radius: 12px; border-left: 5px solid var(--lime); z-index: 99; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); max-width: 420px; }
.toast.err { border-left-color: #ff6b6b; }

.photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.dropzone { border: 2px dashed var(--field-stroke); border-radius: 14px; padding: 22px; text-align: center; background: #fff; cursor: pointer; }
.dropzone.over { border-color: var(--lime-dark); background: #f6fbe6; }

/* Bez modułu "Import i eksport CSV" przyciski plików są ukryte */
body.no-csv [data-csv], body.no-csv [data-import], body.no-csv [data-template] { display: none !important; }

/* Suwaki modułów w panelu właściciela */
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.mod { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.mod input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--graphite); }
.mod .d { font-size: 12px; color: var(--muted); }
.mod.off { opacity: 0.55; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 3px solid var(--lime); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid4 { grid-template-columns: 1fr 1fr; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .panel { border: none; background: #fff; }
}
