/* LABS+: wygląd aktualnej aplikacji labscos.pl. Wartości spisane z jej arkuszy stylów. */
:root {
  --bg: #f1f4f9; --surface: #ffffff; --text: #0a1a3d; --text-2: #4a6080; --text-3: #5d7190;
  --blue: #0066ff; --blue-dark: #0047cc; --blue-mid: #a3c4ff; --blue-pale: #dce8ff; --blue-ultra: #f0f5ff; --tile: #e8f0ff; --on-brand-2: #c9d9ff;
  --line: #dfe6f2; --line-soft: #edf1f7; --line-strong: #c3cfe4; --tint: #f6f8fc; --tint-2: #eef2f8; --track: #e6edf8;
  --ok: #15803d; --ok-bg: #e9f7ee; --warn: #b45309; --warn-bg: #fdf3e6; --bad: #c62828; --bad-bg: #fdecec; --bad-line: #f2b8b8;
  --r: 6px; --r-sm: 8px; --r-md: 10px; --r-card: 12px; --r-xl: 16px;
  --shadow-1: 0 1px 2px rgba(16,36,79,.06), 0 3px 12px rgba(16,36,79,.05);
  --shadow-2: 0 2px 6px rgba(16,36,79,.08), 0 16px 36px rgba(16,36,79,.18);
  --ring: 0 0 0 3px rgba(0,102,255,.22);
  --font: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 20px; }
a { color: var(--blue-dark); }

/* Ikony jak w aplikacji: obrys 1,75 */
.i { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.btn .i { width: 16px; height: 16px; }

/* Układ: boczne menu + pasek górny */
.lw-app { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 100vh; background: var(--bg); font-family: var(--font); color: var(--text); }
.lw-side { flex: 1 1 232px; max-width: 100%; display: flex; flex-direction: column; background: var(--blue-dark); color: white; box-sizing: border-box; }
.lw-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.lw-side-head { height: 64px; flex: 0 0 auto; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.12); box-sizing: border-box; }
.lw-nav { flex: 1 1 auto; padding: 8px 10px 16px; }
.lw-grp { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: rgba(255,255,255,.6); padding: 16px 10px 6px; white-space: nowrap; }
.tab { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: var(--r); box-sizing: border-box; color: rgba(255,255,255,.88); font-size: 14px; line-height: 20px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background-color .12s, color .12s; }
.tab:hover { background: rgba(255,255,255,.1); color: white; }
.tab.active { background: white; color: var(--blue-dark); font-weight: 600; }
.lw-side-foot { flex: 0 0 auto; border-top: 1px solid rgba(255,255,255,.12); padding: 10px; }
.lw-topbar { min-height: 64px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 32px; box-sizing: border-box; background: var(--surface); border-bottom: 1px solid var(--line); }
.lw-title { flex: 1 1 200px; min-width: 0; }
.lw-crumb { color: var(--text-2); font-size: 12px; line-height: 16px; }
.lw-title h1 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -.005em; color: var(--text); }
.lw-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lw-user { font-size: 13px; font-weight: 600; color: var(--text-2); }
.panel { padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 20px; align-items: start; }

/* Niebieska karta dnia */
.hero { background: var(--blue-dark); color: white; border-radius: var(--r-xl); padding: 26px 32px 24px; }
.hero-eyebrow { font-size: 12px; line-height: 16px; color: var(--on-brand-2); }
.hero h2 { margin: 4px 0 0; font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -.26px; }
.hero p { margin: 6px 0 0; color: var(--on-brand-2); font-size: 13px; line-height: 18px; }
.hero-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.18); }
.hero-facts dt { font-size: 12px; line-height: 16px; color: var(--on-brand-2); }
.hero-facts dd { margin: 2px 0 0; font-size: 20px; line-height: 26px; font-weight: 600; }
.hero-facts a { color: white; text-decoration: none; }
.hero-facts a:hover { text-decoration: underline; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: white; }
.btn-ghost:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); color: white; }

