/* GTI Pipeline - makieta. Paleta z logo GTI: atrament #020a0a, żółty akcent #ffd744 */
:root {
  --ink: #0d1512;
  --paper: #f6f6f2;
  --card: #ffffff;
  --line: #e2e2da;
  --muted: #68706c;
  --yellow: #ffd744;
  --yellow-dark: #eab308;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --gray-bg: #eceff1;
  --amber-bg: #fef3c7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(13,21,18,.08), 0 4px 14px rgba(13,21,18,.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(14px, 3vw, 28px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { height: 30px; width: auto; flex-shrink: 0; }
.brand-tag {
  font-size: 11px; letter-spacing: .12em; color: var(--muted); font-weight: 700;
  border-left: 1px solid var(--line); padding-left: 14px; white-space: nowrap;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search {
  width: clamp(140px, 22vw, 260px);
  padding: 9px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; background: var(--paper);
  transition: all .15s ease-in-out;
}
.search:focus { outline: none; border-color: var(--ink); background: #fff; }
.select {
  padding: 9px 32px 9px 14px; border: 1px solid var(--line); border-radius: 999px;
  font: inherit; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%230d1512' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none; cursor: pointer; max-width: 170px;
}
.select:focus { outline: none; border-color: var(--ink); }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 18px; transition: all .15s ease-in-out;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(13,21,18,.25); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn-ghost:hover { color: var(--ink); }
.btn-danger-ghost:hover { color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ============ DEMO STRIP ============ */
.demo-strip {
  background: var(--yellow);
  color: var(--ink);
  font-size: 12.5px; font-weight: 600;
  text-align: center;
  padding: 7px 16px;
}

/* ============ STATS ============ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  max-width: 1500px; margin: 18px auto 0;
  padding: 0 clamp(14px, 3vw, 28px);
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow);
}
.stat-value { font-family: 'Newsreader', serif; font-size: 26px; font-weight: 600; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ============ TABS ============ */
.viewtabs {
  display: flex; gap: 8px; max-width: 1500px; margin: 16px auto 0;
  padding: 0 clamp(14px, 3vw, 28px);
}
.viewtab {
  font: inherit; font-weight: 600; cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 20px; color: var(--muted); transition: all .15s ease-in-out;
}
.viewtab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.viewtab:not(.active):hover { border-color: var(--ink); color: var(--ink); }

/* ============ BOARD ============ */
.board-wrap { overflow-x: auto; padding: 18px clamp(14px, 3vw, 28px) 40px; }
.board {
  display: flex; gap: 14px; align-items: flex-start;
  min-height: 55vh;
  width: max-content; min-width: 100%;
}
.col {
  width: 280px; flex-shrink: 0;
  background: #efefe9;
  border: 1px solid var(--line); border-radius: var(--radius);
  max-height: calc(100vh - 300px); min-height: 240px;
  display: flex; flex-direction: column;
}
.col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.col-head h3 { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 9px; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.s-work { background: #f59e0b; } .dot.s-wait { background: #94a3b8; }
.dot.s-win { background: var(--green); } .dot.s-lost { background: #dc2626; } .dot.s-in { background: var(--blue); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.col-empty { text-align: center; color: #a4aaa5; font-size: 12px; padding: 18px 0; }

/* ---- KARTA ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer;
  transition: all .15s ease-in-out;
}
.card:hover { border-color: var(--ink); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-head h4 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.25; }
.grad-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
  color: var(--muted); white-space: nowrap; flex-shrink: 0;
}
.card-agent { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-status { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.dot-inline { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.task-chip {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  margin-top: 9px; padding: 9px 11px;
  background: var(--yellow); border: none; border-radius: 8px;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink);
  cursor: pointer; transition: all .15s ease-in-out;
}
.task-chip svg { width: 15px; height: 15px; flex-shrink: 0; }
.task-chip span:first-of-type { flex: 1; }
.chip-arrow { font-weight: 400; opacity: .7; }
.task-chip:hover { filter: brightness(.96); transform: translateX(2px); }

.card-note, .card-date {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: 11.5px; color: var(--muted);
}
.card-note svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--red); }
.card-date svg { width: 13px; height: 13px; flex-shrink: 0; }
.card-date.today { color: var(--yellow-dark); font-weight: 700; }
.card-date.late { color: var(--red); font-weight: 700; }

/* ============ LISTA ============ */
.list-wrap { max-width: 1500px; margin: 18px auto 40px; padding: 0 clamp(14px, 3vw, 28px); }
.table-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list-table { width: 100%; border-collapse: collapse; min-width: 1050px; font-size: 13.5px; }
.list-table th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 12px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.list-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list-table tbody tr:last-child td { border-bottom: none; }
.list-table tbody tr { cursor: pointer; transition: background .12s ease-in-out; }
.list-table tbody tr:hover { background: #fafaf6; }
.td-name b { display: block; }
.td-name small { color: var(--muted); font-size: 11.5px; }
.td-task { max-width: 260px; font-size: 12.5px; color: #444c48; }
.td-task svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; color: var(--yellow-dark); }
.td-empty { text-align: center; color: var(--muted); padding: 30px 0; }

.status-pill {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
  border-radius: 999px; padding: 4px 11px; white-space: nowrap;
}
.status-pill.s-in { background: var(--blue-bg); color: var(--blue); }
.status-pill.s-work { background: var(--amber-bg); color: #92400e; }
.status-pill.s-wait { background: var(--gray-bg); color: #455a64; }
.status-pill.s-win { background: var(--green-bg); color: var(--green); }
.status-pill.s-lost { background: var(--red-bg); color: var(--red); }

/* ============ DRAWER ============ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(13,21,18,.42);
  z-index: 90; backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(480px, 100%);
  background: #fff;
  box-shadow: -12px 0 40px rgba(13,21,18,.18);
  transform: translateX(100%);
  transition: transform .24s ease-in-out;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 5;
}
.drawer-title { font-family: 'Newsreader', serif; font-size: 23px; font-weight: 600; line-height: 1.15; }
.drawer-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.5; }
.iconbtn {
  border: 1px solid var(--line); background: #fff; border-radius: 50%;
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s ease-in-out;
}
.iconbtn svg { width: 15px; height: 15px; }
.iconbtn:hover { border-color: var(--ink); transform: rotate(90deg); }

.drawer-section { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.sec-label { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.profile-grid > div { background: var(--paper); border-radius: 8px; padding: 9px 12px; }
.profile-grid span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.profile-grid b { font-size: 14px; }
.profile-note { margin: 10px 0 0; font-size: 13px; color: #39413d; font-style: italic; }
.pref-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pref-tag {
  font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px dashed #cfd4cb; border-radius: 999px; padding: 3px 10px;
}

.status-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  background: var(--paper); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}
.status-line span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.status-line .status-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.q-label { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; color: var(--yellow-dark); margin-bottom: 6px; }
.q-label.small { color: var(--muted); letter-spacing: .04em; text-transform: none; font-weight: 700; font-size: 12.5px; }
.q-title { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 16.5px; font-weight: 700; line-height: 1.3; }
.q-title svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--yellow-dark); }
.answers { display: flex; flex-direction: column; gap: 7px; }
.answer-btn {
  font: inherit; font-size: 13.5px; font-weight: 600; text-align: left;
  border: 1.5px solid var(--line); background: #fff; border-radius: 9px;
  padding: 11px 14px; cursor: pointer; color: var(--ink);
  transition: all .13s ease-in-out;
}
.answer-btn:hover { border-color: var(--ink); background: var(--paper); transform: translateX(3px); }
.answer-btn.big { padding: 13px 15px; font-size: 14px; }
.answer-btn.lost { color: var(--red); border-color: #f3cdcd; }
.answer-btn.lost:hover { border-color: var(--red); background: var(--red-bg); }
.answers.vertical { display: flex; flex-direction: column; }
.answers-hint { font-size: 12px; color: var(--muted); margin-top: 10px; font-style: italic; }

/* Termin */
.date-question { background: var(--paper); border-radius: 9px; padding: 13px 14px; }
.date-input {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: 8px;
}
.date-input:focus { outline: none; border-color: var(--ink); }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.qd {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px;
  transition: all .13s ease-in-out;
}
.qd:hover { border-color: var(--ink); background: var(--yellow); border-color: var(--yellow-dark); }
.reason-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Powód odrzucenia */
.reason-box { background: var(--red-bg); border-radius: 9px; padding: 13px 14px; }
.reason-box .q-label.small { color: #7f1d1d; }
.reason-select {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 13.5px;
  border: 1px solid #eccccc; border-radius: 8px; background: #fff; margin-top: 8px;
}
.reason-note {
  width: 100%; margin-top: 8px; padding: 9px 12px; font: inherit; font-size: 13px;
  border: 1px solid #eccccc; border-radius: 8px; resize: vertical; background: #fff;
  font-family: inherit;
}
.reason-note:focus, .reason-select:focus { outline: none; border-color: var(--ink); }

/* Final blocks */
.final-block {
  display: flex; align-items: center; gap: 12px;
  border-radius: 9px; padding: 14px;
  font-size: 13.5px;
}
.final-block svg { width: 22px; height: 22px; flex-shrink: 0; }
.final-block div { flex: 1; line-height: 1.45; }
.final-won { background: var(--green-bg); color: #14532d; }
.final-lost { background: var(--red-bg); color: #7f1d1d; }

.outcome-line { margin: 0 0 12px; font-size: 13.5px; color: #39413d; }
.outcome-line em { color: var(--muted); font-size: 12px; }
.date-edit-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.date-edit-row label { font-size: 12px; color: var(--muted); font-weight: 600; flex: 1 1 130px; min-width: 0; }
.date-edit-row input[type="date"] {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 13px; background: #fff;
  width: 158px; flex: none;
}
.date-edit-row input:focus { outline: none; border-color: var(--ink); }

/* Historia */
.step-progress { list-style: none; margin: 0; padding: 0; }
.step-progress li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.step-progress li:last-child { border-bottom: none; }
.step-name { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 118px; flex-shrink: 0; }
.step-name svg { width: 13px; height: 13px; }
.step-answer { font-size: 13px; }
.step-empty { color: var(--muted); font-style: italic; font-size: 13px; justify-content: center; }

/* Formularz nowego klienta */
.fld {
  width: 100%; padding: 10px 13px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 9px;
}
.fld.err { border-color: var(--red); }
.fld:focus { outline: none; border-color: var(--ink); }
.fld2row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
select.fld { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%230d1512' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; cursor: pointer; }
#addForm h3.q-title { margin-top: 2px; }

/* ============ FOOTER ============ */
.foot {
  max-width: 1500px; margin: 0 auto; padding: 14px clamp(14px, 3vw, 28px) 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 12px;
}
.foot-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600;
  border-radius: 999px; padding: 11px 22px; z-index: 200;
  box-shadow: 0 6px 24px rgba(13,21,18,.35);
  animation: toastIn .22s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ SCROLLBARY ============ */
.col-body::-webkit-scrollbar, .board-wrap::-webkit-scrollbar { height: 8px; width: 8px; }
.board-wrap::-webkit-scrollbar-thumb { background: #cfcfc6; border-radius: 99px; }
.col-body::-webkit-scrollbar-thumb { background: #dddad0; border-radius: 99px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand-tag { display: none; }
  .topbar-actions { width: 100%; margin-left: 0; }
  .search { flex: 1 1 150px; }
  html, body { overflow-x: hidden; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .stats { gap: 8px; margin-top: 12px; }
  .stat-value { font-size: 21px; }
  .col { width: 84vw; }
  .drawer { width: 100%; }
  .fld2row { grid-template-columns: 1fr; }
  .date-edit-row { flex-wrap: wrap; }
  .foot { flex-direction: column; align-items: flex-start; }
}
