/* Insights - wygląd przeniesiony z panelu BrandinAI (brandinai-frontend, theme-purple, light).
   Wartości pochodzą z src/style/theme/common.css, purple.css i src/style/**; tu są rozwiązane do zwykłego CSS. */

@font-face {
  font-family: "Mulish Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("/fonts/mulish-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Mulish Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("/fonts/mulish-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Urbanist z panelu BrandinAI: własny plik, bo podzbiory Google nie mają ł/Ł. */
@font-face {
  font-family: "Urbanist Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/urbanist-variable.woff2") format("woff2-variations");
}

:root {
  --font-body: "Mulish Variable", ui-sans-serif, system-ui, sans-serif;
  --font-heading: "Urbanist Variable", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f6fa;
  --paper: #fff;
  --grey-20: #fafafc;
  --grey-25: #f7f8fa;
  --grey-50: #eff0f5;
  --grey-100: #e3e5ed;
  --grey-200: #d7d9e2;
  --grey-300: #cbced7;
  --grey-400: #c1c3cd;
  --grey-500: #b6b9c3;

  --text: #191d2e;
  --text-2: #6b7085;
  --text-3: #b6b9c3;

  --primary: #6c73ef;
  --primary-light: #9a9ff4;
  --primary-dark: #3e47ea;
  --success: #2e9e6a;
  --success-dark: #207e52;
  --error: #de354c;
  --error-dark: #bf2237;
  --warning: #f58514;
  --warning-dark: #cb6b0b;
  --info: #2783ec;
  --info-dark: #166aca;

  --shadow-2xs: 0 1px 2px rgba(23, 27, 51, 0.04);
  --shadow-xs: 0 1px 2px rgba(23, 27, 51, 0.04), 0 2px 8px -2px rgba(23, 27, 51, 0.06);
  --shadow-lg: 0 8px 16px -4px rgba(23, 27, 51, 0.08), 0 20px 44px -10px rgba(23, 27, 51, 0.14);
  --shadow-2xl: 0 16px 32px -8px rgba(23, 27, 51, 0.12), 0 36px 72px -16px rgba(23, 27, 51, 0.18);
  --shadow-darker-xs: 0 1px 3px rgba(23, 27, 51, 0.08), 0 3px 10px -2px rgba(23, 27, 51, 0.1);
  --shadow-darker-sm: 0 0 0 1px rgba(23, 27, 51, 0.04), 0 4px 12px -2px rgba(23, 27, 51, 0.12), 0 12px 32px -8px rgba(23, 27, 51, 0.14);
  --shadow-darker-md: 0 0 0 1px rgba(23, 27, 51, 0.04), 0 8px 20px -4px rgba(23, 27, 51, 0.14), 0 20px 48px -12px rgba(23, 27, 51, 0.18);
  --ring: 0 0 0 2px hsl(237 80% 68% / 0.4);
  --ring-key: 0 0 0 3px hsl(237 80% 68% / 0.3);

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-tw: cubic-bezier(0.4, 0, 0.2, 1);

  --sb-w: 280px;
  --sb-rail: 60px;
  --topbar-h: 56px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: hsl(237 80% 68% / 0.3); }
:focus { outline: 0; }
:focus-visible { box-shadow: var(--ring-key); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

*::-webkit-scrollbar { width: 6px; height: 6px; background-color: inherit; }
*::-webkit-scrollbar-thumb { background-color: var(--grey-300); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--grey-400); }
*::-webkit-scrollbar-button { display: none; }

.ico { width: 20px; height: 20px; flex: 0 0 auto; display: block; }
.ico-sm { width: 16px; height: 16px; }

/* ---------- Sidebar ---------- */

.sb {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  width: var(--sb-w);
  background: var(--paper);
  border-right: 1px solid var(--grey-100);
}
.sb-col {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px 4px;
}
.sb-logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  flex-shrink: 0;
  min-height: 56px;
  padding: 8px 0 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
}
.wordmark { display: block; height: 28px; width: auto; flex-shrink: 0; }
.product-chip { padding: 2px 8px; }
.sb-logo-row .brand { gap: 6px; }
.sb-logo-row .wordmark { height: 26px; }
.mark { display: none; height: 36px; width: auto; }
.sb-collapse { position: relative; }
.sb-collapse .ico-expand { display: none; }

.sb-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12px;
}