/* Karty */
.form-card, .stats-card { background: var(--surface); border-radius: var(--r-card); padding: 20px 24px 24px; box-shadow: var(--shadow-1); min-width: 0; box-sizing: border-box; }
.form-card h2, .stats-card h3 { color: var(--text); font-size: 16px; line-height: 22px; font-weight: 600; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.big-stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.big-stat { flex: 1 1 150px; min-width: 0; display: block; background: var(--surface); border-radius: var(--r-card); padding: 16px 20px; box-shadow: var(--shadow-1); color: inherit; text-decoration: none; box-sizing: border-box; }
.big-stat .val { font-size: 24px; line-height: 30px; font-weight: 600; color: var(--text); white-space: nowrap; }
.big-stat .lbl { font-size: 13px; line-height: 18px; color: var(--text-2); margin-top: 2px; }
.big-stat.accent .val { color: var(--ok); }
.big-stat.warn .val { color: var(--warn); }

/* Formularze */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.span2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
label { font-size: 13px; line-height: 1.35; font-weight: 600; color: var(--text); }
input:not([type="checkbox"]), select, textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-family: var(--font); font-size: 14px; padding: 0 12px; transition: border-color .12s, box-shadow .12s; }
input:not([type="checkbox"]), select { height: 38px; }
textarea { padding: 8px 12px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); cursor: pointer; }

/* Przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 14px; box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 600 13px/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--blue-ultra); border-color: var(--blue-mid); color: var(--blue-dark); }
.btn-primary { background: var(--blue); border-color: transparent; color: white; box-shadow: 0 1px 2px rgba(0,40,120,.2); }
.btn-primary:hover { background: var(--blue-dark); border-color: transparent; color: white; }
.btn-secondary { background: var(--surface); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.btn-danger { min-height: 30px; padding: 5px 10px; background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); font-size: 12px; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: white; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .sort-btn:focus-visible, .link-btn:focus-visible, .folder:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sort-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; box-sizing: border-box; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--tint-2); color: var(--text-2); font: 500 13px/1.2 var(--font); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
.sort-btn:hover { background: var(--blue-ultra); border-color: var(--blue-pale); color: var(--blue-dark); }
.sort-btn-active, .sort-btn-active:hover { background: var(--blue-pale); border-color: var(--blue-pale); color: var(--blue-dark); font-weight: 600; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.link-btn { background: none; border: none; padding: 0; color: var(--blue-dark); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-align: left; }

/* Statusy */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--r); font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; }
.badge-teal { background: var(--blue-pale); color: var(--blue-dark); }
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-orange { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--bad-bg); color: var(--bad); }

/* Tabele */
.table-wrap { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-1); overflow: hidden; min-width: 0; }
.table-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.table-header h2 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 600; color: var(--text); }
.table-controls input { width: 240px; }
.table-scroll { overflow-x: auto; }
.labs-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.labs-table th { background: var(--tint); color: var(--text-2); font-size: 12px; line-height: 16px; font-weight: 600; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.labs-table td { padding: 10px; color: var(--text); border-bottom: 1px solid var(--line-soft); }
.labs-table th:first-child, .labs-table td:first-child { padding-left: 20px; }
.labs-table tbody tr:last-child td { border-bottom: none; }
.labs-table tbody tr:hover { background: var(--tint); }
.labs-table tbody tr.row-on { background: var(--blue-ultra); }
.labs-table td.num { white-space: nowrap; }
.labs-table input.qty { width: 110px; }
.cell-meta { font-size: 12px; line-height: 16px; color: var(--text-2); }

/* Etapy */
.stages { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.stages > li { flex: 1 1 120px; min-width: 0; display: flex; }
.stage { flex: 1; display: block; padding: 8px 12px; box-sizing: border-box; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--tint); color: var(--text-2); font-size: 13px; line-height: 18px; font-weight: 500; text-decoration: none; }
a.stage:hover { border-color: var(--blue-mid); background: var(--blue-ultra); }
.stage.done { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.stage.now { background: var(--blue); border-color: transparent; color: white; font-weight: 600; }
.stage-n { display: block; font-size: 20px; line-height: 26px; font-weight: 600; color: var(--text); }

/* Listy */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.rows > li:first-child { padding-top: 0; }
.rows > li:last-child { border-bottom: none; padding-bottom: 0; }
.row-main { flex: 1 1 220px; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; line-height: 20px; color: var(--text); }
.row-meta { font-size: 12px; line-height: 16px; color: var(--text-2); margin-top: 2px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tile { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--r-md); background: var(--tile); color: var(--blue); }

/* Pola tylko do odczytu */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 16px; }
.kv-label { font-size: 12px; line-height: 16px; color: var(--text-2); }
.kv-value { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); margin-top: 2px; }
.info-box { padding: 10px 14px; border-radius: var(--r-sm); background: var(--blue-ultra); color: var(--text); font-size: 13px; line-height: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.info-box.ok { background: var(--ok-bg); }
.info-box.warn { background: var(--warn-bg); }

/* Paski postępu */
.progress-row { margin-bottom: 8px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 13px; line-height: 18px; }
.progress-label span:last-child { font-weight: 600; white-space: nowrap; }
.progress-bar { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--blue); }
.fill-green { background: var(--ok); }
.fill-orange { background: var(--blue); }

