/* PROFI4TRANS - stylistyka ujednolicona z CRM4 (ai4me Cockpit).
   Navy sidebar + teal akcent, tabele z navy nagłówkiem, KPI z kolorową kreską. */
:root {
  --navy: #1C1A4C;
  --blue: #147bcf;
  --teal: #05cc9a;
  --bg: #f0f2f5;
  --card: #ffffff;
  --ink: #333333;
  --ink-soft: #6b6b6b;
  --line: #e0e0e0;
  --brand: #147bcf;          /* akcent = CRM4 blue */
  --brand-ink: #ffffff;
  --sidebar-bg: #1C1A4C;     /* navy jak CRM4 */
  --sidebar-ink: #ffffff;
  --sidebar-soft: rgba(255,255,255,.55);
  --sidebar-active: rgba(5,204,154,.18);
  --ok: #2d7a4d;
  --warn: #d68910;
  --crit: #c8102e;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  padding: 0 0 24px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 6px rgba(0,0,0,.08);
}
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark {
  background: linear-gradient(135deg, var(--blue), var(--teal)); color: #fff;
  font-weight: 800; letter-spacing: .5px;
  padding: 7px 9px; border-radius: 8px; font-size: 13px;
}
.brand-mark.big { font-size: 18px; padding: 10px 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: .3px; }
.brand-text small { color: var(--sidebar-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; }

/* ---------- Nav ---------- */
.nav { display: flex; flex-direction: column; gap: 1px; padding-top: 6px; }
.nav-group {
  color: var(--sidebar-soft);
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  margin: 16px 0 4px; padding: 0 20px; font-weight: 700;
}
.nav-item {
  color: rgba(255,255,255,.82);
  padding: 10px 20px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  border-left: 3px solid transparent; transition: all .15s;
}
.nav-item .ico { opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; border-left-color: var(--teal); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 26px; background: var(--card);
  border-bottom: 1px solid var(--line);
  gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.topbar-title { font-size: 22px; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.user { color: var(--ink-soft); font-size: 13px; }
.btn-logout {
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 6px;
  font-size: 12.5px; color: var(--ink);
}
.btn-logout:hover { background: var(--bg); text-decoration: none; }

/* ---------- Language switch ---------- */
.lang-switch, .login-lang { display: flex; gap: 4px; }
.lang {
  font-size: 11px; text-transform: uppercase; padding: 3px 7px;
  border-radius: 5px; color: var(--ink-soft); border: 1px solid var(--line); font-weight: 700;
}
.lang.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Content ---------- */
.content { padding: 24px 26px; max-width: 1600px; }
.subtitle { color: var(--ink-soft); margin: 0 0 18px; }

/* ---------- KPI ---------- */
.kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.kpi {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--blue); }
.kpi.green::before { background: var(--teal); }
.kpi.amber::before { background: var(--warn); }
.kpi.red::before { background: var(--crit); }
.kpi-val { font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--navy); }
.kpi-label { color: var(--ink-soft); font-size: 11px; margin-top: 6px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

/* ---------- Cards / grid ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card h2 { margin: 0 0 14px; font-size: 16px; border: none; padding: 0; }
.empty { color: var(--ink-soft); font-style: italic; padding: 8px 0; }

/* ---------- Headings ---------- */
h1, h2, h3 { color: var(--navy); font-weight: 700; }
h2 { font-size: 22px; margin: 24px 0 12px; border-bottom: 3px solid var(--teal); padding-bottom: 6px; display: inline-block; }
h3 { font-size: 16px; margin: 0 0 14px; line-height: 1.3; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--navy); color: #fff; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tbody tr:hover { background: #fafafa; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 5px; font-size: 12px; font-weight: 600; color: #fff; }
.badge-ok { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-critical { background: #f8d7da; color: #721c24; }
.badge-muted { background: #e2e3e5; color: #495057; }
.pill {
  display: inline-block; min-width: 26px; text-align: center;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 20px; padding: 2px 9px; font-weight: 700;
}
.stage-code {
  display: inline-block; width: 20px; height: 20px; line-height: 20px;
  text-align: center; background: var(--navy); color: #fff;
  border-radius: 50%; font-size: 11px; font-weight: 700; margin-right: 4px;
}

/* ---------- Flash ---------- */
.flashes { padding: 14px 26px 0; }
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 500; }
.flash-error { background: #f8d7da; color: #721c24; border-left: 4px solid var(--crit); }
.flash-success { background: #d4edda; color: #155724; border-left: 4px solid var(--teal); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), #2a2668); padding: 20px;
}
.login-card {
  background: var(--card); border-radius: 14px; padding: 30px 28px;
  width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 14px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-size: 17px; color: var(--navy); }
.login-brand small { color: var(--ink-soft); }
.login-card h1 { font-size: 16px; margin: 6px 0 2px; font-weight: 600; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; color: var(--ink);
}
.login-card input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,123,207,.12); }
.btn-primary {
  background: var(--blue); color: #fff; border: none; padding: 11px 18px;
  border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { background: #0d5fa3; text-decoration: none; }
.login-error { background: #f8d7da; color: #721c24; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.login-lang { justify-content: center; margin-top: 6px; }

/* ---------- E3: listy, filtry, formularze, karta 360 ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.page-count { color: var(--ink-soft); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.c360-name { font-size: 22px; margin: 0 0 2px; color: var(--navy); }

.link { color: var(--blue); font-weight: 600; }
.link:hover { text-decoration: underline; }
.act { color: var(--ink-soft); font-size: 12.5px; margin-right: 8px; }
.act:hover { color: var(--blue); text-decoration: underline; }
.nowrap { white-space: nowrap; }

/* przyciski */
.btn-primary.sm, .btn-outline.sm, .btn-danger.sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-outline {
  display: inline-block; background: #e0e0e0; color: #333;
  border: none; padding: 9px 18px; border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-align: center;
}
.btn-outline:hover { background: #d0d0d0; text-decoration: none; }
.btn-danger {
  display: inline-block; background: var(--crit); color: #fff; border: none;
  padding: 9px 18px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { filter: brightness(1.05); text-decoration: none; }

/* filtry */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.filters input, .filters select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; min-width: 130px; color: var(--ink); background: #fff;
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,123,207,.1); }

/* formularze */
.form-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; max-width: 860px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.form-card.flat { border: none; padding: 0; box-shadow: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label, .form-card label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; color: var(--ink-soft);
}
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea,
.form-card input, .form-card textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; color: var(--ink); background: #fff; font-family: inherit;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.form-card input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,123,207,.12); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
label.check input { width: auto; }
.form-foot { display: flex; gap: 10px; margin-top: 18px; align-items: center; flex-wrap: wrap; }

/* definition list (karta 360) */
.deflist { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.deflist dt { color: var(--ink-soft); font-weight: 600; }
.deflist dd { margin: 0; }

/* modal potwierdzenia usunięcia */
.modal-back {
  display: none; position: fixed; inset: 0; background: rgba(28,26,76,.55);
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 12px; padding: 24px;
  max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal h3 { margin: 0 0 10px; }
.modal p { color: var(--ink-soft); font-size: 13.5px; }

/* przycisk-w-formularzu wyglądający jak akcja tekstowa */
.linkbtn { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--ink-soft); }
.linkbtn:hover { color: var(--crit); text-decoration: underline; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* drobne adnotacje */
.muted-note { color: var(--ink-soft); font-size: 11.5px; }
.stub-note {
  background: #fff3cd; color: #856404; border: 1px solid #f0d98a;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
