/* SIGNUM Dashboard — wygląd oparty na makiecie "Interface SIGNUM Dasboard.svg" */

:root {
  --bg: #f4f6fa;
  --ink: #172033;
  --ink-2: #475569;
  --muted: #64748b;
  --line: #dce1ea;
  --card: #ffffff;
  --accent: #7067f0;
  --accent-dark: #5c54dc;
  --dark: #151b2d;
  --panel: #20283b;
  --panel-2: #252e43;
  --panel-3: #2a3348;
  --panel-line: #354057;
  --panel-ink: #e2e8f0;
  --panel-muted: #8f9bb0;
  --danger: #db4f53;
  --danger-bg: #fee8e8;
  --warn: #9a651f;
  --ok: #37c99c;
  --shadow: 0 4px 14px rgba(15, 23, 42, .10);
  --radius: 13px;

  --col-new: #e9e7fb;
  --col-progress: #fff0e3;
  --col-waiting: #f8eddd;
  --col-blocked: #fde7e8;
  --col-ready: #e4f3ea;

  --bar-new: #7067f0;
  --bar-progress: #f59c5a;
  --bar-waiting: #d79b4a;
  --bar-blocked: #ef6466;
  --bar-ready: #37a275;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 14px/1.45 Inter, "Segoe UI", system-ui, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { display: flex; flex-direction: column; }
#app { display: flex; flex-direction: column; min-height: 100%; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* --- przyciski --- */

.btn {
  font: inherit; font-weight: 700; font-size: 13px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 14px; cursor: pointer; background: #fff; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.subtle { background: #eef4ff; color: #3f73c5; }
.btn.danger { background: #fff0f0; color: #c74247; }
.btn.icon { padding: 9px; width: 40px; justify-content: center; }
.btn.small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- logowanie --- */

.login { flex: 1; display: grid; place-items: center; padding: 24px; background: var(--dark); }
.login-card {
  width: min(380px, 100%); background: #fff; border-radius: 18px;
  padding: 32px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.login-mark {
  width: 46px; height: 46px; border-radius: 12px; background: var(--accent);
  color: #fff; font-weight: 800; font-size: 19px; display: grid; place-items: center;
}
.login-card h1 { font-size: 21px; color: var(--ink); margin: 18px 0 4px; }
.login-sub { margin: 0 0 22px; font-size: 12px; color: var(--muted); }
.login-card label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.login-error { background: var(--danger-bg); color: #b3383c; padding: 9px 12px; border-radius: 9px; font-size: 12.5px; margin: 12px 0 0; }
.login-card .btn { margin-top: 18px; }

input[type=text], input[type=password], input[type=search], input[type=date],
input[type=datetime-local], input[type=number], select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; min-height: 42px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 92px; resize: vertical; }

/* --- pasek górny --- */

.topbar {
  background: var(--dark); color: #f8fafc; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 40px; height: 40px; border-radius: 11px; background: var(--accent); display: grid; place-items: center; font-weight: 800; }
.brand-name { font-size: 16px; font-weight: 750; }
.brand-sub { font-size: 11px; color: #94a3b8; }

.search { flex: 1 1 260px; max-width: 420px; position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 13px; color: #94a3b8; }
.search input {
  background: #252c40; border-color: #394158; color: #f1f5f9; padding-left: 40px; min-height: 42px;
}
.search input::placeholder { color: #94a3b8; }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.topbar-actions .btn.ghost { background: #252c40; border-color: #394158; color: #cbd5e1; }

/* --- powitanie i filtry --- */

.greeting-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; padding: 18px 20px 12px; flex-wrap: wrap;
}
.greeting { font-size: 23px; font-weight: 760; color: var(--ink); margin: 0; }
.greeting-sub { margin: 4px 0 0; font-size: 13px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.segmented { display: flex; background: #e7eaf2; border-radius: 11px; padding: 4px; gap: 2px; }
.segmented button {
  font: inherit; font-size: 12px; font-weight: 650; color: var(--muted);
  background: transparent; border: 0; border-radius: 8px; padding: 8px 15px; cursor: pointer; min-height: 34px;
}
.segmented button[aria-selected="true"] { background: #fff; color: #303a50; font-weight: 700; box-shadow: var(--shadow); }

.select-wrap select { min-width: 140px; }

/* --- układ --- */

.layout { display: flex; gap: 18px; padding: 0 20px 18px; align-items: flex-start; flex: 1; min-height: 0; }
.layout.only-mine .board-wrap { display: none; }
.layout.only-kanban .panel { display: none; }

/* --- Moja praca --- */

.panel {
  width: 290px; flex: none; background: var(--panel); border-radius: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  max-height: calc(100vh - 190px); position: sticky; top: 12px;
}
.panel-head { padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 10px; }
.panel-head h2 { font-size: 13px; font-weight: 750; color: #f8fafc; letter-spacing: .6px; margin: 0; }
.panel-head select { background: var(--panel-2); border-color: var(--panel-line); color: var(--panel-ink); min-height: 38px; }
.panel-body { overflow: auto; padding: 4px 14px 14px; flex: 1; }
.panel-foot {
  border-top: 1px solid var(--panel-line); padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel-foot .btn { background: transparent; border: 0; color: var(--panel-muted); font-size: 17px; }
.sync { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #aeb8c9; }
.sync .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.sync.offline .dot { background: var(--danger); }
.sync.offline { color: #ffb4b5; }

.plan-group { margin-top: 14px; }
.plan-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 750; color: #8894a9; letter-spacing: 1px; padding: 0 4px 8px;
}
.plan-now .plan-label { color: #fff; }

.mini {
  background: var(--panel-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; border: 1px solid transparent; display: block; width: 100%; text-align: left;
  font: inherit; color: var(--panel-ink); position: relative;
}
.mini:hover { border-color: var(--panel-line); }
.mini.is-now { background: var(--panel-3); border-left: 4px solid var(--accent); }
.mini.overdue { border-left: 4px solid var(--danger); }
.mini .mini-title { font-size: 13px; font-weight: 650; color: #fff; }
.mini .mini-meta { font-size: 11px; color: var(--panel-muted); margin-top: 5px; }
.mini .mini-due { font-size: 10px; font-weight: 700; margin-top: 6px; color: #aeb8c9; }
.mini.overdue .mini-due { color: #ff9e9f; }
.panel-empty { color: var(--panel-muted); font-size: 12px; padding: 10px 4px; }

/* --- tablica --- */

.board-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 10px; }
.board-head h2 { font-size: 16px; font-weight: 720; color: #263249; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }

/* align-items: stretch (domyślne) plus min-height sprawiają, że kolumna
   zachowuje kolor na pełnej wysokości także wtedy, gdy nie ma w niej kart. */
.board { display: flex; gap: 14px; align-items: stretch; overflow-x: auto; padding-bottom: 6px; }
.column {
  flex: 1 1 0; min-width: 250px; border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column;
  min-height: min(560px, calc(100vh - 250px));
  max-height: calc(100vh - 250px);
}
.column[data-column=new] { background: var(--col-new); }
.column[data-column=in_progress] { background: var(--col-progress); }
.column[data-column=waiting] { background: var(--col-waiting); }
.column[data-column=blocked] { background: var(--col-blocked); }
.column[data-column=ready] { background: var(--col-ready); }
.column.drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; }

.column-head {
  position: sticky; top: 0; display: flex; align-items: center; gap: 9px;
  padding: 6px 6px 12px; font-size: 15px; font-weight: 720; color: #263249;
}
.column-head .bullet { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.column[data-column=new] .bullet { background: var(--bar-new); }
.column[data-column=in_progress] .bullet { background: var(--bar-progress); }
.column[data-column=waiting] .bullet { background: var(--bar-waiting); }
.column[data-column=blocked] .bullet { background: var(--bar-blocked); }
.column[data-column=ready] .bullet { background: var(--bar-ready); }
.column-head .count {
  margin-left: auto; background: rgba(255,255,255,.75); border-radius: 7px;
  min-width: 24px; height: 24px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; padding: 0 6px;
}
.column-head .count.over { background: var(--danger); color: #fff; }
.column-body { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.column-empty { color: #8a93a5; font-size: 12px; text-align: center; padding: 18px 6px; }

/* --- karta --- */

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 14px 13px 16px; position: relative; cursor: pointer;
  border: 1px solid transparent; text-align: left; font: inherit; color: inherit; width: 100%; display: block;
}
.card:hover { border-color: #d9def0; }
.card.dragging { opacity: .45; }
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: 3px 0 0 3px; background: var(--bar-new);
}
.column[data-column=in_progress] .card::before { background: var(--bar-progress); }
.column[data-column=waiting] .card::before { background: var(--bar-waiting); }
.column[data-column=blocked] .card::before { background: var(--bar-blocked); }
.column[data-column=ready] .card::before { background: var(--bar-ready); }

/* Prawy margines rezerwuje miejsce na przycisk „⋯", który jest pozycjonowany
   absolutnie. Bez tego plakietka z `margin-left: auto` wjeżdża pod niego. */
.card-top {
  display: flex; align-items: center; gap: 6px; margin-bottom: 9px;
  flex-wrap: wrap; padding-right: 32px; min-height: 20px;
}
.chip {
  font-size: 9.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px; background: #ece9ff; color: #655cdf; white-space: nowrap;
}
.chip.p1 { background: var(--danger-bg); color: var(--danger); }
.chip.p2 { background: #fff0e4; color: #c56a2b; }
.chip.p3 { background: #e5f4ff; color: #377eb3; }
.chip.p4 { background: #eef1f6; color: var(--muted); }
.chip.gap { margin-left: auto; }
.chip.missing { background: var(--danger-bg); color: #c74247; }
.chip.partial { background: #fbf0df; color: var(--warn); }

/* Ten sam powód co przy .card-top — tytuł bez rzędu plakietek stoi na wysokości
   przycisku menu. */
.card-title { font-size: 14px; font-weight: 700; color: #202b40; margin: 0 0 5px; padding-right: 26px; }
.card-sub { font-size: 12.5px; color: var(--ink-2); margin: 0; }

.note { border-radius: 8px; padding: 8px 10px; font-size: 11.5px; margin-top: 10px; }
.note.waiting { background: #fbf5ea; color: #936522; }
.note.blocked { background: #fff0f0; color: #bd3c40; }
.note strong { display: block; font-weight: 700; }

.card-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 11px;
  padding-top: 10px; border-top: 1px solid #eef0f5;
}
.avatar {
  width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 800; color: #fff; background: var(--accent); flex: none;
}
.avatar.none { background: #cbd5e1; color: #64748b; }
.card-foot .who { font-size: 11.5px; color: var(--muted); }
.card-foot .due { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); }
.card-foot .due.soon { color: #c56a2b; }
.card-foot .due.overdue { color: var(--danger); }

.card-menu {
  position: absolute; top: 8px; right: 8px; border: 0; background: transparent;
  color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
}
.card-menu:hover { background: #f1f3f8; }

/* --- propozycje --- */

/* Sekcja stoi NAD Kanbanem, nie pod nim. Na dole strony, za wysokimi kolumnami,
   bywała niezauważona — a to jest miejsce, w którym człowiek dopuszcza pracę
   do systemu. */
.proposals { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.proposals-head {
  display: flex; align-items: center; gap: 10px; padding-bottom: 2px;
}
.proposals-head h2 {
  margin: 0; font-size: 15px; font-weight: 720; color: #263249;
}
.proposals-head .pill {
  background: #4a86e8; color: #fff; border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 800;
}
.proposals-head .btn { margin-left: auto; }

.badge-count {
  background: #4a86e8; color: #fff; border-radius: 999px; min-width: 20px;
  height: 20px; padding: 0 6px; font-size: 11px; font-weight: 800;
  display: inline-grid; place-items: center;
}
.proposal {
  background: #fff; border: 1px solid #dfe3eb; border-left: 6px solid #4a86e8;
  border-radius: 14px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.proposal .env { width: 34px; height: 34px; border-radius: 50%; background: #e8f1ff; color: #4a86e8; display: grid; place-items: center; flex: none; }
.proposal-text { flex: 1 1 320px; min-width: 0; }
.proposal-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .7px; }
.proposal-title { font-size: 14px; font-weight: 700; color: #202b40; margin: 3px 0; overflow-wrap: anywhere; }
.proposal-meta { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.proposal-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- drawer, modal --- */

.scrim { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: #fff; z-index: 50; box-shadow: -8px 0 30px rgba(15,23,42,.2);
  display: flex; flex-direction: column;
}
.drawer-head {
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head h2 { margin: 0; font-size: 18px; color: var(--ink); }
.drawer-head .muted { display: block; margin-top: 3px; }
.drawer-body { overflow: auto; padding: 18px 20px; flex: 1; }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 20px; display: flex; gap: 8px; flex-wrap: wrap; }

.modal-host { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; }
.modal {
  background: #fff; border-radius: 16px; width: min(560px, 100%);
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(15,23,42,.3);
}
.modal-head { padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; color: var(--ink); }
.modal-body { padding: 12px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.section-title {
  font-size: 11px; font-weight: 750; letter-spacing: .8px; color: var(--muted);
  text-transform: uppercase; margin: 22px 0 10px;
}
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* Czerwień wyłącznie dla pól, bez których zlecenie nie może wejść na produkcję.
   Puste pole nieobowiązkowe to szara pauza — inaczej kompletne zlecenie krzyczy
   fałszywymi alarmami i po tygodniu nikt nie czyta czerwonych napisów. */
.kv dd.missing { color: var(--danger); font-weight: 700; }
.kv dd.empty { color: #a6b0c0; }
.kv dd.strong { font-weight: 700; font-size: 14px; }

.group { background: #f7f8fc; border: 1px solid #e8ebf3; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.group > .group-title {
  font-size: 11px; font-weight: 750; letter-spacing: .8px; color: var(--muted);
  text-transform: uppercase; margin: 0 0 10px;
}

.meter { border-radius: 12px; padding: 13px 16px; margin-bottom: 16px; }
.meter.ready { background: #e6f5ec; }
.meter.partial { background: #fdf3e2; }
.meter.bad { background: var(--danger-bg); }
.meter-head { display: flex; align-items: baseline; gap: 10px; }
.meter-head strong { font-size: 15px; color: var(--ink); }
.meter.ready .meter-head strong { color: #1f7a4d; }
.meter.partial .meter-head strong { color: #8a5a12; }
.meter.bad .meter-head strong { color: #b3383c; }
.meter-track { height: 7px; border-radius: 4px; background: rgba(255,255,255,.7); margin: 10px 0 0; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; background: #37a275; }
.meter.partial .meter-fill { background: #d79b4a; }
.meter.bad .meter-fill { background: var(--bar-blocked); }
.meter-missing { font-size: 12px; margin: 9px 0 0; color: #7a6034; }
.meter.bad .meter-missing { color: #a34a4d; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 4px 10px;
  border-radius: 999px; background: #eef1f6; color: var(--muted);
}
.pill.good { background: #e6f5ec; color: #1f7a4d; }
.pill.warn { background: #fdf3e2; color: #8a5a12; }
.pill.bad { background: var(--danger-bg); color: #b3383c; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.timeline li { padding: 9px 0 9px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--line);
}
.timeline .when { color: var(--muted); font-size: 11px; }

.menu {
  position: absolute; z-index: 70; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(15,23,42,.2); padding: 6px; min-width: 210px;
}
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  font: inherit; font-size: 13px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
}
.menu button:hover { background: #f1f3f8; }
.menu .menu-label { font-size: 11px; font-weight: 750; color: var(--muted); padding: 8px 12px 4px; letter-spacing: .5px; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 11px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 90vw;
}
.toast.error { background: #b3383c; }

.column-tabs { display: none; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.column-tabs button {
  font: inherit; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 9px 15px; cursor: pointer; min-height: 40px;
}
.column-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --- telefon --- */

@media (max-width: 900px) {
  /* align-items musi wrócić do stretch. Odziedziczone flex-start przy układzie
     kolumnowym każe sekcji tablicy dopasować szerokość do treści, przez co cała
     strona przewijała się w poziomie. */
  .layout { flex-direction: column; align-items: stretch; padding: 0 12px 12px; }
  .panel { width: 100%; position: static; max-height: none; }
  .greeting-row { padding: 14px 12px 10px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .brand-sub { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .controls { width: 100%; }
  .select-wrap, .select-wrap select { flex: 1 1 140px; min-width: 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }

  .column-tabs { display: flex; }
  .board { display: block; overflow: visible; }
  .column { display: none; max-height: none; min-width: 0; width: 100%; }
  .column.active { display: flex; }
  .column-body { overflow: visible; }

  .proposals { padding: 0 12px 18px; }
  .proposal-actions .btn { flex: 1 1 auto; }
  .drawer { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .card, .mini, .btn { transition: border-color .12s ease, background .12s ease, opacity .12s ease; }
}
