/* =============================================================
   ТПК — design tokens & shell styles (new minimalist design).
   Loaded only when the new design is active.
   ============================================================= */

:root {
  --tpk-brand: #1FA34A;
  --tpk-brand-600: #1A8C3F;
  --tpk-brand-700: #15722F;
  --tpk-brand-50:  #ECF7EE;
  --tpk-brand-100: #DDEFDF;
  --tpk-brand-200: #BEE0C2;
  --tpk-brand-300: #94CB9C;

  --tpk-bg:        #F6F8F4;
  --tpk-surface:   #FFFFFF;
  --tpk-surface-2: #FBFCF9;
  --tpk-surface-3: #F1F4ED;

  --tpk-ink:       #1A2421;
  --tpk-ink-2:     #455048;
  --tpk-ink-3:     #6B756E;
  --tpk-ink-4:     #97A09A;

  --tpk-line:      #E5EAE2;
  --tpk-line-2:    #EEF2EB;
  --tpk-divider:   #DDE3D8;

  --tpk-success:   #2E8B57;
  --tpk-success-bg:#E8F4ED;
  --tpk-warn:      #B47A1F;
  --tpk-warn-bg:   #FBF1DD;
  --tpk-danger:    #B5443A;
  --tpk-danger-bg: #F6E2DF;
  --tpk-info:      #2D6A8F;
  --tpk-info-bg:   #E2EEF5;

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;

  --shadow-1: 0 1px 2px rgba(20,40,25,.04), 0 1px 1px rgba(20,40,25,.03);
  --shadow-2: 0 4px 14px rgba(20,60,30,.06);
  --shadow-3: 0 10px 28px rgba(20,60,30,.08);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --side-w: 252px;
  --side-w-collapsed: 68px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.tpk-new {
  font-family: var(--font-sans);
  color: var(--tpk-ink);
  background: var(--tpk-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--tpk-brand-700); text-decoration: none; }
a:hover { color: var(--tpk-brand-600); }

button { font-family: inherit; }

/* ---------- Layout shell ---------- */
.tpk-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
  background: var(--tpk-bg);
  transition: grid-template-columns 220ms cubic-bezier(.2,0,0,1);
}
.tpk-shell.is-collapsed { grid-template-columns: var(--side-w-collapsed) 1fr; }

.tpk-sidebar {
  border-right: 1px solid var(--tpk-line);
  background: var(--tpk-surface-2);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.tpk-sidebar__brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--tpk-line-2);
  text-decoration: none; color: var(--tpk-ink);
}
.tpk-sidebar__brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--tpk-brand-50);
  display: grid; place-items: center;
  flex-shrink: 0; overflow: hidden;
}
.tpk-sidebar__brand-logo img { width: 24px; height: 24px; object-fit: contain; }
.tpk-sidebar__brand-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tpk-sidebar__brand-sub  { font-size: 11px; color: var(--tpk-ink-3); white-space: nowrap; }

.tpk-shell.is-collapsed .tpk-sidebar__brand { padding: 0; justify-content: center; }
.tpk-shell.is-collapsed .tpk-sidebar__brand-text { display: none; }
.tpk-shell.is-collapsed .tpk-sidebar__nav-label { display: none; }
.tpk-shell.is-collapsed .tpk-nav-item__label { display: none; }
.tpk-shell.is-collapsed .tpk-nav-item__badge { display: none; }
.tpk-shell.is-collapsed .tpk-nav-item { justify-content: center; padding: 10px; }
.tpk-shell.is-collapsed .tpk-userblock__text { display: none; }
.tpk-shell.is-collapsed .tpk-userblock { justify-content: center; }
.tpk-shell.is-collapsed .tpk-collapse-btn__label { display: none; }

.tpk-sidebar__nav { flex: 1; padding: 10px; overflow: auto; }
.tpk-sidebar__nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--tpk-ink-3); text-transform: uppercase;
  padding: 12px 10px 6px;
}

