:root{
  --bg:#f6f8fb;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --primary:#0ea5e9;
  --primary-2:#2563eb;
  --success:#16a34a;
  --warning:#f59e0b;
  --danger:#ef4444;
  --shadow:0 10px 30px rgba(2,8,23,.08);
  --radius:14px;
  --sidebar:280px;
  --topbar:76px;
  --font:ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;

  --sidebar-warm:#f3eadf;
  --sidebar-warm-2:#ede1d2;
  --sidebar-line:#e2d2bf;
  --layout-warm:#f6efe6;
  --main-surface:#f8f3ed;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:linear-gradient(180deg, var(--layout-warm) 0%, #f2e9de 100%);
}

a{color:inherit;text-decoration:none}
button,input,select,textarea{font-family:inherit}

.app{
  display:grid;
  grid-template-columns:var(--sidebar) 1fr;
  min-height:100vh;
  align-items:stretch;
}

/* =========================
   SIDEBAR
========================= */

.sidebar{
  background:linear-gradient(180deg, var(--sidebar-warm) 0%, var(--sidebar-warm-2) 100%);
  border-right:1px solid var(--sidebar-line);
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  padding:18px 16px 14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px;
  margin:4px 4px 14px;
  border:1px solid #e7d8c8;
  border-radius:18px;
  background:linear-gradient(180deg, #f7efe6 0%, #efe2d3 100%);
  box-shadow:0 8px 20px rgba(120, 88, 49, .08);
  flex:0 0 auto;
  
    cursor:pointer;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease,
    border-color .18s ease;
}

.brand .logo{
  width:52px;
  height:52px;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  border:1px solid #e7d8c8;
  box-shadow:0 6px 14px rgba(15,23,42,.08);
  font-size:28px;
  line-height:1;
  flex:0 0 52px;
}

.brand > div:last-child{
  min-width:0;
  flex:1;
}

.brand .title{
  font-size:26px;
  font-weight:900;
  line-height:1;
  letter-spacing:.4px;
  color:#0f172a;
}

.brand .subtitle{
  font-size:13px;
  color:#536273;
  margin-top:6px;
  line-height:1.3;
  white-space:normal;
  overflow-wrap:anywhere;
}


/* 🔥 hover efekt */
.brand:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 28px rgba(120, 88, 49, .18);
  background:linear-gradient(180deg, #f9f2ea 0%, #f1e5d8 100%);
  border-color:#d8c2ab;
}

/* kliknięcie */
.brand:active{
  transform:translateY(0);
  box-shadow:0 6px 14px rgba(0,0,0,.12);
}

/* opcjonalnie: animacja samego logo */
.brand:hover .logo{
  transform:scale(1.08);
}

/* płynność logo */
.brand .logo{
  transition:transform .18s ease;
}

.nav{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding-right:4px;
  padding-bottom:12px;
}

.nav::-webkit-scrollbar{
  width:8px;
}

.nav::-webkit-scrollbar-thumb{
  background:#dbe3ee;
  border-radius:999px;
}

.nav a,
.submenu-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:12px;
  color:#0f172a;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    background-color .16s ease,
    color .16s ease,
    border-color .16s ease;
}

.nav a:hover,
.submenu-toggle:hover{
  background:#f1f5f9;
}

.nav a.active{
  background:#1f2937;
  color:#fff;
  box-shadow:0 8px 20px rgba(31,41,55,.18);
}

.nav .icon{
  width:18px;
  height:18px;
  opacity:.9;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}



/* =========================
   OPEN SUBMENU BLOCK
========================= */

.nav-item.has-submenu{
  border-radius:16px;
  transition:
    background-color .18s ease,
    box-shadow .18s ease,
    border-color .18s ease;
}

.nav-item.has-submenu.open{
  background:rgba(255,255,255,.45);
  border:1px solid #e7d8c8;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.35);
  padding:6px;
}

.nav-item.has-submenu.open > .submenu-toggle{
  background:transparent;
  font-weight:700;
}

.nav-item.has-submenu.open .submenu{
  display:block;
}

.nav-item.has-submenu.open .submenu a{
  border-radius:10px;
}

.nav-item.has-submenu.open .submenu a:hover{
  background:rgba(255,255,255,.55);
}

