/* ============================================
   POTRENOWANE v3 UI — zsynchronizowane z Wygląd/v3
   ============================================ */

:root {
  /* Brand */
  --primary: #b0f580;
  --primary-2: #9be86a;
  --primary-soft: rgba(176,245,128,0.18);
  --secondary: #004dff;
  --secondary-soft: rgba(0,77,255,0.10);

  /* Light theme (default) */
  --dark: #091232;
  --dark-2: #131c4a;
  --dark-3: #1d2a6b;
  --bg: #fafaf7;
  --bg-2: #f3f2ec;
  --surface: #ffffff;
  --surface-2: #fafaf7;
  --text: #091232;
  --text-2: #313a64;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #e5e3da;
  --border-2: #ebe9e0;

  /* Status */
  --warning: #fb923c;
  --warning-soft: rgba(251,146,60,0.14);
  --error: #ef4444;
  --error-soft: rgba(239,68,68,0.10);
  --success: #22c55e;
  --info: #0ea5e9;
  --admin-accent: #ff3366;

  /* Type */
  --display: 'Bricolage Grotesque', sans-serif;
  --body: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadow */
  --sh-sm: 0 1px 2px rgba(9,18,50,0.04);
  --sh-md: 0 4px 16px rgba(9,18,50,0.06);
  --sh-lg: 0 20px 48px rgba(9,18,50,0.10);

  /* Density (knob) */
  --d-pad: 1;
  --d-radius: 1;
}

/* Dark theme */
.theme-dark {
  --dark: #050a1f;
  --dark-2: #0d1538;
  --dark-3: #1a2350;
  --bg: #0a1126;
  --bg-2: #06091c;
  --surface: #101938;
  --surface-2: #0d1430;
  --text: #f3f4f8;
  --text-2: #c8cce0;
  --muted: #8089a8;
  --muted-2: #5e6886;
  --border: #1d2750;
  --border-2: #14193a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--body);
  background: var(--bg-2);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
button { font-family: inherit; }

/* ============= TOPBAR (host) ============= */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: var(--dark); color: white;
  padding: 10px 16px;
  display: flex; gap: 10px; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 800;
  font-size: 16px; letter-spacing: -0.02em;
  padding-right: 10px;
  border-right: 1px solid rgba(255,255,255,0.10);
}
.topbar-brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--primary); color: var(--dark);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 800;
}
.topbar-roles {
  display: flex; gap: 4px; padding: 3px;
  background: rgba(255,255,255,0.05); border-radius: 100px;
}
.topbar-roles button {
  padding: 6px 14px; border: none; background: transparent;
  color: rgba(255,255,255,0.65);
  font-size: 12px; font-weight: 600; font-family: var(--body);
  border-radius: 100px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.topbar-roles button:hover { color: white; }
.topbar-roles button.active {
  background: var(--primary); color: var(--dark);
}
.topbar-roles button .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .5;
}
.topbar-roles button.active .dot { background: var(--dark); opacity: 1; }

.topbar-spacer { flex: 1; }

.topbar-mode {
  display: flex; gap: 2px; padding: 3px;
  background: rgba(255,255,255,0.05); border-radius: 100px;
}
.topbar-mode button {
  padding: 5px 12px; border: none; background: transparent;
  color: rgba(255,255,255,0.55);
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  border-radius: 100px; cursor: pointer;
}
.topbar-mode button.active {
  background: var(--primary); color: var(--dark); font-weight: 700;
}

.topbar-icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent; color: rgba(255,255,255,0.7);
  display: grid; place-items: center; cursor: pointer;
}
.topbar-icon-btn:hover { color: white; border-color: rgba(255,255,255,0.3); }
.topbar-icon-btn svg { width: 14px; height: 14px; }

.topbar-version {
  font-family: var(--mono); font-size: 10px;
  color: rgba(255,255,255,0.4);
  padding: 4px 10px; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 100px;
}

/* ============= APP SHELL ============= */
.app-shell {
  background: var(--bg);
  /* Pełna wysokość okna — górny pasek (ext-nav) jest ukryty w shellu aplikacji. */
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 1fr;
  align-items: stretch;
}
.app-shell.mobile-mode {
  grid-template-columns: 1fr;
  max-width: 412px;
  margin: 24px auto;
  height: 844px;
  border-radius: 36px;
  border: 10px solid var(--dark);
  box-shadow: 0 40px 100px rgba(9,18,50,0.25), 0 4px 12px rgba(9,18,50,0.10);
  overflow: hidden;
  position: relative;
}
.app-shell.mobile-mode .sidebar { display: none; }
.app-shell.mobile-mode .main { padding: 14px 14px 86px; }
.app-shell.mobile-mode .tabbar { display: grid; }
.app-shell.mobile-mode .page-header { display: none; }
.app-shell.mobile-mode .desktop-only { display: none !important; }