.tpk-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 2px 0;
  border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  color: var(--tpk-ink-2); background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
  position: relative;
}
.tpk-nav-item:hover { background: var(--tpk-surface-3); color: var(--tpk-ink); }
.tpk-nav-item.is-active {
  background: var(--tpk-brand-50);
  color: var(--tpk-brand-700);
}
.tpk-nav-item.is-active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; background: var(--tpk-brand);
}
.tpk-nav-item__icon { width: 18px; height: 18px; flex-shrink: 0; }
.tpk-nav-item__label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpk-nav-item__badge {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: var(--tpk-surface-3); color: var(--tpk-ink-2);
  border: 1px solid var(--tpk-line); min-width: 22px; text-align: center;
}
.tpk-nav-item.is-active .tpk-nav-item__badge {
  background: var(--tpk-brand-100); color: var(--tpk-brand-700); border-color: var(--tpk-brand-200);
}

.tpk-sidebar__foot { border-top: 1px solid var(--tpk-line-2); padding: 12px; }
.tpk-userblock { display: flex; align-items: center; gap: 10px; padding: 4px; }
.tpk-userblock__avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--tpk-brand-100); color: var(--tpk-brand-700);
  border: 1px solid var(--tpk-brand-200);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.tpk-userblock__text { min-width: 0; flex: 1; }
