/* =============================================================================
   Biuro – styl GEOECOM
   Rama: granatowy pasek boczny, treść na jasnym panelu zaokrąglonym z lewej strony.
   Akcent: gradient zieleń → błękit z logo, poziomice w tle nagłówka.
   ============================================================================= */

:root {
  --granat: #14233b;
  --granat-2: #1c3050;
  --granat-tekst: #b8c4d8;
  --zielony: #2e9e6a;
  --zielony-ciemny: #24825a;
  --zielony-logo: #4fb58e;
  --blekit: #5b7fe8;
  --blekit-logo: #7fa0ff;
  --tlo: #f2f5f9;
  --ramka: #e3e8ef;
  --tekst: #1d2939;
  --tekst-2: #5b6b80;
  --akcent: linear-gradient(180deg, var(--zielony-logo), var(--blekit-logo));
  --akcent-poziomo: linear-gradient(90deg, var(--zielony-logo), var(--blekit-logo));
  --promien-duzy: 28px;
  --promien-karty: 18px;
  --szer-paska: 252px;
  --szer-paska-zwinietego: 84px;

  /* Bootstrap */
  --bs-body-color: var(--tekst);
  --bs-body-bg: var(--tlo);
  --bs-primary: var(--zielony);
  --bs-primary-rgb: 46, 158, 106;
  --bs-link-color: #2f5fc9;
  --bs-link-color-rgb: 47, 95, 201;
  --bs-link-hover-color: #23489b;
  --bs-link-hover-color-rgb: 35, 72, 155;
  --bs-border-color: var(--ramka);
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: 14px;
  --bs-font-sans-serif: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { font-size: .935rem; -webkit-font-smoothing: antialiased; }
h1, .h4 { font-weight: 650; letter-spacing: -.01em; }

/* --- Rama aplikacji ---------------------------------------------------------- */

body.z-paskiem { background: var(--granat); }
.uklad { display: flex; min-height: 100vh; }

.pasek {
  width: var(--szer-paska);
  flex-shrink: 0;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 0 14px 14px;
  color: var(--granat-tekst);
  transition: width .22s ease;
  overflow: hidden;
}
.pasek-logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; text-decoration: none; }
.pasek-logo-pelne { height: 40px; width: auto; flex-shrink: 0; }
.pasek-logo-znak {
  display: none; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 4px rgba(79, 181, 142, .25);
}
.pasek-logo-podpis {
  color: #fff; font-weight: 650; font-size: 1.05rem; padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, .2); white-space: nowrap;
}

