/* ===== TECH VIEW — widok technika (mobile / podgląd admina) ===== */
/* Aktywowany przez body.tech-view-mode — desktop admin bez tej klasy */

body.tech-view-mode {
    --tech-bar-height: 64px;
    --tech-chrome-height: 48px;
}

/* Ukryj pełny nagłówek — zastępuje tech-mobile-chrome */
body.tech-view-mode .app-header {
    display: none;
}

body.tech-view-mode .tech-mobile-chrome {
    display: flex;
}

/* Badge TRYB TEST w nagłówku technika (nie floating na dole) */
body.tech-view-mode #mapa-test-badge {
    display: none !important;
}

.tech-chrome-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tech-chrome-title-row strong {
    min-width: 0;
}

.tech-chrome-test-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    background: #b91c1c;
    color: #fff;
    line-height: 1.2;
}

.tech-chrome-test-badge[hidden] {
    display: none !important;
}

.tech-chrome-offline-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    background: #64748b;
    color: #fff;
    line-height: 1.2;
}

.tech-chrome-offline-badge[hidden] {
    display: none !important;
}

.tech-pwa-install {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--tech-bar-height, 64px) + 8px + env(safe-area-inset-bottom, 0px));
    z-index: 12050;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #1e3a8a;
    color: #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.35);
    font-size: 13px;
}

.tech-pwa-install-text {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.tech-pwa-install .btn-primary {
    flex-shrink: 0;
    white-space: nowrap;
}

.tech-pwa-install-dismiss {
    flex-shrink: 0;
    min-width: 28px;
    padding: 0 6px;
    font-size: 18px;
    line-height: 1;
}

/* Zielone toasty — ukryte; komunikaty idą do panelu Powiadomienia */
body.tech-view-mode .toast-container {
    display: none !important;
}

body.tech-view-mode #geocode-progress-overlay {
    display: none !important;
}

/* Leaflet attribution przy dolnej krawędzi — ukryte w widoku technika */
body.tech-view-mode .leaflet-control-attribution {
    display: none !important;
}

/* Ukryj elementy pełnej aplikacji */
body.tech-view-mode #header-opcje-btn,
body.tech-view-mode .header-menus,
body.tech-view-mode .header-actions {
    display: none;
}
body.tech-view-mode .header-stats,
body.tech-view-mode .data-source-pill,
body.tech-view-mode .header-icon-btn[onclick="restartTour()"],
body.tech-view-mode .sidebar-tabs,
body.tech-view-mode .sidebar-expand-btn,
body.tech-view-mode .compact-weeks,
body.tech-view-mode .compact-days,
body.tech-view-mode .compact-techs,
body.tech-view-mode .map-toolbar,
body.tech-view-mode .sidebar-extra-panel,
body.tech-view-mode .sidebar-tech-detail-panel,
body.tech-view-mode #sidebar-search-input,
body.tech-view-mode .sidebar-collapse {
    display: none;
}

body.tech-view-mode .hamburger-btn {
    display: none;
}

body.tech-view-mode .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: var(--tech-bar-height);
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 0;
    transform: none;
    border-right: none;
    border-top: 1px solid var(--gray-200);
    z-index: 85;
    overflow: hidden;
    transition: max-height 0.25s ease;
    box-shadow: none;
}

body.tech-view-mode.sidebar-open .sidebar {
    max-height: 0;
}

body.tech-view-mode .sidebar-backdrop {
    display: none;
}

body.tech-view-mode .sidebar-content.active {
    display: none;
}

body.tech-view-mode .map-area {
    flex: 1;
    min-height: 0;
}

/* Legenda + „Widok" są zbędne w widoku technika (filtr = 1 technik,
   sterowanie mapą dostępne w pasku dolnym i menu) — i zasłaniały arkusz zadań. */
body.tech-view-mode .map-floating-panel {
    display: none;
}

/* Google Maps Embed (directions) — zamiast Leaflet w obszarze mapy */
.tech-google-nav-wrap {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--gray-100);
}

.tech-google-nav-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.tech-google-nav-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--gray-600);
    background: var(--bg-surface);
}

body.tech-view-mode.tech-google-nav-mode #map {
    visibility: hidden;
    pointer-events: none;
}

