/* Traser linii kablowych — panel po prawej (js/traser.js). Jasny, jak panel asystenta AI. */
.traser-panel {
    position: fixed;
    top: calc(var(--header-h, 56px) + 8px);
    right: 8px;
    bottom: 8px;
    width: 380px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: var(--cge-text, #1A1A1A);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    font-family: var(--cge-font, "DM Sans", system-ui, sans-serif);
    font-size: 13px;
    overflow: hidden;
}
.traser-panel.hidden { display: none; }
.traser-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid #e2e8f0; background: #f8faf9; flex-shrink: 0;
}
.traser-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.traser-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: #6b7280; padding: 0 4px; }
.traser-x:hover { color: #111827; }
.traser-hint { padding: 8px 14px; background: #FFF8E1; color: #6B4E00; font-size: 12px; border-bottom: 1px solid #F5E3A3; }
.traser-hint--err { background: #FDECEC; color: #8A1F1F; border-bottom-color: #F4C2C2; }
.traser-hint.hidden { display: none; }
.traser-body { flex: 1; overflow-y: auto; padding: 12px 14px 16px; }

.traser-sec { margin: 14px 0 6px; font-weight: 600; font-size: 12px; color: #374151; text-transform: none; }
.traser-sec small { font-weight: 400; color: #9CA3AF; margin-left: 4px; }
.traser-small { font-size: 11.5px; color: #6b7280; margin: 4px 0 6px; line-height: 1.45; }
.traser-muted { color: #9CA3AF; font-size: 12px; margin: 6px 0; }
.traser-note { font-size: 11.5px; color: #6b7280; line-height: 1.5; margin-top: 16px; }
.traser-info { background: #EEF6FF; color: #0C447C; border-radius: 8px; padding: 8px 10px; margin: 10px 0; font-size: 12.5px; }
.traser-err { background: #FDECEC; color: #8A1F1F; border-radius: 8px; padding: 8px 10px; margin: 10px 0; font-size: 12.5px; white-space: pre-wrap; }

.traser-btn {
    border: 1px solid #d1d5db; background: #fff; color: #111827; border-radius: 8px;
    padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.traser-btn:hover { background: #f3f4f6; }
.traser-btn:disabled { opacity: .6; cursor: default; }
.traser-btn--primary { background: #111827; color: #fff; border-color: #111827; }
.traser-btn--primary:hover { background: #1f2937; }
.traser-btn--wide { width: 100%; padding: 9px 12px; margin-top: 12px; font-weight: 600; }
.traser-btn--sm { padding: 4px 10px; font-size: 12px; }
.traser-btn--xs { padding: 3px 8px; font-size: 11px; white-space: nowrap; }
.traser-btn--on { background: #FFF1C2; border-color: #D4A800; color: #6B4E00; }
.traser-btn--danger { color: #A32D2D; border-color: #F0C4C4; }
.traser-link { border: 0; background: none; color: #0066CC; cursor: pointer; padding: 0; font: inherit; font-size: 12px; margin-bottom: 8px; }

.traser-field { display: block; margin: 8px 0; }
.traser-field > span { display: block; font-size: 12px; color: #374151; margin-bottom: 3px; }
.traser-field input, .traser-select, .traser-textarea, .traser-field select {
    width: 100%; box-sizing: border-box; border: 1px solid #d1d5db; border-radius: 8px;
    padding: 6px 8px; font: inherit; font-size: 12.5px; background: #fff; color: #111827;
}
.traser-field--inline { display: flex; align-items: center; gap: 8px; }
.traser-field--inline > span { margin: 0; flex: 1; font-size: 11.5px; color: #6b7280; }
.traser-field--inline select { width: auto; }
.traser-select, .traser-textarea { margin: 4px 0 6px; }

.traser-row { display: flex; align-items: center; gap: 8px; }
.traser-place { flex: 1; min-width: 0; font-weight: 500; }
.traser-place small { display: block; font-weight: 400; color: #9CA3AF; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.traser-place--empty { color: #9CA3AF; font-weight: 400; }

.traser-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.traser-chip { display: inline-flex; align-items: center; gap: 2px; border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 12px; }
.traser-chip button { border: 0; background: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 3px; color: inherit; }
.traser-chip--odmowa { background: #FCEBEB; color: #791F1F; }
.traser-chip--zgoda { background: #E6F4EC; color: #0B5D34; }

.traser-details { margin: 12px 0; border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 10px; }
.traser-details summary { cursor: pointer; font-weight: 600; font-size: 12px; color: #374151; }
.traser-param { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12px; }
.traser-param input { width: 64px; border: 1px solid #d1d5db; border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px; }
.traser-param select { border: 1px solid #d1d5db; border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px; }

.traser-job { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px; margin: 6px 0; cursor: pointer; }
.traser-job:hover { border-color: #cbd5e1; background: #fafafa; }
.traser-job-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.traser-job-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traser-job-meta { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.traser-job-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }

.traser-badge { font-size: 11px; padding: 1px 7px; border-radius: 6px; white-space: nowrap; font-weight: 500; }
.traser-badge--ok { background: #E6F4EC; color: #0B5D34; }
.traser-badge--err { background: #FCEBEB; color: #791F1F; }
.traser-badge--run { background: #FFF1C2; color: #6B4E00; }
.traser-badge--wait { background: #EEF2F7; color: #475569; }
.traser-badge--mute { background: #F3F4F6; color: #6b7280; }

.traser-prog { height: 6px; background: #eef0f2; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.traser-prog > div { height: 6px; background: #C8102E; border-radius: 3px; transition: width .4s; }
.traser-prog-lbl { font-size: 11.5px; color: #6b7280; margin-top: 4px; }

.traser-var { display: flex; align-items: center; gap: 8px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 7px 8px; margin: 5px 0; cursor: pointer; }
.traser-var:hover { background: #fafafa; }
.traser-var--on { border-color: #C8102E; box-shadow: inset 3px 0 0 #C8102E; }
.traser-var-id { font-weight: 700; color: #7A0A1C; width: 26px; text-align: center; flex-shrink: 0; }
.traser-var-main { flex: 1; min-width: 0; }
.traser-var-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traser-var-meta { font-size: 11.5px; color: #6b7280; }
.traser-var-tag { font-size: 10.5px; color: #0B5D34; margin-top: 2px; }

.traser-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: #6b7280; margin: 8px 0 2px; }
.traser-legend i { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 4px; }
.traser-legend .tl-line { border-top: 4px solid #C8102E; }
.traser-legend .tl-line--dim { border-top: 2px solid rgba(200, 16, 46, .45); }
.traser-legend .tl-drill { border-top: 4px dotted #7F63B3; }
.traser-legend .tl-road { border-top: 4px dashed rgba(58, 63, 71, .55); }
.traser-legend .tl-ref { height: 10px; width: 12px; background: rgba(200, 16, 46, .28); border: 1.5px solid #C8102E; }

.traser-file { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; color: #0066CC; text-decoration: none; font-size: 12.5px; }
.traser-file:hover { text-decoration: underline; }
.traser-file small { color: #9CA3AF; white-space: nowrap; }
.traser-file--off, .traser-file--off:hover { color: #9CA3AF; text-decoration: none; cursor: pointer; }
.traser-list { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: #374151; }
.traser-list li { margin: 3px 0; }
.traser-log { font-size: 10.5px; white-space: pre-wrap; max-height: 220px; overflow: auto; background: #f8fafc; padding: 6px; border-radius: 6px; }
.traser-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* Dymek karty działki na mapie */
.traser-popup {
    position: relative; background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    padding: 10px 12px; width: 300px; font-family: var(--cge-font, "DM Sans", system-ui, sans-serif); font-size: 12px; color: #111827;
}
.traser-popup-close { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 18px; cursor: pointer; color: #6b7280; }
.traser-popup-title { font-weight: 600; font-size: 13.5px; padding-right: 16px; }
.traser-popup-sub { color: #9CA3AF; font-size: 11px; margin-bottom: 6px; }
.traser-popup-tab { width: 100%; border-collapse: collapse; }
.traser-popup-tab td { padding: 2px 0; vertical-align: top; }
.traser-popup-tab td:first-child { color: #6b7280; width: 38%; padding-right: 6px; }
.traser-popup-note { margin: 6px 0; color: #6B4E00; background: #FFF8E1; border-radius: 6px; padding: 5px 7px; font-size: 11.5px; }
.traser-popup-img { width: 100%; border-radius: 6px; margin: 6px 0 4px; display: block; }
.traser-popup a { color: #0066CC; font-size: 12px; }

/* Telefon: panel na całą szerokość; tylko podgląd (nowa trasa ukryta w JS) */
@media (max-width: 768px) {
    .traser-panel { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 55vh; border-radius: 12px 12px 0 0; }
    .traser-popup { width: 250px; }
}
.traser-check { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: #374151; margin: 6px 0; cursor: pointer; }
.traser-check input { margin-top: 2px; accent-color: #0F6E56; }
.traser-check small { color: #9CA3AF; }