.pasek-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 12px; scrollbar-width: thin; }
.pasek-sekcja {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: #7488a6;
  padding: 18px 14px 6px; white-space: nowrap;
}
.pasek-nav > a {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 10px 14px; margin: 2px 0;
  color: var(--granat-tekst); text-decoration: none; white-space: nowrap;
  border-radius: 16px 0 0 16px;
  transition: background .15s, color .15s;
}
.pasek-nav > a i { font-size: 1.15rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.pasek-nav > a:hover { background: rgba(255, 255, 255, .07); color: #fff; }

/* Aktywna pozycja „wtapia się” w panel treści – zakładka z zaokrągleniami jak w segregatorze. */
.pasek-nav > a.active { background: var(--tlo); color: var(--granat); font-weight: 650; }
.pasek-nav > a.active i { color: var(--zielony); }
.pasek-nav > a.active::before,
.pasek-nav > a.active::after {
  content: ""; position: absolute; right: 0; width: 18px; height: 18px; pointer-events: none;
}
.pasek-nav > a.active::before { top: -18px; border-bottom-right-radius: 18px; box-shadow: 6px 6px 0 6px var(--tlo); }
.pasek-nav > a.active::after { bottom: -18px; border-top-right-radius: 18px; box-shadow: 6px -6px 0 6px var(--tlo); }
/* pionowy akcent przy aktywnej pozycji */
.pasek-nav > a.active > i::before { position: relative; }
.pasek-nav > a.active { box-shadow: inset 3px 0 0 0 var(--zielony-logo); }

.pasek-podmenu { display: flex; flex-direction: column; padding: 4px 0 6px 50px; }
.pasek-podmenu a {
  color: var(--granat-tekst); text-decoration: none; font-size: .86rem; padding: 5px 10px;
  border-radius: 10px 0 0 10px; white-space: nowrap; position: relative;
}
.pasek-podmenu a::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: #4a5d7a;
}
.pasek-podmenu a:hover { color: #fff; }
.pasek-podmenu a.aktywna { color: #fff; font-weight: 600; }
.pasek-podmenu a.aktywna::before { background: var(--akcent-poziomo); }

.pasek-stopka { padding-right: 14px; }
.pasek-uzytkownik {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px; padding: 8px 10px; color: #fff; text-align: left;
}
.pasek-uzytkownik:hover { background: rgba(255, 255, 255, .09); }
.pasek-uzytkownik-dane { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pasek-uzytkownik-dane strong { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pasek-uzytkownik-dane small { color: #8fa1bd; font-size: .74rem; }
.awatar {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff;
  background: linear-gradient(135deg, var(--zielony-logo), var(--blekit));
}

/* Zwinięty pasek – same ikony */
html.pasek-zwiniety .pasek { width: var(--szer-paska-zwinietego); }
html.pasek-zwiniety .pasek-logo-pelne { display: none; }
html.pasek-zwiniety .pasek-logo-znak { display: block; }
html.pasek-zwiniety .pasek-logo { padding-left: 9px; }
html.pasek-zwiniety .pasek-logo-podpis,
html.pasek-zwiniety .pasek-nav > a span,
html.pasek-zwiniety .pasek-podmenu,
html.pasek-zwiniety .pasek-uzytkownik-dane,
html.pasek-zwiniety .pasek-uzytkownik > .bi { display: none; }
html.pasek-zwiniety .pasek-sekcja { padding: 10px 0 4px; height: 1px; overflow: hidden; }
html.pasek-zwiniety .pasek-sekcja span { visibility: hidden; }
html.pasek-zwiniety .pasek-sekcja::after { content: ""; display: block; margin: 0 18px 0 8px; border-top: 1px solid rgba(255, 255, 255, .1); }
html.pasek-zwiniety .pasek-nav > a { justify-content: center; padding-left: 10px; padding-right: 14px; }
html.pasek-zwiniety .pasek-uzytkownik { justify-content: center; padding: 6px; background: transparent; border-color: transparent; }

/* Panel treści – jasna „kartka” zaokrąglona z lewej strony */
.glowna {
  flex: 1; min-width: 0;
  background: var(--tlo);
  margin: 10px 0;
  border-radius: var(--promien-duzy) 0 0 var(--promien-duzy);
  min-height: calc(100vh - 20px);
  position: relative;
  overflow: clip;
}
/* Akcent graficzny: poziomice w prawym górnym rogu + cienka linia gradientu u góry */
.glowna::before {
  content: ""; position: absolute; inset: 0 0 auto auto; width: min(720px, 70%); height: 260px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 260' fill='none' stroke-width='1.2'%3E%3Cg stroke='%234fb58e' stroke-opacity='.28'%3E%3Cpath d='M720 18c-90 6-150 40-230 38S350 8 260 30 120 92 0 70'/%3E%3Cpath d='M720 52c-80 10-140 46-220 46s-130-44-210-26-150 66-250 54'/%3E%3Cpath d='M720 88c-70 14-130 52-200 54s-120-34-190-22-120 54-200 52'/%3E%3C/g%3E%3Cg stroke='%237fa0ff' stroke-opacity='.25'%3E%3Cpath d='M720 126c-60 16-110 50-170 54s-100-26-160-16-100 44-160 46'/%3E%3Cpath d='M720 164c-50 14-90 42-140 46s-80-18-130-10-80 34-130 36'/%3E%3Cpath d='M720 200c-40 12-70 30-110 32s-60-10-100-6'/%3E%3C/g%3E%3C/svg%3E") no-repeat top right / cover;
  mask-image: linear-gradient(to left, #000 40%, transparent);
}
.glowna::after {
  content: ""; position: absolute; top: 0; left: var(--promien-duzy); right: 0; height: 3px;
  background: var(--akcent-poziomo); opacity: .85;
}

.glowna-gora { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 18px 28px 0; }
.przycisk-paska {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--ramka); background: #fff; color: var(--tekst-2);
  display: grid; place-items: center; font-size: 1.1rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.przycisk-paska:hover { color: var(--zielony); border-color: #cfe9dc; }
.glowna-tresc { position: relative; z-index: 1; padding: 18px 28px 40px; }

.pasek-zaslona { display: none; }

/* Telefon / wąski ekran: pasek wysuwany nad treścią */
@media (max-width: 767.98px) {
  .pasek { position: fixed; left: 0; top: 0; z-index: 1045; transform: translateX(-100%); transition: transform .22s ease; background: var(--granat); width: var(--szer-paska) !important; }
  html.pasek-otwarty .pasek { box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  html.pasek-otwarty .pasek { transform: none; }
  html.pasek-otwarty .pasek-zaslona { display: block; position: fixed; inset: 0; background: rgba(10, 18, 32, .45); z-index: 1040; }
  html.pasek-zwiniety .pasek-nav > a span, html.pasek-zwiniety .pasek-logo-podpis, html.pasek-zwiniety .pasek-uzytkownik-dane, html.pasek-zwiniety .pasek-logo-pelne { display: initial; }
  html.pasek-zwiniety .pasek-logo-znak { display: none; }
  .glowna { margin: 0; border-radius: 0; min-height: 100vh; }
  .glowna::after { left: 0; }
  .glowna-gora, .glowna-tresc { padding-left: 16px; padding-right: 16px; }
}

/* --- Karty: lewy brzeg mocniej zaokrąglony, pasek akcentu ------------------ */

.card {
  --bs-card-border-width: 0;
  --bs-card-border-radius: 8px;
  --bs-card-inner-border-radius: 8px;
  --bs-card-cap-bg: #fff;
  --bs-card-bg: #fff;
  border-radius: var(--promien-karty) 8px 8px var(--promien-karty);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .05) !important;
  position: relative;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--akcent); opacity: .9; z-index: 1; pointer-events: none;
}
.card > .card-header:first-child { border-top-left-radius: var(--promien-karty); border-top-right-radius: 8px; }
.card > :last-child { border-bottom-left-radius: var(--promien-karty); border-bottom-right-radius: 8px; }
.card-header {
  background: #fff; border-bottom: 1px solid var(--ramka);
  font-weight: 650; font-size: .9rem; padding: .8rem 1.1rem .8rem 1.25rem;
}
.card-body { padding-left: 1.25rem; }
.card-footer { background: #fafbfd; border-top: 1px solid var(--ramka); }
.card .table { --bs-table-bg: transparent; }
.card > .table-responsive:last-child, .card .card-body.p-0 { border-bottom-left-radius: var(--promien-karty); overflow: hidden; }

/* --- Tabele ------------------------------------------------------------------ */

.table { --bs-table-hover-bg: #f5f9ff; }
.table > thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tekst-2);
  font-weight: 650; border-bottom-color: var(--ramka); background: #fafbfd; white-space: nowrap;
}
.table > thead th a { color: inherit; text-decoration: none; }
.table > thead th.asc a::after { content: " ↑"; } .table > thead th.desc a::after { content: " ↓"; }
.table td, .table th { padding-top: .6rem; padding-bottom: .6rem; }
.table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.table-danger { --bs-table-bg: #fdecec; }
.pagination { --bs-pagination-active-bg: var(--zielony); --bs-pagination-active-border-color: var(--zielony); --bs-pagination-color: var(--tekst); margin: .75rem 1.25rem; }

/* --- Przyciski, formularze, znaczniki ------------------------------------------ */

.btn { --bs-btn-font-weight: 550; border-radius: 10px; }
.btn-sm { border-radius: 9px; }
.btn-primary {
  --bs-btn-bg: var(--zielony); --bs-btn-border-color: var(--zielony);
  --bs-btn-hover-bg: var(--zielony-ciemny); --bs-btn-hover-border-color: var(--zielony-ciemny);
  --bs-btn-active-bg: #1e6e4b; --bs-btn-active-border-color: #1e6e4b;
  --bs-btn-disabled-bg: var(--zielony); --bs-btn-disabled-border-color: var(--zielony);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), inset 0 -2px 0 rgba(0, 0, 0, .08);
}
.btn-outline-primary {
  --bs-btn-color: var(--zielony-ciemny); --bs-btn-border-color: #b9dfcb;
  --bs-btn-hover-bg: var(--zielony); --bs-btn-hover-border-color: var(--zielony); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--zielony-ciemny); --bs-btn-active-border-color: var(--zielony-ciemny);
}
.btn-outline-secondary { --bs-btn-color: var(--tekst-2); --bs-btn-border-color: var(--ramka); --bs-btn-bg: #fff; --bs-btn-hover-bg: #eef2f7; --bs-btn-hover-color: var(--tekst); --bs-btn-hover-border-color: #d5dce6; }
.btn-secondary { --bs-btn-bg: var(--granat-2); --bs-btn-border-color: var(--granat-2); --bs-btn-hover-bg: var(--granat); }
.btn-success { --bs-btn-bg: var(--zielony); --bs-btn-border-color: var(--zielony); --bs-btn-hover-bg: var(--zielony-ciemny); --bs-btn-hover-border-color: var(--zielony-ciemny); }

.form-control, .form-select { border-color: #d6dde7; border-radius: 10px; background-color: #fff; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--zielony-logo); box-shadow: 0 0 0 .2rem rgba(79, 181, 142, .2);
}
.form-check-input:checked { background-color: var(--zielony); border-color: var(--zielony); }
.form-label { font-weight: 550; font-size: .86rem; color: #344256; }
.badge { font-weight: 600; border-radius: 8px; }
.badge.text-bg-secondary { background: #e7edf5 !important; color: var(--granat-2) !important; }
.alert { border: 0; border-radius: 14px 8px 8px 14px; box-shadow: inset 3px 0 0 currentColor; }
.breadcrumb { --bs-breadcrumb-divider-color: #9aa8bb; font-size: .82rem; }
.breadcrumb a { color: var(--tekst-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--zielony); }
.dropdown-menu { border: 0; border-radius: 14px; padding: .4rem; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); }
.dropdown-item { border-radius: 9px; padding: .45rem .75rem; }
.dropdown-item:active { background: var(--zielony); }

/* Zakładki (produkcja) */
.nav-tabs { --bs-nav-tabs-border-color: var(--ramka); }
.nav-tabs .nav-link { color: var(--tekst-2); border-radius: 14px 14px 0 0; font-weight: 550; }
.nav-tabs .nav-link.active { color: var(--tekst); background: #fff; border-color: var(--ramka) var(--ramka) #fff; box-shadow: inset 0 3px 0 var(--zielony-logo); }

/* --- Pulpit ------------------------------------------------------------------- */

.kafelek { transition: transform .15s, box-shadow .15s; }
.kafelek:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16, 24, 40, .1) !important; }
.kafelek .wartosc { font-size: 2.3rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.kafelek-ikona {
  width: 42px; height: 42px; border-radius: 14px 6px 6px 14px; display: grid; place-items: center; font-size: 1.2rem; color: #fff;
  background: linear-gradient(135deg, var(--zielony-logo), var(--blekit));
}
.kafelek-ikona.alarm { background: linear-gradient(135deg, #f08a6c, #e5484d); }
.powitanie small { color: var(--tekst-2); }

/* --- Ekran logowania ------------------------------------------------------------- */

body.bez-paska {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(127, 160, 255, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(79, 181, 142, .18), transparent 60%),
    var(--granat);
}
.bez-paska-tresc { padding: 0 16px; }
.logowanie { max-width: 400px; margin: 12vh auto 0; }
.logowanie .card { border-radius: var(--promien-duzy) 12px 12px var(--promien-duzy); }
.logowanie .card::before { top: 24px; bottom: 24px; width: 4px; }
.logowanie .logowanie-naglowek { background: transparent; padding: 28px 0 8px; }
.logowanie p.text-muted { color: #8fa1bd !important; }
.logo-logowanie { height: 64px; width: auto; }

/* --- Mapa ------------------------------------------------------------------------ */

.mapa { height: 440px; border-radius: 14px 8px 8px 14px; }
.mapa-podglad { height: 340px; }
.mapa-zbiorcza { height: 380px; border-radius: var(--promien-karty) 8px 8px var(--promien-karty); }
.leaflet-control .przycisk-dzialki { width: 30px; height: 30px; line-height: 30px; text-align: center; font-size: 16px; cursor: pointer; background: #fff; display: block; color: #333; }
.leaflet-control .przycisk-dzialki.aktywny { background: var(--zielony); color: #fff; }
.mapa.tryb-dzialek { cursor: crosshair; }

/* --- Arkusz produkcji -------------------------------------------------------------- */

.arkusz-kontener { max-height: 75vh; }
.arkusz { --bs-table-bg: #fff; }
.arkusz thead th { position: sticky; top: 0; background: #fafbfd; z-index: 2; }
.arkusz .arkusz-projekt { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 16rem; max-width: 22rem; box-shadow: inset -1px 0 0 var(--ramka); }
.arkusz thead .arkusz-projekt { z-index: 3; background: #fafbfd; }
.arkusz .arkusz-kolumna { min-width: 6.5rem; max-width: 9rem; text-align: center; vertical-align: bottom; white-space: normal; text-transform: none; letter-spacing: 0; font-size: .76rem; }
.arkusz .komorka { padding: 0 !important; text-align: center; width: 6.5rem; height: 2.75rem; color: #fff; transition: background .15s; }
.arkusz .komorka-przycisk { width: 100%; height: 100%; min-height: 2.75rem; border: 0; background: transparent; color: inherit; font-size: 1.25rem; cursor: pointer; }
.arkusz .komorka:not(.zaznaczona):hover { background: #eaf6f0; }
.arkusz .komorka.zaznaczona { background: linear-gradient(135deg, var(--zielony-logo), var(--zielony)); }
.arkusz .komorka-przycisk:focus-visible { outline: 2px solid var(--blekit); outline-offset: -2px; }
/* Notatka w komórce: ikonka w rogu (widoczna po najechaniu albo gdy notatka istnieje) + znacznik jak w Excelu */
.arkusz .komorka { position: relative; }
.arkusz .komorka-notatka-przycisk {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 6px;
  display: grid; place-items: center; font-size: .72rem; line-height: 1;
  background: rgba(255, 255, 255, .85); color: var(--tekst-2); opacity: 0; transition: opacity .12s;
}
.arkusz .komorka:hover .komorka-notatka-przycisk,
.arkusz .komorka-notatka-przycisk:focus-visible,
.arkusz .komorka.ma-notatke .komorka-notatka-przycisk { opacity: 1; }
.arkusz .komorka.ma-notatke .komorka-notatka-przycisk { color: #b7791f; background: #fff7e6; }
.arkusz .komorka.ma-notatke::after {
  content: ""; position: absolute; left: 0; bottom: 0; border-style: solid; border-width: 0 0 9px 9px;
  border-color: transparent transparent #f0a020 transparent; pointer-events: none;
}
.modal-content { border: 0; border-radius: var(--promien-karty) 10px 10px var(--promien-karty); }
.notatka-tresc { max-width: 28rem; white-space: normal; }

/* --- Formularz oferty --- */
.sekcja-nr {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: .4rem; border-radius: 8px 4px 4px 8px;
  background: var(--akcent-poziomo); color: #fff; font-size: .78rem; font-weight: 700;
}
.wybor-kafelek { position: relative; cursor: pointer; margin: 0; }
.wybor-kafelek input { position: absolute; opacity: 0; }
.wybor-kafelek span {
  display: block; padding: .55rem 1rem; border: 1px solid #d6dde7; border-radius: 12px 6px 6px 12px; background: #fff; font-weight: 550;
  transition: all .12s;
}
.wybor-kafelek:hover span { border-color: var(--zielony-logo); }
.wybor-kafelek input:checked + span { border-color: var(--zielony); background: #eaf6f0; color: var(--zielony-ciemny); box-shadow: inset 3px 0 0 var(--zielony); }
.wybor-kafelek input:focus-visible + span { outline: 2px solid var(--blekit); outline-offset: 2px; }
.pasek-zapisu {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem; margin: 0 -.25rem; background: rgba(242, 245, 249, .92); backdrop-filter: blur(6px);
  border-top: 1px solid var(--ramka); border-radius: 14px 14px 0 0;
}
