/* ==========================================
   GymLog - Cross-platform Optimized Styles
   iOS, Android, macOS, Windows, Linux
   ========================================== */

:root {
  --bg0: #000000;
  --bg1: #0a0a0a;
  --glass: rgba(255,255,255,0.06);
  --glass-strong: rgba(255,255,255,0.10);
  --glass-border: rgba(255,255,255,0.15);
  --stroke: rgba(255,255,255,0.12);
  --stroke2: rgba(255,255,255,0.18);
  --divider: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.95);
  --muted: rgba(255,255,255,0.65);
  --muted2: rgba(255,255,255,0.45);
  --blue: #0A84FF;
  --blue2: #64D2FF;
  --blue-glow: rgba(10,132,255,0.4);
  --danger: #FF453A;
  --shadow: 0 20px 60px rgba(0,0,0,0.6);
  --shadow-accent: 0 15px 40px rgba(10,132,255,0.3);
  --radius: 28px;
  --radius-sm: 18px;
  --blur: 40px;
  
  /* Safe area variables */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Unified spacing system */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
}

/* ==========================================
   Base Styles
   ========================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-weight: 500;
  color: var(--text);
  background: #000;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

html {
  height: -webkit-fill-available;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 10%, rgba(10,132,255,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(100,210,255,0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(10,132,255,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================
   Main App Container
   ========================================== */

.app {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(20px, var(--safe-top)) max(16px, var(--safe-left)) max(24px, var(--safe-bottom)) max(16px, var(--safe-right));
  gap: 16px;
  position: relative;
  z-index: 1;
}

/* ==========================================
   Header & Logo
   ========================================== */

.logo {
  margin: 12px 0 8px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-size: clamp(42px, 7vw, 72px);
  text-align: center;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(10,132,255,0.5));
  user-select: none;
  -webkit-user-select: none;
}

.top {
  width: min(94vw, 900px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ==========================================
   Auth Bar - Cross-platform Layout
   ========================================== */

.authbar {
  margin-top: 0;
  padding: 14px;
  border-radius: 24px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 10px;
  width: 100%;
  
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "status status"
    "btnAuth google"
    "lang   lang";
  align-items: stretch;
}

.auth-actions {
  display: contents;
}

.authbar.is-signed-in {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "status status"
    "btnAuth lang";
}

#authStatus {
  grid-area: status;
  color: var(--muted2);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  line-height: 1.2;
  text-align: center;
}

#btnAuth {
  grid-area: btnAuth;
  justify-self: stretch;
}

#btnGoogle {
  grid-area: google;
  justify-self: stretch;
}

#btnLang {
  grid-area: lang;
  justify-self: stretch;
}

#btnAuth,
#btnGoogle,
#btnLang {
  width: 100%;
}

@media (min-width: 720px) {
  .authbar {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    grid-template-areas: "status btnAuth google lang";
    align-items: center;
  }

  #btnAuth,
  #btnGoogle,
  #btnLang {
    width: auto;
  }
}

/* ==========================================
   Lock Overlay & Notice
   ========================================== */

.lock-notice {
  display: none;
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  margin-top: 0;
  animation: fadeIn 0.3s ease;
}

.app.is-locked .lock-notice {
  display: block;
}

.lock-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
  pointer-events: auto;
}

.lock-overlay-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 380px;
  width: min(380px, 100%);
  text-align: center;
  box-shadow: 
    0 20px 60px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.2);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  pointer-events: auto;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lock-overlay-title {
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.app.is-locked .segmented,
.app.is-locked .card {
  pointer-events: none;
  opacity: 0.5;
  filter: blur(2px);
}

.app.is-locked .authbar {
  pointer-events: auto;
  opacity: 1;
  filter: none;
}

.app.is-locked .sheet,
.app.is-locked .sheet-backdrop,
.app.is-locked .toast {
  display: none !important;
}

/* ==========================================
   Navigation Segmented Control
   ========================================== */

.segmented {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  position: relative;
  overflow: hidden;
}

.segmented::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
  pointer-events: none;
}