/* Podgląd wiadomości, podsumowanie, foldery */
.msg-box { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; background: var(--tint); font-size: 13px; line-height: 18px; }
.msg-subject { font-weight: 600; margin-bottom: 8px; }
.sms { background: var(--blue-pale); border-radius: var(--r-card); padding: 10px 14px; font-size: 13px; line-height: 18px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; line-height: 20px; border-bottom: 1px solid var(--line-soft); }
.sum-row span:first-child { color: var(--text-2); }
.sum-row span:last-child { font-weight: 600; text-align: right; }
.sum-row.total { font-size: 16px; font-weight: 600; border-bottom: none; }
.sum-row.total span:first-child { color: var(--text); }
.folder { width: 100%; display: flex; gap: 8px; align-items: center; min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--r); background: none; color: var(--text); font: 500 14px/20px var(--font); cursor: pointer; text-align: left; }
.folder:hover { background: var(--tint); }
.folder.on { background: var(--blue-ultra); color: var(--blue-dark); font-weight: 600; }

/* Okno i komunikat */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(10,26,61,.45); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--r-xl); padding: 24px; width: 480px; max-width: 95vw; max-height: calc(100dvh - 24px); overflow-y: auto; box-shadow: var(--shadow-2); box-sizing: border-box; }
.modal h3 { margin: 0 0 16px; font-size: 18px; line-height: 24px; font-weight: 600; color: var(--text); }
.modal .form-grid { grid-template-columns: 1fr 1fr; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; width: max-content; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: var(--r-card); background: var(--text); color: white; font: 600 14px/20px var(--font); box-shadow: var(--shadow-2); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 200; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-2); }

@media (max-width: 900px) {
  .lw-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .lw-grp { display: none; }
  .tab { width: auto; }
  .labs-table thead { display: none; }
  .labs-table, .labs-table tbody { display: block; }
  .labs-table tbody { padding: 10px; }
  .labs-table tbody tr { display: block; border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 10px; padding: 6px 12px; }
  .labs-table tbody td, .labs-table td:first-child { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; text-align: right; white-space: normal; }
  .labs-table tbody td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--text-2); text-align: left; }
  .table-controls, .table-controls input { width: 100%; }
}
@media (max-width: 600px) {
  .panel { padding: 16px 16px 32px; }
  .lw-topbar { padding: 8px 16px; }
  .hero { padding: 20px; }
  .form-card, .stats-card { padding: 16px; }
  .span2 { grid-column: auto; }
}

/* Dodatki aplikacji: pasek wersji testowej, dokument w oknie, przycisk pliku */
.test-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 32px; background: var(--warn-bg); color: var(--warn); font-size: 13px; line-height: 18px; font-weight: 600; }
.test-bar .link-btn { color: var(--warn); }
.modal-wide { width: 640px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.field-error { color: var(--bad); font-size: 12px; line-height: 16px; }
.lw-user select { width: auto; height: 32px; font-size: 13px; font-weight: 600; }
h1:focus { outline: none; }
@media (max-width: 600px) { .test-bar { padding: 8px 16px; } }

/* Ekran wejścia i wylogowanie */
.wejscie { min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); background: var(--blue-dark); }
.wejscie-karta { width: 100%; max-width: 400px; box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; padding: 24px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
.wejscie-karta h1 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; }
.wejscie-karta p { margin: 0; }
.tab-btn { border: 0; background: none; cursor: pointer; font-family: var(--font); text-align: left; }
.lw-side-foot { display: flex; flex-direction: column; gap: 2px; }