.overline {
  display: block;
  padding-left: 4px;
  font: 600 11px/14.67px var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.sb-switcher { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 8px; }
.sb-select { position: relative; display: flex; align-items: center; height: 36px; margin: 0; }
.sb-select select,
.sb-select-value {
  width: 100%;
  height: 36px;
  padding: 4px 32px 4px 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--grey-25);
  font: 600 14px/26px var(--font-body);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s var(--ease-tw), border-color 0.15s var(--ease-tw);
}
.sb-select select { appearance: none; cursor: pointer; }
.sb-select-value { padding-right: 12px; }
.sb-select select:hover { background: var(--paper); border-color: var(--grey-300); }
.sb-select select:focus { background: var(--paper); border-color: transparent; box-shadow: inset 0 0 0 2px hsl(237 80% 68% / 0.4); }
.sb-tile {
  position: absolute;
  left: 8px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 10px;
  background: hsl(237 80% 68% / 0.1);
  color: var(--primary);
  font: 700 12px/1 var(--font-body);
  pointer-events: none;
}
.sb-select .chev-down { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; color: var(--text-2); pointer-events: none; }

.sb-items { display: flex; flex-direction: column; gap: 4px; }
.sb-items.is-top { flex: 1; }
.sb-items.is-bottom { gap: 2px; }
.sb-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font: 500 14px/24px var(--font-body);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.sb-item > .ico { width: 22px; height: 22px; margin: 0 8px 0 -4px; transition: color 0.15s var(--ease-tw); }
.sb-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item.is-active { background: hsl(237 80% 68% / 0.1); font-weight: 600; }
.sb-item:focus-visible, .sb-user:focus-visible { box-shadow: inset 0 0 0 2px hsl(237 80% 68% / 0.4); }
.sb-group-head .chev { width: 22px; height: 22px; margin: 0 -4px 0 auto; transition: transform 0.15s var(--ease-tw); }
.sb-group.is-open .sb-group-head .chev { transform: rotate(90deg); }
.sb-group.has-active .sb-group-head { font-weight: 600; }
.sb-group-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s var(--ease-tw);
}
.sb-group.is-open .sb-group-body { grid-template-rows: 1fr; }
.sb-group-inner { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding-left: 16px; }
.sb-group:not(.is-open) .sb-group-inner { visibility: hidden; transition: visibility 0s linear 0.3s; }
.sb-group-inner > :first-child { margin-top: 4px; }
.sb-group-inner > :last-child { margin-bottom: 4px; }
.sb-group-inner .sb-item.is-active { color: var(--primary); }
@media (hover: hover) {
  .sb-item:hover { background: var(--grey-50); }
  .sb-item.is-active:hover { background: hsl(237 80% 68% / 0.14); }
  .sb-group.is-open > .sb-group-head:hover { background: var(--grey-50); }
}
.sb-group.is-open > .sb-group-head { background: transparent; }

.sb-foot {
  position: relative;
  flex-shrink: 0;
  padding: 8px 4px 6px;
  border-top: 1px solid var(--grey-100);
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}
.sb-user:hover { background: var(--grey-50); }
.sb-user[aria-expanded="true"] { background: hsl(228 10% 74% / 0.15); }
.sb-user-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sb-user-name { font: 600 12px/17px var(--font-body); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: hsl(237 80% 78% / 0.2);
  color: var(--primary-dark);
  font: 600 12px/1 var(--font-body);
  user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

.pop {
  position: absolute;
  z-index: 50;
  left: 4px;
  bottom: calc(100% + 4px);
  width: 320px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--grey-100);
  border-radius: 16px;
  box-shadow: var(--shadow-darker-sm);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s var(--ease-tw), transform 0.15s var(--ease-tw);
}
.pop.is-shown { opacity: 1; transform: none; }
.pop-head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.pop-head .avatar { margin-bottom: 8px; }
.pop-name { max-width: 100%; font: 700 14px/21px var(--font-body); overflow-wrap: anywhere; }
.pop-sub { font: 400 12px/17px var(--font-body); color: var(--text-2); }
.pop hr { margin: 16px 0; border: 0; border-top: 1px solid var(--grey-100); }
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; font: 500 14px/20px var(--font-body); }

.sb-backdrop { display: none; }
.topbar { display: none; }

/* ---------- Rail (zwinięty sidebar) ---------- */