.seg-item {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: clamp(14px, 2.2vw, 18px);
  font-weight: 600;
  padding: 14px 12px;
  border-radius: 16px;
  cursor: pointer;
  position: relative;
  line-height: 1;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.seg-item:hover {
  color: rgba(255,255,255,0.85);
  transform: scale(1.02);
}

.seg-item.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(10,132,255,0.9), rgba(10,132,255,0.7));
  box-shadow: 
    0 8px 24px rgba(10,132,255,0.4),
    inset 0 1px 0 rgba(255,255,255,0.3);
  transform: scale(1);
}

.seg-sep {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, transparent, var(--divider), transparent);
  border-radius: 1px;
  flex-shrink: 0;
}

/* ==========================================
   Main Card
   ========================================== */

.card {
  width: min(94vw, 900px);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 20px 60px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.15);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  padding: clamp(18px, 3vw, 26px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: 
    radial-gradient(600px 200px at 50% 0%, rgba(255,255,255,0.1), transparent 70%),
    radial-gradient(800px 300px at 50% 100%, rgba(10,132,255,0.12), transparent 75%);
  pointer-events: none;
  border-radius: inherit;
}

/* ==========================================
   Panels & Tabs
   ========================================== */

.panel {
  display: none;
  position: relative;
  z-index: 1;
}

.panel.is-active {
  display: block;
}

.subtabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.subtab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 2.2vw, 18px);
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.subtab:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
}

.subtab.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(10,132,255,0.85), rgba(10,132,255,0.65));
  box-shadow: 
    0 6px 20px rgba(10,132,255,0.35),
    inset 0 1px 0 rgba(255,255,255,0.25);
  transform: scale(1.02);
}

.subpanel {
  display: none;
  margin-top: 16px;
}

.subpanel.is-active {
  display: block;
}

/* ==========================================
   Typography & Layout Utilities
   ========================================== */

.section-title {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 4px;
}

.mt { margin-top: 20px; }
.mt-sm { margin-top: 14px; }

.hint {
  margin-top: 6px;
  color: var(--muted2);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
}

.row {
  display: flex;
  align-items: center;
}

.gap { gap: 12px; }
.grow { flex: 1; }

.col {
  display: flex;
  flex-direction: column;
}

.hr {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--divider), transparent);
  margin: 14px 0;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--divider), transparent);
  margin: 18px 8px 10px;
  border-radius: 1px;
}

/* ==========================================
   Forms & Inputs - iOS Safari Fixed
   ========================================== */