.tech-menu-item.active {
    background: var(--primary-50, #eff6ff);
    color: var(--primary-700, #1d4ed8);
}

.tech-menu-notify-btn {
    justify-content: flex-start;
}

.tech-notify-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tech-notify-badge[hidden] {
    display: none !important;
}

.tech-notifications-panel {
    margin: 0 12px 8px;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    max-height: 160px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tech-notifications-panel[hidden] {
    display: none !important;
}

.tech-notifications-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    flex-shrink: 0;
}

.tech-notifications-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tech-notify-empty {
    margin: 0;
    font-size: 12px;
    color: var(--gray-500);
}

.tech-notify-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px 8px;
    align-items: start;
    font-size: 12px;
    line-height: 1.3;
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--gray-100);
}

.tech-notify-item i {
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.85;
}

.tech-notify-success i { color: var(--success, #16a34a); }
.tech-notify-error i { color: var(--danger, #dc2626); }
.tech-notify-warning i { color: var(--warning, #d97706); }
.tech-notify-info i { color: var(--primary); }

.tech-notify-time {
    font-size: 10px;
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
}

.tech-menu-geocode-block {
    margin: 4px 12px 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--gray-200));
    background: color-mix(in srgb, var(--primary) 6%, var(--bg-surface));
}

.tech-menu-geocode-block[hidden] {
    display: none !important;
}

.tech-menu-geocode-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.tech-menu-geocode-head i {
    color: var(--primary);
    font-size: 11px;
}

.tech-menu-geocode-sub {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 8px;
    line-height: 1.3;
}

.tech-menu-geocode-track {
    height: 4px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.tech-menu-geocode-track #gpo-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.25s ease;
}

.tech-menu-geocode-foot {
    margin-top: 6px;
    font-size: 10px;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}

/* Modal „Zaproponuj hotel” — podpowiedzi adresu */
.hotel-field-addr-wrap {
    position: relative;
}

.hotel-field-modal .hotel-field-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    max-height: 200px;
    overflow-y: auto;
}

.hotel-field-modal .hotel-field-suggestions .autocomplete-item {
    width: 100%;
    text-align: left;
    border: none;
    background: var(--bg-surface);
    cursor: pointer;
}

/* Fotoradary OSM na mapie */
.speed-cam-marker-wrap {
    background: transparent;
    border: none;
}

.speed-cam-marker {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(145deg, #f97316, #dc2626);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.45);
    border: 2px solid #fff;
}

body.tech-google-nav-mode .speed-cam-marker-wrap {
    display: none;
}

body.tech-view-mode .app-main {
    padding-bottom: var(--tech-bar-height);
    padding-top: var(--tech-chrome-height);
}

body.tech-view-mode .app-layout {
    margin-top: 0;
}

/* Nagłówek technika */
.tech-mobile-chrome {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--tech-chrome-height);
    padding: 0 8px;
    padding-top: env(safe-area-inset-top);
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--gray-200);
    z-index: 220;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.06);
}

.tech-chrome-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--gray-800);
    cursor: pointer;
    flex-shrink: 0;
}

.tech-chrome-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.tech-chrome-title strong {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tech-chrome-title small {
    font-size: 11px;
    color: var(--gray-500);
}

.tech-chrome-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.tech-chrome-logout {
    color: var(--danger, #dc2626);
}

/* Menu boczne technika */
.tech-menu-drawer {
    position: fixed;
    inset: 0;
    z-index: 10050;
    pointer-events: none;
    visibility: hidden;
}

.tech-menu-drawer.open {
    pointer-events: auto;
    visibility: visible;
}

.tech-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tech-menu-drawer.open .tech-menu-backdrop {
    opacity: 1;
}

.tech-menu-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    background: var(--bg-surface);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    padding: max(12px, env(safe-area-inset-top)) 0 12px;
    overflow-y: auto;
}

.tech-menu-drawer.open .tech-menu-panel {
    transform: translateX(0);
}

.tech-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 12px;
    border-bottom: 1px solid var(--gray-100);
}

.tech-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-800);
    text-align: left;
    cursor: pointer;
}

.tech-menu-item:hover {
    background: var(--gray-50);
}

.tech-menu-item i {
    width: 20px;
    color: var(--primary);
}

body.tech-view-mode .sidebar {
    display: none;
}

body.tech-preview-banner:not(:empty) ~ .tech-mobile-chrome,
body:has(.tech-preview-banner:not([hidden])) .tech-mobile-chrome {
    top: 36px;
}

body.tech-view-mode .details-panel {
    max-height: 50vh;
    bottom: var(--tech-bar-height);
}

/* Dolny pasek akcji */
.tech-view-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: var(--tech-bar-height);
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 4px 6px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    background: var(--bg-surface);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.12);
    z-index: 200;
}

