[hidden]{display:none !important;}
/* SaaS Admin UI — biało‑niebieski, nowoczesny (bez frameworków) */

:root{
  --bg: #f6f9ff;
  --panel: #ffffff;
  --panel-2: #f9fbff;

  --text: #0b1220;
  --muted: #5b6475;

  --border: rgba(12, 28, 58, .10);
  --shadow: 0 10px 30px rgba(16, 24, 40, .08);

  --blue-50: #eaf2ff;
  --blue-100: #d7e7ff;
  --blue-200: #b9d5ff;
  --blue-500: #2f7df6;
  --blue-600: #1e65de;
  --blue-700: #184fb3;

  --green-500: #22c55e;
  --yellow-500: #f59e0b;
  --red-500: #ef4444;

  --radius: 14px;
  --radius-sm: 10px;

  --focus: 0 0 0 4px rgba(47, 125, 246, .18);
}

*{box-sizing:border-box}
html, body{height:100%}
body{
  margin:0;
  background: radial-gradient(1200px 500px at 20% -10%, var(--blue-100), transparent 55%),
              radial-gradient(900px 400px at 90% 0%, rgba(47,125,246,.15), transparent 50%),
              var(--bg);
  color:var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

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

::selection{background: rgba(47,125,246,.22)}
body.modal-open{overflow:hidden}

.kbd{
  padding:.15rem .4rem;
  border:1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns: 260px 1fr;
  align-items:stretch;
}

.sidebar{
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.82));
  backdrop-filter: blur(10px);
  position: sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
  gap:14px;
  overflow:hidden;
}

.brand{
  display:flex;
  gap:10px;
  padding: 10px;
  border-radius: var(--radius);
  flex-direction: column;
}
.brand-logo{
  width:min(100%, 176px);
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 14px;
}
.brand-logo img{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio: 5.42 / 1;
  object-fit:contain;
}
.brand-mark{
  width:36px; height:36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-500), #6fb0ff);
  box-shadow: 0 8px 20px rgba(47,125,246,.25);
  display:grid; place-items:center;
  color:#fff;
  font-weight:800;
}
.brand-title{display:flex; flex-direction:column}
.brand-title strong{font-size:14px; letter-spacing:.2px}
.brand-title span{font-size:12px; color:var(--muted)}

.nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding-right:2px;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
}
.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px solid transparent;
}
.nav a svg{width:18px; height:18px; color: #2b4a7a}
.nav a:hover{
  background: rgba(47,125,246,.06);
  color: var(--text);
  border-color: rgba(47,125,246,.15);
}
.nav a.active{
  background: rgba(47,125,246,.12);
  color: var(--text);
  border-color: rgba(47,125,246,.18);
}
.nav .nav-badge{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  padding:0 7px;
  border-radius:999px;
  background:rgba(47,125,246,.12);
  border:1px solid rgba(47,125,246,.18);
  color:rgba(30,101,222,1);
  font-size:11px;
  font-weight:800;
  line-height:1;
}
.nav .nav-group-title{
  margin: 10px 10px 6px;
  font-size: 11px;
  letter-spacing:.12em;
  text-transform: uppercase;
  color: rgba(43, 74, 122, .7);
}

.sidebar-footer{
  margin-top:auto;
  padding-top: 10px;
  border-top: 1px dashed rgba(12,28,58,.16);
  display:flex;
  gap:10px;
  align-items:center;
  color: var(--muted);
  flex-shrink:0;
}
.avatar{
  width:34px; height:34px;
  border-radius: 12px;
  background: rgba(47,125,246,.10);
  border:1px solid rgba(47,125,246,.18);
  display:grid; place-items:center;
  font-weight:700;
  color: rgba(30,101,222,1);
}
.sidebar-footer .meta{display:flex; flex-direction:column; gap:2px}
.sidebar-footer .meta strong{color:var(--text); font-size:13px}
.sidebar-footer .meta span{font-size:12px}

.content{
  display:flex;
  flex-direction:column;
  min-width: 0;
  min-height: 100vh;
}

.topbar{
  padding: 16px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.topbar-left{display:flex; align-items:center; gap:12px; min-width:0}
.page-title{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}
.page-title h1{
  font-size: 16px;
  margin:0;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.page-title p{margin:0; color:var(--muted); font-size:12px}

.breadcrumbs{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  padding: 0 22px 12px;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumbs a{
  color: var(--muted);
}
.breadcrumbs a:hover{
  color: var(--text);
}
.breadcrumbs-sep{
  color: rgba(43,74,122,.45);
}
.breadcrumbs-current{
  color: var(--text);
  font-weight: 700;
}

.search{
  position:relative;
  min-width: 280px;
  max-width: 520px;
  flex: 1;
}
.search input{
  width:100%;
  padding: 10px 12px 10px 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.86);
  outline: none;
}
.search input:focus{box-shadow: var(--focus); border-color: rgba(47,125,246,.35)}
.search svg{
  position:absolute;
  left:12px;
  top:50%;
  transform: translateY(-50%);
  width:16px; height:16px;
  color: rgba(43,74,122,.75);
}

.actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.btn{
  border:1px solid var(--border);
  background: var(--panel);
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  box-shadow: 0 1px 0 rgba(16,24,40,.02);
}
.btn:hover{background: var(--panel-2); border-color: rgba(47,125,246,.22)}
.btn:active{transform: translateY(1px)}
.btn svg{width:16px; height:16px}
.btn.primary{
  border-color: rgba(47,125,246,.32);
  background: linear-gradient(180deg, rgba(47,125,246,.16), rgba(47,125,246,.10));
}
.btn.primary:hover{background: rgba(47,125,246,.18)}
.btn.blue{
  background: linear-gradient(180deg, rgba(47,125,246,.95), rgba(30,101,222,.95));
  border-color: rgba(47,125,246,.7);
  color:#fff;
}
.btn.blue:hover{filter:brightness(1.03)}
.btn.ghost{background: transparent}
.btn.danger{
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
}
.btn.small{padding:8px 10px; border-radius: 10px; font-size: 13px}

.main{
  padding: 0 22px 22px;
  display:flex;
  flex-direction:column;
  gap:16px;
  min-width:0;
  flex:1 1 auto;
}

.grid{
  display:grid;
  gap: 14px;
}
.grid.cols-2{grid-template-columns: repeat(2, minmax(0,1fr))}
.grid.cols-3{grid-template-columns: repeat(3, minmax(0,1fr))}
.grid.cols-4{grid-template-columns: repeat(4, minmax(0,1fr))}
@media (max-width: 1100px){
  .app-shell{grid-template-columns: 80px 1fr}
  .brand-title, .sidebar-footer .meta{display:none}
  .nav a{justify-content:flex-start}
  .sidebar{padding: 16px 10px}
  .search{min-width: 200px}
  .grid.cols-4{grid-template-columns: repeat(2, minmax(0,1fr))}
}
@media (max-width: 760px){
  .topbar{flex-direction:column; align-items:stretch}
  .search{min-width: 100%}
  .grid.cols-3, .grid.cols-2{grid-template-columns: 1fr}
}

.card{
  background: rgba(255,255,255,.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .card-h{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding: 14px 14px 10px;
}
.card .card-h h2{
  margin:0;
  font-size: 14px;
  letter-spacing:.2px;
}
.card .card-h p{
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.card .card-b{padding: 0 14px 14px}
.card .card-pad{padding: 14px}

.kpi{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.kpi .value{font-size: 22px; font-weight: 780; letter-spacing:.2px}
.kpi .sub{color: var(--muted); font-size:12px}
.kpi .trend{display:flex; align-items:center; gap:8px; color: var(--muted); font-size: 12px}
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.7);
  font-size: 12px;
  color: var(--muted);
}
.pill.good{border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.10); color: rgba(20,83,45,1)}
.pill.warn{border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.10); color: rgba(120,53,15,1)}
.pill.bad{border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.10); color: rgba(127,29,29,1)}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 12px;
  border:1px solid transparent;
}
.badge svg{width:12px; height:12px; flex:0 0 12px}
.badge.blue{background: rgba(47,125,246,.10); border-color: rgba(47,125,246,.18); color: rgba(30,101,222,1)}
.badge.gray{background: rgba(15,23,42,.06); border-color: rgba(15,23,42,.10); color: rgba(51,65,85,1)}
.badge.green{background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.18); color: rgba(20,83,45,1)}
.badge.yellow{background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.18); color: rgba(120,53,15,1)}
.badge.red{background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.18); color: rgba(127,29,29,1)}

.toolbar{
  position: relative;
  z-index: 4;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(12,28,58,.08);
  background: rgba(255,255,255,.75);
}
.toolbar .left, .toolbar .right{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.input, select, .select, textarea{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.86);
  border-radius: 12px;
  padding: 9px 10px;
  outline:none;
  min-height: 38px;
}
.input:focus, select:focus, textarea:focus{box-shadow: var(--focus); border-color: rgba(47,125,246,.35)}
.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.field label{font-size: 12px; color: var(--muted)}

.table-wrap{overflow:auto; border-radius: var(--radius); border:1px solid rgba(12,28,58,.10)}
.table{
  width:100%;
  border-collapse: separate;
  border-spacing:0;
  min-width: 900px;
  background: rgba(255,255,255,.9);
}
.table thead th{
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(249,251,255,.9));
  backdrop-filter: blur(6px);
  text-align:left;
  font-weight: 700;
  font-size: 12px;
  letter-spacing:.08em;
  text-transform: uppercase;
  color: rgba(43,74,122,.85);
  padding: 12px 12px;
  border-bottom: 1px solid rgba(12,28,58,.10);
  white-space: nowrap;
}
.table tbody td{
  padding: 11px 12px;
  border-bottom: 1px solid rgba(12,28,58,.07);
  color: rgba(11,18,32,.92);
  vertical-align: top;
}
.table tbody tr:hover td{background: rgba(47,125,246,.05)}
.table tbody tr:last-child td{border-bottom: none}
.table .muted{color: var(--muted); font-size: 12px}
.table .right{text-align:right}