.form {
  margin-top: 12px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.form .row.gap {
  margin-top: 14px;
}

.label {
  display: block;
  margin: 10px 0 8px;
  color: var(--muted);
  font-weight: 650;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.input {
  width: 100%;
  height: 54px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  color: var(--text);
  padding: 0 16px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.input:focus {
  border-color: rgba(10,132,255,0.5);
  background: rgba(255,255,255,0.08);
  box-shadow: 
    0 0 0 4px rgba(10,132,255,0.1),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.input::placeholder {
  color: rgba(255,255,255,0.35);
  font-weight: 500;
}

.select {
  padding-right: 12px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.6)' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.textarea {
  width: 100%;
  min-height: 100px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  color: var(--text);
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  transition: all 0.2s ease;
  font-family: inherit;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}

.textarea:focus {
  border-color: rgba(10,132,255,0.5);
  background: rgba(255,255,255,0.08);
  box-shadow: 
    0 0 0 4px rgba(10,132,255,0.1),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.small {
  height: 42px;
  width: 90px;
  border-radius: 14px;
  font-weight: 650;
}

.mini {
  height: 42px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  padding: 0 12px;
}

/* ==========================================
   Buttons - Cross-platform Optimized
   ========================================== */

.btn {
  border: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 18px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.1;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.06));
  border: 1px solid var(--stroke);
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn:hover::before {
  opacity: 1;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 24px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn .btn-ico {
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-wide {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 58px;
  margin-top: 14px;
  border-radius: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(10,132,255,1), rgba(10,132,255,0.85));
  border: 1px solid rgba(10,132,255,0.6);
  box-shadow: 
    0 8px 32px rgba(10,132,255,0.4),
    inset 0 1px 0 rgba(255,255,255,0.3);
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 
    0 12px 40px rgba(10,132,255,0.5),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

.btn-ghost {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
}

.btn-accent {
  background: linear-gradient(135deg, rgba(10,132,255,0.3), rgba(10,132,255,0.15));
  border: 1px solid rgba(10,132,255,0.4);
  box-shadow: 
    0 6px 24px rgba(10,132,255,0.2),
    inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-danger {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,69,58,0.5);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(255,69,58,0.1);
  border-color: rgba(255,69,58,0.7);
}

.btn-auth-logout {
  background: linear-gradient(135deg, rgba(255,59,48,1), rgba(255,59,48,0.85));
  border: 1px solid rgba(255,59,48,0.6);
  box-shadow:
    0 8px 32px rgba(255,59,48,0.35),
    inset 0 1px 0 rgba(255,255,255,0.25);
  color: #fff;
}

.btn-icon {
  padding-left: 12px;
  padding-right: 12px;
  min-width: 44px;
}

.icon {
  font-size: 20px;
}

.file input {
  display: none;
}

/* ==========================================
   Lists & Items
   ========================================== */

.list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  border: 1px solid var(--stroke);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.item:hover {
  border-color: var(--stroke2);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.item-head:hover {
  background: rgba(255,255,255,0.03);
}

.item-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
}

.badge {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--stroke);
  padding: 6px 12px;
  border-radius: 12px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.item-body {
  display: none;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 14px;
  background: rgba(0,0,0,0.2);
}

.item.is-open .item-body {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ==========================================
   Exercise & Template Picker
   ========================================== */

.picker {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid var(--stroke);
  transition: all 0.2s ease;
}

.pick:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--stroke2);
}

/* Style picker items used by split picker to match template picker visuals */
.picker-item {
  display: block;
}
.picker-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid var(--stroke);
  transition: all 0.18s ease;
}
.picker-label:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--stroke2);
}
.picker-name {
  font-weight: 600;
  color: var(--text);
}
.picker-check {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.pick-left {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.chk {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.group-head {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  margin-top: 16px;
  margin-bottom: 8px;
  padding-left: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ==========================================
   Calendar - Cross-platform Optimized
   ========================================== */

.cal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
}

.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid var(--stroke);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 85px;
}

.pill-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.cal-box {
border-radius: 26px;
background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
border: 1px solid var(--glass-border);
padding: 18px;
box-shadow:
0 20px 60px rgba(0,0,0,0.4),
inset 0 1px 0 rgba(255,255,255,0.15);
backdrop-filter: blur(var(--blur));
-webkit-backdrop-filter: blur(var(--blur));
}
.cal-head {
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
margin-bottom: 12px;
}
.cal-title {
font-size: clamp(20px, 3.5vw, 32px);
font-weight: 800;
letter-spacing: -0.5px;
background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
user-select: none;
-webkit-user-select: none;
}
.cal-arrow {
width: 46px;
height: 46px;
border-radius: 14px;
border: 1px solid var(--stroke);
background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
color: var(--text);
font-size: 24px;
cursor: pointer;
box-shadow:
0 4px 16px rgba(0,0,0,0.2),
inset 0 1px 0 rgba(255,255,255,0.1);
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
flex-shrink: 0;
}
.cal-arrow:hover {
background: rgba(255,255,255,0.12);
transform: scale(1.05);
box-shadow:
0 6px 20px rgba(0,0,0,0.3),
inset 0 1px 0 rgba(255,255,255,0.15);
}
.cal-arrow:active {
transform: scale(0.95);
}
.cal-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 4px;
margin-bottom: 12px;
color: var(--muted);
font-weight: 700;
text-align: center;
font-size: 13px;
}
.cal-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* Mobile / narrow screens: make inactive day cards slightly smaller
   and ensure hover/active return to full (desktop) size while
   preserving spacing. */
@media (max-width: 720px) {
  .cal-grid {
    gap: 8px; /* increase gap slightly to avoid overlap when scaled */
  }
  .day {
    transform-origin: center center;
    transform: scale(0.96); /* slightly smaller by default */
  }
  .day:hover:not(:disabled),
  .day.is-assigned,
  .day.is-progress,
  .day.is-done {
    transform: scale(1); /* grow to the current default size (no larger) */
  }
}
.day {
aspect-ratio: 1 / 1;
border-radius: 16px;
border: 1px solid var(--stroke);
background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: column;
font-weight: 700;
font-size: 15px;
color: var(--text);
position: relative;
cursor: pointer;
padding-bottom: 20px;
box-shadow:
0 2px 8px rgba(0,0,0,0.15),
inset 0 1px 0 rgba(255,255,255,0.08);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
line-height: 1;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.day:hover:not(:disabled) {
  transform: scale(1);
  background: rgba(255,255,255,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.15);
}
.day:disabled {
cursor: default;
opacity: 0;
}
.day.is-empty {
opacity: 0;
cursor: default;
pointer-events: none;
}
.day .dot {
position: absolute;
bottom: 6px;
left: 50%;
transform: translateX(-50%);
width: 6px;
height: 6px;
border-radius: 50%;
background: rgba(255,255,255,0.3);
pointer-events: none;
transition: all 0.2s ease;
}
.day.is-assigned {
border-color: rgba(255,255,255,0.25);
background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.05));
}
.day.is-assigned .dot {
background: rgba(255,255,255,0.7);
box-shadow: 0 0 8px rgba(255,255,255,0.5);
}
.day.is-progress {
background: linear-gradient(135deg, rgba(10,132,255,0.3), rgba(10,132,255,0.15));
border: 1.5px solid rgba(10,132,255,0.6);
box-shadow:
0 4px 20px rgba(10,132,255,0.3),
inset 0 1px 0 rgba(255,255,255,0.2);
}
.day.is-progress .dot {
background: var(--blue);
width: 7px;
height: 7px;
box-shadow: 0 0 12px rgba(10,132,255,0.8);
}
.day.is-done {
background: linear-gradient(135deg, rgba(10,132,255,0.5), rgba(10,132,255,0.3));
border: 1.5px solid rgba(10,132,255,0.7);
box-shadow:
0 6px 24px rgba(10,132,255,0.4),
inset 0 1px 0 rgba(255,255,255,0.25);
}
.day.is-done .dot {
background: var(--blue2);
width: 8px;
height: 8px;
box-shadow: 0 0 16px rgba(100,210,255,1);
}
/* ==========================================
Stats Section
========================================== */
.stats-card {
margin-bottom: 20px;
padding: 20px;
border-radius: 24px;
background: linear-gradient(145deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
border: 1px solid var(--stroke);
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.stats-title {
font-weight: 800;
font-size: 22px;
letter-spacing: -0.3px;
margin-bottom: 16px;
}
.stats-kpis {
display: grid;
grid-template-columns: 1fr;
gap: 12px;
margin-bottom: 20px;
}
.stats-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid var(--divider);
}
.stats-label {
font-size: 14px;
font-weight: 600;
color: var(--muted);
}
.stats-value {
font-size: 18px;
font-weight: 800;
color: var(--text);
letter-spacing: -0.3px;
}
.stats-viz {
display: flex;
flex-direction: column;
gap: 16px;
align-items: center;
}
.stats-pie-wrap {
width: 100%;
max-width: 320px;
aspect-ratio: 1 / 1;
display: flex;
align-items: center;
justify-content: center;
}
#statsPie {
max-width: 100%;
height: auto;
}
.stats-legend {
width: 100%;
display: flex;
flex-direction: column;
gap: 8px;
}
.legend-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
border-radius: 12px;
background: rgba(255,255,255,0.04);
border: 1px solid var(--stroke);
}
.legend-left {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.legend-dot {
width: 12px;
height: 12px;
border-radius: 50%;
flex-shrink: 0;
}
.legend-label {
font-size: 14px;
font-weight: 600;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.legend-val {
font-size: 14px;
font-weight: 700;
color: var(--muted);
flex-shrink: 0;
margin-left: 12px;
}
/* ==========================================
Backup Section
========================================== */
.backup-actions {
padding-top: 6px;
}
.backup-actions .btn {
font-size: 16px;
font-weight: 650;
}
.backup-actions .btn .btn-ico {
font-size: 17px;
}
.note {
margin: 14px 8px 0;
color: var(--muted2);
font-size: 14px;
line-height: 1.4;
font-weight: 500;
}
.sync-status {
margin: 12px 8px 0;
color: var(--muted);
font-size: 14px;
font-weight: 600;
}
.sync-help {
margin: 8px 8px 0;
color: var(--muted2);
font-size: 14px;
line-height: 1.4;
font-weight: 500;
}
/* ==========================================
Bottom Sheet - iOS/Android Optimized
========================================== */
.sheet-backdrop {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.7);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
display: none;
z-index: 50;
animation: none;
}
.sheet {
position: fixed;
left: 50%;
transform: translate(-50%, 100%);
bottom: 0;
width: min(94vw, 900px);
max-height: min(80vh, 800px);
border-radius: 28px 28px 0 0;
background: linear-gradient(165deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
border: 1px solid var(--stroke2);
border-bottom: none;
box-shadow:
0 -30px 80px rgba(0,0,0,0.8),
inset 0 1px 0 rgba(255,255,255,0.2);
backdrop-filter: blur(var(--blur));
-webkit-backdrop-filter: blur(var(--blur));
z-index: 60;
will-change: transform;
transition: transform 220ms ease-out;
}
.sheet.is-open {
transform: translate(-50%, 0);
}
.sheet-backdrop.is-open {
display: block;
}
.sheet-handle {
width: 80px;
height: 5px;
border-radius: 3px;
background: linear-gradient(90deg, rgba(255,255,255,0.3), rgba(255,255,255,0.2));
margin: 12px auto 0;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
cursor: grab;
user-select: none;
-webkit-user-select: none;
}
.sheet-handle:active {
cursor: grabbing;
}
.sheet-body {
padding: 16px 16px max(20px, var(--safe-bottom));
max-height: min(72vh, 700px);
overflow-y: auto;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
}
.sheet-body::-webkit-scrollbar {
width: 8px;
}
.sheet-body::-webkit-scrollbar-track {
background: rgba(255,255,255,0.03);
border-radius: 4px;
}
.sheet-body::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.2);
border-radius: 4px;
}
.sheet-body::-webkit-scrollbar-thumb:hover {
background: rgba(255,255,255,0.3);
}
.sheet-title {
font-weight: 800;
font-size: 20px;
letter-spacing: -0.3px;
margin-bottom: 4px;
}
.sheet-sub {
margin-top: 6px;
color: var(--muted);
font-size: 14px;
font-weight: 500;
line-height: 1.4;
}
.sheet-meta {
margin-top: 8px;
display: flex;
flex-direction: column;
gap: 8px;
}
.sheet-notes {
color: var(--muted);
font-size: 14px;
font-weight: 500;
line-height: 1.4;
padding: 10px 12px;
border-radius: 12px;
background: rgba(255,255,255,0.04);
border: 1px solid var(--stroke);
}
.sheet-actions {
margin-top: 14px;
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.sheet-actions .btn {
flex: 1;
min-width: 140px;
}
/* ==========================================
Workout Editor in Sheet
========================================== */
.wk-card {
margin-top: 14px;
border-radius: 20px;
background: linear-gradient(145deg, rgba(0,0,0,0.4), rgba(0,0,0,0.2));
border: 1px solid var(--stroke);
padding: 14px;
box-shadow:
0 4px 16px rgba(0,0,0,0.3),
inset 0 1px 0 rgba(255,255,255,0.08);
}
.wk-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.wk-info {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
flex: 1;
}
.wk-name {
font-weight: 800;
font-size: 17px;
letter-spacing: -0.2px;
}
.wk-last {
color: var(--muted);
font-size: 13px;
font-weight: 500;
}
.wk-actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
}
.wk-actions .btn {
flex: 0 0 auto;
width: auto;
padding: 10px 14px;
font-size: 14px;
line-height: 1;
white-space: nowrap;
display: inline-flex;
align-items: center;
justify-content: center;
max-width: 100%;
}
.wk-actions .btn.btn-icon {
padding-left: 12px;
padding-right: 12px;
min-width: 44px;
}
.wk-actions-row {
display: flex;
gap: 8px;
flex-wrap: nowrap;
align-items: stretch;
}
.wk-actions-row .btn {
flex: 1 1 0;
min-width: 0;
padding: 10px 14px;
font-size: 14px;
white-space: nowrap;
display: flex;
align-items: center;
justify-content: center;
height: auto;
}
.wk-actions-row [data-move-ex-up],
.wk-actions-row [data-move-ex-down] {
flex: 0 0 52px;
width: 52px;
padding-left: 0;
padding-right: 0;
}
.wk-actions-secondary {
width: 100%;
}