/* mobile status notch */
.mobile-status {
  display: none;
  height: 38px;
  background: var(--dark);
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  font-family: var(--mono); font-size: 11px;
  font-weight: 700; color: white;
  position: relative;
}
.mobile-status::before {
  content: ''; position: absolute;
  top: 6px; left: 50%; transform: translateX(-50%);
  width: 100px; height: 26px;
  background: #000; border-radius: 0 0 18px 18px;
}
.app-shell.mobile-mode .mobile-status { display: flex; }

/* ============= SIDEBAR ============= */
.sidebar {
  background: var(--dark); color: white;
  padding: 20px 16px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}
.app-shell.mobile-mode .sidebar {
  position: static;
  height: auto;
}

/* Brand row (mock v3 sidebar-logo) */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 16px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none; color: inherit;
}
.sidebar-logo:hover { color: white; opacity: .95; }
.sidebar-logo-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--primary); color: var(--dark);
  display: grid; place-items: center;
  font-family: var(--display); font-size: 16px; font-weight: 800;
  flex-shrink: 0;
}
.sidebar-logo-stack {
  display: flex; flex-direction: column;
  gap: 2px; min-width: 0;
}
.sidebar-logo-name {
  font-family: var(--display); font-weight: 800;
  font-size: 17px; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logo-role {
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.45);
}

.sidebar-role-tag {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--primary);
  padding: 4px 10px; border-radius: 100px;
  background: rgba(176,245,128,0.10);
  border: 1px solid rgba(176,245,128,0.20);
  margin: 4px 4px 14px;
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
}
.sidebar-role-tag::before {
  content: ''; width: 5px; height: 5px;
  background: var(--primary); border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(176,245,128,0.20);
}
.sidebar-section {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,0.32);
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.65); font-size: 13px;
  cursor: pointer; text-decoration: none;
  border: none; background: transparent;
  text-align: left; width: 100%;
  font-family: var(--body); transition: all .12s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  background: var(--primary); color: var(--dark); font-weight: 600;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.10); color: white;
  padding: 1px 7px; border-radius: 100px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
}
.nav-item.active .nav-badge { background: var(--dark); color: var(--primary); }
.nav-item .nav-dot {
  margin-left: auto; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
}
.nav-item .nav-dot.nav-dot--live {
  width: 8px; height: 8px;
  background: var(--error);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
  animation: nav-live-pulse 1.8s ease-in-out infinite;
}
@keyframes nav-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: rgba(255,255,255,0.5);
  font-family: var(--mono); font-size: 11px;
  cursor: pointer;
}
.sidebar-search svg { width: 12px; height: 12px; }
.sidebar-search kbd {
  margin-left: auto; padding: 1px 6px;
  background: rgba(255,255,255,0.08); border-radius: 4px;
  font-family: var(--mono); font-size: 9px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.04);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px; font-weight: 600; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-family: var(--mono); font-size: 9px;
  color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ============= MAIN CANVAS ============= */