@media (min-width: 960px) {
  html.sb-rail { --sb-w: var(--sb-rail); }
  html.sb-rail .sb-col { align-items: center; padding-inline: 8px; }
  html.sb-rail .sb-logo-row { justify-content: center; padding: 12px 0; min-height: 68px; }
  html.sb-rail .sb-logo-row .brand { width: 44px; height: 44px; justify-content: center; }
  html.sb-rail .wordmark,
  html.sb-rail .product-chip,
  html.sb-rail .sb-label,
  html.sb-rail .sb-group-head,
  html.sb-rail .overline,
  html.sb-rail .sb-select select,
  html.sb-rail .sb-select-value,
  html.sb-rail .sb-select .chev-down,
  html.sb-rail .sb-user-meta { display: none; }
  html.sb-rail .mark { display: block; }
  html.sb-rail .sb-collapse { display: none; }
  html.sb-rail .sb-collapse .ico-collapse { display: none; }
  html.sb-rail .sb-collapse .ico-expand { display: block; }
  html.sb-rail .sb-logo-row:hover .brand,
  html.sb-rail .sb-logo-row:has(:focus-visible) .brand { display: none; }
  html.sb-rail .sb-logo-row:hover .sb-collapse,
  html.sb-rail .sb-logo-row:has(:focus-visible) .sb-collapse { display: grid; width: 44px; height: 44px; }
  html.sb-rail .sb-col { cursor: ew-resize; }
  html.sb-rail .sb-col a, html.sb-rail .sb-col button, html.sb-rail .sb-col .pop { cursor: pointer; }
  html.sb-rail .pop { cursor: default; }
  html.sb-rail .sb-scroll { width: 100%; align-items: center; overflow: visible; }
  html.sb-rail .sb-switcher { padding: 0 0 8px; }
  html.sb-rail .sb-select { width: 44px; height: 44px; justify-content: center; cursor: pointer; }
  html.sb-rail .sb-tile { position: static; width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
  html.sb-rail .sb-items { align-items: center; }
  html.sb-rail .sb-item { width: 44px; height: 44px; padding: 11px; justify-content: center; }
  html.sb-rail .sb-item > .ico { margin: 0; transition: transform 0.15s var(--ease-tw); }
  html.sb-rail .sb-item:hover > .ico,
  html.sb-rail .sb-item.is-active > .ico { transform: scale(0.85); }
  html.sb-rail .sb-item:not(.is-active):hover { background: var(--grey-25); }
  html.sb-rail .sb-item.is-active { background: hsl(237 80% 78% / 0.15); color: var(--primary); }
  html.sb-rail .sb-group-body { grid-template-rows: 1fr; }
  html.sb-rail .sb-group-inner { padding-left: 0; align-items: center; overflow: visible; }
  html.sb-rail .sb-group-inner > :first-child { margin-top: 0; }
  html.sb-rail .sb-group-inner > :last-child { margin-bottom: 0; }
  html.sb-rail .sb-foot { width: 100%; padding-inline: 0; display: flex; justify-content: center; }
  html.sb-rail .sb-user { width: 44px; justify-content: center; padding: 6px; }
  html.sb-rail .pop { left: 0; }
  html.sb-rail .sb-group .sb-group-inner { visibility: visible; transition: none; }

  html.sb-rail [data-tip]:hover::after,
  html.sb-rail [data-tip]:focus-visible::after,
  .sb-collapse[data-tip]:hover::after,
  .sb-collapse[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    z-index: 60;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 12px;
    border: 1px solid var(--grey-100);
    border-radius: 10px;
    background: var(--paper);
    box-shadow: var(--shadow-darker-sm);
    font: 500 12px/1.4 var(--font-body);
    color: var(--text);
    white-space: nowrap;
    pointer-events: none;
  }
  html.sb-rail .sb-item[data-tip]:hover::after,
  html.sb-rail .sb-item[data-tip]:focus-visible::after { padding: 7px 19px; border-radius: 8px; font: 500 14px/16px var(--font-body); }
  html.sb-rail .sb-item.is-active::after { color: var(--primary); }
  html.sb-rail [data-tip]:hover::before,
  html.sb-rail [data-tip]:focus-visible::before,
  .sb-collapse[data-tip]:hover::before,
  .sb-collapse[data-tip]:focus-visible::before {
    content: "";
    position: absolute;
    z-index: 61;
    left: calc(100% + 4.5px);
    top: 50%;
    width: 7px;
    height: 7px;
    background: var(--paper);
    border-left: 1px solid var(--grey-200);
    border-bottom: 1px solid var(--grey-200);
    transform: translateY(-50%) rotate(45deg);
    pointer-events: none;
  }
  html.sb-rail .sb-user[aria-expanded="true"]::before,
  html.sb-rail .sb-user[aria-expanded="true"]::after { display: none; }
}

@media (min-width: 960px) and (max-width: 1439px) {
  :root { --sb-w: 240px; }
  .sb-logo-row .wordmark { height: 20px; }
}

html.sb-ready .sb { transition: width 0.15s var(--ease-tw); }
html.sb-ready .main { transition: margin-left 0.15s var(--ease-tw); }

/* ---------- Content shell ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sb-w);
}
.shell {
  container-type: inline-size;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
}
.app-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  font: 400 12px/1.45 var(--font-body);
  color: var(--text-2);
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; }
.page-head-text { display: flex; flex-direction: column; gap: 4px; flex: 1 1 320px; min-width: 0; }
.page-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-head-actions form { margin: 0; }

/* Dymek z wyjaśnieniem (tooltip BrandinAI: biały, włos grey-100, promień 10, cień darker-sm, strzałka). */
.hint { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.hint-box {
  position: absolute;
  z-index: 45;
  top: calc(100% + 10px);
  right: 0;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid var(--grey-100);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow-darker-sm);
  font: 500 12px/1.5 var(--font-body);
  color: var(--text-2);
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s var(--ease-tw), transform 0.15s var(--ease-tw), visibility 0s linear 0.15s;
  pointer-events: none;
}
.hint-box b { display: block; margin-bottom: 2px; font-weight: 700; color: var(--text); }
.hint-box::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 28px;
  width: 8px;
  height: 8px;
  background: var(--paper);
  border-left: 1px solid var(--grey-200);
  border-top: 1px solid var(--grey-200);
  transform: rotate(45deg);
}
.hint:has(> .btn:hover) .hint-box,
.hint:has(> .btn:focus-visible) .hint-box,
.hint.is-open .hint-box {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.15s var(--ease-tw) 0.25s, transform 0.15s var(--ease-tw) 0.25s, visibility 0s linear 0.25s;
}
.hint.is-open .hint-box { transition-delay: 0s; }
.hint.is-left .hint-box { left: 0; right: auto; }
.hint.is-left .hint-box::before { left: 28px; right: auto; }
.hint-btn { display: none; }
@media (hover: none) {
  .hint-btn { display: grid; }
  .hint-box::before { right: 10px; }
  .hint.is-left .hint-box::before { display: none; }
}
h1 {
  margin: 0;
  font: 700 28px/1.15 var(--font-heading);
  letter-spacing: -0.02em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 400 12px/20px var(--font-body);
  color: var(--text-2);
}
.crumbs li { min-width: 0; }
.crumbs li + li::before { content: "/"; margin: 0 8px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--primary); }