/* aktywny element w rozwiniętej grupie */
.nav-item.has-submenu.open .submenu a.active{
  background:#1f2937;
  color:#fff;
  box-shadow:0 8px 20px rgba(31,41,55,.18);
}


.submenu-toggle .arrow{
  margin-left:auto;
  transition:transform .2s ease;
}


.has-submenu.open .arrow{
  transform:rotate(180deg);
}

/* =========================
   NAV / SUBMENU (POPRAWIONE)
========================= */

.nav-item{
  display:flex;
  flex-direction:column;
  gap:4px;
  border-radius:16px;
  transition:
    background-color .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    padding .18s ease;
}

.submenu-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  justify-content:space-between;
}

.submenu-toggle .arrow{
  margin-left:auto;
  transition:transform .2s ease;
}

.has-submenu .submenu{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding-left:18px;
  margin-top:0;
  max-height:0;
  overflow:hidden;
  opacity:0;
  transform:translateY(-4px);
  pointer-events:none;
  transition:
    max-height .26s ease,
    opacity .18s ease,
    transform .22s ease,
    margin-top .22s ease;
}

.has-submenu.open{
  background:linear-gradient(180deg, rgba(255,255,255,.42) 0%, rgba(255,255,255,.28) 100%);
  border:1px solid #e0cfbc;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.45),
    0 8px 18px rgba(120, 88, 49, .08);
  padding:6px;
}

.has-submenu.open > .submenu-toggle{
  background:transparent;
  font-weight:800;
}

.has-submenu.open > .submenu-toggle:hover{
  background:rgba(255,255,255,.28);
}

.has-submenu.open .submenu{
  display:flex;
  max-height:700px;
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
  margin-top:2px;
}

.has-submenu.open .arrow{
  transform:rotate(180deg);
}

.submenu a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 12px;
  border-radius:10px;
  font-size:14px;
  color:#3b2f24;
  transition:
    background-color .16s ease,
    color .16s ease,
    transform .16s ease,
    box-shadow .16s ease;
}

.submenu a:hover{
  background:rgba(255,255,255,.45);
}

.submenu a.active{
  background:#1f2937;
  color:#fff;
  box-shadow:0 8px 20px rgba(31,41,55,.18);
}

/* disabled nav */
.nav a.is-disabled,
.submenu-toggle.is-disabled,
.nav-item.is-disabled > .submenu-toggle{
  opacity:.45;
  pointer-events:none;
  cursor:not-allowed;
  filter:grayscale(.15);
  background:transparent !important;
  color:var(--muted) !important;
  border-color:transparent !important;
  box-shadow:none !important;
  transform:none !important;
}

.nav a.is-disabled:hover,
.submenu-toggle.is-disabled:hover{
  background:transparent !important;
  color:var(--muted) !important;
  box-shadow:none !important;
  transform:none !important;
}

.sidebar-footer{
  margin-top:auto;
  flex:0 0 auto;
  padding-top:14px;
  border-top:1px solid rgba(120, 88, 49, .12);
}

