*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0A102A;
  --bg-surface: #050818;
  --bg-muted: #13193D;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #E0E6ED;
  --text-2: #8898AA;
  --text-3: #606059;
  --accent: #D4AF37;
  /* Antique Gold */
  --accent-2: #f0f0ec;
  --accent-fg: #000000;

  --green: #28A745;
  --green-bg: rgba(40, 167, 69, 0.1);
  --amber: #D4AF37;
  --amber-bg: rgba(212, 175, 55, 0.1);
  --red: #F09595;
  --red-bg: rgba(240, 149, 149, 0.1);

  --strength: #D4AF37;
  --strength-bg: rgba(212, 175, 55, 0.15);
  --cardio: #5b9bef;
  --cardio-bg: rgba(91, 155, 239, 0.15);
  --mobility: #97C459;
  --mobility-bg: rgba(151, 196, 89, 0.15);
  --other: #a0a09a;
  --other-bg: rgba(160, 160, 154, 0.15);

  --fin-bg: #0A102A;
  --fin-card: rgba(19, 25, 61, 0.6);
  --fin-gold: #D4AF37;
  --fin-blue: #007BFF;
  --fin-green: #28A745;
  --fin-text: #E0E6ED;
  --fin-subtext: #8898AA;
  --fin-border: rgba(212, 175, 55, 0.15);
  --r: 8px;
  --r-lg: 16px;
}

/* --- Global Utilities --- */
.text-finance {
  color: var(--fin-gold) !important;
}

.bg-finance {
  background: var(--fin-gold) !important;
  color: #000 !important;
}

/* --- Finance UI Components --- */
.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--fin-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--fin-border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.transaction-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(212, 175, 55, 0.3);
}

.amount-neg {
  color: #F09595;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
}

.amount-pos {
  color: var(--fin-green);
  font-weight: 600;
  font-family: 'DM Mono', monospace;
}

/* --- Dynamic Themes --- */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  min-width: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 123, 255, 0.08) 0%, transparent 40%),
    linear-gradient(135deg, #0A102A 0%, #010411 100%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Sub-pattern for Training (Default) */
.layout:not(.mode-finance-theme) .main-content::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08; /* Low opacity per request */
  pointer-events: none;
  background-image: url('/static/training_topo_bg.png');
  background-size: cover;
  background-position: center;
}

/* FINANCE MODE OVERRIDES */
.layout.mode-finance-theme .main-content::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.1;
  pointer-events: none;
  background-image: url('/static/finance_topo_analytical_bg.png');
  background-size: cover;
  background-position: center;
}

.layout.mode-finance-theme .main-content {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 123, 255, 0.08) 0%, transparent 40%),
    linear-gradient(135deg, #0A102A 0%, #010411 100%) !important;
  background-repeat: no-repeat;
  color: var(--fin-text);
}

.layout.mode-finance-theme #sidebar-streak {
  display: none !important;
}

.layout.mode-finance-theme .sidebar-bottom {
  display: none !important;
}

.layout.mode-finance-theme .sidebar {
  background: #050818 !important;
  border-right: 1px solid rgba(212, 175, 55, 0.1);
}

.layout.mode-finance-theme .logo-training {
  display: none;
}

.layout.mode-finance-theme .logo-finance {
  display: block !important;
}