.tpk-userblock__name { font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.tpk-userblock__role { font-size: 11px; color: var(--tpk-ink-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.tpk-userblock__logout {
  width: 30px; height: 30px; border: 1px solid transparent; background: transparent;
  border-radius: 8px; color: var(--tpk-ink-3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.tpk-userblock__logout:hover { background: var(--tpk-surface-3); color: var(--tpk-danger); }

.tpk-collapse-btn {
  margin-top: 10px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 1px solid var(--tpk-line);
  color: var(--tpk-ink-3); border-radius: 8px;
  padding: 6px 8px; cursor: pointer; font-size: 12px;
}
.tpk-collapse-btn:hover { background: var(--tpk-surface-3); color: var(--tpk-ink); }

/* ---------- Main column ---------- */
.tpk-main {
  display: flex; flex-direction: column; min-width: 0;
}
.tpk-topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--tpk-line);
  background: var(--tpk-surface);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.tpk-topbar__toggle {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid transparent; color: var(--tpk-ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.tpk-topbar__toggle:hover { background: var(--tpk-surface-3); }
.tpk-topbar__title-wrap { flex: 1; min-width: 0; }
.tpk-topbar__crumbs {
  font-size: 11.5px; color: var(--tpk-ink-3);
  display: flex; gap: 6px; align-items: center;
}
.tpk-topbar__crumbs a { color: var(--tpk-ink-3); }
.tpk-topbar__crumbs .sep { opacity: .5; }
.tpk-topbar__title {
  font-size: 17px; font-weight: 600; color: var(--tpk-ink);
  letter-spacing: -0.01em; margin-top: 1px;
}
.tpk-topbar__user {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--tpk-brand-100); color: var(--tpk-brand-700);
  border: 1px solid var(--tpk-brand-200);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 0;
  transition: background 140ms ease, box-shadow 140ms ease;
}
.tpk-topbar__user:hover { background: var(--tpk-brand-200); }
.tpk-topbar__user[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--tpk-brand-50); }

/* ---------- User side panel (right drawer) ---------- */
.tpk-userpanel-backdrop {
  position: fixed; inset: 0; background: rgba(20, 30, 25, .35);
  z-index: 1900; opacity: 0; pointer-events: none;
  transition: opacity 160ms ease;
}
.tpk-userpanel-backdrop.is-open { opacity: 1; pointer-events: auto; }
.tpk-userpanel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 320px; max-width: 92vw;
  background: var(--tpk-surface);
  border-left: 1px solid var(--tpk-line);
  box-shadow: -8px 0 24px rgba(20, 30, 25, .08);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 200ms ease;
  z-index: 1950;
}
.tpk-userpanel.is-open { transform: translateX(0); }
.tpk-userpanel__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 18px 18px 14px;
  border-bottom: 1px solid var(--tpk-line);
}
.tpk-userpanel__profile { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tpk-userpanel__avatar {
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--tpk-brand-100); color: var(--tpk-brand-700);
  border: 1px solid var(--tpk-brand-200);
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
  flex-shrink: 0;
}
.tpk-userpanel__name { font-size: 14px; font-weight: 600; color: var(--tpk-ink); line-height: 1.2; }
.tpk-userpanel__role { font-size: 12px; color: var(--tpk-ink-3); margin-top: 2px; }
.tpk-userpanel__email { font-size: 11.5px; color: var(--tpk-ink-3); margin-top: 4px; font-family: var(--font-mono); word-break: break-all; }
.tpk-userpanel__close {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent;
  color: var(--tpk-ink-3); cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center;
}
.tpk-userpanel__close:hover { background: var(--tpk-surface-3); color: var(--tpk-ink); }
.tpk-userpanel__body { flex: 1 1 auto; overflow-y: auto; padding: 12px 0; min-height: 0; }
.tpk-userpanel__foot {
  border-top: 1px solid var(--tpk-line); padding: 14px 18px;
  background: var(--tpk-surface-2);
}
.tpk-userpanel__logout {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  background: var(--tpk-surface); border: 1px solid var(--tpk-line);
  color: var(--tpk-danger); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 140ms ease, border-color 140ms ease;
}
.tpk-userpanel__logout:hover { background: var(--tpk-danger-bg); border-color: #E8C8C3; }

.tpk-content { flex: 1; padding: 28px 36px 36px; min-width: 0; }

/* ---------- Cards & primitives ---------- */
.tpk-card {
  background: var(--tpk-surface);
  border: 1px solid var(--tpk-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px;
}
.tpk-card--accent { border-top: 3px solid var(--tpk-brand); }
.tpk-card--flat   { box-shadow: none; }
.tpk-card--p0     { padding: 0; }

.tpk-section-title {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.tpk-section-title h2,
.tpk-section-title h3 {
  margin: 0; font-size: 15px; font-weight: 600; color: var(--tpk-ink);
  letter-spacing: -0.005em;
}
.tpk-section-title__sub { font-size: 12.5px; color: var(--tpk-ink-3); margin-top: 2px; }

/* ---------- Buttons ---------- */
.tpk-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 36px; padding: 8px 14px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
  border: 1px solid var(--tpk-line); background: var(--tpk-surface); color: var(--tpk-ink);
}
.tpk-btn:hover { background: var(--tpk-surface-3); }
.tpk-btn--primary {
  background: var(--tpk-brand); color: #fff; border-color: var(--tpk-brand);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 1px 1px rgba(20,60,30,.12);
}
.tpk-btn--primary:hover { background: var(--tpk-brand-600); border-color: var(--tpk-brand-600); color: #fff; }
.tpk-btn--soft {
  background: var(--tpk-brand-50); color: var(--tpk-brand-700); border-color: var(--tpk-brand-100);
}
.tpk-btn--soft:hover { background: var(--tpk-brand-100); }
.tpk-btn--ghost { background: transparent; border-color: transparent; color: var(--tpk-ink-2); }
.tpk-btn--ghost:hover { background: var(--tpk-surface-3); color: var(--tpk-ink); }
.tpk-btn--danger { color: var(--tpk-danger); }
.tpk-btn--danger:hover { background: var(--tpk-danger-bg); border-color: #E8C8C3; color: var(--tpk-danger); }
.tpk-btn--sm { height: 30px; padding: 6px 10px; font-size: 12.5px; gap: 6px; }
.tpk-btn--lg { height: 42px; padding: 10px 18px; font-size: 14px; }
.tpk-btn--icon { width: 32px; padding: 0; }
.tpk-btn--block { width: 100%; }
.tpk-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Badges ---------- */
.tpk-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--tpk-surface-3); color: var(--tpk-ink-2);
  border: 1px solid var(--tpk-line);
}
.tpk-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor;
  display: none;
}
.tpk-badge--dot::before { display: inline-block; }
.tpk-badge--brand   { background: var(--tpk-brand-50);   color: var(--tpk-brand-700); border-color: var(--tpk-brand-100); }
.tpk-badge--success { background: var(--tpk-success-bg); color: var(--tpk-success);   border-color: #CFE4D7; }
.tpk-badge--warn    { background: var(--tpk-warn-bg);    color: var(--tpk-warn);      border-color: #EBDABA; }
.tpk-badge--danger  { background: var(--tpk-danger-bg);  color: var(--tpk-danger);    border-color: #E8C8C3; }
.tpk-badge--info    { background: var(--tpk-info-bg);    color: var(--tpk-info);      border-color: #C9DCE7; }

/* ---------- Avatar ---------- */
.tpk-avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--tpk-brand-100); color: var(--tpk-brand-700);
  border: 1px solid var(--tpk-brand-200);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.tpk-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.tpk-avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.tpk-avatar--neutral { background: var(--tpk-surface-3); color: var(--tpk-ink-2); border-color: var(--tpk-line); }
.tpk-avatar--info    { background: var(--tpk-info-bg);   color: var(--tpk-info);   border-color: #C9DCE7; }

/* ---------- Inputs ---------- */
.tpk-field { display: flex; flex-direction: column; gap: 6px; }
.tpk-field__label { font-size: 12px; color: var(--tpk-ink-2); font-weight: 500; }
.tpk-input, .tpk-select, .tpk-textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--tpk-line);
  background: var(--tpk-surface); color: var(--tpk-ink);
  font-size: 13.5px; outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  font-family: inherit;
}
.tpk-textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.tpk-input:focus, .tpk-select:focus, .tpk-textarea:focus {
  border-color: var(--tpk-brand);
  box-shadow: 0 0 0 3px var(--tpk-brand-50);
}
.tpk-input::placeholder, .tpk-textarea::placeholder { color: var(--tpk-ink-4); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--tpk-brand); }

/* ---------- Tables ---------- */
.tpk-table {
  width: 100%; border-collapse: collapse; background: var(--tpk-surface);
  font-size: 13px;
}
.tpk-table thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--tpk-ink-3);
  background: var(--tpk-surface-2);
  border-bottom: 1px solid var(--tpk-line);
  white-space: nowrap;
}
.tpk-table tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--tpk-line-2);
  vertical-align: middle;
}
.tpk-table tbody tr:hover { background: var(--tpk-surface-2); }
.tpk-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tpk-table .mono { font-family: var(--font-mono); }