.sortable{cursor:pointer; user-select:none}
.sortable .sort-ind{
  display:inline-block;
  width: 10px;
  margin-left: 6px;
  opacity:.55;
}

.tabs{
  display:flex;
  gap:6px;
  padding: 10px;
  border: 1px solid rgba(12,28,58,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
}
.tab{
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
  border:1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  user-select:none;
}
.tab.active{
  background: rgba(47,125,246,.12);
  color: var(--text);
  border-color: rgba(47,125,246,.22);
}

.notice{
  display:flex;
  gap:10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border:1px solid rgba(47,125,246,.18);
  background: rgba(47,125,246,.08);
  color: rgba(43,74,122,1);
}
.notice svg{width:18px; height:18px; margin-top: 2px}
.notice strong{display:block}
.notice p{margin: 4px 0 0; color: rgba(43,74,122,.85)}

.dropzone{
  border: 1px dashed rgba(47,125,246,.35);
  background: rgba(255,255,255,.65);
  border-radius: var(--radius);
  padding: 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.dropzone.drag{
  box-shadow: var(--focus);
  border-color: rgba(47,125,246,.55);
  background: rgba(47,125,246,.06);
}
.dropzone .hint{color: var(--muted); font-size: 12px}
.dropzone .title{font-weight: 750; letter-spacing:.2px}
.dropzone input{display:none}

.modal-backdrop{
  position: fixed;
  inset:0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(8px);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  /* Musi być nad drawerami (podglądami) */
  z-index: 11500;
}
.modal-backdrop.open{display:flex}
.modal-backdrop[hidden]{display:none !important}
.modal-backdrop.fullscreen{
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}
.modal{
  width: min(920px, 100%);
  max-height: min(86vh, 900px);
  overflow:auto;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.22);
  box-shadow: 0 25px 70px rgba(0,0,0,.25);
  background: rgba(255,255,255,.92);
}
.modal.fullscreen{
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}
.modal-backdrop.fullscreen .modal{
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}
.modal .modal-h{
  position: sticky;
  top:0;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(12,28,58,.08);
  padding: 14px 14px;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.modal .modal-h h3{margin:0; font-size: 14px}
.modal .modal-h p{margin: 4px 0 0; color: var(--muted); font-size: 12px}
.modal .modal-b{padding: 14px}
.modal .modal-f{
  position: sticky;
  bottom:0;
  background: rgba(255,255,255,.92);
  border-top: 1px solid rgba(12,28,58,.08);
  padding: 12px 14px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

.drawer{
  position: fixed;
  inset: 0 0 0 auto;
  width: min(520px, 100%);
  background: rgba(255,255,255,.95);
  border-left: 1px solid rgba(12,28,58,.10);
  box-shadow: -10px 0 40px rgba(16,24,40,.14);
  transform: translateX(102%);
  transition: transform .18s ease;
  z-index: 11010;
  display:flex;
  flex-direction:column;
}
.drawer.open{transform: translateX(0)}
.drawer .drawer-h{
  padding: 14px 14px;
  border-bottom: 1px solid rgba(12,28,58,.08);
  display:flex;
  justify-content:space-between;
  gap:10px;
}

/* Podglądy kontrahenta (#ctrDrawer) mają wypełniać 100% szerokości ekranu */
#ctrDrawer .drawer{
  width: 100vw;
  max-width: none;
  border-left: 0;
}
.drawer .drawer-h h3{margin:0; font-size: 14px}
.drawer .drawer-h p{margin: 4px 0 0; color: var(--muted); font-size: 12px}
.drawer .drawer-b{padding: 14px; overflow:auto; display:flex; flex-direction:column; gap:12px}
.drawer .drawer-f{
  padding: 12px 14px;
  border-top: 1px solid rgba(12,28,58,.08);
  display:flex;
  justify-content:flex-end;
  gap:10px;
  background: rgba(255,255,255,.92);
}

.kanban{
  display:grid;
  grid-template-columns: repeat(6, minmax(240px, 1fr));
  gap: 12px;
  overflow:auto;
  padding-bottom: 4px;
}
.column{
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(12,28,58,.10);
  border-radius: var(--radius);
  min-height: 240px;
  display:flex;
  flex-direction:column;
}
.column .col-h{
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(12,28,58,.08);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.column .col-h strong{font-size: 12px; letter-spacing:.08em; text-transform: uppercase; color: rgba(43,74,122,.85)}
.column .col-b{padding: 10px; display:flex; flex-direction:column; gap:10px}
.case{
  border-radius: 14px;
  border:1px solid rgba(12,28,58,.10);
  background: rgba(255,255,255,.92);
  padding: 10px;
  cursor:grab;
}
.case:active{cursor:grabbing}
.case .top{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.case .name{font-weight: 750}
.case .meta{color: var(--muted); font-size: 12px; margin-top: 4px}
.case .actions{margin-top: 10px; display:flex; gap:8px; flex-wrap:wrap}

.toast-wrap{
  position: fixed;
  bottom: 16px;
  right: 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index: 12000;
}
.toast{
  min-width: 280px;
  max-width: 360px;
  background: rgba(255,255,255,.92);
  border:1px solid rgba(12,28,58,.12);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(16,24,40,.18);
  padding: 10px 10px;
  display:flex;
  gap:10px;
}
.toast .dot{
  width:10px; height:10px;
  border-radius: 999px;
  background: var(--blue-500);
  margin-top: 4px;
}
.toast.good .dot{background: var(--green-500)}
.toast.warn .dot{background: var(--yellow-500)}
.toast.bad .dot{background: var(--red-500)}
.toast .txt{display:flex; flex-direction:column; gap:2px}
.toast .txt strong{font-size: 13px}
.toast .txt span{font-size: 12px; color: var(--muted)}
.toast .close{margin-left:auto}

.hr{
  height:1px;
  background: rgba(12,28,58,.10);
  margin: 10px 0;
}

.small-muted{color: var(--muted); font-size:12px}
.chips{display:flex; gap:8px; flex-wrap:wrap}
.chip{
  border:1px solid rgba(12,28,58,.10);
  background: rgba(15,23,42,.04);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: rgba(51,65,85,1);
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.chip button{
  border:none;
  background: transparent;
  cursor:pointer;
  padding:0;
  color: rgba(51,65,85,.75);
}

.progress{
  height:10px;
  border-radius: 999px;
  background: rgba(15,23,42,.08);
  overflow:hidden;
}
.progress > div{
  height:100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(47,125,246,.95), rgba(111,176,255,.95));
}


/* --- Dodatkowe klasy pomocnicze (wersja "HTML w pliku", minimalny JS) --- */
.split{
  display:grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 14px;
  align-items:start;
  min-width:0;
}
@media (max-width: 1100px){
  .split{grid-template-columns: 1fr}
}
.stack{display:flex; flex-direction:column; gap:12px; min-width:0}
.row{display:flex; gap:12px; align-items:center; flex-wrap:wrap}
.row.between{justify-content:space-between}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;}
.help{color: var(--muted); font-size:12px}
.hidden{display:none !important}
.table.min{min-width: 0}



.table tbody tr.active-row{
  background: rgba(47,125,246,.08);
}
.table tbody tr.active-row td{
  border-bottom-color: rgba(47,125,246,.18);
}



/* --- Pagination + forms (produkcyjnie) --- */
.table-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 14px;
  border-top: 1px solid rgba(12,28,58,.08);
  background: rgba(255,255,255,.75);
  flex-wrap: wrap;
}
.pager{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap: wrap;
}
.pager .page-btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.86);
  border-radius: 10px;
  padding: 8px 10px;
  cursor:pointer;
  min-width: 38px;
  text-align:center;
}
.pager .page-btn:hover{border-color: rgba(47,125,246,.22); background: var(--panel-2)}
.pager .page-btn.active{
  border-color: rgba(47,125,246,.35);
  background: rgba(47,125,246,.12);
  font-weight: 750;
}
.pager .page-btn[disabled], .btn[disabled], .input[disabled], select[disabled], textarea[disabled]{
  opacity:.55;
  cursor:not-allowed;
}
.is-disabled{opacity:.55; pointer-events:none}
.table-footer .meta{
  color: var(--muted);
  font-size: 12px;
}
.help-inline{
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
.help-inline[data-state="good"]{color: rgba(20,83,45,1);}
.help-inline[data-state="bad"]{color: rgba(153,27,27,1);}
.help-inline[data-state="warn"]{color: rgba(120,53,15,1);}
.help-inline[data-state="loading"]{color: rgba(30,101,222,1);}
.field-inline{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.field-inline .input{flex:1 1 220px; min-width:0;}
.form-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
.form-grid.cols-3{grid-template-columns: repeat(3, minmax(0,1fr))}
@media (max-width: 760px){
  .form-grid, .form-grid.cols-3{grid-template-columns: 1fr}
}

.contract-config-section,
.contract-config-block{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.contract-config-section{
  border-top:1px solid rgba(148,163,184,.28);
  padding-top:14px;
}
.section-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.section-heading h3{
  margin:0;
  font-size:13px;
  letter-spacing:.1px;
}
.section-heading p{
  margin:3px 0 0;
  color:var(--muted);
  font-size:12px;
}
.section-heading.compact{
  align-items:center;
}
.contract-parameter-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.contract-parameter-row{
  display:grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, .7fr) minmax(220px, 1.6fr) auto;
  gap:10px;
  align-items:start;
  padding:10px;
  border:1px solid rgba(148,163,184,.32);
  border-radius:12px;
  background:rgba(248,250,252,.72);
}
.contract-parameter-row .field,
.contract-module-editor .field{
  margin:0;
}
.contract-parameter-key-control{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.contract-parameter-key-control [hidden]{
  display:none !important;
}
.contract-parameter-value-field textarea{
  min-height:42px;
}
.parameter-row-action{
  min-width:96px;
}
.contract-module-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.contract-module-editor{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:12px;
  border:1px solid rgba(47,125,246,.18);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(255,255,255,.88), rgba(248,250,252,.72));
}
.parameter-display-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
}
.parameter-display-item{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px 12px;
  border:1px solid rgba(148,163,184,.32);
  border-radius:12px;
  background:rgba(255,255,255,.72);
  min-width:0;
}
.parameter-display-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}
.parameter-display-head strong{
  overflow-wrap:anywhere;
}
.parameter-display-value{
  color:var(--text);
  line-height:1.45;
  overflow-wrap:anywhere;
  white-space:normal;
}
.parameter-display-value.is-multi{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.parameter-display-value.is-multi span{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:4px 8px;
  border:1px solid rgba(148,163,184,.32);
  border-radius:999px;
  background:rgba(241,245,249,.86);
}
.contract-module-display-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap:12px;
}
.contract-module-display{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:12px;
  border:1px solid rgba(47,125,246,.18);
  border-radius:14px;
  background:rgba(255,255,255,.76);
  min-width:0;
}
.contract-module-display-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.module-note{
  padding:9px 10px;
  border-radius:10px;
  border:1px solid rgba(148,163,184,.24);
  background:rgba(248,250,252,.82);
  color:var(--muted);
  overflow-wrap:anywhere;
}
@media (max-width: 980px){
  .contract-parameter-row{
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}
@media (max-width: 680px){
  .contract-parameter-row,
  .contract-module-display-grid{
    grid-template-columns: 1fr;
  }
  .parameter-row-action{
    min-width:0;
  }
}

.table-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.table-actions .btn{white-space: nowrap}
.stack-sm{display:flex; flex-direction:column; gap:6px;}
.metric-stack{display:flex; flex-direction:column; gap:8px; min-width: 0;}
.metric-inline{display:flex; align-items:baseline; justify-content:space-between; gap:12px;}
.metric-inline-label{font-size:12px; color:var(--muted);}
.text-warn{color:#b45309;}

.clickable-row{cursor:pointer;}
.clickable-row td{transition: background .15s ease;}
.clickable-row:hover td,
.clickable-row.is-row-focus td{
  background: rgba(47,125,246,.07);
}
.btn.icon-btn{
  width: 36px;
  min-width: 36px;
  height: 36px;
  justify-content:center;
  padding: 8px;
  gap:0;
}
.btn.icon-btn svg{
  width:16px;
  height:16px;
}
.mail-preview{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  font:13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color:var(--text);
}
.gap-sm{gap:8px;}
.schedule-current-month{
  display:inline-flex;
  align-items:center;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid rgba(12,28,58,.10);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
  font-weight: 650;
}
.schedule-weekdays,
.schedule-calendar{
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}
.schedule-weekdays{
  margin-bottom: 12px;
}
.schedule-weekdays > div{
  padding: 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.schedule-day{
  min-height: 200px;
  padding: 12px;
  border: 1px solid rgba(12,28,58,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.86);
  display:flex;
  flex-direction:column;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(16,24,40,.06);
}
.schedule-day.has-items{
  border-color: rgba(47,125,246,.16);
}
.schedule-day.is-today{
  border-color: rgba(47,125,246,.32);
  box-shadow: 0 12px 28px rgba(47,125,246,.12);
}
.schedule-day-empty{
  visibility:hidden;
  pointer-events:none;
}
.schedule-day-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.schedule-day-head strong{
  font-size: 20px;
  line-height: 1;
}
.schedule-items{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.schedule-item{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(12,28,58,.08);
  background: rgba(255,255,255,.92);
}
.schedule-item .btn.small{
  align-self:flex-start;
}
.schedule-list{ gap:14px; }
.schedule-list-day{ overflow:hidden; }
.schedule-list-day.is-today{
  border-color: rgba(245,158,11,.4);
  box-shadow: 0 0 0 1px rgba(245,158,11,.12);
}
.schedule-list-day .card-h h3{
  margin:0;
}
@media (max-width: 1200px){
  .schedule-weekdays,
  .schedule-calendar{grid-template-columns: repeat(4, minmax(0, 1fr));}
}
@media (max-width: 900px){
  .schedule-weekdays,
  .schedule-calendar{grid-template-columns: repeat(2, minmax(0, 1fr));}
}
@media (max-width: 640px){
  .schedule-weekdays,
  .schedule-calendar{grid-template-columns: 1fr;}
  .schedule-day-empty{display:none;}
}

.code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border:1px solid rgba(12,28,58,.10);
  background: rgba(255,255,255,.75);
}

/* Stepper */
.stepper{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.step{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(12,28,58,.10);
  background: rgba(255,255,255,.70);
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
}
.step .num{
  width:22px; height:22px;
  border-radius: 999px;
  display:grid; place-items:center;
  border:1px solid rgba(12,28,58,.10);
  background: rgba(47,125,246,.08);
  color: rgba(30,101,222,1);
}
.step.active{
  border-color: rgba(47,125,246,.22);
  background: rgba(47,125,246,.10);
  color: var(--text);
}
.step.done{
  border-color: rgba(34,197,94,.22);
  background: rgba(34,197,94,.10);
  color: rgba(20,83,45,1);
}

/* Accessible "no access" */
.no-access{
  padding: 18px 14px;
}
.no-access h2{margin:0; font-size: 14px}
.no-access p{margin:6px 0 0; color: var(--muted)}


/* --- Custom UI helpers for SaaS admin views --- */
.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip: rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* Lekki "select2" (wyszukiwalny select) — bez zależności */
.sselect{ position:relative; }
.sselect .sselect-input{ padding-right: 34px; }
.sselect .sselect-clear{
  position:absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border:none;
  background: transparent;
  cursor:pointer;
  padding: 4px;
  color: rgba(51,65,85,.7);
}
.sselect .sselect-clear:hover{ color: rgba(51,65,85,1); }
.sselect .sselect-menu{
  position:absolute;
  left:0; right:0;
  top: calc(100% + 6px);
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(12,28,58,.12);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(16,24,40,.18);
  overflow:auto;
  max-height: 280px;
  display:none;
  z-index: 260;
}
.sselect.open .sselect-menu{ display:block; }
.sselect .sselect-item{
  padding: 10px 10px;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.sselect .sselect-item .sub{ font-size:12px; color: var(--muted); }
.sselect .sselect-item:hover{ background: rgba(47,125,246,.08); }
.sselect .sselect-item.active{ background: rgba(47,125,246,.12); }
.sselect .sselect-empty{ padding: 10px 10px; color: var(--muted); font-size: 12px; }

.drawer-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 11000;
}
.drawer-backdrop.open{ display:block; }
.drawer-backdrop[aria-hidden="true"]{ display:none; }

/* Fullscreen drawers (podglądy na 100% szerokości) */
.drawer-backdrop.fullscreen .drawer{
  left: 0;
  right: 0;
  width: 100vw;
  max-width: none;
  border-left: 0;
  border-radius: 0;
}

.kv{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.kv .k{
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  gap:12px;
  padding:8px 10px;
  border:1px solid rgba(148,163,184,.35);
  border-radius:10px;
  background: rgba(255,255,255,.6);
}
.kv .k .muted{ flex:0 0 160px; }
.kv .k span:last-child{
  flex:1 1 auto;
  min-width:0;
  text-align:left;
  overflow-wrap:anywhere;
}
.kv .k.k-emphasis{
  font-weight:700;
}
.kv .k.k-emphasis .muted{
  color:inherit;
}
.kv.two-col{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
.kv.two-col .k{
  height:100%;
}
@media (max-width: 920px){
  .kv.two-col{ grid-template-columns: 1fr; }
}

.metrics{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
  padding: 14px;
}
.metric{
  border:1px solid rgba(148,163,184,.35);
  border-radius:14px;
  padding:12px 12px;
  background: rgba(255,255,255,.7);
}
.metric .label{
  font-size:12px;
  color: rgba(15,23,42,.7);
  margin-bottom:6px;
}
.metric .value{
  font-size:20px;
  font-weight:800;
  margin-bottom:4px;
}
.metric .hint{
  font-size:12px;
  color: rgba(15,23,42,.55);
}

.badge.green{ background:#dcfce7; color:#166534; border-color:#86efac; }
.badge.red{ background:#fee2e2; color:#991b1b; border-color:#fecaca; }
.badge.yellow{ background:#fef9c3; color:#854d0e; border-color:#fde68a; }
.badge.blue{ background:#dbeafe; color:#1e40af; border-color:#bfdbfe; }
.badge.gray{ background:#f1f5f9; color:#334155; border-color:#e2e8f0; }



/* --- PHP skeleton additions --- */
.svg-sprite{display:none}

.flash-stack{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin: 0 0 12px;
}
.flash{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(16,24,40,.06);
  background: #fff;
}
.flash .flash-title{
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .08em;
  opacity: .9;
  margin-bottom: 4px;
}
.flash .flash-msg{ color: rgba(15,23,42,.78); }
.flash.green{ background:#f0fdf4; border-color:#bbf7d0; }
.flash.red{ background:#fef2f2; border-color:#fecaca; }
.flash.yellow{ background:#fffbeb; border-color:#fde68a; }
.flash.blue{ background:#eff6ff; border-color:#bfdbfe; }
.flash.gray{ background:#f8fafc; border-color:#e2e8f0; }

.sort-link{
  color: inherit;
  text-decoration: none;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.sort-link:hover{ color: rgba(30,101,222,1); }
.input-error{
  border-color: rgba(239,68,68,.45) !important;
  box-shadow: 0 0 0 4px rgba(239,68,68,.08) !important;
}
.field-error{
  color: #b91c1c;
  font-size: 12px;
  margin-top: 4px;
}
.checkbox-inline{
  display:inline-flex;
  align-items:center;
  gap:10px;
  border:1px solid rgba(12,28,58,.10);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.75);
}
.checkbox-inline input{ margin:0; }
.audit-entry{
  border:1px solid rgba(12,28,58,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  padding: 10px 12px;
}
.audit-entry summary{
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.audit-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin-top: 10px;
}
.prejson{
  margin: 6px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(12,28,58,.10);
  background: rgba(248,250,252,.95);
  color: rgba(15,23,42,.86);
  font-size: 12px;
  overflow:auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.actions form{margin:0}
.narrow-card{max-width: 620px; margin: 0 auto}

.auth-body{
  min-height:100vh;
  background:
    radial-gradient(circle at top left, rgba(93,156,236,.14), transparent 32%),
    radial-gradient(circle at bottom right, rgba(34,197,94,.10), transparent 28%),
    var(--bg);
}
.auth-shell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding: 32px 18px;
}
.auth-card-wrap{
  width:min(100%, 520px);
  display:grid;
  gap:16px;
}
.auth-logo{
  display:flex;
  justify-content:center;
  margin-bottom:25px;
}
.auth-logo img{
  width:min(100%, 260px);
  height:auto;
  aspect-ratio: 5.42 / 1;
  object-fit:contain;
}
.auth-header{
  display:grid;
  gap:10px;
  text-align:center;
}
.auth-header h1{
  margin:0;
  font-size: clamp(30px, 4vw, 42px);
  line-height:1.05;
}
.auth-header p{
  margin:0;
  color: var(--muted);
  font-size:15px;
  line-height:1.55;
}
.auth-login-card{
  border-radius: 24px;
}
.auth-login-form{
  gap:16px;
}
.auth-login-actions{
  justify-content:flex-end;
}
:root[data-theme="dark"] .auth-body{
  background:
    radial-gradient(circle at top left, rgba(93,156,236,.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(34,197,94,.14), transparent 30%),
    var(--bg);
}

/* --- Extended admin CRUD UI --- */
.pager .page-btn.disabled{
  opacity:.55;
  pointer-events:none;
  cursor:not-allowed;
}
.checkbox-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
}
.checkbox-card{
  display:flex;
  align-items:flex-start;
  gap:10px;
  border:1px solid rgba(12,28,58,.10);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.8);
}
.checkbox-card input{ margin-top:3px; }
.checkbox-card span{ display:flex; flex-direction:column; gap:4px; }
.checkbox-card strong{ font-size:14px; }
.checkbox-card small{ color: var(--muted); font-size:12px; }
.checkbox-card.readonly{
  pointer-events:none;
  background: rgba(248,250,252,.85);
}
.readonly-grid .checkbox-card{ min-height:72px; }
.permissions-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap:12px;
}
.permission-group{
  border:1px solid rgba(12,28,58,.10);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.74);
}
.permission-group.readonly{ background: rgba(248,250,252,.9); }
.permission-group > header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(12,28,58,.08);
}
.permission-group > header span{
  color: var(--muted);
  font-size: 12px;
}
.badge-list{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.badge-list.compact .badge{ font-size:12px; }
.readonly-input{
  display:flex;
  align-items:center;
  min-height: 44px;
  color: rgba(15,23,42,.78);
}
.inline-top{ margin-top: 8px; }
.row-gap{ gap:10px; flex-wrap:wrap; }
@media (max-width: 760px){
  .permissions-grid,
  .checkbox-grid{ grid-template-columns: 1fr; }
}

.bulk-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  border-top:1px solid rgba(12,28,58,.08);
}
.bulk-toolbar-left,
.bulk-toolbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.compact-field{
  display:flex;
  align-items:center;
  gap:8px;
}
.compact-field > span{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}
.cell-checkbox{
  width:44px;
  text-align:center;
}
.cell-checkbox input[type="checkbox"]{
  width:16px;
  height:16px;
}
.status-stack{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.tiny{
  min-height:30px;
  padding:6px 10px;
  font-size:12px;
}
.inline-form{
  display:inline-flex;
}
.is-archived{
  opacity:.78;
}
@media (max-width: 860px){
  .bulk-toolbar{
    align-items:flex-start;
  }
  .bulk-toolbar-right,
  .bulk-toolbar-left{
    width:100%;
  }
}

/* --- AJAX lookup + contracts module --- */
.form-grid.cols-4{grid-template-columns: repeat(4, minmax(0,1fr));}
@media (max-width: 980px){ .form-grid.cols-4{grid-template-columns: repeat(2, minmax(0,1fr));} }
@media (max-width: 760px){ .form-grid.cols-4{grid-template-columns: 1fr;} }
.field-span-2{grid-column: span 2;}
.field-wide{min-width: 280px;}
@media (max-width: 760px){ .field-span-2{grid-column: auto;} }

.lookup{
  position: relative;
  z-index: 1;
}
.lookup.lookup-open{
  z-index: 1600;
}
.card.lookup-layer-open,
.card-b.lookup-layer-open{
  overflow: visible;
}
.table-wrap.lookup-layer-open{
  overflow: visible;
  position: relative;
  z-index: 1500;
}
.table-wrap.lookup-layer-open .table,
.table-wrap.lookup-layer-open tbody,
.table-wrap.lookup-layer-open tr,
.table-wrap.lookup-layer-open td{
  overflow: visible;
}
.table-wrap.lookup-layer-open td,
tr.lookup-layer-open td{
  position: relative;
  z-index: 1501;
}
.lookup-menu[hidden]{
  display:none !important;
}
.lookup-menu{
  position:absolute;
  left:0;
  right:0;
  top: calc(100% + 6px);
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:8px;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(12,28,58,.12);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(16,24,40,.18);
  max-height: 320px;
  overflow:auto;
  z-index: 1400;
}
.lookup-item{
  border: none;
  background: transparent;
  padding: 10px 10px;
  border-radius: 10px;
  text-align:left;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.lookup-item:hover{ background: rgba(47,125,246,.08); }
.lookup-item strong{ font-size:13px; }
.lookup-meta, .lookup-empty{
  font-size: 12px;
  color: var(--muted);
}
.lookup-empty{ padding: 8px 10px; }
.lookup-error .input{ border-color: rgba(239,68,68,.45) !important; }

.contract-services-table td{ vertical-align: top; }
.contract-services-table .lookup,
.contract-services-table .input{ min-width: 120px; }
.contract-service-row .field-error{ max-width: 180px; }
.row-end-actions{ white-space: nowrap; }
.line-total{
  font-weight: 700;
  white-space: nowrap;
  padding-top: 10px;
}
.compact-kv .k .muted{ flex-basis: 190px; }

/* --- Invoices module --- */
.badge.orange{ background:#ffedd5; color:#9a3412; border-color:#fdba74; }
.badge.purple{ background:#ede9fe; color:#6d28d9; border-color:#c4b5fd; }
.readonly-box{
  min-height: 38px;
  display:flex;
  align-items:center;
  padding: 2px 0;
}
.contract-services-table .input,
.contract-services-table select,
.contract-services-table textarea{
  width:100%;
}
.contract-services-table td .input + .input,
.contract-services-table td .input + select,
.contract-services-table td select + .input,
.contract-services-table td .input + textarea,
.contract-services-table td textarea + .input{
  margin-top:6px;
}


.bank-transaction-reconcile-layout{
  grid-template-columns: minmax(300px, .9fr) minmax(520px, 2.1fr);
  align-items:start;
}
.tx-focus-grid{
  display:grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(240px, .8fr);
  gap:12px;
  padding: 0 14px 14px;
}
.tx-focus-card{
  border:1px solid rgba(47,125,246,.16);
  border-radius:16px;
  padding:16px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(234,242,255,.78));
  box-shadow: 0 10px 24px rgba(16,24,40,.06);
  min-width:0;
}
.tx-focus-card-amount{
  background: linear-gradient(180deg, rgba(47,125,246,.16), rgba(47,125,246,.08));
}
.tx-focus-label{
  font-size:11px;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
  color: rgba(24,79,179,.8);
  margin-bottom:8px;
}
.tx-focus-value{
  font-size: clamp(1.6rem, 2.8vw, 2.5rem);
  line-height:1.08;
  font-weight:900;
  color: var(--text);
  overflow-wrap:anywhere;
}
.tx-focus-uppercase{
  text-transform:uppercase;
}
.bank-transaction-settings{
  position: sticky;
  top: 8px;
  z-index: 3;
}
.bank-transaction-settings .card-b{
  padding-top: 14px;
}
.bank-transaction-settings-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.bank-transaction-settings-toggle{
  font-weight:600;
}
.bank-suggestion-contractor{
  margin-bottom:4px;
  font-size:14px;
  font-weight:700;
  color: var(--text);
  line-height:1.3;
}
.bank-suggestions-card .card-b{
  padding-top:0;
}
.bank-suggestions-list{
  gap:10px;
}
.bank-suggestion-item{
  display:grid;
  grid-template-columns: minmax(0, 1.8fr) repeat(2, minmax(132px, .55fr)) auto;
  gap:12px;
  align-items:center;
  padding:14px 16px;
  border:1px solid rgba(12,28,58,.10);
  border-radius:14px;
  background: rgba(255,255,255,.86);
}
.bank-suggestion-main,
.bank-suggestion-actions,
.bank-suggestion-meta{
  min-width:0;
}
.bank-suggestion-title{
  display:block;
  font-size:16px;
  line-height:1.2;
  margin-bottom:4px;
}
.bank-suggestion-badges{
  margin-top:8px;
}
.bank-suggestion-badges .badge{
  max-width:100%;
}
.bank-suggestion-meta{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.bank-suggestion-meta-label{
  font-size:11px;
  font-weight:800;
  letter-spacing:.1em;
  text-transform:uppercase;
  color: var(--muted);
}
.bank-suggestion-balance{
  display:flex;
  flex-direction:column;
  gap:6px;
  align-items:flex-start;
}
.bank-suggestion-checklist{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.bank-suggestion-checklist > div{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.bank-suggestion-checklist strong{
  line-height:1.2;
}
.bank-suggestion-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}
.bank-allocation-basket{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:14px;
  border:1px dashed rgba(12,28,58,.18);
  border-radius:14px;
  background: rgba(255,255,255,.72);
}
.bank-allocation-basket-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.bank-allocation-basket-items{
  gap:10px;
}
.bank-allocation-item{
  display:grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(180px, .75fr) auto;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  border:1px solid rgba(12,28,58,.10);
  border-radius:12px;
  background: var(--surface);
}
.bank-allocation-item-main,
.bank-allocation-item-amount{
  min-width:0;
}
.bank-allocation-item-main{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.bank-allocation-item-amount{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.bank-allocation-item-amount .input{
  width:100%;
}
.bank-allocation-item-actions{
  justify-content:flex-end;
}
@media (max-width: 1280px){
  .bank-suggestion-item{
    grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(120px, .55fr)) auto;
  }
}
@media (max-width: 1120px){
  .bank-transaction-reconcile-layout,
  .tx-focus-grid{
    grid-template-columns: 1fr;
  }
}
@media (max-width: 860px){
  .bank-transaction-settings{
    position: static;
  }
  .bank-transaction-settings-row{
    align-items:flex-start;
  }
  .bank-suggestion-item{
    grid-template-columns: 1fr;
    align-items:flex-start;
  }
  .bank-allocation-basket-head,
  .bank-allocation-item{
    grid-template-columns: 1fr;
    display:grid;
  }
  .bank-suggestion-actions{
    justify-content:flex-start;
  }
  .bank-allocation-item-actions{
    justify-content:flex-start;
  }
}

/* Stage 7: bank / suppliers / diagnostics */
.json-block{
  display:block;
  white-space:pre-wrap;
  padding:12px;
  overflow:auto;
  line-height:1.45;
}
.spark-chart{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  align-items:end;
  gap:10px;
  min-height: 180px;
}
.spark-col{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  min-width:0;
}
.spark-col span{
  font-size:11px;
  color: var(--muted);
  text-align:center;
  line-height:1.2;
}
.spark-bar{
  width:100%;
  min-height:10px;
  border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, rgba(47,125,246,.28), rgba(47,125,246,.86));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.spark-h-1{height:16px}.spark-h-2{height:30px}.spark-h-3{height:45px}.spark-h-4{height:60px}.spark-h-5{height:76px}
.spark-h-6{height:92px}.spark-h-7{height:110px}.spark-h-8{height:128px}.spark-h-9{height:145px}.spark-h-10{height:160px}

.uplot-wrap,
.uplot-chart-shell,
[data-uplot-chart]{
  width:100%;
}
[data-uplot-chart]{
  min-height: 220px;
}
.uplot-chart-shell .uplot{
  font-family: inherit;
}
.uplot-chart-shell .u-label,
.uplot-chart-shell .u-legend,
.uplot-chart-shell .u-axis{
  font-size: 12px;
}

/* Stage 8.x fixes: KSeF / invoice date actions / bank balance chart */
.mini-date-input{
  width: 148px;
  min-width: 148px;
  padding: 8px 10px;
  font-size: 12px;
}
.inline-form.row-gap{
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.spark-bar.negative-bar{
  background: linear-gradient(180deg, rgba(222,69,69,.28), rgba(222,69,69,.88));
}


.code-block{margin:0; padding:10px 12px; border-radius:12px; border:1px solid rgba(15,23,42,.12); background:#0f172a; color:#e2e8f0; overflow:auto; font:12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace}


.details-card{
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  overflow:hidden;
}
.details-card + .details-card{ margin-top:12px; }
.details-card summary{
  list-style:none;
  cursor:pointer;
  padding:14px 16px;
}
.details-card summary::-webkit-details-marker{ display:none; }
.details-card[open] summary{ border-bottom:1px solid var(--line); }
.details-summary{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.mt-8{ margin-top:8px; }


/* --- Cost groups + collapsible sidebar --- */
.btn.icon-only{
  width: 42px;
  height: 42px;
  justify-content:center;
  padding:10px;
}
.sidebar-toggle{ flex:0 0 auto; }
.sidebar-backdrop{
  display:none;
  position:fixed;
  inset:0;
  border:0;
  background: rgba(15,23,42,.34);
  z-index: 950;
}
.toolbar-inline{
  display:flex;
  align-items:center;
  gap:10px;
}
.inline-edit-details{ min-width: 0; }
.inline-edit-details summary{ list-style:none; }
.inline-edit-details summary::-webkit-details-marker{ display:none; }
.inline-edit-form{
  min-width: 280px;
  padding-top: 12px;
}
.bank-cost-group-actions{
  display:flex;
  align-items:flex-end;
  gap:12px;
  flex-wrap:wrap;
}
@media (max-width: 1100px) and (min-width: 981px){
  body:not(.menu-collapsed) .app-shell{ grid-template-columns: 260px 1fr; }
  body:not(.menu-collapsed) .brand-title,
  body:not(.menu-collapsed) .sidebar-footer .meta{ display:flex; }
  body:not(.menu-collapsed) .nav a span,
  body:not(.menu-collapsed) .nav .nav-group-title{ display:block; }
  body:not(.menu-collapsed) .nav a{ justify-content:flex-start; }
  body:not(.menu-collapsed) .sidebar{ padding: 18px 14px; }
}
@media (min-width: 981px){
  body.menu-collapsed .app-shell{ grid-template-columns: 84px 1fr; }
  body.menu-collapsed .brand-title,
  body.menu-collapsed .sidebar-footer .meta,
  body.menu-collapsed .nav a span,
  body.menu-collapsed .nav .nav-group-title{ display:none !important; }
  body.menu-collapsed .nav a{ justify-content:center; }
  body.menu-collapsed .sidebar{ padding: 16px 10px; }
  body.menu-collapsed .brand{ justify-content:center; }
  body.menu-collapsed .brand-logo{ width:46px; padding:6px; border-radius:12px; }
}
@media (max-width: 980px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    width:min(290px, 86vw);
    height:100vh;
    transform: translateX(-110%);
    transition: transform .2s ease;
    z-index:1000;
    box-shadow: 0 18px 50px rgba(15,23,42,.22);
  }
  body.menu-open .sidebar{ transform: translateX(0); }
  .sidebar-backdrop{
    display:block;
    opacity:0;
    pointer-events:none;
    transition: opacity .2s ease;
  }
  body.menu-open .sidebar-backdrop{
    opacity:1;
    pointer-events:auto;
  }
}
@media (max-width: 760px){
  .bank-cost-group-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .inline-edit-form{ min-width: 0; }
}

/* --- Activity feed --- */
.activity-type-cloud{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.activity-chip{
  text-decoration:none;
  justify-content:space-between;
  min-width: 180px;
  padding: 8px 12px;
}
.activity-chip strong{font-size:13px; color: rgba(15,23,42,.92);}
.activity-chip span{font-size:12px; color: var(--muted);}
.activity-chip.is-active,
.activity-chip:hover{
  border-color: rgba(47,125,246,.22);
  background: rgba(47,125,246,.08);
}
.activity-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.activity-day-marker{
  position:sticky;
  top:0;
  z-index:1;
  display:inline-flex;
  align-self:flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.08);
  color: rgba(15,23,42,.72);
  font-size: 12px;
  font-weight: 700;
}
.activity-entry{
  border:1px solid rgba(12,28,58,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.86);
  overflow:hidden;
}
.activity-entry summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding: 14px 16px;
}
.activity-entry summary::-webkit-details-marker{display:none;}
.activity-summary-main{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:0;
  flex:1 1 auto;
}
.activity-summary-main strong{
  font-size: 16px;
  line-height: 1.35;
}
.activity-subline{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.activity-summary-side{
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-end;
  text-align:right;
  flex:0 0 auto;
}
.activity-actor{
  font-weight: 700;
  color: rgba(15,23,42,.9);
}
.activity-body{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding: 0 16px 16px;
}
.activity-meta-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}
.activity-panel{
  border:1px solid rgba(12,28,58,.08);
  border-radius: 14px;
  background: rgba(248,250,252,.88);
  padding: 12px;
  min-width:0;
}
.activity-json-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
}
.activity-kv-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top: 8px;
}
.activity-kv-item{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px dashed rgba(12,28,58,.10);
  padding-bottom:6px;
}
.activity-kv-item:last-child{
  border-bottom:none;
  padding-bottom:0;
}
.activity-kv-item span{
  font-size:12px;
  color: var(--muted);
  flex:0 0 140px;
}
.activity-kv-item strong{
  font-size:13px;
  text-align:right;
  color: rgba(15,23,42,.88);
  min-width:0;
}
.break-anywhere{
  overflow-wrap:anywhere;
  word-break:break-word;
}
.field-actions-bottom{
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
}
@media (max-width: 1080px){
  .activity-json-grid{grid-template-columns: 1fr;}
}
@media (max-width: 900px){
  .activity-meta-grid{grid-template-columns: 1fr;}
  .activity-entry summary{
    flex-direction:column;
    align-items:flex-start;
  }
  .activity-summary-side{
    align-items:flex-start;
    text-align:left;
  }
}
@media (max-width: 760px){
  .activity-kv-item{
    flex-direction:column;
    align-items:flex-start;
  }
  .activity-kv-item strong{
    text-align:left;
  }
}

/* --- Dark mode + theme switch --- */
:root{
  color-scheme: light;
  --chart-axis: #5b6475;
  --chart-grid: rgba(148,163,184,.20);
  --chart-line: #2f7df6;
  --chart-point-fill: #ffffff;
  --chart-point-stroke: #2f7df6;
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #11192b;
  --panel-2: #162036;
  --text: #e8eefb;
  --muted: #9aa9c3;
  --border: rgba(148,163,184,.18);
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --blue-50: #0f1e3b;
  --blue-100: #15284f;
  --blue-200: #1d3a72;
  --focus: 0 0 0 4px rgba(47,125,246,.24);
  --chart-axis: #9fb1ca;
  --chart-grid: rgba(148,163,184,.16);
  --chart-line: #6fb0ff;
  --chart-point-fill: #0f172a;
  --chart-point-stroke: #6fb0ff;
}
:root[data-theme="dark"] body{
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(47,125,246,.18), transparent 55%),
    radial-gradient(900px 420px at 90% 0%, rgba(111,176,255,.12), transparent 50%),
    linear-gradient(180deg, #0b1220 0%, #0d1424 100%);
  color: var(--text);
}

.theme-switch{
  gap:10px;
  min-height:42px;
  padding: 8px 12px;
}
.theme-switch-icons{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:space-between;
  width:42px;
  height:22px;
  border-radius:999px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(47,125,246,.12), rgba(47,125,246,.06));
  padding: 0 4px;
  overflow:hidden;
  flex:0 0 auto;
}
.theme-switch-icons::after{
  content:"";
  position:absolute;
  left:2px;
  top:2px;
  width:16px;
  height:16px;
  border-radius:999px;
  background:#fff;
  box-shadow: 0 2px 10px rgba(15,23,42,.16);
  transition: transform .18s ease, background .18s ease;
}
.theme-switch svg{
  width:12px;
  height:12px;
  position:relative;
  z-index:1;
}
.theme-switch .sun{ color:#b45309; }
.theme-switch .moon{ color:#1e40af; }
.theme-switch[data-theme="dark"] .theme-switch-icons::after{
  transform: translateX(18px);
  background: #dbeafe;
}
.theme-switch-label{
  white-space:nowrap;
}
@media (max-width: 760px){
  .theme-switch-label{ display:none; }
}

:root[data-theme="dark"] .sidebar{
  background: linear-gradient(180deg, rgba(9,13,24,.96), rgba(12,18,34,.90));
  border-right-color: var(--border);
}
:root[data-theme="dark"] .brand-title span,
:root[data-theme="dark"] .page-title p,
:root[data-theme="dark"] .breadcrumbs,
:root[data-theme="dark"] .breadcrumbs a,
:root[data-theme="dark"] .field label,
:root[data-theme="dark"] .help,
:root[data-theme="dark"] .help-inline,
:root[data-theme="dark"] .lookup-meta,
:root[data-theme="dark"] .lookup-empty,
:root[data-theme="dark"] .table .muted,
:root[data-theme="dark"] .activity-chip span,
:root[data-theme="dark"] .schedule-weekdays > div,
:root[data-theme="dark"] .metric .label,
:root[data-theme="dark"] .metric .hint,
:root[data-theme="dark"] .drawer .drawer-h p,
:root[data-theme="dark"] .modal .modal-h p,
:root[data-theme="dark"] .notice p,
:root[data-theme="dark"] .dropzone .hint,
:root[data-theme="dark"] .card .card-h p,
:root[data-theme="dark"] .search svg,
:root[data-theme="dark"] .sselect .sselect-item .sub,
:root[data-theme="dark"] .sselect .sselect-empty,
:root[data-theme="dark"] .breadcrumbs-sep,
:root[data-theme="dark"] .sidebar-footer,
:root[data-theme="dark"] .sidebar-footer .meta span,
:root[data-theme="dark"] .activity-day-marker,
:root[data-theme="dark"] .nav .nav-group-title,
:root[data-theme="dark"] .code,
:root[data-theme="dark"] .table-footer .meta,
:root[data-theme="dark"] .step,
:root[data-theme="dark"] .kpi .sub,
:root[data-theme="dark"] .kpi .trend,
:root[data-theme="dark"] .mail-preview,
:root[data-theme="dark"] .page-title p,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .schedule-current-month,
:root[data-theme="dark"] .table thead th{
  color: var(--muted);
}
:root[data-theme="dark"] .nav a{ color: var(--muted); }
:root[data-theme="dark"] .nav a svg{ color:#8fb8ff; }
:root[data-theme="dark"] .nav a:hover,
:root[data-theme="dark"] .nav a.active{
  background: rgba(47,125,246,.14);
  color: var(--text);
  border-color: rgba(111,176,255,.22);
}
:root[data-theme="dark"] .sidebar-footer{
  border-top-color: rgba(148,163,184,.16);
}
:root[data-theme="dark"] .avatar{
  background: rgba(47,125,246,.18);
  border-color: rgba(111,176,255,.24);
  color:#dbeafe;
}

:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .search input,
:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .readonly-box,
:root[data-theme="dark"] .tabs,
:root[data-theme="dark"] .schedule-current-month,
:root[data-theme="dark"] .code,
:root[data-theme="dark"] .step,
:root[data-theme="dark"] .dropzone,
:root[data-theme="dark"] .lookup-menu,
:root[data-theme="dark"] .sselect .sselect-menu,
:root[data-theme="dark"] .lookup-item,
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .details-card,
:root[data-theme="dark"] .details-card summary,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .kv .k,
:root[data-theme="dark"] .column,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .table-footer,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .modal .modal-h,
:root[data-theme="dark"] .modal .modal-f,
:root[data-theme="dark"] .drawer,
:root[data-theme="dark"] .drawer .drawer-f,
:root[data-theme="dark"] .activity-entry,
:root[data-theme="dark"] .schedule-day,
:root[data-theme="dark"] .schedule-item,
:root[data-theme="dark"] .activity-chip,
:root[data-theme="dark"] .topbar .badge,
:root[data-theme="dark"] .pager .page-btn{
  background: rgba(15,23,42,.82);
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}
:root[data-theme="dark"] .btn:hover,
:root[data-theme="dark"] .lookup-item:hover,
:root[data-theme="dark"] .sselect .sselect-item:hover,
:root[data-theme="dark"] .pager .page-btn:hover,
:root[data-theme="dark"] .activity-chip:hover{
  background: rgba(30,41,59,.94);
  border-color: rgba(111,176,255,.22);
}
:root[data-theme="dark"] .btn.primary{
  background: linear-gradient(180deg, rgba(47,125,246,.28), rgba(47,125,246,.16));
  border-color: rgba(111,176,255,.28);
}
:root[data-theme="dark"] .btn.blue{
  background: linear-gradient(180deg, rgba(47,125,246,.92), rgba(30,101,222,.88));
  border-color: rgba(111,176,255,.42);
}
:root[data-theme="dark"] .input::placeholder,
:root[data-theme="dark"] textarea::placeholder,
:root[data-theme="dark"] .search input::placeholder{
  color: rgba(154,169,195,.85);
}
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .table-footer,
:root[data-theme="dark"] .modal .modal-h,
:root[data-theme="dark"] .modal .modal-f,
:root[data-theme="dark"] .drawer .drawer-h,
:root[data-theme="dark"] .drawer .drawer-f,
:root[data-theme="dark"] .column .col-h{
  border-color: rgba(148,163,184,.14);
}
:root[data-theme="dark"] .table-wrap{
  background: rgba(8,13,24,.48);
}
:root[data-theme="dark"] .table{
  background: rgba(11,18,32,.62);
}
:root[data-theme="dark"] .table thead th{
  background: linear-gradient(180deg, rgba(16,23,42,.96), rgba(17,26,46,.94));
  border-bottom-color: rgba(148,163,184,.18);
}
:root[data-theme="dark"] .table tbody td{
  color: var(--text);
  border-bottom-color: rgba(148,163,184,.10);
}
:root[data-theme="dark"] .table tbody tr:hover td,
:root[data-theme="dark"] .clickable-row:hover td,
:root[data-theme="dark"] .clickable-row.is-row-focus td,
:root[data-theme="dark"] .table tbody tr.active-row td{
  background: rgba(47,125,246,.12);
}
:root[data-theme="dark"] .lookup-menu,
:root[data-theme="dark"] .sselect .sselect-menu,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .drawer,
:root[data-theme="dark"] .activity-entry,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .schedule-day,
:root[data-theme="dark"] .schedule-item,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .column,
:root[data-theme="dark"] .details-card{
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
}
:root[data-theme="dark"] .badge.gray{
  background: rgba(148,163,184,.12);
  color: #d4deef;
  border-color: rgba(148,163,184,.18);
}
:root[data-theme="dark"] .badge.blue{
  background: rgba(47,125,246,.18);
  color: #dbeafe;
  border-color: rgba(111,176,255,.24);
}
:root[data-theme="dark"] .badge.green{
  background: rgba(34,197,94,.16);
  color: #bbf7d0;
  border-color: rgba(34,197,94,.26);
}
:root[data-theme="dark"] .badge.yellow{
  background: rgba(245,158,11,.16);
  color: #fde68a;
  border-color: rgba(245,158,11,.26);
}
:root[data-theme="dark"] .badge.red{
  background: rgba(239,68,68,.16);
  color: #fecaca;
  border-color: rgba(239,68,68,.26);
}
:root[data-theme="dark"] .badge.orange{
  background: rgba(249,115,22,.16);
  color: #fdba74;
  border-color: rgba(249,115,22,.26);
}
:root[data-theme="dark"] .badge.purple{
  background: rgba(139,92,246,.16);
  color: #ddd6fe;
  border-color: rgba(139,92,246,.26);
}
:root[data-theme="dark"] .notice{
  background: rgba(47,125,246,.14);
  border-color: rgba(111,176,255,.22);
  color: #dbeafe;
}
:root[data-theme="dark"] .dropzone.drag,
:root[data-theme="dark"] .tab.active,
:root[data-theme="dark"] .pager .page-btn.active,
:root[data-theme="dark"] .step.active,
:root[data-theme="dark"] .activity-chip.is-active{
  background: rgba(47,125,246,.16);
  border-color: rgba(111,176,255,.26);
  color: var(--text);
}
:root[data-theme="dark"] .schedule-day.has-items{
  border-color: rgba(111,176,255,.22);
}
:root[data-theme="dark"] .schedule-day.is-today{
  border-color: rgba(111,176,255,.32);
  box-shadow: 0 12px 28px rgba(47,125,246,.18);
}
:root[data-theme="dark"] .activity-day-marker{
  background: rgba(148,163,184,.12);
  color: #c8d5ea;
}
:root[data-theme="dark"] .modal-backdrop,
:root[data-theme="dark"] .drawer-backdrop,
:root[data-theme="dark"] .sidebar-backdrop{
  background: rgba(2,6,23,.62);
}
:root[data-theme="dark"] .uplot text,
:root[data-theme="dark"] .uplot .u-legend,
:root[data-theme="dark"] .uplot{
  color: var(--chart-axis);
}

/* --- Dark mode: graphite + cool blue accents --- */
:root[data-theme="dark"]{
  --bg: #202327;
  --panel: #2b2f36;
  --panel-2: #252a31;
  --text: #c6d4e3;
  --muted: #8a97a8;
  --border: rgba(198,212,227,.10);
  --shadow: 0 18px 42px rgba(0,0,0,.42);
  --blue-50: #243042;
  --blue-100: #28364b;
  --blue-200: #304d70;
  --blue-500: #5d9cec;
  --blue-600: #4a87d8;
  --blue-700: #356cb1;
  --focus: 0 0 0 4px rgba(93,156,236,.20);
  --chart-axis: #90a2b7;
  --chart-grid: rgba(198,212,227,.12);
  --chart-line: #74b2ff;
  --chart-point-fill: #2b2f36;
  --chart-point-stroke: #74b2ff;
}

:root[data-theme="dark"] body{
  background:
    radial-gradient(1100px 460px at 18% -8%, rgba(93,156,236,.10), transparent 56%),
    radial-gradient(840px 360px at 92% 0%, rgba(116,178,255,.08), transparent 52%),
    linear-gradient(180deg, #202327 0%, #1b1f24 100%);
}
:root[data-theme="dark"] ::selection{
  background: rgba(93,156,236,.26);
  color: #eef5ff;
}

:root[data-theme="dark"] .theme-switch-icons{
  border-color: rgba(198,212,227,.14);
  background: linear-gradient(180deg, rgba(43,47,54,.98), rgba(37,42,49,.94));
}
:root[data-theme="dark"] .theme-switch-icons::after{
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .theme-switch[data-theme="dark"] .theme-switch-icons::after{
  background: #8fc2ff;
}
:root[data-theme="dark"] .theme-switch .moon{
  color: #8fc2ff;
}
:root[data-theme="dark"] .theme-switch .sun{
  color: #8a97a8;
}

:root[data-theme="dark"] .sidebar{
  background: linear-gradient(180deg, rgba(32,35,39,.98), rgba(37,42,49,.96));
}
:root[data-theme="dark"] .brand-mark{
  background: linear-gradient(135deg, #5d9cec, #3977c7);
  box-shadow: 0 10px 24px rgba(93,156,236,.24);
}
:root[data-theme="dark"] .nav a svg{
  color: #9abce6;
}
:root[data-theme="dark"] .nav a:hover,
:root[data-theme="dark"] .nav a.active{
  background: rgba(93,156,236,.12);
  color: #d9e7f6;
  border-color: rgba(93,156,236,.22);
}
:root[data-theme="dark"] .avatar{
  background: rgba(93,156,236,.14);
  border-color: rgba(93,156,236,.22);
  color: #dcebff;
}

:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .search input,
:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .readonly-box,
:root[data-theme="dark"] .tabs,
:root[data-theme="dark"] .schedule-current-month,
:root[data-theme="dark"] .code,
:root[data-theme="dark"] .step,
:root[data-theme="dark"] .dropzone,
:root[data-theme="dark"] .lookup-menu,
:root[data-theme="dark"] .sselect .sselect-menu,
:root[data-theme="dark"] .lookup-item,
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .details-card,
:root[data-theme="dark"] .details-card summary,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .kv .k,
:root[data-theme="dark"] .column,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .table-footer,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .modal .modal-h,
:root[data-theme="dark"] .modal .modal-f,
:root[data-theme="dark"] .drawer,
:root[data-theme="dark"] .drawer .drawer-f,
:root[data-theme="dark"] .activity-entry,
:root[data-theme="dark"] .schedule-day,
:root[data-theme="dark"] .schedule-item,
:root[data-theme="dark"] .activity-chip,
:root[data-theme="dark"] .topbar .badge,
:root[data-theme="dark"] .pager .page-btn{
  background: rgba(43,47,54,.92);
}
:root[data-theme="dark"] .btn:hover,
:root[data-theme="dark"] .lookup-item:hover,
:root[data-theme="dark"] .sselect .sselect-item:hover,
:root[data-theme="dark"] .pager .page-btn:hover,
:root[data-theme="dark"] .activity-chip:hover{
  background: rgba(52,57,66,.96);
  border-color: rgba(93,156,236,.20);
}
:root[data-theme="dark"] .btn.primary{
  background: linear-gradient(180deg, rgba(93,156,236,.22), rgba(93,156,236,.12));
  border-color: rgba(93,156,236,.24);
}
:root[data-theme="dark"] .btn.blue{
  background: linear-gradient(180deg, rgba(93,156,236,.92), rgba(58,119,199,.90));
  border-color: rgba(93,156,236,.40);
  color: #eef6ff;
}

:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .table-footer,
:root[data-theme="dark"] .modal .modal-h,
:root[data-theme="dark"] .modal .modal-f,
:root[data-theme="dark"] .drawer .drawer-h,
:root[data-theme="dark"] .drawer .drawer-f,
:root[data-theme="dark"] .column .col-h,
:root[data-theme="dark"] .sidebar-footer{
  border-color: rgba(198,212,227,.08);
}
:root[data-theme="dark"] .table-wrap{
  background: rgba(37,42,49,.64);
}
:root[data-theme="dark"] .table{
  background: rgba(32,35,39,.46);
}
:root[data-theme="dark"] .table thead th{
  background: linear-gradient(180deg, rgba(55,61,70,.98), rgba(43,47,54,.96));
  border-bottom-color: rgba(198,212,227,.10);
}
:root[data-theme="dark"] .table tbody td{
  border-bottom-color: rgba(198,212,227,.06);
}
:root[data-theme="dark"] .table tbody tr:hover td,
:root[data-theme="dark"] .clickable-row:hover td,
:root[data-theme="dark"] .clickable-row.is-row-focus td,
:root[data-theme="dark"] .table tbody tr.active-row td{
  background: rgba(93,156,236,.10);
}

:root[data-theme="dark"] .badge.gray{
  background: rgba(138,151,168,.14);
  color: #d2dbe5;
  border-color: rgba(138,151,168,.22);
}
:root[data-theme="dark"] .badge.blue{
  background: rgba(93,156,236,.16);
  color: #dcebff;
  border-color: rgba(93,156,236,.24);
}
:root[data-theme="dark"] .badge.green{
  background: rgba(106,135,89,.18);
  color: #c8ddb9;
  border-color: rgba(106,135,89,.28);
}
:root[data-theme="dark"] .badge.yellow,
:root[data-theme="dark"] .badge.orange{
  background: rgba(245,158,11,.18);
  color: #fdd28b;
  border-color: rgba(245,158,11,.28);
}
:root[data-theme="dark"] .badge.red{
  background: rgba(188,85,78,.18);
  color: #f2c2bc;
  border-color: rgba(188,85,78,.28);
}
:root[data-theme="dark"] .badge.purple{
  background: rgba(132,103,184,.16);
  color: #ddd4f3;
  border-color: rgba(132,103,184,.26);
}

:root[data-theme="dark"] .notice{
  background: rgba(93,156,236,.12);
  border-color: rgba(93,156,236,.22);
  color: #dcecff;
}
:root[data-theme="dark"] .dropzone.drag,
:root[data-theme="dark"] .tab.active,
:root[data-theme="dark"] .pager .page-btn.active,
:root[data-theme="dark"] .step.active,
:root[data-theme="dark"] .activity-chip.is-active{
  background: rgba(93,156,236,.14);
  border-color: rgba(93,156,236,.24);
}
:root[data-theme="dark"] .schedule-day.has-items{
  border-color: rgba(93,156,236,.22);
}
:root[data-theme="dark"] .schedule-day.is-today{
  border-color: rgba(93,156,236,.30);
  box-shadow: 0 12px 28px rgba(93,156,236,.12);
}
:root[data-theme="dark"] .activity-day-marker{
  background: rgba(138,151,168,.12);
  color: #c4ccd5;
}
:root[data-theme="dark"] .modal-backdrop,
:root[data-theme="dark"] .drawer-backdrop,
:root[data-theme="dark"] .sidebar-backdrop{
  background: rgba(0,0,0,.66);
}

.state-card{
  display:grid;
  grid-template-columns: 72px minmax(0,1fr);
  gap: 20px;
  align-items:flex-start;
  padding: 24px;
  border:1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.state-card-icon{
  width:72px;
  height:72px;
  display:grid;
  place-items:center;
  border-radius: 20px;
  background: rgba(239,68,68,.10);
  color: var(--red-500);
  border:1px solid rgba(239,68,68,.14);
}
.state-card-icon svg{ width:32px; height:32px; }
.state-card-eyebrow{
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.state-card h1{
  margin:0;
  font-size: 30px;
  line-height:1.1;
}
.state-card-lead{
  margin: 12px 0 10px;
  font-size: 16px;
  line-height:1.55;
}
.state-card-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top: 18px;
}
:root[data-theme="dark"] .state-card{
  background: rgba(43,47,54,.94);
  border-color: rgba(198,212,227,.10);
}
:root[data-theme="dark"] .state-card-icon{
  background: rgba(93,156,236,.14);
  color: #dcecff;
  border-color: rgba(93,156,236,.22);
}
@media (max-width: 760px){
  .state-card{
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px;
  }
  .state-card-icon{
    width:56px;
    height:56px;
    border-radius: 16px;
  }
  .state-card h1{ font-size: 24px; }
}


.notice-spaced{margin-top:12px}
.qr-panel{align-items:flex-start; gap:16px}
.qr-preview{
  width:min(220px, 100%);
  padding:10px;
  border:1px solid var(--border);
  border-radius:16px;
  background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(246,249,255,.95));
}
.qr-preview img{display:block; width:100%; height:auto}
.qr-preview svg{display:block; width:100%; height:auto}
.qr-ksef-number-break{word-break:break-all}
.payment-badge-offset{margin-top:6px}
.col-min-240{min-width:240px}
.col-min-230{min-width:230px}
.col-min-260{min-width:260px}
.file-trigger{position:relative; overflow:hidden}
.file-trigger-input{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
}
.stack-tight{gap:8px}
.progress-meter{
  width:100%;
  height:12px;
  border:none;
  border-radius:999px;
  overflow:hidden;
  background:rgba(47,125,246,.12);
  appearance:none;
  -webkit-appearance:none;
}
.progress-meter::-webkit-progress-bar{background:rgba(47,125,246,.12); border-radius:999px}
.progress-meter::-webkit-progress-value{background:linear-gradient(90deg, rgba(47,125,246,.7), rgba(47,125,246,.95)); border-radius:999px}
.progress-meter::-moz-progress-bar{background:linear-gradient(90deg, rgba(47,125,246,.7), rgba(47,125,246,.95)); border-radius:999px}

/* --- Collections bulk tools + compact snapshot fixes --- */
.split-actions{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.inline-fields{
  display:flex;
  align-items:flex-end;
  gap:12px;
  flex-wrap:wrap;
}
.wrap-end{
  justify-content:flex-end;
}
.bulk-tools-head{
  border-top:1px solid rgba(12,28,58,.08);
}
.bulk-tool-panel{
  border-top:1px solid rgba(12,28,58,.08);
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.border-top-soft{
  border-top:1px solid rgba(12,28,58,.08);
}
.bulk-tool-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:12px;
  flex:1 1 720px;
  min-width: min(100%, 720px);
}
.bulk-tool-grid--actions{
  flex-basis: 380px;
  min-width: min(100%, 380px);
}
.bulk-tool-grid .field{
  margin:0;
}
.bulk-tool-grid .field-span-2{
  grid-column: span 2;
}
.selection-counter{
  white-space:nowrap;
  font-size:12px;
}
.compact-select label{
  display:block;
}
.compact-select select,
.compact-select .input{
  min-width: 210px;
}
.col-check{
  width:52px;
  text-align:center;
}
.col-check input[type="checkbox"]{
  width:16px;
  height:16px;
}
.compact-kv .k{
  display:grid;
  grid-template-columns: minmax(112px, 150px) minmax(0, 1fr);
  align-items:start;
  gap:12px;
}
.compact-kv .k .muted{
  flex:0 0 auto;
  min-width:0;
  white-space:normal;
}
.compact-kv .k span:last-child{
  min-width:0;
  width:100%;
}
.badge.teal{ background:#ccfbf1; color:#115e59; border-color:#99f6e4; }
.badge.cyan{ background:#cffafe; color:#155e75; border-color:#a5f3fc; }
.badge.indigo{ background:#e0e7ff; color:#3730a3; border-color:#c7d2fe; }
.badge.pink{ background:#fce7f3; color:#9d174d; border-color:#f9a8d4; }
.badge.brown{ background:#efddcf; color:#7c4a24; border-color:#ddc0a6; }
.badge.black{ background:#e5e7eb; color:#111827; border-color:#9ca3af; }
@media (max-width: 900px){
  .split-actions,
  .bulk-tool-panel{
    align-items:stretch;
  }
  .bulk-tool-panel > .table-actions,
  .bulk-tool-panel > .row-gap,
  .bulk-tools-head .inline-fields{
    width:100%;
  }
  .bulk-tool-grid .field-span-2{
    grid-column: auto;
  }
}
@media (max-width: 760px){
  .bulk-tool-grid{
    grid-template-columns: 1fr;
  }
  .compact-kv .k{
    grid-template-columns: 1fr;
  }
  .compact-select select,
  .compact-select .input{
    min-width: 0;
    width:100%;
  }
}


.sidebar-footer{
  text-decoration:none;
}
.sidebar-footer:hover{
  color:var(--muted);
}
.avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:inherit;
  display:block;
}
.profile-page .profile-identity{
  display:flex;
  gap:16px;
  align-items:center;
}
.profile-avatar-shell{
  width:96px;
  height:96px;
  border-radius:28px;
  overflow:hidden;
  border:1px solid rgba(47,125,246,.16);
  background: rgba(47,125,246,.08);
  flex:0 0 96px;
}
.profile-avatar-image{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.tag-cloud{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.tag-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.08);
  background: rgba(15,23,42,.04);
  font-size:12px;
  line-height:1.2;
}
.tag-chip .tag-label{
  white-space:nowrap;
}
.tag-chip .tag-remove{
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  color:inherit;
  cursor:pointer;
  font-size:13px;
}
.comment-list{
  display:grid;
  gap:12px;
}
.comment-item{
  padding:14px 16px;
  border:1px solid rgba(12,28,58,.08);
  border-radius:16px;
  background: rgba(255,255,255,.6);
}
.comment-item .meta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:8px;
  color:var(--muted);
  font-size:12px;
}
.comment-item p{
  margin:0;
  white-space:pre-wrap;
}
@media (max-width: 760px){
  .profile-page .profile-identity{
    align-items:flex-start;
    flex-direction:column;
  }
}

:root[data-theme="dark"] .brand-logo,
:root[data-theme="dark"] .auth-logo img{
  background: rgba(15,23,42,.55);
  border-color: rgba(148,163,184,.2);
}

.bulk-tools-disclosure{
  border-top:1px solid rgba(12,28,58,.08);
}
.bulk-tools-disclosure > summary{
  list-style:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin:12px 16px 0;
  cursor:pointer;
}
.bulk-tools-disclosure > summary::-webkit-details-marker{
  display:none;
}
.bulk-tools-disclosure > summary::before{
  content:'▸';
  font-size:12px;
  line-height:1;
  opacity:.7;
}
.bulk-tools-disclosure[open] > summary::before{
  content:'▾';
}
.bulk-tools-disclosure > summary + *{
  margin-top:12px;
}
.audit-note{
  white-space:pre-wrap;
  line-height:1.5;
}

.bulk-tools-body{ display:grid; gap:0; }
.bulk-tools-head .selection-counter{ margin-right:4px; }

.page-preloader{
  position:fixed;
  inset:0;
  z-index:16050;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(246,249,255,.72);
  backdrop-filter:blur(8px);
}
.page-preloader-box{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:min(92vw, 360px);
  padding:18px 20px;
  border:1px solid var(--border);
  border-radius:18px;
  background:rgba(255,255,255,.94);
  box-shadow:var(--shadow);
}
.page-preloader-spinner{
  width:22px;
  height:22px;
  border-radius:999px;
  border:3px solid rgba(47,125,246,.18);
  border-top-color:var(--blue-600);
  animation:page-preloader-spin .8s linear infinite;
  flex:0 0 auto;
}
.page-preloader-text{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.page-preloader-text strong{
  font-size:14px;
}
.page-preloader-text span{
  color:var(--muted);
  font-size:13px;
}
body.page-loading{
  cursor:progress;
}
@keyframes page-preloader-spin{
  to{ transform:rotate(360deg); }
}

.mail-index-layout{
  display:grid;
  grid-template-columns:minmax(0, 1.15fr) minmax(340px, .85fr);
  gap:18px;
  align-items:start;
}
.mail-table tr[data-row-href]{
  cursor:pointer;
}
.mail-table tr.mail-row-selected td{
  background:rgba(47,125,246,.08);
}
.mail-row-subject{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.mail-row-subject .small-muted{
  max-width:52ch;
}
.mail-preview-card{
  min-height:100%;
}
.mail-preview-meta{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px 16px;
}
.mail-preview-kv{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.mail-preview-kv .label{
  color:var(--muted);
  font-size:12px;
}
.mail-preview-frame{
  width:100%;
  min-height:780px;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
}
:root[data-theme="dark"] .contract-parameter-row,
:root[data-theme="dark"] .contract-module-editor,
:root[data-theme="dark"] .parameter-display-item,
:root[data-theme="dark"] .contract-module-display,
:root[data-theme="dark"] .module-note{
  background:rgba(15,23,42,.72);
  border-color:rgba(148,163,184,.24);
}
:root[data-theme="dark"] .parameter-display-value.is-multi span{
  background:rgba(30,41,59,.86);
  border-color:rgba(148,163,184,.24);
}
@media (max-width: 1180px){
  .mail-index-layout{
    grid-template-columns:1fr;
  }
  .mail-preview-frame{
    min-height:620px;
  }
}
@media (max-width: 760px){
  .mail-preview-meta{
    grid-template-columns:1fr;
  }
}