.layout.mode-finance-theme .sidebar-hero {
  background: linear-gradient(to bottom, #13193D, #050818);
}

.layout.mode-finance-theme .nav-link {
  color: var(--fin-subtext);
}

.layout.mode-finance-theme .nav-link:hover {
  background: rgba(212, 175, 55, 0.05);
  color: var(--fin-text);
}

.layout.mode-finance-theme .nav-link.active {
  background: rgba(212, 175, 55, 0.1);
  color: var(--fin-gold);
  border-left: 3px solid var(--fin-gold);
  border-radius: 0 12px 12px 0;
}

.layout.mode-finance-theme .sidebar-hero-text {
  color: var(--fin-gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.layout.mode-finance-theme .nav-section {
  color: rgba(212, 175, 55, 0.4);
}

/* --- Top Mode Bar --- */
.top-mode-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 28px 0;
  width: 100%;
  position: relative;
}

/* User Profile */
.user-profile {
  position: absolute;
  right: 28px;
  top: 16px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  color: var(--fin-gold);
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.user-avatar:hover {
  border-color: var(--fin-gold);
  transform: scale(1.05);
}

.user-dropdown {
  position: absolute;
  top: 70px;
  right: 28px;
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.user-dropdown.active {
  display: block;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  padding: 12px 16px;
}

.dropdown-username {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

.dropdown-email {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.dropdown-item {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.dropdown-item.logout {
  color: #ff8888;
}

.dropdown-item.logout:hover {
  background: rgba(255, 136, 136, 0.1);
}

.mode-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  padding: 4px;
  max-width: 400px;
  width: 100%;
  gap: 4px;
}

.mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mode-btn.active.training {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(200, 56, 10, 0.3);
}

.mode-btn.active.finance {
  background: var(--fin-gold);
  color: #000;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.finance-hero-btn {
  background: linear-gradient(135deg, var(--fin-gold) 0%, #B8860B 100%);
  color: #000;
  border: none;
  padding: 14px 32px;
  border-radius: var(--r-lg);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.finance-hero-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(212, 175, 55, 0.4);
}

/* Market Ticker */
.market-ticker-container {
  max-width: 800px;
  margin: 24px auto 0;
  width: calc(100% - 56px);
  background: var(--fin-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--fin-border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.ticker-header {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticker-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.4;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }

  100% {
    opacity: 0.4;
    transform: scale(1);
  }
}

.ticker-grid {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ticker-item {
  flex: 1;
  min-width: 170px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}

.ticker-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Sparkline simulation in background */
.ticker-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(to top, rgba(0, 123, 255, 0.1), transparent);
  clip-path: polygon(0 100%, 10% 80%, 20% 90%, 30% 60%, 40% 70%, 50% 40%, 60% 50%, 70% 20%, 80% 40%, 90% 10%, 100% 30%, 100% 100%);
  opacity: 0.5;
}

.ticker-label {
  font-size: 11px;
  color: var(--fin-subtext);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.ticker-value {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Inter', 'DM Sans', sans-serif;
  color: var(--fin-text);
}

/* Toggling sections */
.layout.mode-finance-theme .audio-system-container {
  display: none !important;
}

.layout.mode-finance-theme #market-ticker {
  display: block !important;
}

.layout:not(.mode-finance-theme) #market-ticker {
  display: none !important;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 228px;
  background: #050818;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 100;
  transition: all 0.3s ease;
}

.sidebar-hero {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: linear-gradient(to bottom, #13193D, #050818);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.4));
}

.sidebar-hero-text {
  font-size: 13px;
  font-weight: 800;
  color: var(--fin-gold);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.sidebar-nav {
  padding: 8px 8px 12px;
  flex: 1;
}

.nav-section {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: #8898AA;
  text-decoration: none;
  margin-bottom: 4px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

.nav-link:hover svg {
  opacity: 1;
}

.nav-link.active {
  background: rgba(212, 175, 55, 0.1);
  color: var(--fin-gold);
  font-weight: 700;
  border-left: 3px solid var(--fin-gold);
}

.nav-link.active svg {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
}

.sidebar-bottom {
  margin: 0 12px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--fin-gold);
  border-radius: 0 16px 16px 0;
  padding: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.streak-label {
  font-size: 10px;
  color: rgba(212, 175, 55, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.streak-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--fin-gold);
  line-height: 1;
}

.streak-sub {
  font-size: 11px;
  color: #8898AA;
  margin-top: 4px;
  display: block;
}

.day-hero {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, #13193D 0%, #0A102A 100%);
  max-width: 800px;
  margin: 16px auto 0;
  border-radius: 20px;
  border: 1px solid rgba(212, 175, 55, 0.1);
  width: calc(100% - 56px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.day-hero svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.6;
  /* Subtelniejsze tło SVG */
}

.day-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(15, 10, 6, 0.85) 0%, rgba(15, 10, 6, 0.2) 70%, transparent 100%);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
}

.day-hero-info {
  flex: 1;
}

.day-hero-title {
  font-size: 21px;
  font-weight: 500;
  color: #fff;
  line-height: 1.2;
}

.day-hero-date {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.day-hero-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #e84a18 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(200, 56, 10, 0.3);
}

.day-hero-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200, 56, 10, 0.4);
}

.page-body {
  padding: 20px 28px 28px;
}


.sessions-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.session-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(19, 25, 61, 0.4);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.session-chip:hover {
  background: rgba(212, 175, 55, 0.05);
  border-color: rgba(212, 175, 55, 0.3);
}

.session-chip.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--fin-gold);
  color: var(--fin-gold);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.type-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-vol {
  font-size: 11px;
  color: var(--text-3);
}

.add-session-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 20px;
  border: 0.5px dashed var(--border-strong);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-3);
  font-family: inherit;
  transition: color 0.1s;
}

.add-session-chip:hover {
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 15px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 25px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.exercise-card {
  background: var(--fin-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.exercise-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 175, 55, 0.3);
}

.exercise-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cpath d='M0 80 L20 60 L40 70 L60 30 L80 50 L100 10' fill='none' stroke='white' stroke-width='1.5' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.exercise-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.ex-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.ex-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ex-actions {
  display: flex;
  gap: 5px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  border: 0.5px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.1s, color 0.1s;
}

.icon-btn:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.sets-table tr:first-child td {
  border-top: none;
}

.sets-table .pr-row td {
  color: var(--green);
  font-weight: 500;
}

.pr-badge {
  font-size: 10px;
  background: var(--green-bg);
  color: var(--green);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
}

.type-badge.strength {
  background: var(--strength-bg);
  color: var(--strength);
}

.type-badge.cardio {
  background: var(--cardio-bg);
  color: var(--cardio);
}

.type-badge.mobility {
  background: var(--mobility-bg);
  color: var(--mobility);
}

.type-badge.other {
  background: var(--other-bg);
  color: var(--other);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.12s;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-primary.dark {
  background: var(--accent-2);
}

.btn-secondary {
  background: transparent;
  color: var(--text-2);
  border: 0.5px solid var(--border-strong);
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}

.btn-secondary:hover {
  background: var(--bg-muted);
}

.btn-add-set {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  background: transparent;
  border: 0.5px dashed var(--border-strong);
  padding: 6px 12px;
  border-radius: var(--r);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.1s;
}

.btn-add-set:hover {
  color: var(--text);
}

.input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 0.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--accent);
}

.input-sm {
  padding: 5px 8px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  width: 80px;
  text-align: right;
  outline: none;
}

.input-sm:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
}

/* --- Audio System --- */
.audio-system-container {
  padding: 24px 28px 0;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

#app-view {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: block;
  clear: both;
}

.audio-main-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(to right, rgba(212, 175, 55, 0.1) var(--progress, 0%), transparent var(--progress, 0%)), rgba(255, 255, 255, 0.02);
  transition: background 0.3s ease-out;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
}

@media (max-width: 600px) {
  .audio-main-bar {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .audio-main-label {
    font-size: 11px;
    width: 100%;
    text-align: center;
    order: -1;
  }

  .audio-timer {
    font-size: 10px;
    flex: 1;
  }

  .volume-slider {
    width: 60px;
  }
}

.audio-timer {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  margin-left: 12px;
  min-width: 70px;
}

.audio-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.audio-main-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.audio-main-controls {
  display: flex;
  gap: 6px;
}

.audio-min-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-muted);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.audio-min-btn svg {
  width: 12px;
  height: 12px;
}

.audio-min-btn:hover {
  background: var(--strength);
  color: #fff;
}

.audio-volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.volume-slider:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--strength);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 8px rgba(200, 56, 10, 0.4);
}