.main {
  padding: 24px 32px 32px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.page-header {
  display: flex; justify-content: space-between;
  align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.page-title {
  font-family: var(--display); font-size: 32px;
  font-weight: 700; letter-spacing: -0.025em;
  line-height: 1.05;
}
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.45; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Mobile header */
.mobile-header {
  display: none; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.app-shell.mobile-mode .mobile-header { display: flex; }
.mobile-header-back, .mobile-header-action {
  width: 36px; height: 36px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
  display: grid; place-items: center; cursor: pointer;
}
.mobile-header-back svg, .mobile-header-action svg { width: 14px; height: 14px; }
.mobile-header-title {
  font-family: var(--display); font-weight: 700;
  font-size: 16px; letter-spacing: -0.01em;
}

/* Tabbar (mobile bottom) */
.tabbar {
  display: none;
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 8px 16px;
  grid-template-columns: repeat(5, 1fr); gap: 4px;
}
.tabbar button,
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; color: var(--muted);
  border: none; background: transparent;
  cursor: pointer; border-radius: 8px;
  text-decoration: none;
}
.tabbar button svg,
.tabbar a svg { width: 18px; height: 18px; stroke: currentColor; }
.tabbar button span,
.tabbar a span {
  font-size: 9px; font-weight: 600;
  font-family: var(--mono); letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tabbar button.active,
.tabbar a.active { color: var(--dark); font-weight: 700; }
.tabbar button.active svg { stroke-width: 2.2; }
.tabbar a.active svg { stroke-width: 2.2; }
.tabbar button.fab {
  background: var(--primary); color: var(--dark);
  border-radius: 50%; width: 44px; height: 44px;
  align-self: center; padding: 0; margin-top: -16px;
  box-shadow: 0 4px 14px rgba(176,245,128,0.45);
}
.tabbar button.fab svg { width: 18px; height: 18px; }
.tabbar button.fab span { display: none; }

/* ============= BUTTONS ============= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px;
  border-radius: var(--r-sm);
  font-family: var(--body); font-weight: 600; font-size: 13px;
  border: none; cursor: pointer; text-decoration: none;
  transition: all .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--dark); }
.btn-primary:hover { background: var(--primary-2); }
.btn-dark { background: var(--text); color: var(--bg); }
.btn-dark:hover { background: var(--text-2); }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-2); }
.btn-link {
  background: transparent; color: var(--secondary);
  padding: 0;
}
.btn-danger {
  background: var(--error-soft); color: var(--error);
}
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 14px 22px; font-size: 14px; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.icon-btn {
  width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn svg { width: 14px; height: 14px; }

/* ============= PANELS / CARDS ============= */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
}
.panel-tight { padding: 14px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 14px;
}
.panel-title {
  font-family: var(--display); font-size: 16px;
  font-weight: 700; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.panel-title-eyebrow {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 4px;
}
.panel-link {
  color: var(--secondary); font-size: 12px;
  text-decoration: none; font-weight: 500; cursor: pointer;
}

/* ============= AVATAR ============= */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700;
  color: var(--dark); font-size: 12px;
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-md { width: 42px; height: 42px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; }
.avatar-xl { width: 88px; height: 88px; font-size: 32px; border-radius: 22px; }
.avatar-blue { background: linear-gradient(135deg, #4d7cff, #001f8a); color: white; }
.avatar-amber { background: linear-gradient(135deg, #fb923c, #c2410c); color: white; }
.avatar-violet { background: linear-gradient(135deg, #a78bfa, #5b21b6); color: white; }
.avatar-rose { background: linear-gradient(135deg, #fb7185, #9f1239); color: white; }
.avatar-teal { background: linear-gradient(135deg, #5eead4, #0f766e); color: white; }

.avatar-stack { display: flex; }
.avatar-stack .avatar {
  border: 2px solid var(--surface);
  margin-left: -10px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack-more {
  font-family: var(--mono); font-size: 11px;
  font-weight: 700; color: var(--muted);
  margin-left: 6px; align-self: center;
}

/* ============= BADGES ============= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 100px;
  font-family: var(--mono); font-size: 10px;
  font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-success { background: var(--primary-soft); color: #1f6e00; }
.theme-dark .badge-success { background: rgba(176,245,128,0.16); color: var(--primary); }
.badge-info { background: var(--secondary-soft); color: var(--secondary); }
.theme-dark .badge-info { background: rgba(0,77,255,0.20); color: #93b8ff; }
.badge-warning { background: var(--warning-soft); color: #c2410c; }
.theme-dark .badge-warning { background: rgba(251,146,60,0.18); color: var(--warning); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-neutral { background: var(--bg-2); color: var(--muted); }
.theme-dark .badge-neutral { background: rgba(255,255,255,0.05); color: var(--text-2); }
.badge-dark { background: var(--text); color: var(--bg); }
.badge-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--error); box-shadow: 0 0 0 3px var(--error-soft);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============= DASHBOARD HERO (v3 mock) ============= */
.dash-hero {
  background: var(--dark); color: white;
  border-radius: var(--r-lg);
  padding: 24px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.dash-hero::before {
  content: ''; position: absolute;
  top: -40%; right: -20%;
  width: 320px; height: 320px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 62%);
  opacity: 0.18; pointer-events: none;
}
.dash-hero-greeting {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--primary); margin-bottom: 6px;
  position: relative;
}
.dash-hero-name {
  font-family: var(--display); font-size: 28px;
  font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.05; position: relative;
}
.dash-hero-name em {
  font-style: italic; font-weight: 500;
  color: var(--primary);
}
.dash-hero-stats {
  display: flex; gap: 24px; margin-top: 18px;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.10);
  position: relative; flex-wrap: wrap;
}
.dash-hero-stat-num {
  font-family: var(--display); font-size: 22px;
  font-weight: 700; letter-spacing: -0.02em; color: white;
}
.dash-hero-stat-num em {
  color: var(--primary); font-style: normal;
}
.dash-hero-stat-label {
  font-family: var(--mono); font-size: 9px;
  color: rgba(255,255,255,0.5); text-transform: uppercase;
  letter-spacing: 0.1em; margin-top: 2px;
}
.dash-hero-lead {
  color: rgba(255,255,255,0.72);
  font-size: 14px; line-height: 1.45;
  margin-top: 8px; position: relative; max-width: 520px;
}
.dash-toolbar {
  display: flex; justify-content: flex-end;
  align-items: center; margin-bottom: 12px;
}

body[data-role="admin"] .dash-hero::before {
  background: radial-gradient(circle, var(--admin-accent) 0%, transparent 62%);
  opacity: 0.14;
}

/* ============= STAT CARD ============= */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  position: relative;
}
.stat-card-label {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.stat-card-value {
  font-family: var(--display); font-size: 24px;
  font-weight: 700; letter-spacing: -0.02em;
  line-height: 1; margin-bottom: 4px;
  color: var(--text);
}
.stat-card-trend {
  font-family: var(--mono); font-size: 10px;
  font-weight: 600; color: var(--success);
}
.stat-card-trend.down { color: var(--error); }
.stat-card-trend.flat { color: var(--muted); }
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat-label {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.stat-label svg { width: 12px; height: 12px; }
.stat-value {
  font-family: var(--display); font-size: 28px;
  font-weight: 700; letter-spacing: -0.025em;
  line-height: 1; color: var(--text);
}
.stat-value small {
  font-size: 14px; color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
}
.stat-trend {
  font-family: var(--mono); font-size: 10px;
  font-weight: 700; margin-top: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--success);
}
.stat-trend.down { color: var(--error); }
.stat-trend.flat { color: var(--muted); }
.stat-spark {
  position: absolute; right: 14px; top: 14px;
  width: 60px; height: 24px;
  opacity: 0.7;
}

/* ============= INPUTS ============= */
.input,
.search-input input,
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--body); font-size: 13px;
  color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .form-control:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px var(--secondary-soft);
}
.search-input {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
}
.search-input input {
  border: none; padding: 0; flex: 1;
  font-size: 13px; background: transparent;
}
.search-input svg { width: 14px; height: 14px; flex-shrink: 0; }
.search-input kbd {
  font-family: var(--mono); font-size: 10px;
  padding: 2px 6px; background: var(--bg-2);
  border-radius: 4px; color: var(--muted);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.form-group label {
  display: block; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}

/* ============= TABS / SUBNAV ============= */
.subnav {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow-x: auto;
  margin-bottom: 16px;
}
.subnav::-webkit-scrollbar { height: 0; }
.subnav button {
  padding: 7px 14px; border: none; background: transparent;
  color: var(--muted); border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .12s;
}
.subnav button:hover { color: var(--text); }
.subnav button.active { background: var(--text); color: var(--bg); }
.subnav a {
  padding: 7px 14px; border: none; background: transparent;
  color: var(--muted); border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .12s;
  text-decoration: none;
}
.subnav a:hover { color: var(--text); }
.subnav a.active { background: var(--text); color: var(--bg); }
.subnav button .count {
  font-family: var(--mono); font-size: 10px;
  background: var(--bg-2); color: var(--muted);
  padding: 0 6px; border-radius: 100px;
}
.subnav button.active .count { background: rgba(255,255,255,0.16); color: var(--bg); }

/* ============= TABLE ============= */
.table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table-row {
  display: grid; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.table-row.head {
  background: var(--bg);
  font-family: var(--mono); font-size: 10px;
  font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.table-row:last-child { border-bottom: none; }
.table-row.clickable { cursor: pointer; }
.table-row.clickable:hover { background: var(--bg); }
.table-row.head:hover { background: var(--bg); }

/* ============= SCREEN ============= */
.screen { display: none; }
.screen.active { display: block; }

/* ============= UTIL ============= */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-grow { flex-grow: 1; }
.text-muted { color: var(--muted); }
.text-mono { font-family: var(--mono); }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.fs-11 { font-size: 11px; } .fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-14 { font-size: 14px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.app-shell.mobile-mode .grid-2,
.app-shell.mobile-mode .grid-3,
.app-shell.mobile-mode .grid-4 { grid-template-columns: 1fr 1fr; gap: 8px; }

/* ============= AI CHIP / PROMPT ============= */
.ai-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px;
  background: linear-gradient(135deg, rgba(176,245,128,0.18), rgba(0,77,255,0.10));
  border: 1px solid rgba(0,77,255,0.20);
  font-family: var(--mono); font-size: 10px;
  font-weight: 700; color: var(--secondary);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.ai-chip::before {
  content: '✦'; font-size: 10px;
}
.theme-dark .ai-chip { color: #93b8ff; }

.ai-card {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 100%);
  color: white;
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative; overflow: hidden;
}
.ai-card::before {
  content: ''; position: absolute;
  top: -30%; right: -10%; width: 280px; height: 280px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 60%);
  opacity: 0.16;
}
.ai-card-eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--primary); margin-bottom: 8px;
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
}
.ai-card-title {
  font-family: var(--display); font-size: 22px;
  font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.15;
  position: relative;
  text-wrap: pretty;
  margin-bottom: 12px;
}
.ai-card-actions { position: relative; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============= COMMAND PALETTE ============= */
.cmd-overlay {
  position: fixed; inset: 0;
  background: rgba(9,18,50,0.45);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 96px;
}
.cmd-overlay.open { display: flex; }
.cmd {
  width: 600px; max-width: 90vw;
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.cmd-input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmd-input svg { width: 16px; height: 16px; color: var(--muted); }
.cmd-input input {
  flex: 1; border: none; outline: none;
  font-family: var(--body); font-size: 15px;
  background: transparent; color: var(--text);
}
.cmd-input kbd {
  font-family: var(--mono); font-size: 10px;
  padding: 3px 8px; background: var(--bg-2);
  border-radius: 4px; color: var(--muted);
}
.cmd-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmd-section-label {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px 6px;
}
.cmd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
}
.cmd-item:hover, .cmd-item.active { background: var(--bg-2); }
.cmd-item .cmd-icon {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--bg-2); display: grid; place-items: center;
  color: var(--text);
}
.cmd-item .cmd-icon svg { width: 13px; height: 13px; }
.cmd-item .cmd-shortcut {
  margin-left: auto; font-family: var(--mono);
  font-size: 10px; color: var(--muted);
}

/* ============= TWEAKS LOCAL OVERRIDES ============= */
[data-density="compact"] .panel { padding: 12px; }
[data-density="compact"] .stat-card { padding: 10px 12px; }
[data-density="compact"] .stat-value { font-size: 22px; }
[data-density="comfortable"] .panel { padding: 22px; }

/* density radius via data-radius */
[data-radius="sharp"] {
  --r-xs: 2px; --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-xl: 14px;
}
[data-radius="rounded"] {
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px;
}

/* hero variant */
.hero-card-flat { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border); }
.hero-card-flat::before { display: none !important; }
.hero-card-flat .ai-card-eyebrow { color: var(--secondary); }

[data-accent="blue"] {
  --primary: #6ea0ff;
  --primary-2: #4d85ee;
  --primary-soft: rgba(110,160,255,0.18);
}
[data-accent="amber"] {
  --primary: #fbbf24;
  --primary-2: #f59e0b;
  --primary-soft: rgba(251,191,36,0.18);
}
[data-accent="rose"] {
  --primary: #fb7185;
  --primary-2: #e11d48;
  --primary-soft: rgba(251,113,133,0.18);
}

/* ============= ADMIN: biblioteka ćwiczeń (v3, AJAX drawer) ============= */
.admin-ex-v3-page .page-eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 4px;
}

.admin-ex-v3-flash {
  border-radius: var(--r-md);
  font-size: 13px;
  animation: admin-ex-flash-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.admin-ex-v3-flash--ok {
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.22);
  color: var(--success);
}
.admin-ex-v3-flash--err {
  background: var(--error-soft);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: var(--error);
}
@keyframes admin-ex-flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-ex-v3-add {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
}
.admin-ex-v3-add__glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(0, 77, 255, 0.06), rgba(176, 245, 128, 0.12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.admin-ex-v3-add > * {
  position: relative;
  z-index: 1;
}
.admin-ex-v3-add-form {
  position: relative;
  z-index: 1;
}
.admin-ex-v3-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 14px;
}
.admin-ex-v3-form-grid .field:nth-child(2) {
  grid-column: 1 / -1;
}
@media (min-width: 900px) {
  .admin-ex-v3-form-grid .field:nth-child(2) {
    grid-column: span 2;
  }
}

.admin-ex-v3-input,
.admin-ex-v3-select,
input.admin-ex-v3-input,
textarea.admin-ex-v3-input,
select.admin-ex-v3-select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text);
  font-family: var(--body);
  font-size: 13px;
  transition: border-color 0.18s ease, box-shadow 0.22s ease;
}
textarea.admin-ex-v3-input {
  resize: vertical;
  min-height: 72px;
}
.admin-ex-v3-input:focus,
.admin-ex-v3-select:focus {
  outline: none;
  border-color: rgba(0, 77, 255, 0.45);
  box-shadow: 0 0 0 3px var(--secondary-soft);
}
.admin-ex-v3-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.35;
}
.admin-ex-v3-check input { margin-top: 3px; }
.admin-ex-v3-submit {
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.admin-ex-v3-submit:hover {
  box-shadow: 0 4px 14px rgba(176, 245, 128, 0.35);
}

.admin-ex-v3-toolbar {
  border-radius: var(--r-md);
}
.admin-ex-v3-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}
.admin-ex-v3-filter-grow {
  flex: 1;
  min-width: 180px;
}

.admin-ex-v3-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-ex-v3-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  transition: box-shadow 0.25s ease, border-color 0.2s ease, transform 0.2s ease;
}
.admin-ex-v3-card:hover {
  box-shadow: var(--sh-md);
  border-color: var(--border-2);
}
.admin-ex-v3-card__main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px 16px;
  align-items: start;
  padding: 16px;
}
@media (max-width: 720px) {
  .admin-ex-v3-card__main {
    grid-template-columns: 1fr;
  }
  .admin-ex-v3-card__actions {
    width: 100%;
    justify-content: space-between;
  }
}

.admin-ex-v3-card__thumb-wrap {
  flex-shrink: 0;
}
.admin-ex-v3-card__thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.admin-ex-v3-card__thumb--empty {
  background: linear-gradient(145deg, var(--bg-2), var(--surface-2));
  border-style: dashed;
}

.admin-ex-v3-card__body {
  min-width: 0;
}
.admin-ex-v3-card__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 4px;
}
.admin-ex-v3-card__title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}
.admin-ex-v3-card__meta {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}
.admin-ex-v3-card__dot { opacity: 0.45; padding: 0 4px; }
.admin-ex-v3-card__snippet {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.admin-ex-v3-card__link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--secondary);
  word-break: break-all;
  text-decoration: none;
}
.admin-ex-v3-card__link:hover { text-decoration: underline; }

.admin-ex-v3-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.admin-ex-v3-del-form { margin: 0; }

.admin-ex-v3-card__drawer {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  border-top: 1px solid transparent;
}
.admin-ex-v3-card__drawer.is-open {
  max-height: 2000px;
  opacity: 1;
  border-top-color: var(--border);
  background: var(--surface-2);
}
.admin-ex-v3-card__drawer-inner {
  padding: 16px 16px 20px;
  animation: admin-ex-drawer-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.admin-ex-v3-card__drawer.is-loading .admin-ex-v3-card__drawer-inner {
  animation: none;
}
@keyframes admin-ex-drawer-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-ex-v3-form-wrap {
  max-width: 720px;
}
.admin-ex-v3-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-ex-v3-form-head__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-ex-v3-skel {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-ex-v3-skel__line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 0%, var(--bg-2) 50%, var(--border) 100%);
  background-size: 200% 100%;
  animation: admin-ex-shimmer 1.1s ease-in-out infinite;
}
.admin-ex-v3-skel__line--lg { height: 14px; width: 40%; }
.admin-ex-v3-skel__line--sm { width: 55%; height: 10px; }
@keyframes admin-ex-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.admin-ex-v3-err {
  color: var(--error);
  font-size: 13px;
  margin: 0;
}

.admin-ex-v3-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
  border-radius: var(--r-md);
}