/* ---------- Card ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--grey-100);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow-2xs);
  min-width: 0;
}
.card-body { padding: 16px; }
.card-title {
  display: flex;
  align-items: center;
  min-height: 32px;
  margin: 0 0 8px;
  font: 700 16px/1.4 var(--font-heading);
  letter-spacing: -0.01em;
}
.card-intro { margin: 0 0 12px; font: 400 12px/1.45 var(--font-body); color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Tabela (DataGrid) ---------- */

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.grid { width: 100%; min-width: 520px; border-collapse: separate; border-spacing: 0; }
.grid th {
  position: relative;
  height: 56px;
  padding: 0 10px;
  border-bottom: 2px solid var(--grey-50);
  text-align: left;
  vertical-align: middle;
  font: 600 11px/14.67px var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.grid th + th::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 24px;
  transform: translateY(-50%);
  background: var(--grey-100);
}
.grid thead::after { content: ""; display: table-row; height: 8px; }
.grid td {
  height: 52px;
  padding: 0 10px;
  vertical-align: middle;
  font: 400 14px/21px var(--font-body);
  transition: background-color 0.15s var(--ease-tw);
}
.grid tbody tr:hover td { background: var(--grey-25); }
.grid tbody tr:hover td:first-child { border-radius: 12px 0 0 12px; }
.grid tbody tr:hover td:last-child { border-radius: 0 12px 12px 0; }
.grid tr[data-href] { cursor: pointer; }
.grid .num { text-align: right; }
.cell-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 14px/21px var(--font-body);
  color: var(--primary);
  text-decoration: none;
}
.cell-link:hover { text-decoration: underline; }
.cell-link.is-muted { font-weight: 600; color: var(--text-2); }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-ext { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); text-decoration: none; }
.cell-ext:hover { text-decoration: underline; }
.cell-ext .ico { width: 14px; height: 14px; }
.strong { font-weight: 600; }
.muted { color: var(--text-2); }
.dash { color: var(--text-3); }

