/* Freight Empire – komponenty */
.ic { display: inline-flex; flex: none; vertical-align: middle; }

/* przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 14.5px; cursor: pointer; background: var(--route); color: #fff; transition: transform 0.08s, background 0.15s, opacity 0.15s; position: relative;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary { background: var(--route); }
.btn.primary:hover:not(:disabled) { background: var(--route-d); }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cfd8d3; }
.btn.ghost:hover:not(:disabled) { background: #f2f6f4; }
.btn.danger { background: var(--neg); }
.btn.small { height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.busy { pointer-events: none; }
.btn.busy::after {
  content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }
.btn-row.tight { gap: 6px; }
.btn-row.tight > .btn { flex: 0 0 auto; }
.btn-row.wrap > .btn { flex: 0 1 auto; }
.icon-btn { all: unset; cursor: pointer; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--ink-2); }
.icon-btn:hover { background: #eef2f0; }
.link { all: unset; cursor: pointer; color: var(--route-d); font-weight: 600; font-size: 13.5px; padding: 4px 0; }

/* pola */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
input[type='text'], input[type='search'], input[type='email'], input[type='password'], select {
  height: 44px; padding: 0 12px; border: 1.5px solid #d3dcd7; border-radius: 10px; background: #fff; font: inherit; color: var(--ink); width: 100%; min-width: 0;
}
textarea { padding: 10px 12px; border: 1.5px solid #d3dcd7; border-radius: 10px; background: #fff; font: inherit; color: var(--ink); width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--route); box-shadow: 0 0 0 3px rgba(14, 143, 176, 0.18); }
.filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.filters select { height: 40px; font-size: 14px; }

/* karty */
.cards { display: grid; gap: 10px; }
.card {
  all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px;
  box-shadow: var(--shadow); cursor: default; position: relative;
}
button.card { cursor: pointer; }
button.card:hover { border-color: #b9ccd3; }
button.card:active { transform: scale(0.995); }
.card.contract.available { border-left: 4px solid var(--info); }
.card.contract.accepted, .card.contract.searching { border-left: 4px solid var(--navy); }
.card.contract.contracted, .card.contract.in_transit { border-left: 4px solid var(--route); }
.card.contract.delayed { border-left: 4px solid var(--warn); }
.card.contract.delivered { border-left: 4px solid var(--pos); }
.card.contract.cancelled { border-left: 4px solid var(--neg); opacity: 0.8; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.route { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 15.5px; }
.route .dist { font-size: 12px; color: var(--ink-3); margin-left: 6px; }
.route.big { font-size: 20px; }
.price { text-align: right; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.price small { display: block; font-weight: 600; font-size: 12px; }
.card-mid { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.cargo { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); font-weight: 600; }
.card-time { display: flex; gap: 6px; align-items: center; font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 600; background: #eef1ef; color: var(--ink-2); white-space: nowrap;
}
.chip.pos { background: #e3f5ec; color: #157a4a; }
.chip.neg { background: #fdeaea; color: #b53030; }
.chip.warn { background: #fff0e0; color: #b4601a; }
.chip.info { background: #e8f0f9; color: #2f5d93; }
.chip.navy { background: #e4e9f0; color: var(--navy); }
.chip.route { background: #dff3f8; color: var(--route-d); }
.progress { height: 6px; border-radius: 3px; background: #e6ece9; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--route); border-radius: 3px; transition: width 0.6s; }
.progress.warn i { background: var(--warn); }
.panel-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.panel-card h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.sec { font-size: 14px; margin: 6px 0 2px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi-grid.three { grid-template-columns: repeat(3, 1fr); }
.kpi {
  all: unset; box-sizing: border-box; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow); min-width: 0;
}
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: #b9ccd3; }
.kpi-l { font-size: 12px; color: var(--ink-2); display: flex; gap: 5px; align-items: center; }
.kpi-v { font-size: 19px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { font-size: 11.5px; color: var(--ink-3); }
.kpi.hero { background: linear-gradient(135deg, #16304a, #1d4d73); color: #fff; border: 0; }
.kpi.hero .kpi-l, .kpi.hero small { color: #b5cbe0; }
.kpi.pos .kpi-v { color: var(--pos); }
.kpi.neg .kpi-v { color: var(--neg); }

/* listy klucz-wartość */
.kv-list, .info-grid { display: flex; flex-direction: column; gap: 2px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 4px 0; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 14px; }
.kv > span { color: var(--ink-2); }
.kv > b { text-align: right; }
.kv.wide { grid-column: 1 / -1; flex-direction: column; align-items: flex-start; }
.info-grid .kv { flex-direction: column; align-items: flex-start; gap: 1px; padding: 0; }
.info-grid .kv > b { text-align: left; font-size: 14px; }
.kv-list .kv { border-bottom: 1px solid #f0f3f1; }
.kv-list .kv:last-child { border-bottom: 0; }
.big { font-size: 17px; }
.econ-box { background: #f6f9f8; border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; margin: 6px 0; }
.econ-box .kv { border-bottom: 1px dashed #dde5e1; }
.econ-box .kv:last-child { border-bottom: 0; }
.econ-box.compact .kv { font-size: 13.5px; }
.note { font-size: 12.5px; line-height: 1.45; }
.warn-note { display: flex; gap: 7px; align-items: flex-start; color: #a4561b; background: #fff4e8; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.warn-note.small { padding: 0; background: none; font-size: 12px; }
.small-note { font-size: 12.5px; }
.next-step { display: flex; gap: 12px; align-items: center; background: #eaf6f9; border-radius: 12px; padding: 11px 13px; color: var(--route-d); margin: 8px 0; }
.next-step b { color: var(--navy); }
.next-step p { font-size: 13px; color: var(--ink-2); }
.next-step .btn { flex: none; }

.detail-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }

/* zakładki */
.tabs { display: flex; gap: 4px; background: #e8eeeb; padding: 3px; border-radius: 12px; }
.tabs button { flex: 1; border: 0; background: transparent; height: 38px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--ink-2); position: relative; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(22, 48, 74, 0.14); }
.tabs.small button { height: 32px; font-size: 13px; }
.tabs .dot { margin-left: 6px; background: var(--neg); color: #fff; font-style: normal; font-size: 11px; border-radius: 9px; padding: 1px 6px; }

/* oś statusów */
.timeline { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); padding: 0; margin: 4px 0 8px; gap: 0; }
.timeline li { position: relative; text-align: center; font-size: 10.5px; color: var(--ink-3); padding-top: 18px; line-height: 1.2; }
.timeline li i { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: #d5dde0; z-index: 1; }
.timeline li::before { content: ''; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px; background: #d5dde0; }
.timeline li:first-child::before { display: none; }
.timeline li.done i, .timeline li.now i { background: var(--route); }
.timeline li.done::before, .timeline li.now::before { background: var(--route); }
.timeline li.now { color: var(--ink); font-weight: 650; }
.timeline li.now i { box-shadow: 0 0 0 4px rgba(14, 143, 176, 0.22); }
.timeline li.warn i { background: var(--warn); box-shadow: 0 0 0 4px rgba(232, 136, 58, 0.25); }

/* wyceny przewoźników */
.quotes { display: flex; flex-direction: column; gap: 10px; }
.quote { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 9px; background: #fff; }
.quote.blocked { background: #fafbfa; }
.quote.blocked .q-head, .quote.blocked .q-grid { opacity: 0.7; }
.q-head { display: flex; justify-content: space-between; gap: 10px; }
.q-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; }
.q-grid span { display: block; font-size: 11.5px; color: var(--ink-3); }
.q-grid b { font-size: 13.5px; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff7e8; border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.negotiate { background: #f4f8f7; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.odds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.odd { border: 1.5px solid #d3dcd7; background: #fff; border-radius: 10px; padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.odd span { font-size: 11.5px; color: var(--ink-2); }
.odd.on { border-color: var(--route); background: #e3f3f7; }
.bad-list { display: flex; flex-direction: column; gap: 6px; }
.bad { display: flex; flex-direction: column; font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid #eef2f0; }

/* przewoźnicy */
.card.carrier.busy { background: #fafbfa; }
.meter-row { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.meter { height: 8px; background: #e6ece9; border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--route); border-radius: 4px; }
.meter i.neg { background: var(--neg); }
.meter.big { height: 10px; }
.rel-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dots { display: flex; gap: 4px; margin: 3px 0; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: #dfe6e3; }
.dots i.on { background: var(--route); }

/* wiersze list */
.rows { display: flex; flex-direction: column; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f3f1; font-size: 14px; }
.line:last-child { border-bottom: 0; }
.line > b { white-space: nowrap; }
.lane-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.two-col { display: flex; flex-direction: column; gap: 12px; }
.upgrade { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f3f1; }
.upgrade:last-child { border-bottom: 0; }
.upgrade.locked { opacity: 0.8; }
.upgrade p { margin-top: 2px; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.checks div { display: flex; gap: 8px; align-items: center; color: var(--neg); font-size: 14px; }
.checks div.ok { color: var(--pos); }

/* pulpit */
.banner { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r); align-items: flex-start; }
.banner.warn { background: #fff2e2; color: #8a4a12; }
.banner.neg { background: #fdeaea; color: #8f2a2a; }
.banner b { display: block; }
.banner p { font-size: 13.5px; margin: 2px 0 6px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick .btn { flex: 1 1 100px; }
.tips { background: linear-gradient(180deg, #f4fbfd, #fff); border-color: #cde8ef; }
.tips-head { display: flex; justify-content: space-between; align-items: center; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.steps li i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b8c9d1; display: grid; place-items: center; flex: none; margin-top: 1px; color: #fff; }
.steps li.ok i { background: var(--pos); border-color: var(--pos); }
.steps li.ok span { color: var(--ink-3); text-decoration: line-through; }
.log-list { display: flex; flex-direction: column; }
.log-item { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid #f0f3f1; font-size: 13.5px; align-items: flex-start; }
.log-item:last-child { border-bottom: 0; }
.log-ic { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: #eef2f0; color: var(--ink-2); }
.log-item.pos .log-ic { background: #e3f5ec; color: var(--pos); }
.log-item.warn .log-ic { background: #fff0e0; color: var(--warn); }
.log-item.neg .log-ic { background: #fdeaea; color: var(--neg); }
.log-item.route .log-ic { background: #dff3f8; color: var(--route-d); }
.log-item.navy .log-ic { background: #e4e9f0; color: var(--navy); }
.log-item.info .log-ic { background: #e8f0f9; color: var(--info); }
.log-day h4 { font-size: 12.5px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 0 2px; }
.log-day { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px 8px; }

/* miasto */
.city-head { position: relative; display: flex; flex-direction: column; gap: 8px; padding-right: 44px; }
.city-head h2 { font-size: 22px; }
.close-city { position: absolute; top: 0; right: 0; }
.legend-list { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.legend-list > div { display: flex; gap: 12px; align-items: center; }
.legend-list i, .legend-map i { display: inline-block; width: 30px; height: 0; border-top: 3px solid; flex: none; }
.lg-lane.active { border-top-style: dashed; border-top-width: 3px; border-color: var(--route-d); width: 22px; animation: lgflow 1.1s linear infinite; }
@keyframes lgflow { to { transform: translateX(3px); } }
.lg-lane.relation { border-color: var(--route); border-top-width: 2px; }
.lg-lane.potential { border-top-style: dashed; border-color: #8d9aa7; border-top-width: 2px; }
.lg-lane.locked { border-top-style: dotted; border-color: #b9b7aa; border-top-width: 2px; }
.lg-lane.sea { border-top-style: dotted; border-color: #6f9fbd; border-top-width: 3px; }
.lg-lane.off { border-color: #c4c4bf; border-top-width: 8px; border-radius: 2px; }

/* wykres */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: #e8eeeb; stroke-width: 1; }
.ch-ax { fill: var(--ink-3); font-size: 11px; }
.ch-line { stroke: var(--route); stroke-width: 2.6; stroke-linejoin: round; }
.ch-area { fill: rgba(14, 143, 176, 0.12); }
.ch-bar.pos { fill: var(--pos); opacity: 0.85; }
.ch-bar.neg { fill: var(--neg); opacity: 0.85; }
.ch-dot { fill: #fff; stroke: var(--route); stroke-width: 2.5; }
.ch-empty { fill: var(--ink-3); font-size: 14px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 16px; height: 4px; border-radius: 2px; }
.lg.line { background: var(--route); }
.lg.bar { background: var(--pos); height: 8px; width: 8px; }

/* puste stany */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 16px; color: var(--ink-2); }
.empty .ic { color: #aebdc2; }
.empty b { color: var(--ink); }

/* okna (arkusze / modale) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(16, 30, 48, 0.5); display: flex; align-items: flex-end; justify-content: center; z-index: 60; animation: fade 0.18s; }
.sheet-backdrop.out { opacity: 0; transition: opacity 0.18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: #fff; width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: slideUp 0.24s ease; box-shadow: var(--shadow-lg); }
.sheet-grab { width: 42px; height: 4px; border-radius: 2px; background: #cfd8d3; margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 16px; flex: none; }
.sheet-title { font-weight: 700; font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(20px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.confirm { display: flex; flex-direction: column; gap: 12px; }
.more-list { display: flex; flex-direction: column; }
.more-item { all: unset; box-sizing: border-box; width: 100%; text-align: left; justify-content: flex-start; display: flex; align-items: center; gap: 14px; padding: 15px 4px; border-bottom: 1px solid #eef2f0; cursor: pointer; font-weight: 600; }
.more-item .more-label { flex: 1; text-align: left; }
.more-item > :first-child, .more-item > :last-child { flex: none; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { width: 540px; max-height: 88vh; border-radius: 20px; }
  .sheet.wide { width: 640px; }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 12px; }
  .filters { grid-template-columns: repeat(3, 1fr); }
}

/* powiadomienia */
.toasts { position: fixed; top: calc(var(--topbar) + 10px); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: slideDown 0.22s ease; }
.toast.success { background: #176e47; }
.toast.error { background: #a63636; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all 0.3s; }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } }
.toast .ic { margin-top: 1px; }

@media (min-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.btn span { white-space: nowrap; }

/* tryb oszczędny: bez animacji i dużych cieni */
[data-perf='lite'] *, [data-perf='lite'] *::before, [data-perf='lite'] *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
[data-perf='lite'] .lg-lane.active { animation: none; }
[data-perf='lite'] .panel, [data-perf='lite'] .lobby-card { box-shadow: none; border: 1px solid var(--line); }
.perf-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; }
.perf-toggle small { display: block; color: var(--ink-2); font-size: 12px; }
.perf-toggle .sw { width: 42px; height: 24px; border-radius: 12px; background: #c6cfd6; position: relative; flex: none; }
.perf-toggle .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; }
.perf-toggle.on .sw { background: var(--pos); }
.perf-toggle.on .sw::after { left: 20px; }

.line.rank { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.line.rank > div { flex: 1; min-width: 0; }
.rank-n { font-weight: 700; color: var(--ink-3); width: 24px; flex: none; }
.line.rank.me { background: #e8f5f9; }
.field small { display: block; margin-top: 4px; }
.field select { width: 100%; }

.rank-val { text-align: right; flex: none; }
.rank-val small { display: block; font-size: 11.5px; }
.share { display: flex; flex-direction: column; gap: 8px; }
.share-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.share-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .meter { height: 8px; }
.share-row.me span { font-weight: 650; }