/* ============= KREATOR PLANU (Wygłąd/v3/app-trener.html) ============= */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  color: var(--text);
  min-width: 0;
}
.search-box:focus-within {
  border-color: rgba(0, 77, 255, 0.45);
  box-shadow: 0 0 0 3px var(--secondary-soft);
}
.search-box svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.plan-builder-v3 .builder-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 16px;
  align-items: start;
}
.app-shell.mobile-mode .plan-builder-v3 .builder-grid {
  grid-template-columns: 1fr;
}

.plan-builder-v3 .exercise-library {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  height: fit-content;
  position: sticky;
  top: 20px;
}
.app-shell.mobile-mode .plan-builder-v3 .exercise-library {
  position: static;
}

.plan-builder-v3 .library-section-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 2px 10px;
}

.plan-builder-v3 .exercise-lib-search {
  margin-bottom: 12px;
}

.plan-builder-v3 .exercise-lib-categories {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.plan-builder-v3 .exercise-lib-cat {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 500;
  cursor: default;
  background: var(--surface);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.plan-builder-v3 .exercise-lib-cat.active {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
}

.plan-builder-v3 .exercise-lib-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(480px, calc(100vh - 280px));
  overflow-y: auto;
  padding-right: 4px;
}

.plan-builder-v3 .exercise-lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px dashed transparent;
}

