:root{
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2:#f0f3f8;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;
  --shadow: 0 10px 24px rgba(15,23,42,.08);
  --radius: 16px;

  --primary:#16a34a;       /* zielony */
  --primary-600:#15803d;
  --primary-50:#ecfdf5;

  --danger:#ef4444;
  --warning:#f59e0b;
  --info:#2563eb;
  --success:#16a34a;

  --sidebar:#0b1220;
  --sidebar-text:#e5e7eb;
  --sidebar-muted:#9ca3af;
  --sidebar-active-bg: rgba(22,163,74,.18);
  --sidebar-active-border: rgba(22,163,74,.55);

  --topbar:#ffffff;
}

[data-theme="dark"]{
  /* przygotowane pod przyszły dark mode */
  --bg:#0b1220;
  --surface:#0f172a;
  --surface-2:#111c33;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:#1f2a44;
  --shadow: 0 10px 24px rgba(0,0,0,.35);

  --topbar:#0f172a;
  --sidebar:#070c16;
  --sidebar-text:#e5e7eb;
  --sidebar-muted:#94a3b8;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* layout */
.app{
  display:grid;
  grid-template-columns: 260px 1fr;
  min-height:100vh;
}
.sidebar{
  background:var(--sidebar);
  color:var(--sidebar-text);
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.06);
  margin-bottom:14px;
}
.brand-badge{
  width:34px;height:34px;border-radius:12px;
  background:linear-gradient(135deg, var(--primary), #22c55e);
  box-shadow: 0 10px 16px rgba(34,197,94,.25);
}
.brand-title{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:12px;color:var(--sidebar-muted)}
.side-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:10px;
}
.side-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  color:var(--sidebar-text);
  text-decoration:none;
  border:1px solid transparent;
}
.side-link:hover{background:rgba(255,255,255,.06)}
.side-link.active{
  background:var(--sidebar-active-bg);
  border-color:var(--sidebar-active-border);
}
.side-icon{
  width:10px;height:10px;border-radius:4px;background:rgba(255,255,255,.25)
}
.side-footer{
  position:absolute;
  left:14px; right:14px;
  bottom:14px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  font-size:12px;
  color:var(--sidebar-muted);
}
.content{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.topbar{
  background:var(--topbar);
  border-bottom:1px solid var(--border);
  padding:14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  position:sticky;
  top:0;
  z-index:10;
}
.topbar .who{
  font-size:13px;
  color:var(--muted);
}
.main{
  padding:18px;
}

/* cards, tables */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}
.card.flat{box-shadow:none}
.hstack{display:flex; gap:10px; align-items:center}
.vstack{display:flex; flex-direction:column; gap:10px}
.row{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
@media (max-width: 980px){
  .app{grid-template-columns: 1fr}
  .sidebar{position:relative;height:auto}
  .row{grid-template-columns:1fr}
}

h1,h2,h3{margin:0 0 10px 0}
h2{font-size:20px}
h3{font-size:16px}
.muted{color:var(--muted); font-size:12px}

input,select,textarea{
  width:100%;
  padding:11px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface);
  color:var(--text);
  outline:none;
}
input:focus,select:focus,textarea:focus{
  border-color: rgba(22,163,74,.6);
  box-shadow: 0 0 0 4px rgba(22,163,74,.15);
}

.btn{
  padding:10px 12px;
  border:1px solid transparent;
  border-radius:14px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-weight:600;
}
.btn-primary{background:var(--primary); color:white}
.btn-primary:hover{background:var(--primary-600)}
.btn-secondary{background:var(--surface-2); color:var(--text); border-color:var(--border)}
.btn-danger{background:var(--danger); color:white}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--border);
}
.table th, .table td{
  padding:12px;
  border-bottom:1px solid var(--border);
  text-align: center;	

}
.table th{
  font-size:12px;
  letter-spacing:.5px;
  text-transform:uppercase;
  color:var(--muted);
  background:var(--surface-2);
}
.table tr:hover td{background: rgba(22,163,74,.05)}

/* modal + lista produktów z miniaturkami */
.modal-backdrop{
  position:fixed;
  inset:0;
  background: rgba(15,23,42,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index: 50;
}
.modal{
  width:min(860px, 100%);
  background:var(--surface);
  border:1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  background:var(--surface-2);
}
.modal-body{padding:16px}
.product-list{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
@media (max-width: 700px){
  .product-list{grid-template-columns:1fr}
}
.product-item{
  display:flex;
  gap:12px;
  align-items:center;
  width:100%;
  text-align:left;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius: 16px;
  background:var(--surface);
  cursor:pointer;
}
.product-item:hover{background: rgba(22,163,74,.05)}
.product-thumb{
  width:48px;
  height:48px;
  border-radius: 14px;
  object-fit:cover;
  border:1px solid var(--border);
}
.product-thumb.placeholder{
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  background:var(--surface-2);
}
.product-meta{min-width:0}
.product-name{font-weight:800; line-height:1.2}
.product-sub{font-size:12px; color:var(--muted); margin-top:2px; line-height:1.2}
.product-chip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius: 16px;
  background:var(--surface);
}

.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--border);
  background:var(--surface-2);
}
.badge.status-new{background:#f1f5f9}
.badge.status-received{background:#e0f2fe; border-color:#bae6fd}
.badge.status-verified{background:#ede9fe; border-color:#ddd6fe}
.badge.status-completed{background:var(--primary-50); border-color:rgba(22,163,74,.35)}
.badge.status-rejected{background:#fee2e2; border-color:#fecaca}

.kpi{
  padding:14px;
  border-radius: var(--radius);
  border:1px solid var(--border);
  background:var(--surface);
  box-shadow: var(--shadow);
}
.kpi .label{color:var(--muted); font-size:12px}
.kpi .value{font-size:28px; font-weight:800; margin-top:6px}

/* timeline */
.timeline{position:relative; padding-left:18px}
.timeline:before{
  content:"";
  position:absolute;
  left:7px; top:0; bottom:0;
  width:2px;
  background: var(--border);
}
.titem{position:relative; padding:10px 0 10px 0}
.tdot{
  position:absolute; left:0; top:16px;
  width:14px;height:14px;border-radius:6px;
  background: var(--primary);
  box-shadow: 0 6px 14px rgba(22,163,74,.25);
}
.tcard{
  margin-left:14px;
  padding:12px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface);
}
.tmeta{font-size:12px; color:var(--muted)}
