/* ============================================================
   BIG PRINT CRM — style
   Paleta z logo: niebieski #4A72B8, czerwień #B0272E, grafit #333
   ============================================================ */
:root {
  --blue:   #4A72B8;
  --blue-d: #3a5c96;
  --red:    #B0272E;
  --red-d:  #8f1f25;
  --ink:    #2b2f36;
  --muted:  #6b7280;
  --line:   #e5e7eb;
  --bg:     #f4f6f9;
  --panel:  #ffffff;
  --ok:     #1a9d5a;
  --warn:   #d98324;
  --danger: #c62828;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 10px; border-bottom: 1px solid var(--line); }
.brand-logo { max-width: 150px; height: auto; display: block; }
.nav { padding: 12px 10px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink);
  font-weight: 500;
}
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-link.active { background: var(--blue); color: #fff; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.user-chip { display: flex; flex-direction: column; margin-bottom: 8px; }
.user-name { font-weight: 600; }
.user-role { font-size: 12px; color: var(--muted); }
.btn-logout { display: block; text-align: center; padding: 7px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.btn-logout:hover { background: var(--bg); text-decoration: none; }
.main { flex: 1; padding: 24px 28px; max-width: 1200px; }

/* ---------- Head / buttons ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; }
.subhead { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
  font-family: inherit;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); }
.btn-ghost { color: var(--red); border-color: #e7c3c5; }
.btn-ghost:hover { background: #fbeff0; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: #fbeff0; color: var(--red); }
.link-btn { border: none; background: none; color: var(--blue); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }
.inline { display: inline; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash-success { background: #e7f6ee; color: #10683c; border: 1px solid #bce6cf; }
.flash-error   { background: #fdecec; color: #922; border: 1px solid #f5c6c6; }

/* ---------- Cards / stats ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat { text-align: left; color: var(--ink); }
a.stat:hover { text-decoration: none; border-color: var(--blue); }
.stat-num { font-size: 30px; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); margin-top: 6px; font-size: 13px; }
.stat-danger .stat-num { color: var(--danger); }
.stat-warn .stat-num { color: var(--warn); }
.section-title { margin: 8px 0 14px; }

/* ---------- Order grid (dashboard) ---------- */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.order-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow);
  display: block;
}
.order-card:hover { text-decoration: none; border-color: var(--blue); transform: translateY(-1px); transition: .12s; }
.order-card.dl-overdue { border-color: #eab8ba; background: #fffafa; }
.order-card.dl-soon { border-color: #f0d3a8; background: #fffdf9; }
.order-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-num { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); font-weight: 600; }
.order-title { font-weight: 600; margin-bottom: 2px; }
.order-client { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.order-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); gap: 8px; }
.order-card-foot .meta { display: flex; gap: 6px; align-items: center; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 999px; }
.progress-sm { height: 6px; width: 90px; display: inline-block; vertical-align: middle; }
.progress-inline { height: 8px; flex: 1; }
.pct { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-nowe { background: #eef2fb; color: var(--blue-d); }
.badge-w_realizacji { background: #fff2e2; color: var(--warn); }
.badge-wstrzymane { background: #f1f1f3; color: #555; }
.badge-zakonczone { background: #e7f6ee; color: var(--ok); }
.badge-archiwum { background: #ececec; color: #777; }
.badge-prio-krytyczny { background: #fdecec; color: var(--danger); }
.badge-prio-wysoki { background: #fff2e2; color: var(--warn); }
.badge-prio-normalny { background: #eef2fb; color: var(--blue-d); }
.badge-prio-niski { background: #f1f1f3; color: #666; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: #eef0f4; color: #555; font-weight: 600; }
.chip-danger { background: #fdecec; color: var(--danger); }
.chip-ok { background: #e7f6ee; color: var(--ok); }
.chip-src { text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Deadline tags ---------- */
.dl-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.dl-tag.dl-overdue { background: #fdecec; color: var(--danger); }
.dl-tag.dl-soon { background: #fff3e3; color: var(--warn); }
.dl-tag.dl-ok { background: #e7f6ee; color: var(--ok); }
.dl-tag.dl-none { background: #f1f1f3; color: var(--muted); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { text-align: left; padding: 11px 14px; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #f7f9fc; }
.table-slim td, .table-slim th { padding: 8px 10px; }
.table .mono, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.table .right { text-align: right; }
.table tfoot td { padding: 11px 14px; background: #fafbfc; }
.offer { font-weight: 700; color: var(--blue-d); }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }
.muted { color: var(--muted); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input[type=search], .filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.filters input[type=search] { min-width: 260px; }

/* ---------- Panels & forms ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 860px; box-shadow: var(--shadow); }
.form-card h2 { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-card h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
label { display: block; margin-bottom: 14px; font-weight: 500; font-size: 13px; color: #444; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; margin-top: 5px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,114,184,.12); }
textarea { resize: vertical; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .col { flex: 1; min-width: 160px; }
.form-actions { margin-top: 8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.hint code { background: #f1f1f3; padding: 1px 5px; border-radius: 4px; }
.radio { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.radio input { width: auto; margin: 0; }
.inline-label { display: inline-flex; flex-direction: column; font-size: 13px; }
.form-inline-grid { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-inline-grid input, .form-inline-grid select { width: auto; flex: 1; min-width: 130px; margin: 0; }
.hidden { display: none; }
.w-qty { max-width: 90px; }
.w-price { max-width: 140px; }

/* ---------- Order view specifics ---------- */
.desc { white-space: pre-wrap; }
.meta-list { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px 20px; margin: 14px 0 0; }
.meta-list dt { font-size: 12px; color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 500; }

.stages { list-style: none; padding: 0; margin: 0 0 14px; }
.stage { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stage:last-child { border-bottom: none; }
.stage-name { flex: 1; font-weight: 500; }
.stage.is-done .stage-name { text-decoration: line-through; color: var(--muted); }
.check { width: 24px; height: 24px; border: 2px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; padding: 0; }
.stage.is-done .check { background: var(--ok); border-color: var(--ok); }
.stage-assign select { width: auto; margin: 0; padding: 5px 8px; font-size: 12px; }
.stage-add-form, .item-add-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.stage-add-form input, .item-add-form input, .item-add-form select, .stage-add-form select { width: auto; flex: 1; min-width: 120px; margin: 0; }

.comment-form textarea { margin-bottom: 8px; }
.comment-form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.comments { list-style: none; padding: 0; margin: 16px 0 0; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment-mat { background: #fff8f8; margin: 0 -8px; padding: 10px 8px; border-radius: 8px; border-bottom: none; }
.comment.is-resolved { opacity: .55; }
.comment-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-form select { margin-bottom: 10px; }

/* ---------- Notifications ---------- */
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; box-shadow: var(--shadow); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.notif-warning .notif-dot { background: var(--warn); }
.notif-critical .notif-dot { background: var(--danger); }
.notif-body { flex: 1; }
.notif-date { font-size: 12px; color: var(--muted); }
.notif.is-seen { opacity: .55; }
.is-inactive { opacity: .5; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #eef2fb, #f4f6f9); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 34px 30px; width: 360px; box-shadow: 0 10px 40px rgba(16,24,40,.12); text-align: center; }
.login-logo { max-width: 190px; margin-bottom: 10px; }
.login-card h1 { font-size: 17px; color: var(--muted); font-weight: 500; margin-bottom: 20px; }
.login-card form { text-align: left; }
.login-card label { font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2,1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-sep { display: none; }
  .brand { border: none; }
  .main { padding: 16px; }
  .cards { grid-template-columns: repeat(2,1fr); }
}