.tech-bar-btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.15;
    cursor: pointer;
    min-height: 52px;
    padding: 4px 2px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tech-bar-btn i {
    font-size: 15px;
    line-height: 1;
}

.tech-bar-btn span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    padding: 0 1px;
}

.tech-bar-btn:active {
    transform: scale(0.98);
}

.tech-bar-btn.tech-bar-accent {
    background: color-mix(in srgb, var(--primary) 12%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--primary) 35%, var(--gray-200));
    color: var(--primary-dark);
}

body.tech-view-compact .tech-view-bar {
    gap: 3px;
    padding: 4px 5px;
}

/* Arkusz zadań od dołu */
.tech-task-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--tech-bar-height);
    max-height: 55vh;
    background: var(--bg-surface);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
    z-index: 190;
    transform: translateY(100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tech-task-sheet.open {
    transform: translateY(0);
}

.tech-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 4px;
    margin: 8px auto 4px;
    cursor: pointer;
    touch-action: none;
}

.tech-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px 10px;
    border-bottom: 1px solid var(--gray-100);
}

.tech-sheet-header h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.tech-sheet-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 8px 10px 12px;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.tech-sheet-summary {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 6px 8px;
}

.tech-task-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--bg-surface);
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.tech-task-row:hover {
    border-color: var(--primary-light);
    background: color-mix(in srgb, var(--primary) 6%, var(--bg-surface));
}

.tech-task-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.tech-task-addr {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    overflow: visible;
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.tech-task-addr small {
    display: block;
    margin-top: 1px;
    color: var(--gray-500);
    font-weight: 400;
    font-size: 11px;
}

.tech-task-dist {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-500);
    margin-top: 2px;
}

.tech-task-dist i {
    margin-right: 4px;
    opacity: 0.8;
}

.tech-task-distance-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 0 12px 6px;
}

.tech-sheet-travel-summary {
    margin: 0 6px 8px;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 7%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--gray-200));
    color: var(--gray-700);
}

.tech-task-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 0 12px 8px;
    font-size: 12px;
}

.tech-task-contact a {
    color: var(--primary);
    text-decoration: none;
}

.tech-task-contact a i {
    margin-right: 4px;
    opacity: 0.85;
}

.tech-task-row > i {
    color: var(--gray-400);
    flex-shrink: 0;
}

.tech-task-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.tech-task-share,
.tech-task-reply {
    padding: 4px 6px;
    min-width: 0;
}

.messages-inbox-list {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    padding: 0 4px;
}

.tech-sheet-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--gray-400);
}

.tech-sheet-empty i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

/* Modal kolegów */
.tech-nearby-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 10060;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.tech-nearby-overlay.active {
    display: flex;
}

.tech-nearby-modal {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    background: var(--bg-surface);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: techSheetUp 0.25s ease;
}

@keyframes techSheetUp {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.tech-nearby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.tech-nearby-header h2 {
    font-size: 15px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tech-nearby-hint {
    font-size: 12px;
    color: var(--gray-500);
    padding: 8px 16px 0;
    margin: 0;
    line-height: 1.4;
}

.tech-nearby-list {
    overflow-y: auto;
    padding: 12px 16px 16px;
    flex: 1;
}

.tech-nearby-card {
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--gray-50);
}

.tech-nearby-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tech-nearby-card-top strong {
    font-size: 14px;
}

.tech-nearby-meta {
    font-size: 11px;
    color: var(--gray-500);
    margin-left: auto;
}

.tech-nearby-cities {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 10px;
}

.tech-nearby-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tech-nearby-badge.overlap {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
}

.tech-nearby-no-phone {
    font-size: 11px;
    color: var(--gray-400);
    font-style: italic;
}

.tech-call-btn {
    text-decoration: none;
}

/* Banner podglądu admina */
.tech-preview-banner {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 10055;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
    font-size: 13px;
    color: #92400e;
}

body.tech-view-mode:has(.tech-preview-banner:not([hidden])) .app-main {
    margin-top: 40px;
}

/* Tablet preview (admin) */
body.tech-view-tablet .tech-view-bar {
    max-width: 768px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px 12px 0 0;
}

body.tech-view-tablet .tech-task-sheet {
    max-width: 100%;
    left: 0;
    right: 0;
    width: 100%;
    transform: translateY(100%);
}

body.tech-view-tablet .tech-task-sheet.open {
    transform: translateY(0);
}

body.tech-view-tablet .tech-calendar-modal {
    max-width: 100%;
}

@media (min-width: 769px) {
    body.tech-view-mode:not(.tech-view-tablet) .tech-view-bar,
    body.tech-view-mode:not(.tech-view-tablet) .tech-task-sheet {
        display: none;
    }
}

/* Kalendarz technika */
.tech-calendar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 10065;
    align-items: flex-end;
    justify-content: center;
}