/* ---------- KPI / Stat cards ---------- */
.tpk-stat {
  background: var(--tpk-surface);
  border: 1px solid var(--tpk-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 18px;
}
.tpk-stat__label { font-size: 12.5px; color: var(--tpk-ink-3); font-weight: 500; }
.tpk-stat__value {
  font-size: 28px; font-weight: 600; margin-top: 6px;
  color: var(--tpk-ink); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tpk-stat__foot { margin-top: 6px; font-size: 12px; color: var(--tpk-ink-3); }

/* ---------- Progress bar ---------- */
.tpk-progress {
  height: 6px; border-radius: 999px; background: var(--tpk-surface-3);
  overflow: hidden;
}
.tpk-progress__bar {
  height: 100%; background: var(--tpk-brand); border-radius: 999px;
  transition: width 300ms ease;
}

/* ---------- Page header ---------- */
.tpk-page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.tpk-page-header__title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.tpk-page-header__sub { color: var(--tpk-ink-3); font-size: 13px; margin-top: 4px; }

/* ---------- Alert / messages ---------- */
.tpk-alert {
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--tpk-line); background: var(--tpk-surface-2);
  color: var(--tpk-ink); font-size: 13px;
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.tpk-alert--success { background: var(--tpk-success-bg); border-color: #CFE4D7; color: var(--tpk-success); }
.tpk-alert--warning { background: var(--tpk-warn-bg);    border-color: #EBDABA; color: var(--tpk-warn); }
.tpk-alert--danger  { background: var(--tpk-danger-bg);  border-color: #E8C8C3; color: var(--tpk-danger); }
.tpk-alert--info    { background: var(--tpk-info-bg);    border-color: #C9DCE7; color: var(--tpk-info); }

/* ---------- Dev-mode design switcher pill ---------- */
.tpk-design-switcher {
  position: fixed; bottom: 16px; left: 16px; z-index: 9000;
  background: var(--tpk-ink); color: #fff;
  border-radius: 999px; padding: 6px 10px 6px 14px;
  font-size: 11.5px; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-2);
}
.tpk-design-switcher a {
  color: #fff; opacity: .6; text-decoration: none;
  border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
  padding: 2px 8px;
}
.tpk-design-switcher a.is-active { opacity: 1; background: var(--tpk-brand); border-color: var(--tpk-brand); }
.tpk-design-switcher a:hover { opacity: 1; }

/* ---------- Bug report widget (reused) ---------- */
.bug-report-trigger {
  position: fixed; right: 20px; bottom: 20px; z-index: 1080;
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--tpk-danger); color: #fff; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-3); cursor: pointer;
}
.bug-report-trigger:hover { background: #9a3a31; }
.bug-report-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.35); cursor: crosshair; }
.bug-report-overlay-hint {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 8px 12px; background: rgba(0,0,0,.75); color: #fff;
  border-radius: 8px; font-size: 13px;
}
.bug-report-selection { position: fixed; border: 2px solid var(--tpk-brand); background: rgba(31,163,74,.15); pointer-events: none; }
.bug-report-preview {
  width: 100%; max-height: 320px; object-fit: contain;
  border: 1px solid var(--tpk-line); border-radius: 10px; background: var(--tpk-surface-2);
}
.bug-report-preview-wrap { position: relative; }
.bug-report-preview-remove {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 999px; border: 0;
  background: rgba(0,0,0,.65); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Modal ---------- */
.tpk-modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 30, 25, .35);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity 160ms ease;
}
.tpk-modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.tpk-modal {
  background: var(--tpk-surface); border-radius: 14px;
  border: 1px solid var(--tpk-line); box-shadow: var(--shadow-3);
  max-height: calc(100vh - 48px); width: 560px; max-width: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(8px); transition: transform 160ms ease;
}
.tpk-modal--lg { width: 760px; }
.tpk-modal--xl { width: 980px; }
.tpk-modal-backdrop.is-open .tpk-modal { transform: translateY(0); }
.tpk-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--tpk-line);
}
.tpk-modal__title { margin: 0; font-size: 16px; font-weight: 600; }
.tpk-modal__close {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  color: var(--tpk-ink-3); cursor: pointer;
}
.tpk-modal__close:hover { background: var(--tpk-surface-3); color: var(--tpk-ink); }
.tpk-modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.tpk-modal__body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.tpk-modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--tpk-line);
  background: var(--tpk-surface-2);
}