.user-chip{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  width:100%;
  padding:10px 12px;
  border-radius:18px;
  background:linear-gradient(180deg, #f7efe6 0%, #efe2d3 100%);
  border:1px solid #e7d8c8;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    0 8px 20px rgba(120, 88, 49, .08);
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease,
    border-color .18s ease;
}

.user-chip:hover{
  transform:translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    0 14px 28px rgba(120, 88, 49, .14);
  background:linear-gradient(180deg, #f9f2ea 0%, #f1e5d8 100%);
  border-color:#d8c2ab;
}

.avatar{
  width:42px;
  height:42px;
  border-radius:14px;
  background:#fff;
  border:1px solid #e7d8c8;
  box-shadow:0 6px 14px rgba(15,23,42,.08);
  display:grid;
  place-items:center;
  color:#334155;
  font-weight:800;
  font-size:15px;
  flex:0 0 auto;
}

.user-meta{
  min-width:0;
  flex:1 1 auto;
}

.user-meta .name{
  font-size:14px;
  font-weight:800;
  color:#0f172a;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.2;
}

.user-meta .role{
  font-size:12px;
  color:#7c6a58;
  margin-top:3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-transform:capitalize;
  line-height:1.2;
}

.logout-form{
  margin:0;
  flex:0 0 auto;
}

.logout{
  width:40px;
  height:40px;
  min-height:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #e7d8c8;
  border-radius:14px;
  background:#fff;
  color:#7c6a58;
  box-shadow:0 6px 14px rgba(15,23,42,.06);
  flex:0 0 auto;
}

.logout:hover{
  background:#ef4444;
  border-color:#ef4444;
  color:#fff;
  transform:translateY(-2px);
  box-shadow:0 8px 18px rgba(239,68,68,.28);
}

.logout:active{
  transform:translateY(0);
  box-shadow:0 2px 6px rgba(0,0,0,.15);
}

/* =========================
   MAIN
========================= */

.main{
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:100vh;
  background:var(--main-surface);
}

.topbar{
  height:var(--topbar);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 22px;
}

.hgroup .h1{
  font-size:26px;
  font-weight:900;
  line-height:1.1;
}

.hgroup .h2{
  color:var(--muted);
  font-size:13px;
  margin-top:4px;
}

.content{
  padding:6px 16px 16px 0;
  min-width:0;
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
}
/* =========================
   CARDS / UI
========================= */

.card{
  background:var(--panel);
  border:1px solid #e7ddd1;
  border-radius:var(--radius);
  box-shadow:0 1px 0 rgba(2,8,23,.02);
}

.notice{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  margin:12px 0;
}

.notice.ok{
  border-color:#bbf7d0;
  background:#f0fdf4;
}

.notice.err{
  border-color:#fecaca;
  background:#fef2f2;
}

.small{
  font-size:12px;
  color:var(--muted);
}

/* =========================
   KPI
========================= */

.kpis{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:14px;
  margin-bottom:14px;
}

.kpi{
  padding:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.kpi .label{
  color:var(--muted);
  font-size:13px;
  font-weight:600;
}

.kpi .value{
  font-size:28px;
  font-weight:900;
  margin-top:6px;
}

.kpi .badge{
  width:44px;
  height:44px;
  border-radius:14px;
  display:grid;
  place-items:center;
  border:1px solid var(--border);
}

/* =========================
   TABS / FILTERS / INPUTS
========================= */

.tabs{
  display:flex;
  align-items:center;
  gap:8px;
  margin:10px 0;
  flex-wrap:wrap;
}

.tab{
  border:1px solid var(--border);
  background:#fff;
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  font-size:13px;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    background-color .16s ease,
    color .16s ease,
    border-color .16s ease;
}

.tab.active{
  background:#0f172a;
  color:#fff;
  border-color:#0f172a;
}

.filters{
  display:grid;
  grid-template-columns:1.2fr repeat(4, minmax(0, .7fr));
  gap:10px;
  margin-bottom:12px;
}

.input,
.select{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  outline:none;
}

.input:focus,
.select:focus{
  border-color:#cbd5e1;
}

/* =========================
   SHIPMENTS
========================= */

.shipment{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  padding:14px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:#fff;
}

.shipment + .shipment{
  margin-top:10px;
}

.shipment .left{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.code{font-weight:900}

.pill{
  font-size:12px;
  border-radius:999px;
  padding:4px 10px;
  border:1px solid var(--border);
  background:#f8fafc;
  font-weight:700;
}

.pill.assigned{
  background:#e0f2fe;
  border-color:#bae6fd;
  color:#0369a1;
}

.pill.normal{
  background:#eff6ff;
  border-color:#dbeafe;
  color:#1d4ed8;
}

.meta{
  color:var(--muted);
  font-size:13px;
}

.dots{
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  cursor:pointer;
}

.dots:hover{
  background:#f8fafc;
}

/* =========================
   BUTTON SYSTEM
========================= */

button,
.tab,
.primary-btn,
a.btn,
.logout,
.form-tab-btn{
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    background-color .16s ease,
    color .16s ease,
    border-color .16s ease;
  cursor:pointer;
}

button,
.tab,
.primary-btn,
.logout,
.form-tab-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1.2;
  white-space:nowrap;
}

button:hover,
.tab:hover,
.primary-btn:hover,
a.btn:hover,
.form-tab-btn:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,0.15);
}

button:active,
.tab:active,
.primary-btn:active,
a.btn:active,
.form-tab-btn:active{
  transform:translateY(0);
  box-shadow:0 2px 6px rgba(0,0,0,0.12);
}

button:focus-visible,
.tab:focus-visible,
.primary-btn:focus-visible,
.form-tab-btn:focus-visible,
.logout:focus-visible{
  outline:2px solid rgba(37,99,235,.35);
  outline-offset:2px;
}

.tab{
  min-height:38px;
  padding:8px 12px;
}

.form-tab-btn{
  min-height:38px;
  padding:8px 12px;
}

.primary-btn{
  background:#0f172a;
  color:#fff;
  border:1px solid #0f172a;
  border-radius:12px;
  padding:12px 14px;
  min-height:44px;
  font-weight:700;
  display:flex;
  align-items:center;
  gap:10px;
  box-shadow:var(--shadow);
}

.primary-btn:hover{
  filter:brightness(1.05);
}

.primary-success{
  background:#16a34a;
  border:1px solid #16a34a;
  color:#fff;
}

.primary-success:hover{
  background:#15803d;
  border-color:#15803d;
}

/* login */
.login button{
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:#0f172a;
  color:#fff;
  border:none;
  border-radius:12px;
  padding:12px 14px;
  font-weight:700;
  box-shadow:var(--shadow);
}

/* logout */
.logout{
  width:36px;
  height:36px;
  min-height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  color:var(--muted);
  flex:0 0 auto;
}

.logout:hover{
  background:#ef4444;
  border-color:#ef4444;
  color:#fff;
  transform:translateY(-2px);
  box-shadow:0 6px 14px rgba(239,68,68,.35);
}

.logout:active{
  transform:translateY(0);
  box-shadow:0 2px 6px rgba(0,0,0,.15);
}

button:disabled,
.tab:disabled,
.primary-btn:disabled,
.form-tab-btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none !important;
  box-shadow:none !important;
  filter:grayscale(.08);
}