/* Template metrics: stack on mobile for readability */
body[data-layout="compact"] .tpl-ex-badge {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

body[data-layout="compact"] .tpl-metric {
  display: block;
  white-space: nowrap;
}

/* Workout editor actions: two-row layout on mobile */
body[data-layout="compact"] .wk-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
}

body[data-layout="compact"] .wk-actions-row {
  width: 100%;
  flex-wrap: nowrap;
}

body[data-layout="compact"] .wk-actions-row .btn {
  flex: 1 1 0;
  min-width: 0;
}

body[data-layout="compact"] .wk-actions-row [data-move-ex-up],
body[data-layout="compact"] .wk-actions-row [data-move-ex-down] {
  flex: 0 0 52px;
}
.btn-block {
width: 100%;
display: inline-flex;
justify-content: center;
}
.set-grid {
display: grid;
grid-template-columns: 48px 1fr 1fr 1.2fr;
gap: 8px;
margin-top: 12px;
}
.set-grid.cardio-grid {
grid-template-columns: 1fr 1fr 1.2fr;
}
.set-label {
display: flex;
align-items: center;
justify-content: center;
color: var(--muted);
font-weight: 800;
font-size: 14px;
}
.diff-row {
display: flex;
gap: 10px;
margin-top: 12px;
flex-wrap: wrap;
}
.diff-chip {
flex: 1;
min-width: 90px;
}
/* ==========================================
Template Exercise Rows - Mobile Safe
========================================== */
.tpl-ex-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "main badge"
    "arrows arrows";
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  align-items: start;
}