.plan-builder-v3 .exercise-lib-item:hover {
  background: var(--bg-2);
  border-color: var(--border);
}

.plan-builder-v3 .exercise-lib-icon {
  width: 28px;
  height: 28px;
  background: var(--bg-2);
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.plan-builder-v3 .plan-lib-result {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
}
.plan-builder-v3 .plan-lib-result:hover {
  border-color: rgba(0, 77, 255, 0.25);
}

.plan-builder-v3 .plan-lib-result .exercise-lib-item {
  padding: 0 0 8px;
  border: none;
  background: transparent;
}
.plan-builder-v3 .plan-lib-result .exercise-lib-item:hover {
  background: transparent;
  border: none;
}

.plan-builder-v3 .plan-search-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: flex-end;
}
.plan-builder-v3 .plan-search-add-form select,
.plan-builder-v3 .plan-search-add-form input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--body);
  background: var(--surface);
  color: var(--text);
}
.plan-builder-v3 .plan-search-add-form .btn {
  flex-shrink: 0;
}

.plan-builder-v3 .builder-canvas {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plan-builder-v3 .builder-panel-tight {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.plan-builder-v3 .builder-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.plan-builder-v3 .builder-meta-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 640px) {
  .plan-builder-v3 .builder-meta-row {
    grid-template-columns: 1fr;
  }
}

.plan-builder-v3 .meta-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--body);
  font-size: 13px;
  background: var(--surface);
  outline: none;
  color: var(--text);
}
.plan-builder-v3 .meta-input:focus {
  border-color: var(--secondary);
}