.audio-playlist {
  background: #0f0f0e;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: hidden;
  width: 100%;
}

.audio-track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
  border-top: 1px solid var(--border);
}

.audio-track-item:first-child {
  border-top: none;
}

.audio-track-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.audio-track-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--strength);
}

.track-number {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  opacity: 0.5;
  width: 15px;
}

.track-name {
  font-size: 13px;
  flex: 1;
}

.audio-track-item.active .track-name {
  font-weight: 500;
}


.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 24px 28px 0;
}

.page-title {
  font-size: 20px;
  font-weight: 500;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow-y: auto;
  padding: 20px;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  border: 0.5px solid var(--border-strong);
  width: 540px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
}

.modal-title {
  font-size: 15px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 0.5px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
}

.field-label {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 0.5px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.12s;
  background: var(--bg-surface);
  font-family: inherit;
  width: 100%;
}

.type-option:hover {
  border-color: var(--border-strong);
}

.type-option.selected.strength {
  border-color: var(--strength);
  background: var(--strength-bg);
  color: var(--strength);
  font-weight: 500;
}

.type-option.selected.cardio {
  border-color: var(--cardio);
  background: var(--cardio-bg);
  color: var(--cardio);
  font-weight: 500;
}

.type-option.selected.mobility {
  border-color: var(--mobility);
  background: var(--mobility-bg);
  color: var(--mobility);
  font-weight: 500;
}