/* ---------- Tabs ---------- */
.tpk-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--tpk-line); margin-bottom: 16px; }
.tpk-tab {
  padding: 10px 14px; font-size: 13px; color: var(--tpk-ink-3); font-weight: 500;
  border-bottom: 2px solid transparent; cursor: pointer;
  background: transparent; border-left: 0; border-right: 0; border-top: 0;
  margin-bottom: -1px;
}
.tpk-tab:hover { color: var(--tpk-ink-2); }
.tpk-tab.is-active { color: var(--tpk-ink); font-weight: 600; border-bottom-color: var(--tpk-brand); }

/* ---------- Photo grid (ficha) ---------- */
.tpk-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tpk-photo-card { background: var(--tpk-surface); border: 1px solid var(--tpk-line);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-1); transition: transform 140ms ease, box-shadow 140ms ease;
  text-decoration: none; color: inherit; display: block; }
.tpk-photo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }

/* ---------- Utilities ---------- */
.tpk-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tpk-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tpk-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tpk-row { display: flex; align-items: center; gap: 8px; }
.tpk-row--between { justify-content: space-between; }
.tpk-mono { font-family: var(--font-mono); }
.tpk-muted { color: var(--tpk-ink-3); }
.tpk-stack { display: flex; flex-direction: column; }
.tpk-stack > * + * { margin-top: 12px; }
.tpk-divider { height: 1px; background: var(--tpk-line-2); margin: 16px 0; }
.tpk-pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  background: var(--tpk-success); position: relative; flex-shrink: 0;
}
.tpk-pulse-dot::after {
  content: ''; position: absolute; inset: -4px;
  border-radius: 999px; background: rgba(46,139,87,.3);
  animation: tpk-pulse 1.4s infinite ease-out;
}
@keyframes tpk-pulse {
  0% { transform: scale(.6); opacity: .9; }
  100% { transform: scale(2); opacity: 0; }
}