/* =========================
   ACTION BUTTONS
========================= */

/* delete */
button[data-del],
.tab[data-del],
button[data-user-del],
.tab[data-user-del],
button[data-company-del],
.tab[data-company-del],
button[data-setting-del],
.tab[data-setting-del],
button[data-backup-delete],
.tab[data-backup-delete]{
  background:#fff;
  border:1px solid #ef4444;
  color:#ef4444;
}

button[data-del]:hover,
.tab[data-del]:hover,
button[data-user-del]:hover,
.tab[data-user-del]:hover,
button[data-company-del]:hover,
.tab[data-company-del]:hover,
button[data-setting-del]:hover,
.tab[data-setting-del]:hover,
button[data-backup-delete]:hover,
.tab[data-backup-delete]:hover{
  background:#ef4444;
  border-color:#ef4444;
  color:#fff;
  box-shadow:0 6px 16px rgba(239,68,68,.35);
}

/* edit */
button[data-edit],
.tab[data-edit],
button[data-user-edit],
.tab[data-user-edit],
button[data-company-edit],
.tab[data-company-edit],
button[data-setting-edit],
.tab[data-setting-edit],
button[data-backup-import-file],
.tab[data-backup-import-file]{
  background:#fff;
  border:1px solid #000;
  color:#000;
}

button[data-edit]:hover,
.tab[data-edit]:hover,
button[data-user-edit]:hover,
.tab[data-user-edit]:hover,
button[data-company-edit]:hover,
.tab[data-company-edit]:hover,
button[data-setting-edit]:hover,
.tab[data-setting-edit]:hover,
button[data-backup-import-file]:hover,
.tab[data-backup-import-file]:hover{
  background:#000;
  border-color:#000;
  color:#fff;
  box-shadow:0 6px 16px rgba(0,0,0,.25);
}

/* addresses */
button[data-company-addresses],
.tab[data-company-addresses]{
  background:#fff;
  border:1px solid #2563eb;
  color:#2563eb;
}

button[data-company-addresses]:hover,
.tab[data-company-addresses]:hover{
  background:#2563eb;
  border-color:#2563eb;
  color:#fff;
  box-shadow:0 6px 16px rgba(37,99,235,.35);
}

/* address default */
button[data-address-default],
.tab[data-address-default]{
  background:#fff;
  border:1px solid #16a34a;
  color:#16a34a;
}