.tech-calendar-overlay.active {
    display: flex;
}

.tech-calendar-modal {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    background: var(--bg-surface);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: techSheetUp 0.25s ease;
}

body.tech-view-mode .tech-calendar-modal,
body.tech-view-mode .tech-task-sheet {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
}

.tech-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.tech-cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px 4px;
    border-bottom: 1px solid var(--gray-100);
}

.tech-cal-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--gray-50);
    color: var(--gray-800);
    cursor: pointer;
    flex-shrink: 0;
}

.tech-cal-date-display {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.tech-cal-week-kw {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-900, #0f172a);
}

.tech-cal-week-range {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
}

.tech-cal-week-day {
    font-size: 11px;
    color: var(--gray-500);
}

.tech-cal-today-btn {
    flex-shrink: 0;
    margin-left: 4px;
}

.tech-map-legend-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    padding-bottom: calc(var(--tech-bar-height) + 12px);
    background: rgba(15, 23, 42, 0.4);
}

.tech-map-legend-overlay.active {
    display: flex;
}

.tech-map-legend-panel {
    width: min(400px, 100%);
    max-height: 50vh;
    overflow: auto;
    background: var(--bg-surface);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.2);
}

.tech-map-legend-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tech-colleagues-map-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--gray-200));
    font-size: 13px;
    line-height: 1.35;
    cursor: pointer;
}

.tech-colleagues-map-toggle input {
    margin-top: 2px;
    flex-shrink: 0;
}

.tech-map-legend-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin: 0 0 12px;
    line-height: 1.4;
}

.tech-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
}

.tech-legend-row.is-me {
    font-weight: 600;
}

.tech-legend-swatch {
    border-radius: 50%;
    flex-shrink: 0;
}

.tech-calendar-header h2 {
    font-size: 15px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tech-calendar-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--gray-100);
}

.tech-cal-day {
    min-width: 0;
    padding: 6px 4px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font: inherit;
    color: inherit;
}

.tech-cal-day.has-tasks .tech-cal-day-count {
    color: var(--primary-dark, #1d4ed8);
}

.tech-cal-weekday {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--gray-500);
    line-height: 1.1;
}

.tech-cal-day-num {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.tech-cal-day.active {
    background: color-mix(in srgb, var(--primary) 14%, var(--bg-surface));
    border-color: var(--primary);
    color: var(--primary-dark);
}

.tech-cal-day-count {
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gray-400);
    line-height: 1;
}

.tech-cal-empty {
    font-size: 13px;
    color: var(--gray-500);
    padding: 8px;
    margin: 0;
}

.tech-calendar-body {
    overflow-y: auto;
    flex: 1;
    padding: 10px 12px 16px;
    -webkit-overflow-scrolling: touch;
}

body.tech-calendar-open .tech-view-bar {
    z-index: 100;
}

/* Samouczek mobilny technika */
.tour-tooltip.tour-tooltip--tech-sheet {
    max-width: none;
    width: auto;
}

.tour-highlight--subtle {
    box-shadow: 0 0 0 3px var(--primary), 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

body.tech-view-mode .onboarding-hint-banner {
    display: none;
}

/* Pasek trasy / ETA (Faza 5.3) */
.tech-route-bar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--tech-bar-height) + max(6px, env(safe-area-inset-bottom)) + 4px);
    z-index: 88;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
    border: 1px solid var(--gray-200);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(8px);
    font-size: 12px;
}