/* Bootstrap-compat helpers used by bug-report.js */
.d-none { display: none !important; }
.alert.alert-info    { background: var(--tpk-info-bg);    border: 1px solid #C9DCE7; color: var(--tpk-info);    padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.alert.alert-success { background: var(--tpk-success-bg); border: 1px solid #CFE4D7; color: var(--tpk-success); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.alert.alert-warning { background: var(--tpk-warn-bg);    border: 1px solid #EBDABA; color: var(--tpk-warn);    padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.alert.alert-danger  { background: var(--tpk-danger-bg);  border: 1px solid #E8C8C3; color: var(--tpk-danger);  padding: 8px 12px; border-radius: 8px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ---------- Mobile nav drawer backdrop ---------- */
.tpk-nav-backdrop {
  position: fixed; inset: 0; background: rgba(20, 30, 25, .42);
  z-index: 1090; opacity: 0; pointer-events: none;
  transition: opacity 180ms ease;
}

/* Responsive — tablets & below */
@media (max-width: 960px) {
  /* Single-column shell; sidebar becomes an off-canvas drawer */
  .tpk-shell,
  .tpk-shell.is-collapsed { grid-template-columns: 1fr; }

  .tpk-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--side-w); height: 100vh; max-width: 86vw;
    z-index: 1100; transform: translateX(-100%);
    box-shadow: var(--shadow-3);
    transition: transform 240ms cubic-bezier(.2,0,0,1);
  }
  body.tpk-nav-open { overflow: hidden; }
  body.tpk-nav-open .tpk-sidebar { transform: translateX(0); }
  body.tpk-nav-open .tpk-nav-backdrop { opacity: 1; pointer-events: auto; }

  /* The drawer always shows full (expanded) content regardless of a stored
     "collapsed" preference, and the desktop collapse button is hidden. */
  .tpk-shell.is-collapsed .tpk-sidebar__brand { padding: 0 16px; justify-content: flex-start; }
  .tpk-shell.is-collapsed .tpk-sidebar__nav-label { display: block; }
  .tpk-shell.is-collapsed .tpk-sidebar__brand-text,
  .tpk-shell.is-collapsed .tpk-nav-item__label,
  .tpk-shell.is-collapsed .tpk-nav-item__badge,
  .tpk-shell.is-collapsed .tpk-userblock__text { display: inline; }
  .tpk-shell.is-collapsed .tpk-nav-item { justify-content: flex-start; padding: 8px 10px; }
  .tpk-shell.is-collapsed .tpk-userblock { justify-content: flex-start; }
  .tpk-collapse-btn { display: none; }

  .tpk-topbar { padding: 0 14px; gap: 12px; }
  .tpk-topbar__title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tpk-content { padding: 18px 16px 28px; }

  .tpk-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .tpk-grid-3 { grid-template-columns: 1fr; }
  .tpk-grid-2 { grid-template-columns: 1fr; }
}

/* Responsive — phones */
@media (max-width: 560px) {
  .tpk-content { padding: 14px 12px 24px; }
  .tpk-page-header { gap: 12px; }
  .tpk-page-header__title { font-size: 18px; }
  /* Header action buttons stretch full width instead of overflowing */
  .tpk-page-header > div:last-child { width: 100%; flex-wrap: wrap; }
  .tpk-page-header > div:last-child .tpk-btn { flex: 1 1 auto; }
  .tpk-grid-4 { grid-template-columns: 1fr; }
  .tpk-photo-grid { grid-template-columns: 1fr; }

  /* Modals go (near) full-width on phones */
  .tpk-modal-backdrop { padding: 10px; }
  .tpk-modal,
  .tpk-modal--lg,
  .tpk-modal--xl { width: 100%; }
  .tpk-modal__body { padding: 16px; }
  .tpk-modal__head,
  .tpk-modal__foot { padding-left: 16px; padding-right: 16px; }

  /* Comfortable tap targets */
  .tpk-btn { height: 40px; }
  .tpk-btn--sm { height: 34px; }
}