.plan-builder-v3 .builder-day-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.plan-builder-v3 .builder-day-tabs::-webkit-scrollbar {
  height: 0;
}

.plan-builder-v3 .builder-day-tab {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border);
  font-family: var(--body);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.plan-builder-v3 .builder-day-tab.active {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
}

.plan-builder-v3 .builder-day-tab.add-day-tab {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}

.plan-builder-v3 .plan-builder-day-pane {
  display: none;
  animation: plan-day-fade 0.25s ease;
}
.plan-builder-v3 .plan-builder-day-pane.is-active {
  display: block;
}

@keyframes plan-day-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.plan-builder-v3 .plan-builder-colhead {
  display: grid;
  grid-template-columns: 22px 22px minmax(100px, 1fr) repeat(3, minmax(48px, 64px)) minmax(72px, 88px) 36px;
  gap: 6px;
  padding: 0 8px 8px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.app-shell.mobile-mode .plan-builder-v3 .plan-builder-colhead {
  display: none;
}

.plan-builder-v3 .builder-exercise-row {
  display: grid;
  grid-template-columns: 22px 22px minmax(100px, 1fr) repeat(3, minmax(48px, 64px)) minmax(72px, 88px) 36px;
  gap: 6px;
  align-items: start;
  padding: 10px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.plan-builder-v3 .builder-exercise-row:focus-within {
  border-color: rgba(0, 77, 255, 0.35);
  box-shadow: 0 0 0 2px var(--secondary-soft);
}

.app-shell.mobile-mode .plan-builder-v3 .builder-exercise-row {
  grid-template-columns: 1fr;
  gap: 10px;
}
.app-shell.mobile-mode .plan-builder-v3 .builder-grip,
.app-shell.mobile-mode .plan-builder-v3 .builder-ex-num {
  display: none;
}

.plan-builder-v3 .builder-grip {
  color: var(--muted);
  cursor: grab;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.05em;
  text-align: center;
  user-select: none;
}

.plan-builder-v3 .builder-ex-num {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--secondary);
  font-size: 11px;
  text-align: center;
}

.plan-builder-v3 .builder-exercise-name-block {
  min-width: 0;
}
.plan-builder-v3 .builder-exercise-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
}
.plan-builder-v3 .builder-exercise-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.plan-builder-v3 .builder-ex-band-check {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.plan-builder-v3 .builder-ex-band-check input {
  margin: 0;
}

.plan-builder-v3 .builder-input-mini {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  outline: none;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.plan-builder-v3 .builder-input-mini:focus {
  border-color: var(--secondary);
}

.plan-builder-v3 .builder-band-select {
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--body);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

.plan-builder-v3 .builder-remove {
  color: var(--error);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  line-height: 1;
}
.plan-builder-v3 .builder-remove:hover {
  background: var(--error-soft);
}

.plan-builder-v3 .builder-add-day-inline {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 10px;
  align-items: end;
}
@media (max-width: 640px) {
  .plan-builder-v3 .builder-add-day-inline {
    grid-template-columns: 1fr;
  }
}

.plan-builder-v3 .drop-zone-hint {
  padding: 18px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.plan-builder-v3 #exerciseSearchAjaxInfo {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}

/* —— Dashboard v3 (pulpit: trener / studio / admin / klient) —— */
.dash-v3 {
  margin-bottom: 20px;
}
.dash-v3-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.dash-v3-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-v3-title {
  margin: 6px 0 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.dash-v3-lead {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 42rem;
}
.dash-v3-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dash-v3-revenue {
  border-radius: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #0b1229 0%, #151f3d 100%);
  color: #f8fafc;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.dash-v3-revenue--studio,
.dash-v3-revenue--admin {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.dash-v3-revenue-k {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.dash-v3-cur {
  font-size: 0.85em;
  font-weight: 700;
  opacity: 0.65;
}
.dash-v3-revenue-sub {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.75;
}
.dash-v3-revenue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.88;
}
.dash-v3-growth {
  font-weight: 700;
  color: #bef264;
}

.dash-v3-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
.dash-v3-grid--client-intro {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 960px) {
  .dash-v3-grid {
    grid-template-columns: 1fr;
  }
  .dash-v3-grid--client-intro {
    grid-template-columns: 1fr;
  }
}

.dash-v3-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
  margin-bottom: 14px;
}
.dash-v3-card--tight {
  padding: 12px 14px;
}
.dash-v3-card-h {
  margin: 0 0 10px;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.dash-v3-card-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.dash-v3-muted {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.dash-v3-muted.small {
  font-size: 12px;
  margin-top: 8px;
}

.dash-v3-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-v3-session {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.dash-v3-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: rgba(132, 204, 22, 0.2);
  color: #365314;
}
.dash-v3-session-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.dash-v3-session-name {
  font-weight: 800;
  font-size: 14px;
}
.dash-v3-session-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.dash-v3-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.dash-v3-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.dash-v3-tag--paid {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #15803d;
}
.dash-v3-tag--package {
  background: rgba(251, 146, 60, 0.12);
  border-color: rgba(251, 146, 60, 0.4);
  color: #c2410c;
}
.dash-v3-tag--online {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #1d4ed8;
}
.dash-v3-tag--unpaid {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  color: #b45309;
}

.dash-v3-pend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-v3-pend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
}
.dash-v3-pend-row--muted {
  opacity: 0.75;
  font-size: 13px;
}
.dash-v3-pend-title {
  font-weight: 800;
  font-size: 13px;
}
.dash-v3-pend-sub {
  font-size: 12px;
  color: var(--muted);
}
.dash-v3-pend-sub.mono {
  font-family: var(--mono);
}
.dash-v3-pend-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dash-v3-inline-form {
  margin: 0;
  display: inline;
}

.dash-v3-wallet-amt {
  font-size: 1.35rem;
  font-weight: 800;
}
.dash-v3-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dash-v3-mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.dash-v3-mini-list li:last-child {
  border-bottom: none;
}
.dash-v3-act {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-v3-act-li {
  font-size: 12px;
  line-height: 1.45;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.dash-v3-act-time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
}
.dash-v3-alert {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.08);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}
.mono {
  font-family: var(--mono);
}