.tech-route-bar.tech-route-late {
    border-color: #f87171;
    background: color-mix(in srgb, #fef2f2 92%, transparent);
}

.tech-route-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tech-route-main strong {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.tech-route-addr {
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tech-route-meta {
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}

.tech-route-nav {
    flex-shrink: 0;
    white-space: nowrap;
}

body.tech-view-mode.tech-route-visible .sidebar {
    bottom: calc(var(--tech-bar-height) + 56px);
}

/* ===== Task card wrapper (IU-4) ===== */
.tech-task-card {
    border-bottom: 1px solid var(--gray-100, #f1f5f9);
}
.tech-task-card:last-child { border-bottom: none; }

.tech-task-card .tech-task-row {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 0;
    text-align: left;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    min-height: 52px;
}
.tech-task-card .tech-task-row:active { background: var(--gray-50, #f8fafc); }

.tech-task-card .tech-task-time {
    flex: 0 0 auto;
    max-width: 34%;
}

.tech-task-card .tech-task-addr {
    flex: 1 1 0;
    min-width: 0;
}

.tech-task-card .tech-task-row-actions {
    flex: 0 0 auto;
    align-self: center;
}

/* ===== Status badge ===== */
.tech-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
    background: var(--gray-200, #e2e8f0);
    color: var(--gray-700, #334155);
}
.tech-status-badge.tech-status-arrived     { background: #dbeafe; color: #1e40af; }
.tech-status-badge.tech-status-in_progress { background: #fef3c7; color: #92400e; }
.tech-status-badge.tech-status-done        { background: #dcfce7; color: #166534; }
.tech-status-badge.tech-status-missed      { background: #fee2e2; color: #991b1b; }

/* ===== Narzędzia zadania (ikony z podpisem) ===== */
.tech-task-tools-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px 8px;
}

.tech-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.tech-tool-btn i {
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.tech-tool-btn:active {
    transform: scale(0.98);
}

.tech-tool-map {
    margin-left: auto;
    color: var(--primary-dark, #1d4ed8);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--gray-200));
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-surface));
}

.tech-tool-delay {
    color: #b45309;
    border-color: #fcd34d;
    background: #fffbeb;
}

/* ===== Field actions panel (zwijany) ===== */
.tech-field-actions {
    padding: 0 10px 10px;
}

.tech-fa-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--gray-800);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.tech-fa-toggle .tech-fa-chevron {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.2s ease;
}

.tech-fa-toggle.expanded .tech-fa-chevron {
    transform: rotate(180deg);
}

.tech-fa-toggle-label {
    flex: 1;
    min-width: 0;
}

.tech-fa-panel {
    margin-top: 8px;
    padding-top: 4px;
}

.tech-fa-panel[hidden] {
    display: none !important;
}

.tech-fa-status-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
}

@media (min-width: 400px) {
    .tech-fa-status-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 520px) {
    .tech-fa-status-row {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.tech-fa-status-btn {
    min-width: 0;
    font-size: 10px;
    font-weight: 500;
    padding: 5px 4px;
    border-radius: 6px;
    border: 1px solid var(--gray-200, #e2e8f0);
    background: var(--gray-50, #f8fafc);
    color: var(--gray-600, #475569);
    cursor: pointer;
    white-space: normal;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    transition: background 0.12s, color 0.12s;
}
.tech-fa-status-btn:active,
.tech-fa-status-btn.active {
    border-color: var(--primary, #3b82f6);
    background: var(--primary, #3b82f6);
    color: #fff;
}

.tech-fa-note-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.tech-fa-note-input {
    flex: 1;
    font-size: 13px;
    padding: 6px 8px;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 6px;
    resize: none;
    background: var(--white, #fff);
    color: var(--text-primary, #1e293b);
    font-family: inherit;
}
.tech-fa-note-input:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}

.tech-fa-note-send {
    flex-shrink: 0;
    align-self: flex-end;
    font-size: 12px;
    padding: 6px 10px;
}

.tech-task-delay {
    color: #b45309;
    background: transparent;
    border: none;
    padding: 4px 5px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
}
.tech-task-delay:hover { background: rgba(180, 83, 9, 0.12); }

/* ===== iPhone SE i wąskie telefony (≤390px) ===== */
body.tech-view-narrow {
    --tech-bar-height: 54px;
    --tech-chrome-height: 44px;
}

body.tech-view-compact.tech-view-mode .app-main,
body.tech-view-narrow.tech-view-mode .app-main {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

body.tech-view-narrow .tech-mobile-chrome {
    padding-left: 4px;
    padding-right: 4px;
    gap: 4px;
}

body.tech-view-narrow .tech-chrome-title strong {
    font-size: 13px;
}

body.tech-view-narrow .tech-chrome-test-badge {
    font-size: 8px;
    padding: 1px 5px;
}

body.tech-view-narrow .tech-chrome-btn {
    width: 36px;
    height: 36px;
}

body.tech-view-narrow .tech-view-bar {
    gap: 2px;
    padding: 3px 4px;
    padding-bottom: max(3px, env(safe-area-inset-bottom));
}

body.tech-view-narrow .tech-bar-btn {
    min-height: 46px;
    padding: 2px 1px;
    gap: 1px;
    font-size: 7px;
    border-radius: 8px;
}

body.tech-view-narrow .tech-bar-btn i {
    font-size: 13px;
}

body.tech-view-narrow .tech-bar-btn.tech-bar-accent span {
    max-width: 100%;
}

body.tech-view-narrow .tech-task-sheet {
    max-height: min(58vh, calc(100dvh - var(--tech-chrome-height) - var(--tech-bar-height) - 80px));
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
}

body.tech-view-narrow .tech-sheet-body {
    padding: 6px 8px 10px;
}

body.tech-view-narrow .tech-sheet-header {
    padding: 4px 10px 8px;
}

body.tech-view-narrow .tech-sheet-header h3 {
    font-size: 13px;
}

body.tech-view-narrow .tech-task-card .tech-task-row {
    padding: 8px 8px;
    gap: 6px;
    min-height: 44px;
}

body.tech-view-narrow .tech-task-card .tech-task-time {
    font-size: 10px;
    max-width: 30%;
}

body.tech-view-narrow .tech-task-addr {
    font-size: 12px;
}

body.tech-view-narrow .tech-task-distance-row {
    padding: 0 8px 6px;
}

body.tech-view-narrow .tech-fa-status-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.tech-view-narrow .tech-fa-status-btn {
    font-size: 9px;
    padding: 5px 3px;
}

body.tech-view-narrow .tech-fa-note-row {
    flex-direction: column;
    align-items: stretch;
}

body.tech-view-narrow .tech-fa-note-send {
    width: 100%;
    align-self: stretch;
}

body.tech-view-narrow .tech-field-actions {
    padding: 0 8px 8px;
}

body.tech-view-narrow .tech-task-tools-row {
    padding: 0 8px 6px;
    gap: 4px;
}

body.tech-view-narrow .tech-tool-btn {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 10px;
}

body.tech-view-narrow .tech-tool-btn span {
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.tech-view-narrow .tech-tool-map {
    margin-left: 0;
    width: 100%;
    justify-content: center;
}

body.tech-view-narrow .tech-calendar-strip {
    gap: 2px;
    padding: 6px 4px;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

body.tech-view-narrow .tech-cal-day {
    padding: 4px 1px;
    border-radius: 6px;
    min-height: 44px;
    justify-content: center;
}

body.tech-view-narrow .tech-cal-weekday {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.tech-view-narrow .tech-cal-day-num {
    font-size: 13px;
}

body.tech-view-narrow .tech-cal-day-count {
    font-size: 8px;
    min-height: 10px;
}

body.tech-view-narrow .tech-cal-nav {
    padding: 6px 8px 4px;
    gap: 4px;
}

body.tech-view-narrow .tech-cal-date-display {
    font-size: 13px;
    min-width: 0;
    flex: 1;
}

body.tech-view-narrow .tech-cal-nav-btn {
    width: 32px;
    height: 32px;
}

body.tech-view-narrow .tech-cal-today-btn {
    font-size: 10px;
    padding: 4px 6px;
}

body.tech-view-narrow .tech-calendar-modal {
    max-height: 92dvh;
    width: 100%;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
}

body.tech-view-narrow .tech-route-bar {
    left: 4px;
    right: 4px;
    padding: 6px 8px;
    font-size: 11px;
}

body.tech-view-narrow .tech-route-addr {
    font-size: 12px;
    -webkit-line-clamp: 1;
}

body.tech-view-narrow .tech-map-legend-panel,
body.tech-view-narrow .tech-map-legend-overlay {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
}

body.tech-view-narrow .tech-menu-panel {
    width: min(272px, 94vw);
}

body.tech-view-narrow .tech-menu-item {
    padding: 12px 14px;
    font-size: 14px;
}

body.tech-view-mode.tech-view-narrow #map {
    min-height: 120px;
}

body.tech-view-narrow.tech-task-sheet-open .tech-route-bar,
body.tech-view-narrow:has(.tech-task-sheet.open) .tech-route-bar {
    display: none;
}

/* Stałe kolumny Pon–Nd — nagłówek zawsze w tej samej kolumnie */
.tech-calendar-strip {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.tech-cal-dow-0 { grid-column: 1; }
.tech-cal-dow-1 { grid-column: 2; }
.tech-cal-dow-2 { grid-column: 3; }
.tech-cal-dow-3 { grid-column: 4; }
.tech-cal-dow-4 { grid-column: 5; }
.tech-cal-dow-5 { grid-column: 6; }
.tech-cal-dow-6 { grid-column: 7; }