button[data-address-default]:hover,
.tab[data-address-default]:hover{
  background:#16a34a;
  border-color:#16a34a;
  color:#fff;
  box-shadow:0 6px 16px rgba(22,163,74,.35);
}

/* backup download */
button[data-backup-download],
.tab[data-backup-download]{
  background:#fff;
  border:1px solid #16a34a;
  color:#16a34a;
}

button[data-backup-download]:hover,
.tab[data-backup-download]:hover{
  background:#16a34a;
  border-color:#16a34a;
  color:#fff;
  box-shadow:0 6px 16px rgba(22,163,74,.35);
}

/* action icons - css only */
button[data-edit]::before,
.tab[data-edit]::before,
button[data-user-edit]::before,
.tab[data-user-edit]::before,
button[data-company-edit]::before,
.tab[data-company-edit]::before,
button[data-setting-edit]::before,
.tab[data-setting-edit]::before{
  content:"✎";
  font-size:12px;
  line-height:1;
}

button[data-del]::before,
.tab[data-del]::before,
button[data-user-del]::before,
.tab[data-user-del]::before,
button[data-company-del]::before,
.tab[data-company-del]::before,
button[data-setting-del]::before,
.tab[data-setting-del]::before,
button[data-backup-delete]::before,
.tab[data-backup-delete]::before{
  content:"✕";
  font-size:12px;
  line-height:1;
}

button[data-company-addresses]::before,
.tab[data-company-addresses]::before{
  content:"⌂";
  font-size:12px;
  line-height:1;
}

button[data-address-default]::before,
.tab[data-address-default]::before,
button[data-backup-download]::before,
.tab[data-backup-download]::before{
  content:"✓";
  font-size:12px;
  line-height:1;
}

button[data-backup-import-file]::before,
.tab[data-backup-import-file]::before{
  content:"↑";
  font-size:12px;
  line-height:1;
}

button[data-open-set-create]::before,
.tab[data-open-set-create]::before{
  content:"+";
  font-size:14px;
  font-weight:900;
  line-height:1;
}

/* =========================
   COMPANY FILTER PILLS
========================= */

#users-company-pills .tab{
  background:#fff;
  border:1px solid #16a34a;
  color:#16a34a;
  border-radius:999px;
  padding:6px 12px;
  font-weight:700;
}

#users-company-pills .tab:hover{
  background:#f0fdf4;
  border-color:#16a34a;
  color:#15803d;
}

#users-company-pills .tab.is-active,
#users-company-pills .tab[aria-pressed="true"]{
  background:#16a34a;
  border-color:#16a34a;
  color:#fff;
  box-shadow:0 4px 10px rgba(22,163,74,.25);
}

#users-company-pills .tab.is-active:hover,
#users-company-pills .tab[aria-pressed="true"]:hover{
  background:#15803d;
  border-color:#15803d;
}

/* =========================
   COMPANY CHECKBOX LIST
========================= */

.company-checkbox-list{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(220px,1fr));
  gap:8px;
  margin-top:4px;
}

.company-check{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border:1px solid var(--border);
  border-radius:8px;
  cursor:pointer;
  font-size:13px;
}

.company-check:hover{
  background:#f8fafc;
}

.company-check input{
  cursor:pointer;
}

/* =========================
   MODALS
========================= */

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:999;
  padding:16px;
}