.type-option.selected.other {
  border-color: var(--border-strong);
  background: var(--bg-muted);
  color: var(--text);
  font-weight: 500;
}

.set-builder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.set-builder-row label {
  font-size: 12px;
  color: var(--text-3);
  width: 60px;
  flex-shrink: 0;
}

.workout-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.12s;
}

.workout-list-item:hover {
  border-color: var(--border-strong);
}

.workout-date {
  font-size: 13px;
  font-weight: 500;
  min-width: 110px;
}

.workout-meta {
  font-size: 12px;
  color: var(--text-3);
  flex: 1;
}

.workout-vol {
  font-size: 13px;
  color: var(--text-2);
  font-family: 'DM Mono', monospace;
}

.chart-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.chart-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}

.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pr-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-2);
}

.pr-table tr:last-child td {
  border-bottom: none;
}

.pr-table .ex-col {
  color: var(--text);
  font-weight: 500;
}

.pr-table .val-col {
  font-family: 'DM Mono', monospace;
  color: var(--text);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.empty-state p {
  margin-bottom: 16px;
  font-size: 14px;
}

/* --- Responsive Overrides --- */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }

  .main-content {
    padding: 16px 16px 80px;
    /* space for bottom nav */
  }

  .top-mode-bar {
    padding: 12px 16px 0;
  }

  .audio-system-container {
    padding: 16px 16px 0;
  }

  .page-header {
    padding: 16px 16px 0;
  }

  .day-hero {
    width: 100%;
    margin: 12px 0 0;
    height: 120px;
    border-radius: 16px;
  }

  .day-hero-overlay {
    padding: 0 20px;
  }

  .day-hero-title {
    font-size: 18px;
  }

  .day-hero-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .exercise-card {
    padding: 16px;
    margin-bottom: 12px;
  }

  .ex-name {
    font-size: 16px;
  }

  /* Bottom Navigation Styling */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 16, 42, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding: 0 12px 8px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  }

  .bn-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #8898AA;
    font-size: 10px;
    font-weight: 500;
    padding: 8px;
    transition: all 0.2s;
  }

  .bn-link svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
  }

  .bn-link.active {
    color: var(--fin-gold);
  }

  .bn-link.bn-gold {
    color: var(--fin-gold);
    opacity: 0.8;
  }

  .bn-link.bn-gold svg {
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
  }

  /* Forms on Mobile */
  .modal {
    width: 95%;
    margin: 0 auto;
  }

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

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

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

  .stat-value {
    font-size: 20px;
  }
}

.hidden {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background-color: #050a1f;
  background-image: url('/static/landing_bg.png');
  background-size: cover;
  background-position: center;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: rgba(10, 16, 42, 0.6);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 28px;
  padding: 50px 40px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 175, 55, 0.05);
  text-align: center;
}

.auth-hero {
  margin-bottom: 40px;
}

.auth-logo-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
}

.auth-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--fin-gold);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

.auth-subtitle {
  font-size: 14px;
  color: #a0aec0;
  font-weight: 400;
  line-height: 1.5;
  max-width: 250px;
  margin: 0 auto;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-btn {
  padding: 16px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s;
}

.btn-gold {
  background: var(--fin-gold);
  color: #050a1f;
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.2);
}