.tpl-ex-main {
  grid-area: main;
  min-width: 0;
}

.tpl-ex-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tpl-ex-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.3;
}

.tpl-ex-side {
  grid-area: badge;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.tpl-ex-badge {
  font-size: 11px;
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 100%;
  /* Ensure the badge is at least as tall as the arrow buttons */
  min-height: 48px;
  justify-content: center;
}

.tpl-metric {
  white-space: nowrap;
}

.tpl-ex-arrows {
  grid-area: arrows;
  display: flex;
  gap: 8px;
  width: 100%;
}

.tpl-arrow {
  flex: 1;
  height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

@media (min-width: 640px) {
  .tpl-ex-row {
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "main badge arrows";
    align-items: center;
  }
  
  .tpl-ex-title {
    margin-bottom: 2px;
  }
  
  .tpl-ex-badge {
    font-size: 12px;
    max-width: 300px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    /* Match desktop arrow button height */
    min-height: 52px;
  }
  
  .tpl-ex-arrows {
    width: auto;
    gap: 8px;
  }
  
  .tpl-arrow {
    flex: 0 0 52px;
    width: 52px;
  }
}

/* ==========================================
   Toast / Update Banner
   ========================================== */

.toast {
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: calc(18px + var(--safe-bottom));
width: min(94vw, 900px);
display: none;
z-index: 200;
animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.is-open {
display: block;
}
.toast-inner {
display: flex;
gap: 14px;
align-items: center;
justify-content: space-between;
padding: 16px 18px;
border-radius: 22px;
background: linear-gradient(145deg, rgba(20,20,30,0.95), rgba(15,15,25,0.95));
border: 1px solid rgba(255,255,255,0.2);
box-shadow:
0 20px 70px rgba(0,0,0,0.7),
inset 0 1px 0 rgba(255,255,255,0.15);
backdrop-filter: blur(var(--blur));
-webkit-backdrop-filter: blur(var(--blur));
}
.toast-title {
font-weight: 800;
font-size: 16px;
letter-spacing: -0.2px;
}
.toast-sub {
margin-top: 4px;
color: rgba(255,255,255,0.6);
font-size: 13px;
font-weight: 500;
}
.toast-actions {
display: flex;
gap: 10px;
align-items: center;
}
.toast-actions .btn {
padding: 10px 16px;
border-radius: 14px;
font-size: 14px;
height: auto;
}
/* ==========================================
App Version Badge
========================================== */
#app-version {
position: fixed;
bottom: max(6px, var(--safe-bottom));
left: 50%;
transform: translateX(-50%);
text-align: center;
font-size: 11px;
font-weight: 600;
opacity: 0.4;
z-index: 9999;
pointer-events: none;
color: var(--muted2);
letter-spacing: 0.5px;
}
/* ==========================================
Animations
========================================== */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.loading {
animation: pulse 1.5s ease-in-out infinite;
}
/* ==========================================
Responsive - Mobile First
========================================== */
@media (max-width: 380px) {
.logo {
font-size: 38px;
}
.seg-item {
padding: 12px 8px;
font-size: 13px;
}
.card {
padding: 14px;
}
.form {
padding: 14px;
}
.btn-wide {
height: 52px;
font-size: 14px;
}
.sheet-actions .btn {
min-width: 110px;
font-size: 13px;
}
}
@media (max-width: 520px) {
.set-grid {
grid-template-columns: 44px 1fr 1fr;
}
.set-grid .note-cell {
grid-column: 1 / -1;
}
.day {
padding-bottom: 14px;
font-size: 14px;
}
.day .dot {
bottom: 5px;
width: 5px;
height: 5px;
}
.day.is-progress .dot {
width: 6px;
height: 6px;
}
.day.is-done .dot {
width: 7px;
height: 7px;
}
.wk-actions {
justify-content: flex-start;
}
.cal-grid {
gap: 4px;
}
.cal-weekdays {
gap: 4px;
}
}
@media (min-width: 720px) {
.wk-actions {
flex-direction: row;
align-items: center;
}
.wk-actions-row {
order: 0;
flex-wrap: nowrap;
}
.wk-actions-secondary {
order: 1;
width: auto;
margin-left: 8px;
}
.btn-block {
width: auto;
}
.wk-actions {
gap: 6px;
}
.wk-actions-row {
gap: 6px;
}
.wk-actions-row .btn {
padding: 9px 12px;
}
.wk-actions-row [data-move-ex-up],
.wk-actions-row [data-move-ex-down] {
flex: 0 0 48px;
width: 48px;
}
.stats-viz {
flex-direction: row;
align-items: flex-start;
}
.stats-pie-wrap {
flex: 0 0 320px;
}
.stats-legend {
flex: 1;
}
}
@media (min-width: 900px) {
.day {
font-size: 22px;
justify-content: center;
padding-bottom: 0;
}
.day .dot {
bottom: 8px;
width: 10px;
height: 10px;
}
.day.is-progress .dot {
width: 11px;
height: 11px;
}
.day.is-done .dot {
width: 12px;
height: 12px;
}
}
/* ==========================================
Accessibility & Browser Support
========================================== */
*:focus-visible {
outline: 2px solid rgba(10,132,255,0.6);
outline-offset: 2px;
}
@media (prefers-contrast: high) {
:root {
--glass-border: rgba(255,255,255,0.3);
--stroke: rgba(255,255,255,0.25);
--stroke2: rgba(255,255,255,0.35);
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
@media (prefers-color-scheme: dark) {
/* Already optimized for dark mode */
}
@media (prefers-color-scheme: light) {
/* Keep dark theme - this app is designed for dark mode */
}
@media print {
  .authbar,
  .segmented,
  .lock-notice,
  .lock-overlay,
  .sheet,
  .sheet-backdrop,
  .toast,
  #app-version {
    display: none !important;
  }
  
  body::before,
  body::after {
    display: none;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Calendar spacing patch */
[data-panel="calendar"] .form{ margin-bottom:14px; }
.cal-stats{ margin-top:14px; }
.cal-box{ margin-top:14px; }

/* Calendar spacing fixes */
.panel[data-panel="calendar"] .form{ margin-bottom:14px; }
.panel[data-panel="calendar"] .cal-stats{ margin-top:12px; }
.panel[data-panel="calendar"] .cal-box{ margin-top:12px; }

/* ==========================================
   Toast Notification System (ADDED)
   ========================================== */

.custom-toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 90vw;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  pointer-events: none;
}

.custom-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.custom-toast.toast-error {
  background: rgba(255, 69, 58, 0.15);
  border-color: var(--danger);
}

.custom-toast.toast-success {
  background: rgba(50, 215, 75, 0.15);
  border-color: #32D74B;
}

.custom-toast.toast-warning {
  background: rgba(255, 159, 10, 0.15);
  border-color: #FF9F0A;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}