.modal{
  width:min(1100px, 100%);
  background:var(--bg,#fff);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
}

.modal-title{
  font-weight:900;
}

.modal-body{
  padding:16px;
}

.modal-body-scroll{
  max-height:min(70vh, 900px);
  overflow:auto;
  padding-right:4px;
}

.modal-actions{
  margin-top:auto;
  display:flex;
  gap:10px;
  justify-content:flex-end;
  align-items:center;
  padding:14px 16px;
  border-top:1px solid var(--border);
  background:var(--bg,#fff);
}

.modal-msg{
  padding:0 16px;
  margin-top:12px;
}

.modal-msg .notice{
  margin:0;
}

/* form tabs inside modal */
.form-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:16px;
  padding-bottom:10px;
  border-bottom:1px solid var(--border);
}

.form-tab-btn{
  border:1px solid var(--border);
  background:var(--bg,#fff);
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}

.form-tab-btn.active{
  background:var(--accent-soft, rgba(59,130,246,.10));
  border-color:var(--accent, #3b82f6);
}

.form-tab-pane{
  display:none;
}

.form-tab-pane.active{
  display:block;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width:1100px){
  :root{--sidebar:240px}
  .kpis{grid-template-columns:repeat(2, minmax(0,1fr))}
  .filters{grid-template-columns:1fr 1fr}
}

@media (max-width:860px){
  .app{
    grid-template-columns:1fr;
  }

  .sidebar{
    position:relative;
    height:auto;
    min-height:auto;
  }

  .nav{
    overflow:visible;
    max-height:none;
  }

  .sidebar-footer{
    position:relative;
    margin-top:16px;
  }

  .filters{
    grid-template-columns:1fr;
  }

  .shipment{
    grid-template-columns:1fr;
  }
}

/* =========================
   VEHICLES ALERTS TILES
========================= */

.alert-tile{
  background: linear-gradient(135deg, #eff6ff, #f8fbff);
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.alert-tile:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(37,99,235,.12);
  border-color: #93c5fd;
}

.alert-tile:active{
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
}

/* layout inside tile */

.alert-tile .label{
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.alert-tile .value{
  font-size: 28px;
  font-weight: 900;
  margin-top: 6px;
  color: #0f172a;
}

/* =========================
   COLOR VARIANTS
========================= */

/* 🔴 Przeterminowane */
.alert-tile.expired{
  background: #fef2f2;
  border-color: #fecaca;
}

.alert-tile.expired .value{
  color: #dc2626;
}

/* 🟧 Do 3 dni */
.alert-tile.due-3{
  background: #fff7ed;
  border-color: #fed7aa;
}

.alert-tile.due-3 .value{
  color: #ea580c;
}

/* 🟨 Do 7 dni */
.alert-tile.due-7{
  background: #fffbeb;
  border-color: #fde68a;
}

.alert-tile.due-7 .value{
  color: #ca8a04;
}

/* 🟦 Do 30 dni (primary) */
.alert-tile.due-30{
  background: #eff6ff;
  border-color: #bfdbfe;
}

.alert-tile.due-30 .value{
  color: #2563eb;
}

/* ⚪ Wszystkie / neutral */
.alert-tile.all{
  background: #f8fafc;
  border-color: #e2e8f0;
}

.alert-tile.all .value{
  color: #0f172a;
}
/* =========================
   VEHICLES KPI TILES (jak alerts)
========================= */

.vehicles-summary-card{
  margin-top: 10px;
}

.vehicles-kpis-row{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.vehicles-kpi-tile{
  min-height: 84px;
  padding: 16px !important;
  border-radius: 16px !important;
  cursor: pointer;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.vehicles-kpi-tile:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(37,99,235,.12) !important;
}

.vehicles-kpi-tile:active{
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0,0,0,.08) !important;
}

.vehicles-kpi-tile .label{
  font-size: 13px;
  font-weight: 600;
  color: #64748b !important;
}

.vehicles-kpi-tile .value{
  font-size: 28px !important;
  font-weight: 900;
  margin-top: 6px;
  line-height: 1;
}

/* ⚪ Wszystkie */
.vehicles-kpi-tile[data-kind-tab="all"]{
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

.vehicles-kpi-tile[data-kind-tab="all"] .value{
  color: #0f172a !important;
}

/* 🟦 Busy */
.vehicles-kpi-tile[data-kind-tab="bus"]{
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.vehicles-kpi-tile[data-kind-tab="bus"] .value{
  color: #2563eb !important;
}

/* 🟩 Ciągniki */
.vehicles-kpi-tile[data-kind-tab="tractor"]{
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.vehicles-kpi-tile[data-kind-tab="tractor"] .value{
  color: #16a34a !important;
}

/* 🟧 Naczepy */
.vehicles-kpi-tile[data-kind-tab="trailer"]{
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}

.vehicles-kpi-tile[data-kind-tab="trailer"] .value{
  color: #ea580c !important;
}

/* 🟪 Zestawy */
.vehicles-kpi-tile[data-kind-tab="set"]{
  background: #f5f3ff !important;
  border-color: #ddd6fe !important;
}

.vehicles-kpi-tile[data-kind-tab="set"] .value{
  color: #7c3aed !important;
}

@media (max-width: 1200px){
  .vehicles-kpis-row{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px){
  .vehicles-kpis-row{
    grid-template-columns: 1fr;
  }
}

/* =========================
   VEHICLES KIND TABS = KPI COLORS
========================= */

.vehicles-kind-tabs .tab{
  background: #fff !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: none !important;
}

.vehicles-kind-tabs .tab.is-active,
.vehicles-kind-tabs .tab[aria-pressed="true"]{
  font-weight: 800;
}

/* ⚪ Wszystkie */
.vehicles-kind-tabs .tab[data-kind-tab="all"].is-active,
.vehicles-kind-tabs .tab[data-kind-tab="all"][aria-pressed="true"]{
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* 🟦 Busy */
.vehicles-kind-tabs .tab[data-kind-tab="bus"].is-active,
.vehicles-kind-tabs .tab[data-kind-tab="bus"][aria-pressed="true"]{
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #2563eb !important;
}

/* 🟩 Ciągniki */
.vehicles-kind-tabs .tab[data-kind-tab="tractor"].is-active,
.vehicles-kind-tabs .tab[data-kind-tab="tractor"][aria-pressed="true"]{
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #16a34a !important;
}

/* 🟧 Naczepy */
.vehicles-kind-tabs .tab[data-kind-tab="trailer"].is-active,
.vehicles-kind-tabs .tab[data-kind-tab="trailer"][aria-pressed="true"]{
  background: #fff7ed !important;
  border-color: #fed7aa !important;
  color: #ea580c !important;
}

/* 🟪 Zestawy */
.vehicles-kind-tabs .tab[data-kind-tab="set"].is-active,
.vehicles-kind-tabs .tab[data-kind-tab="set"][aria-pressed="true"]{
  background: #f5f3ff !important;
  border-color: #ddd6fe !important;
  color: #7c3aed !important;
}
/* =========================
   VEHICLES ACTIONS INLINE FIX
========================= */

.vehicle-actions-inline{
  display:flex;
  flex-direction:row;
  flex-wrap:nowrap;
  gap:6px;
  align-items:center;
  justify-content:center;
}

.vehicle-actions-inline .tab{
  flex:0 0 auto;
  min-width:auto;
  padding:7px 9px;
  font-size:12px;
  white-space:nowrap;
}

/* żeby nie łamało przycisków */
.vehicle-actions-inline .tab span{
  white-space:nowrap;
}

/* =========================
   ADD TO SET = PRIMARY SUCCESS STYLE
========================= */

button[data-open-set-create],
.tab[data-open-set-create]{
  background:#16a34a;
  border:1px solid #16a34a;
  color:#fff;
  box-shadow:0 10px 24px rgba(22,163,74,.22);
}

button[data-open-set-create]:hover,
.tab[data-open-set-create]:hover{
  background:#15803d;
  border-color:#15803d;
  color:#fff;
}

/* ikona już masz (+), tylko dopasuj spacing */
button[data-open-set-create]::before,
.tab[data-open-set-create]::before{
  content:"+";
  font-weight:900;
  font-size:14px;
}

/* driver IMI */
button[data-driver-imi-trigger],
.tab[data-driver-imi-trigger]{
  background:#fff;
  border:1px solid #2563eb;
  color:#2563eb;
}

button[data-driver-imi-trigger]:hover,
.tab[data-driver-imi-trigger]:hover{
  background:#2563eb;
  border-color:#2563eb;
  color:#fff;
  box-shadow:0 6px 16px rgba(37,99,235,.35);
}

button[data-driver-imi-trigger]::before,
.tab[data-driver-imi-trigger]::before{
  content:"⌂";
  font-size:12px;
  line-height:1;
}
/* === LEASING TABS (zielony wariant 1) === */

.form-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.form-tab-btn{
  appearance:none;
  -webkit-appearance:none;
  border:1px solid #d1d5db;
  background:#ffffff;
  color:#111827;
  padding:9px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  font-size:13px;
  min-height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1;
  transition:
    background-color .16s ease,
    color .16s ease,
    border-color .16s ease,
    box-shadow .16s ease;
}

/* hover dla nieaktywnych */
.form-tab-btn:hover{
  background:#f8fafc;
  border-color:#cbd5e1;
}

/* AKTYWNA ZAKŁADKA – ZIELONA */
.form-tab-btn.active{
  background:#f0fdf4;
  color:#166534;
  border-color:#22c55e;
  box-shadow:0 0 0 1px #22c55e inset;
}

/* opcjonalnie focus (ładne UX) */
.form-tab-btn:focus-visible{
  outline:none;
  box-shadow:0 0 0 2px rgba(34,197,94,.35);
}

/* =========================
   EDIT ORDER STEP TABS = jak vehicles-kind-tabs
========================= */

.edit-order-kpis-row{
  display:grid;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:10px;
}

.edit-order-kpi-tile{
  background:#fff !important;
  border:1px solid var(--border) !important;
  color:var(--text) !important;
  border-radius:12px !important;
  box-shadow:none !important;
  min-height:60px;
  padding:10px 14px !important;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  text-align:left;
  cursor:pointer;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    background-color .16s ease,
    color .16s ease,
    border-color .16s ease;
}

.edit-order-kpi-tile:hover{
  transform:none;
  box-shadow:none !important;
}

.edit-order-kpi-tile .label{
  font-size:12px;
  font-weight:500;
  color:#64748b !important;
  margin-bottom:4px;
}

.edit-order-kpi-tile .value{
  font-size:13px !important;
  font-weight:800;
  line-height:1.15;
  margin:0 !important;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.edit-order-kpi-tile .badge{
  display:none !important;
}

/* aktywny stan */
.edit-order-kpi-tile.active{
  font-weight:800;
}

/* ⚪ neutral */
.edit-order-kpi-tile[data-step-theme="neutral"].active{
  background:#f8fafc !important;
  border-color:#e2e8f0 !important;
  color:#0f172a !important;
}

/* 🟦 blue */
.edit-order-kpi-tile[data-step-theme="blue"].active{
  background:#eff6ff !important;
  border-color:#bfdbfe !important;
  color:#2563eb !important;
}

/* 🟩 green */
.edit-order-kpi-tile[data-step-theme="green"].active{
  background:#f0fdf4 !important;
  border-color:#bbf7d0 !important;
  color:#16a34a !important;
}

/* 🟧 orange */
.edit-order-kpi-tile[data-step-theme="orange"].active{
  background:#fff7ed !important;
  border-color:#fed7aa !important;
  color:#ea580c !important;
}

/* 🟪 purple */
.edit-order-kpi-tile[data-step-theme="purple"].active{
  background:#f5f3ff !important;
  border-color:#ddd6fe !important;
  color:#7c3aed !important;
}

/* label zostaje stonowany także w active */
.edit-order-kpi-tile.active .label{
  color:#64748b !important;
}

@media (max-width:1400px){
  .edit-order-kpis-row{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
}

@media (max-width:860px){
  .edit-order-kpis-row{
    grid-template-columns:1fr;
  }
}

/* =========================
   EDIT ORDER HEADER BADGES = jak orders
========================= */

.edit-order-header-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid #e2e8f0;
  background:#f8fafc;
  color:#0f172a;
  font-size:13px;
  font-weight:700;
  line-height:1;
  white-space:nowrap;
  box-shadow:none;
}

.edit-order-header-badge[data-badge-theme="neutral"]{
  background:#f8fafc;
  border-color:#e2e8f0;
  color:#0f172a;
}

/* =========================
   DRIVERS PAGE HEIGHT FIX
   Rozciąga kartę listy kierowców do dołu dostępnego obszaru.
========================= */

.drivers-page{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
}

.drivers-page #drivers-sticky{
  flex:0 0 auto;
}

.drivers-list-card{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
}

.drivers-list-card > div:first-child{
  flex:0 0 auto;
}

#drivers-list-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
}

@media (max-width:860px){
  .drivers-page{
    min-height:auto;
  }

  #drivers-list-scroll{
    max-height:none;
  }
}

.tms-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  background: #f8fafc;
  white-space: nowrap;
}

.tms-segmented__btn {
  border: 0;
  border-radius: 999px;
  padding: 5px 10px;
  background: transparent;
  color: var(--text, #111827);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tms-segmented__btn.active,
.tms-segmented__btn[aria-pressed="true"] {
  background: var(--primary-2, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .18);
}