.btn-gold:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--fin-gold);
  color: var(--fin-gold);
}

.btn-guest {
  background: rgba(255, 255, 255, 0.03);
  color: #718096;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4a5568;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  width: 100%;
  outline: none;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.auth-back {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
}

.logout-link {
  color: var(--red) !important;
  font-weight: 600;
}

.mobile-header {
  display: none;
}

.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .mobile-logo {
    color: var(--fin-gold);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 14px;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(10, 16, 42, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: 10px;
  }

  .bn-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 10px;
  }

  .bn-link svg {
    width: 22px;
    height: 22px;
  }

  .bn-link.active {
    color: var(--fin-gold);
  }

  .bn-fab {
    width: 44px;
    height: 44px;
    background: var(--fin-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: none;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    margin-top: -30px;
    cursor: pointer;
  }
  .main-content {
    padding: 16px 16px 80px !important;
  }
}

/* Ukrywanie zakladek treningu (postepy, statystyki itp) w trybie finansów */
.mode-finance-theme .hide-in-finance {
  display: none !important;
}

.guest-warning-close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  display: none; /* Ukryte domyślnie */
}

@media (max-width: 768px) {
  .guest-warning-close-btn {
    display: block;
  }
  
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  
  .modal {
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 95vh;
  }
  
  .user-profile {
    display: none !important;
  }

  .logout-link-mobile {
    color: var(--red) !important;
  }

  .bn-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-muted);
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: var(--fin-gold);
    transition: all 0.2s;
  }

  .bn-link.active .bn-avatar {
    border-color: var(--fin-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.15);
  }

  .user-dropdown {
    position: fixed !important;
    top: auto !important;
    bottom: 85px !important;
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    border-radius: 24px !important;
    background: rgba(10, 16, 42, 0.98);
    border-color: var(--border-strong);
  }
}
/* Finance Expansion Styles */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.finance-card {
  background: var(--fin-card);
  border: 1px solid var(--fin-border);
  border-radius: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}

.finance-card:hover {
  transform: translateY(-4px);
  border-color: var(--fin-gold-dim);
}

.forecast-card {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05) 0%, rgba(10, 16, 42, 0.4) 100%);
  border-left: 4px solid var(--fin-gold);
}

.goal-card {
  margin-bottom: 16px;
}

.progress-container {
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  overflow: hidden;
  margin: 12px 0 6px;
}

.progress-fill {
  height: 100%;
  background: var(--fin-gold);
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.sub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sub-info {
  display: flex;
  flex-direction: column;
}

.sub-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.sub-meta {
  font-size: 11px;
  color: var(--text-3);
}

.sub-amount {
  font-weight: 700;
  color: var(--fin-gold);
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.1);
  color: var(--fin-gold);
  border: 1px solid rgba(212, 175, 55, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--fin-gold);
  color: #000;
}

.burn-rate-val {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

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

/* OCR Receipt Scanner Styles */
.receipt-carousel-container {
  margin-bottom: 32px;
}

.receipt-carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.receipt-carousel {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding-bottom: 12px;
  scrollbar-width: none; /* Firefox */
}
.receipt-carousel::-webkit-scrollbar { display: none; } /* Chrome */

.receipt-card {
  min-width: 200px;
  background: var(--fin-card);
  border: 1px solid var(--fin-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.receipt-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.receipt-icon {
  width: 32px;
  height: 32px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.receipt-shop {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-date {
  font-size: 11px;
  color: var(--text-3);
}

.receipt-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.receipt-amount {
  font-weight: 700;
  font-size: 16px;
  color: var(--fin-gold);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--fin-gold);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.btn-icon:hover { opacity: 1; }

.btn-outlined-gold {
  background: transparent;
  border: 1px solid var(--fin-gold);
  color: var(--fin-gold);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-outlined-gold:hover {
  background: rgba(212, 175, 55, 0.1);
}

.ocr-item-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: center;
}

.ocr-item-row input {
  flex: 1;
}
.ocr-item-row input.price-input {
  width: 80px;
  flex: none;
}