/* ---------- Chip ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 2px 12px;
  border-radius: 8px;
  background: var(--grey-50);
  font: 600 11px/16px var(--font-body);
  color: var(--text);
  white-space: nowrap;
}
.chip-md { height: 24px; padding: 2px 12px; font-size: 12px; line-height: 20px; }
.chip-muted { color: var(--text-2); }
.chip-primary { background: hsl(237 80% 68% / 0.12); color: var(--primary-dark); }
.chip-success { background: hsl(152 55% 40% / 0.12); color: var(--success-dark); }
.chip-warning { background: hsl(30 92% 52% / 0.12); color: var(--warning-dark); }
.chip-error { background: hsl(352 72% 54% / 0.1); color: var(--error-dark); }
.chip-info { background: hsl(212 84% 54% / 0.1); color: var(--info-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Przyciski ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 36px;
  height: 36px;
  padding: 8px 20px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: 600 14px/20px var(--font-body);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn > .ico { width: 20px; height: 20px; margin-left: -4px; }
.btn-sm { height: 32px; min-width: 32px; padding: 8px 16px; border-radius: 8px; line-height: 16px; }
.btn-sm > .ico { width: 18px; height: 18px; }
.btn-tiny { height: 28px; min-width: 28px; padding: 6px 14px; border-radius: 8px; font-size: 12px; line-height: 16px; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(23, 27, 51, 0.12);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { background: var(--primary-dark); box-shadow: inset 0 1px 2px rgba(23, 27, 51, 0.16); }
.btn-error { background: var(--error); color: #fff; box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(23, 27, 51, 0.12); }
.btn-error:hover { background: var(--error-dark); }
.btn-outline {
  padding: 7px 19px;
  border: 1px solid hsl(237 80% 68% / 0.6);
  background: var(--paper);
  color: var(--primary);
}
.btn-outline:hover { border-color: var(--primary); background: hsl(237 80% 68% / 0.06); color: var(--primary-dark); }
.btn-neutral {
  padding: 7px 19px;
  border: 1px solid var(--grey-200);
  background: var(--paper);
  color: var(--text);
  box-shadow: var(--shadow-2xs);
}
.btn-neutral > .ico { color: var(--text-2); }
.btn-neutral:hover { border-color: var(--grey-300); background: var(--grey-20); }
.btn-neutral:active { border-color: var(--grey-300); background: var(--grey-25); }
.btn-primary:focus-visible,
.btn-error:focus-visible { box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(23, 27, 51, 0.12), var(--ring-key); }
.btn-neutral:focus-visible { box-shadow: var(--shadow-2xs), var(--ring-key); }
.btn-outline-error {
  padding: 7px 19px;
  border: 1px solid hsl(352 72% 54% / 0.5);
  background: var(--paper);
  color: var(--error);
}
.btn-outline-error:hover { border-color: var(--error); background: hsl(352 72% 64% / 0.1); color: var(--error-dark); }
.btn-sm.btn-outline, .btn-sm.btn-neutral, .btn-sm.btn-outline-error { padding: 7px 15px; }
.btn-tiny.btn-outline, .btn-tiny.btn-neutral, .btn-tiny.btn-outline-error { padding: 5px 13px; }
.btn-text-grey:hover { background: var(--grey-25); }
.btn-text-grey:active { background: var(--grey-50); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn-icon:hover { background: var(--grey-25); color: var(--text); }
.btn-icon .ico { width: 20px; height: 20px; }

/* ---------- Pola formularzy ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.field-label { font: 600 12px/17px var(--font-body); color: var(--text); }
.field-hint { margin: 0; font: 400 12px/16px var(--font-body); color: var(--text-2); }
.input {
  width: 100%;
  height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--grey-200);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-2xs);
  font: 400 14px/20px var(--font-body);
  color: var(--text);
  transition: border-color 0.15s var(--ease-tw), box-shadow 0.15s var(--ease-tw);
}
.input::placeholder { color: var(--text); opacity: 0.5; }
.input:hover { border-color: var(--grey-300); }
.input:focus { border-color: transparent; box-shadow: var(--shadow-2xs), var(--ring); }
.input-sm { height: 36px; padding: 7px 15px; border-radius: 10px; }
select.input {
  appearance: none;
  padding-right: 40px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='%236b7085' d='M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z'/%3E%3C/svg%3E") no-repeat right 10px center / 20px 20px;
  cursor: pointer;
}
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .reveal { position: absolute; right: 4px; top: 50%; width: 32px; height: 32px; transform: translateY(-50%); }
.input-wrap .reveal:hover { background: transparent; color: var(--primary); }
.input-wrap .reveal .ico-hide { display: none; }
.input-wrap.is-revealed .reveal .ico-show { display: none; }
.input-wrap.is-revealed .reveal .ico-hide { display: block; }

.checks { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font: 400 14px/20px var(--font-body); color: var(--text); cursor: pointer; }
.cbx {
  appearance: none;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  background: var(--paper) center / 12px 12px no-repeat;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-tw), border-color 0.15s var(--ease-tw);
}
.check:hover .cbx { border-color: var(--grey-500); }
.cbx:checked {
  border-color: var(--primary);
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.9 8.6 9.6 3.6' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check:hover .cbx:checked { border-color: var(--primary-light); background-color: var(--primary-light); }

/* Wiersz ustawień: etykieta z opisem po lewej, kontrolka po prawej (jak ustawienia marki w BrandinAI). */
.srow { display: grid; gap: 12px 24px; padding: 20px 0; border-top: 1px solid var(--grey-100); }
.srow:first-of-type { padding-top: 4px; border-top: 0; }
.srow:last-child { padding-bottom: 4px; }
.srow-label { display: flex; flex-direction: column; gap: 2px; }
.srow-label b { font: 600 14px/20px var(--font-body); }
.srow-label span { font: 400 12px/1.45 var(--font-body); color: var(--text-2); }
.srow-control { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; min-width: 0; }
.srow-control .input { width: 280px; max-width: 100%; }
.srow-control form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin: 0; }
.srow-control form.checks-form { flex-direction: column; }
.srow-control.is-inline { align-items: center; align-self: start; }
@media (min-width: 1100px) {
  .srow { grid-template-columns: 240px minmax(0, 1fr); }
  .srow:has(> .srow-control > form:not(.checks-form)) .srow-label { padding-top: 8px; }
}

/* ---------- Kafelki z liczbami ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 16px 20px 18px;
  border: 1px solid var(--grey-100);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-2xs);
  font: inherit;
  color: var(--text);
  text-align: left;
}
button.kpi { cursor: pointer; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
button.kpi:hover { border-color: var(--grey-200); box-shadow: var(--shadow-xs); }
button.kpi.is-active { border-color: hsl(237 80% 68% / 0.5); box-shadow: var(--shadow-xs), 0 0 0 1px hsl(237 80% 68% / 0.5); }
button.kpi:focus-visible { box-shadow: var(--shadow-2xs), var(--ring-key); }
button.kpi.is-active:focus-visible { box-shadow: var(--shadow-xs), 0 0 0 1px hsl(237 80% 68% / 0.5), var(--ring-key); }
.kpi-label { font: 600 11px/14.67px var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.kpi-value { margin-top: auto; padding-top: 6px; font: 700 28px/1.15 var(--font-heading); letter-spacing: -0.02em; }
.kpi-sub { font: 400 12px/1.45 var(--font-body); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-error .kpi-value { color: var(--error-dark); }
/* Kafelki w jednym rzędzie dzielą wiersze siatki, więc etykiety, liczby i podpisy stoją na jednej wysokości. */
@supports (grid-template-rows: subgrid) {
  .kpi { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 2px; }
  .kpi-value { margin-top: 0; }
}
@container (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@container (max-width: 520px) {
  .kpi { padding: 14px 16px 16px; }
  .kpi-sub { white-space: normal; }
}

/* ---------- Pasek tabeli: szukaj + filtry ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.search { position: relative; flex: 0 1 320px; min-width: 200px; }
.search > .ico { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.search .input::-webkit-search-cancel-button { cursor: pointer; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font: 600 14px/20px var(--font-body);
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s var(--ease-tw), background-color 0.15s var(--ease-tw);
}
.tab:not(.is-selected):hover { background: var(--grey-50); color: var(--text); }
.tab.is-selected { background: hsl(237 80% 68% / 0.1); color: var(--primary-dark); }
.tab:focus-visible, .th-sort:focus-visible, .pg-item:focus-visible { box-shadow: inset 0 0 0 2px hsl(237 80% 68% / 0.4); }
.tab-count { min-width: 20px; padding: 0 6px; border-radius: 6px; background: var(--grey-50); font: 600 11px/18px var(--font-body); color: var(--text-2); text-align: center; }
.tab.is-selected .tab-count { background: hsl(237 80% 68% / 0.14); color: var(--primary-dark); }

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.th-sort:hover { background: var(--grey-25); color: var(--text); }
.th-arrow { width: 14px; height: 14px; opacity: 0; transition: opacity 0.15s var(--ease-tw), transform 0.15s var(--ease-tw); }
.th-sort:hover .th-arrow { opacity: 0.5; }
th[aria-sort] .th-sort { color: var(--text); }
th[aria-sort] .th-arrow { opacity: 1; }
th[aria-sort="descending"] .th-arrow { transform: rotate(180deg); }

.grid-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 40px; margin-top: 8px; padding: 0 10px; }
.grid-count { font: 400 12px/1.45 var(--font-body); color: var(--text-2); }
.pager { display: flex; align-items: center; gap: 6px; }
.pg-ico { width: 18px; height: 18px; margin: 0 -4px; }
.pg-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: 500 14px/16px var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-tw), color 0.15s var(--ease-tw);
}
.pg-item:hover { background: var(--grey-25); }
.pg-item.is-current { background: var(--grey-25); color: var(--primary); font-weight: 700; }
.pg-item:disabled { opacity: 0.5; pointer-events: none; }
.pg-gap { min-width: 20px; text-align: center; color: var(--text-2); }
.table-ctl.is-empty .table-wrap, .table-ctl.is-empty .grid-foot { display: none; }
.table-ctl { scroll-margin-top: 16px; }
.grid-fixed { table-layout: fixed; }
.grid-fixed td { overflow: hidden; overflow-wrap: anywhere; }
.sort-select { display: none; }
.nowrap { white-space: nowrap; }
.cell-trunc { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ev-target { font-weight: 600; overflow-wrap: anywhere; }
.ev-text { font-size: 12px; line-height: 1.45; color: var(--text-2); }

/* ---------- Sprawdź listę ---------- */

.textarea { height: auto; min-height: 180px; resize: vertical; font: 400 13px/20px var(--font-mono); }
.check-form { display: flex; flex-direction: column; gap: 16px; }
.check-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.file-btn { position: relative; max-width: 100%; overflow: hidden; }
.file-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn:focus-within { box-shadow: var(--shadow-2xs), var(--ring-key); }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.card-head .card-intro { flex: 1 1 280px; }
.card-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Alert ---------- */

.alert {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: hsl(212 84% 54% / 0.08);
  font: 400 14px/20px var(--font-body);
  color: var(--text);
}
.alert > .ico { width: 20px; height: 20px; margin-top: 4px; color: var(--info); }
.alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; padding: 4px 0; }
.alert-title { font-weight: 600; }
.alert-success { background: hsl(152 55% 40% / 0.08); }
.alert-success > .ico { color: var(--success); }
.alert-warning { background: hsl(30 92% 52% / 0.1); }
.alert-warning > .ico { color: var(--warning); }
.alert-error { background: hsl(352 72% 54% / 0.08); }
.alert-error > .ico { color: var(--error); }
.alert-neutral { background: var(--paper); border: 1px solid var(--grey-100); box-shadow: var(--shadow-2xs); }
.alert-neutral > .ico { color: var(--error); }
.alert-neutral .alert-body { color: var(--text-2); }
.alert-neutral .alert-title { color: var(--text); }
.copy-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.copy-lbl { display: grid; justify-items: start; }
.copy-lbl > span { grid-area: 1 / 1; }
.copy-lbl > span + span, .is-copied .copy-lbl > span:first-child { visibility: hidden; }
.is-copied .copy-lbl > span + span { visibility: visible; }
.copy-row .input { font-family: var(--font-mono); font-size: 12px; }

/* ---------- Dialog ---------- */

.dlg {
  width: calc(100% - 32px);
  max-width: 480px;
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--paper);
  color: var(--text);
  box-shadow: var(--shadow-2xl);
}
.dlg[open] { animation: dlg-in 0.2s var(--ease-tw); }
.dlg::backdrop { background: rgba(0, 0, 0, 0.5); animation: fade-in 0.2s var(--ease-tw); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
.dlg-form { position: relative; margin: 0; }
.dlg-title { margin: 0; padding: 28px 56px 16px 28px; font: 700 16px/1.4 var(--font-heading); letter-spacing: -0.01em; }
.dlg-content { display: flex; flex-direction: column; gap: 16px; padding: 0 28px; }
.dlg-content p { margin: 0; font: 400 14px/20px var(--font-body); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 28px 28px; }
.dlg-close { position: absolute; top: 12px; right: 12px; }
@media (max-width: 599px) {
  .dlg-title { padding: 20px 56px 12px 20px; }
  .dlg-content { padding: 0 20px; }
  .dlg-actions { padding: 16px 20px 20px; }
  /* Formularz w oknie zajmuje cały ekran, jak dialogi BrandinAI poniżej 600 px. */
  .dlg-sheet { width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; border-radius: 0; }
  .dlg-sheet[open] { animation-name: fade-in; }
  .dlg-sheet .dlg-form { display: flex; flex-direction: column; min-height: 100%; }
  .dlg-sheet .dlg-title { padding: 16px 56px 16px 16px; }
  .dlg-sheet .dlg-content { flex: 1 0 auto; padding: 0 16px; }
  .dlg-sheet .dlg-actions { padding: 16px; }
}

/* ---------- Stan pusty ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  padding: 16px;
  text-align: center;
}
.empty-tile { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--grey-25); color: var(--grey-300); }
.empty-tile svg { width: 20px; height: 20px; }
.empty-text { display: flex; flex-direction: column; gap: 2px; }
.empty-title { margin: 0; font: 600 14px/20px var(--font-body); color: var(--text); }
.empty-sub { margin: 0; font: 500 12px/1.45 var(--font-body); color: var(--text-2); }

/* ---------- Szczegóły zgody ---------- */

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { margin: 0 0 2px; font: 600 11px/14.67px var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.facts dd { margin: 0; font: 500 14px/20px var(--font-body); overflow-wrap: anywhere; }
.code {
  display: block;
  padding: 8px 12px;
  border: 1px solid var(--grey-100);
  border-radius: 8px;
  background: var(--grey-20);
  font: 400 12px/1.5 var(--font-mono);
  color: var(--text-2);
  word-break: break-all;
}

.tl { position: relative; margin: 4px 0 0; padding: 0; list-style: none; }
.tl-item { position: relative; padding: 0 0 20px 28px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 18px; bottom: -2px; width: 2px; background: var(--grey-100); }
.tl-item:last-child::before { display: none; }
.tl-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--grey-300);
  box-shadow: 0 0 0 3px var(--paper);
}
.tl-item.is-open::after { background: var(--success); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tl-meta { font: 400 12px/1.45 var(--font-body); color: var(--text-2); }
.quote {
  margin: 10px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--grey-25);
  font: 400 14px/20px var(--font-body);
}

/* ---------- Logowanie ---------- */

body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg) url("/brand/bg-light.jpg") center / cover no-repeat fixed;
}
.auth-card {
  width: 512px;
  max-width: 100%;
  padding: 28px 0 40px;
  background: var(--paper);
  border: 1px solid var(--grey-100);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.auth-inner { display: flex; flex-direction: column; gap: 16px; padding: 0 56px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.auth-top .wordmark { height: 30px; }
.auth-heading h1 { margin-bottom: 12px; }
.auth-heading p { margin: 0; font: 400 14px/20px var(--font-body); color: var(--text); overflow-wrap: anywhere; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin: 24px 0 0; }
.auth-form .btn-block { margin-top: 8px; }
.auth-foot { margin: 8px 0 0; font: 400 12px/1.45 var(--font-body); color: var(--text-2); text-align: center; }
@media (max-width: 479px) {
  .auth-inner { padding: 0 24px; }
  .auth-top .wordmark { height: 22px; }
}

/* ---------- Mobile ---------- */

@media (max-width: 959px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--topbar-h);
    padding: 8px 6px;
    background: var(--paper);
    box-shadow: var(--shadow-darker-xs);
  }
  .topbar .btn-icon { width: 40px; height: 40px; border-radius: 12px; color: var(--text); }
  .topbar .btn-icon .ico { width: 24px; height: 24px; }
  .topbar .wordmark { height: 28px; }
  .sb {
    top: var(--topbar-h);
    width: 240px;
    max-width: calc(100vw - 48px);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s var(--ease-tw), visibility 0s linear 0.2s;
  }
  html.sb-open .sb { transform: none; visibility: visible; transition: transform 0.2s var(--ease-tw); }
  .sb-logo-row { display: none; }
  .sb-col { padding-top: 12px; }
  .sb-backdrop {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 25;
    display: block;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease-tw), visibility 0s linear 0.2s;
  }
  html.sb-open .sb-backdrop { opacity: 1; visibility: visible; transition: opacity 0.2s var(--ease-tw); }
  html.sb-open body { overflow: hidden; }
  html { scroll-padding-top: calc(var(--topbar-h) + 12px); }
  .table-ctl { scroll-margin-top: calc(var(--topbar-h) + 12px); }
  .pop { right: 4px; width: auto; }
  .main { margin-left: 0; min-height: calc(100vh - var(--topbar-h)); }
  .shell { padding: 12px; gap: 16px; }
}
@media (max-width: 640px) {
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; min-width: 0; }
  .grid thead { display: none; }
  .search { flex-basis: 100%; }
  .grid-foot { justify-content: center; padding: 0; }
  .grid colgroup { display: none; }
  .grid-fixed td { overflow: visible; }
  .sort-select { display: block; flex: 1 1 100%; }
  .pg-item.is-current { background: var(--paper); outline: 1px solid var(--grey-100); outline-offset: -1px; box-shadow: var(--shadow-2xs); }
  .card:has(.table-wrap) { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
  .card:has(.table-wrap) > .card-body { padding: 0; }
  .grid tr { padding: 10px 12px; background: var(--paper); border: 1px solid var(--grey-100); border-radius: 14px; box-shadow: var(--shadow-2xs); transition: border-color 0.15s var(--ease-tw), box-shadow 0.15s var(--ease-tw); }
  .grid tbody { display: flex; flex-direction: column; gap: 10px; }
  .grid td > * { min-width: 0; }
  .cell-ext { min-width: 0; max-width: 100%; }
  .cell-ext-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cell-ext .ico { flex: none; }
  .grid td { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: auto; min-height: 28px; padding: 2px 0; text-align: right; }
  .grid td::before { content: attr(data-label); flex-shrink: 0; font: 600 11px/14.67px var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); text-align: left; white-space: nowrap; }
  .grid td:first-child { justify-content: flex-start; padding-bottom: 6px; text-align: left; }
  .grid td:first-child::before { display: none; }
  .grid tbody tr:hover td { background: transparent; }
  .grid tbody tr:hover { background: var(--paper); border-color: var(--grey-200); box-shadow: var(--shadow-xs); }
}
@media (max-width: 540px) {
  .card-body { padding: 8px; }
  .shell { padding: 10px; }
  .page-head-actions { width: 100%; }
}
