/* ==========================================================================
   RunPlanner — design system
   Mobile-first, jasny/ciemny motyw, akcent pomarańczowo-niebieski
   ========================================================================== */

:root {
  --orange: #f97316;
  --orange-strong: #ea580c;
  --orange-soft: #fff1e6;
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --blue-soft: #e8f0ff;
  --green: #16a34a;
  --red: #dc2626;
  --red-soft: #fee2e2;

  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #ffe9d6 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 0%, #dbe8ff 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --surface-3: #e7eaf2;
  --border: #e3e7ef;
  --border-strong: #cdd4e0;
  --text: #101828;
  --text-muted: #5b6478;
  --text-faint: #8b93a7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .14);
  --focus: 0 0 0 3px rgba(37, 99, 235, .25);
  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --nav-h: 68px;
  --tap: 52px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --orange: #ff8a3d;
  --orange-strong: #ffa565;
  --orange-soft: rgba(255, 138, 61, .14);
  --blue: #6c9bff;
  --blue-strong: #8fb3ff;
  --blue-soft: rgba(108, 155, 255, .14);
  --green: #4ade80;
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .14);

  --bg: #0b0e14;
  --bg-grad: radial-gradient(1100px 600px at 8% -10%, rgba(249, 115, 22, .12) 0%, transparent 60%),
             radial-gradient(900px 520px at 108% 0%, rgba(37, 99, 235, .16) 0%, transparent 55%);
  --surface: #141821;
  --surface-2: #1b2029;
  --surface-3: #232936;
  --border: #262c38;
  --border-strong: #343c4c;
  --text: #edf0f7;
  --text-muted: #a3adc2;
  --text-faint: #7c8598;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 8px 26px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(108, 155, 255, .35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }

::selection { background: var(--orange); color: #fff; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------- Typografia ------------------------------- */

.h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800; }
.h2 { font-size: clamp(1.25rem, 4vw, 1.6rem); font-weight: 750; }
.h3 { font-size: 1.05rem; font-weight: 700; }
.lead { color: var(--text-muted); font-size: .975rem; }
.small { font-size: .84rem; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.gradient-text {
  background: linear-gradient(100deg, var(--orange), var(--blue));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --------------------------------- Layout --------------------------------- */

.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px;
}

.container-wide { max-width: 1100px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------- Komponenty ------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-tight { padding: 16px; border-radius: var(--radius); }

.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em; color: var(--text);
  text-decoration: none;
}
.logo-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(249, 115, 22, .28);
  flex: 0 0 auto;
}
.logo-mark svg { width: 21px; height: 21px; }

/* Przyciski */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 650;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .06s ease, filter .15s ease, background .15s ease, opacity .15s;
  touch-action: manipulation;
  text-decoration: none;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }

.btn-primary {
  background: linear-gradient(100deg, var(--orange), #fb8b3c 45%, var(--blue));
  color: #fff;
  box-shadow: 0 10px 24px rgba(249, 115, 22, .28);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.04); }

.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(37, 99, 235, .25); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .875rem; border-radius: 11px; }
.btn-icon { min-height: 44px; width: 44px; padding: 0; border-radius: 12px; }

.btn-google {
  background: var(--surface); border-color: var(--border-strong); color: var(--text);
  font-weight: 600;
}
.btn-google svg { width: 19px; height: 19px; }

/* Pola formularza */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.label { font-size: .875rem; font-weight: 650; color: var(--text); }
.label .optional { font-weight: 500; color: var(--text-faint); font-size: .8rem; }
.hint { font-size: .8rem; color: var(--text-faint); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 13px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: var(--focus);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c768a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--red);
}
.error-text { font-size: .8rem; color: var(--red); font-weight: 550; display: flex; gap: 5px; align-items: flex-start; }
.error-text svg { width: 14px; height: 14px; margin-top: 2px; flex: 0 0 auto; }

.input-suffix { position: relative; }
.input-suffix .suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-size: .9rem; pointer-events: none;
}
.input-suffix .input { padding-right: 46px; }

/* Pole hasła z przełącznikiem „pokaż / ukryj” */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap .input-password { padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border: 0; border-radius: 11px;
  background: transparent; color: var(--text-faint);
  cursor: pointer; transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--focus); color: var(--blue); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-toggle[aria-pressed="true"] { color: var(--blue); }

/* Karty wyboru (radio/checkbox stylizowane) */
.choice-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 480px) {
  .choice-grid-2 { grid-template-columns: 1fr 1fr; }
  .choice-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.choice {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice:hover { border-color: var(--blue); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice .choice-title { font-weight: 650; font-size: .95rem; }
.choice .choice-sub { font-size: .8rem; color: var(--text-muted); }
.choice .dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: 0 0 auto; display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.choice .dot::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: transparent; transition: background .15s;
}
.choice input:checked ~ .dot { border-color: var(--orange); background: var(--orange-soft); }
.choice input:checked ~ .dot::after { background: var(--orange); }
.choice input:checked ~ .dot.box { border-radius: 7px; background: var(--blue-soft); border-color: var(--blue); }
.choice input:checked ~ .dot.box::after {
  width: 12px; height: 12px; border-radius: 3px; background: var(--blue);
}
.choice:has(input:checked) {
  border-color: var(--orange);
  background: linear-gradient(0deg, var(--orange-soft), var(--orange-soft)), var(--surface);
  box-shadow: 0 4px 14px rgba(249, 115, 22, .12);
}
.choice:has(input:checked) .choice-title { color: var(--text); }

/* Chipy dni tygodnia */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 46px; min-width: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 650; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s;
}
.chip[aria-pressed="true"] {
  background: var(--blue); border-color: var(--blue); color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .25);
}

/* Pasek postępu */
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress-bar {
  height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
.progress-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-muted); }

/* Alerty */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 15px; border-radius: 13px;
  font-size: .9rem; line-height: 1.45;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-success { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.alert-info { background: var(--blue-soft); color: var(--blue-strong); border-color: color-mix(in srgb, var(--blue) 22%, transparent); }
[data-theme="dark"] .alert-info { color: #b9ceff; }

/* Spinner / ładowanie */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn .spinner { width: 18px; height: 18px; border-width: 2px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 12px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.loading-block { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 0; color: var(--text-muted); }

/* ------------------------------ Ekrany auth ------------------------------- */

.auth-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
  gap: 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
}
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

/* -------------------------------- Aplikacja ------------------------------- */

.app-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 18px;
}

.avatar-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(135deg, var(--orange), var(--blue)) border-box;
  color: var(--text); font-weight: 750; font-size: .9rem;
  display: grid; place-items: center; cursor: pointer;
  padding: 0;
}
.avatar-btn span { 
  width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 18px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}

/* Nawigacja dolna (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--nav-h);
  background: none; border: none; cursor: pointer;
  color: var(--text-faint);
  font-size: .7rem; font-weight: 600;
  text-decoration: none;
  transition: color .15s;
  position: relative;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item[aria-current="page"] { color: var(--orange); }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--orange), var(--blue));
}

/* Boczna nawigacja (desktop) */
.side-nav { display: none; }

@media (min-width: 900px) {
  .shell-app {
    display: grid;
    grid-template-columns: 264px 1fr;
    min-height: 100dvh;
  }
  .side-nav {
    display: flex; flex-direction: column; gap: 8px;
    position: sticky; top: 0; height: 100dvh;
    padding: 22px 16px;
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 60%, transparent);
  }
  .side-nav .nav-item {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 48px; padding: 0 14px;
    border-radius: 12px; font-size: .95rem; font-weight: 600;
  }
  .side-nav .nav-item[aria-current="page"] {
    background: linear-gradient(100deg, var(--orange-soft), var(--blue-soft));
    color: var(--text);
  }
  .side-nav .nav-item[aria-current="page"]::before {
    top: 50%; left: -16px; transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--orange), var(--blue));
  }
  .bottom-nav { display: none; }
  .app-main { padding: 28px 32px 48px; }
  .app-header { position: sticky; }
  .app-header-inner { padding: 14px 32px; }
  .mobile-only { display: none !important; }
}

@media (max-width: 899px) {
  .desktop-only { display: none !important; }
}

/* Menu profilu */
.menu-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6, 9, 15, .45);
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
.menu {
  position: fixed; z-index: 61;
  top: 64px; right: 16px;
  width: min(300px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
  animation: popIn .16s cubic-bezier(.2, .9, .3, 1.2);
}
@media (min-width: 900px) { .menu { top: 72px; right: 32px; } }
.menu-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; gap: 11px; align-items: center; }
.menu-head .name { font-weight: 700; font-size: .95rem; }
.menu-head .mail { font-size: .78rem; color: var(--text-muted); word-break: break-all; }
.menu-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 12px;
  background: none; border: none; border-radius: 11px;
  color: var(--text); font-size: .93rem; font-weight: 550;
  text-align: left; cursor: pointer;
}
.menu-item svg { width: 19px; height: 19px; color: var(--text-muted); flex: 0 0 auto; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--red); }
.menu-item.danger svg { color: var(--red); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }

/* Modal / arkusz */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(6, 9, 15, .5);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease;
  padding: 0;
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
}
.sheet {
  width: 100%; max-width: 560px;
  max-height: 92dvh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp .24s cubic-bezier(.2, .8, .3, 1);
  display: flex; flex-direction: column; gap: 16px;
}
@media (min-width: 640px) { .sheet { border-radius: 24px; padding-bottom: 22px; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: -8px auto 2px; }
@media (min-width: 640px) { .sheet-handle { display: none; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.close-btn {
  width: 36px; height: 36px; border-radius: 10px; border: none;
  background: var(--surface-2); color: var(--text-muted);
  display: grid; place-items: center; cursor: pointer; flex: 0 0 auto;
}
.close-btn svg { width: 18px; height: 18px; }
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Zakładki placeholdery */
.placeholder-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px;
  min-height: 54dvh;
  padding: 30px 20px;
}
.placeholder-icon {
  width: 76px; height: 76px; border-radius: 24px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--orange-soft), var(--blue-soft));
  color: var(--orange);
  margin-bottom: 4px;
}
.placeholder-icon svg { width: 34px; height: 34px; }
.badge-soon {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px;
  background: var(--blue-soft); color: var(--blue-strong);
  font-size: .76rem; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase;
}
[data-theme="dark"] .badge-soon { color: #b9ceff; }

.page-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }

/* Onboarding */
.onboarding-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column;
}
.onboarding-top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.onboarding-top-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.onboarding-body {
  flex: 1; width: 100%; max-width: 720px; margin: 0 auto;
  padding: 24px 18px 140px;
}
.onboarding-foot {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
}
.onboarding-foot-inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }
.onboarding-foot .btn { flex: 1; }
.onboarding-foot .btn-back { flex: 0 0 auto; width: 52px; padding: 0; }
.step-title { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }

/* Strefy tętna */
.zone-list { display: flex; flex-direction: column; gap: 10px; }
.zone-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 68px 10px 68px;
  align-items: center; gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}
@media (max-width: 380px) {
  .zone-row { grid-template-columns: 40px minmax(0, 1fr) 60px 8px 60px; gap: 4px; padding: 8px; }
  .zone-input { width: 60px; }
}
.zone-tag {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: .85rem; color: #fff;
}
.zone-name { font-size: .82rem; color: var(--text-muted); }
.zone-input { width: 74px; text-align: center; min-height: 42px; padding: 6px; }
.zone-dash { color: var(--text-faint); }
.zone-1 .zone-tag { background: #38bdf8; }
.zone-2 .zone-tag { background: #22c55e; }
.zone-3 .zone-tag { background: #eab308; }
.zone-4 .zone-tag { background: #f97316; }
.zone-5 .zone-tag { background: #ef4444; }

.result-row {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px;
  padding: 14px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2);
}
.result-row .field { gap: 4px; }
.result-row .input, .result-row .select { min-height: 44px; background: var(--surface); }
@media (max-width: 420px) { .result-row { grid-template-columns: 1fr 1fr; } .result-row .remove-result { grid-column: 2; justify-self: end; } }

.info-box {
  display: flex; gap: 10px; padding: 13px 14px;
  border-radius: 13px; background: var(--blue-soft); color: var(--blue-strong);
  font-size: .85rem; line-height: 1.45;
}
[data-theme="dark"] .info-box { color: #b9ceff; }
.info-box svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }

.summary-list { display: flex; flex-direction: column; gap: 0; }
.summary-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-row dt { color: var(--text-muted); }
.summary-row dd { margin: 0; font-weight: 600; text-align: right; }

/* Motywy — przełącznik */
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border-radius: 13px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-size: .78rem; font-weight: 600; color: var(--text-muted);
}
.theme-opt svg { width: 20px; height: 20px; }
.theme-opt[aria-pressed="true"] {
  border-color: var(--orange); color: var(--text);
  background: linear-gradient(0deg, var(--orange-soft), var(--orange-soft)), var(--surface);
}

.toast-stack {
  position: fixed; bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px;
  width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
@media (min-width: 900px) { .toast-stack { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 550;
  animation: slideUp .2s ease;
}
.toast svg { width: 18px; height: 18px; flex: 0 0 auto; }
.toast.success svg { color: var(--green); }
.toast.error svg { color: var(--red); }

/* Sekcje profilu */
.section-title { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: .95rem; margin-bottom: 12px; }
.section-title svg { width: 18px; height: 18px; color: var(--orange); }

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

.link-btn {
  background: none; border: none; padding: 0; color: var(--blue);
  font-weight: 600; cursor: pointer; font-size: .875rem;
  text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

.stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: .78rem; font-weight: 600;
}

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

/* ==========================================================================
   KALENDARZ TRENINGÓW
   ========================================================================== */

/* Kolory typów treningów */
:root {
  --wt-base_z2: #2563eb;
  --wt-long: #7c3aed;
  --wt-tempo: #f97316;
  --wt-intervals: #db2777;
  --wt-recovery: #0891b2;
  --wt-rest: #64748b;
  --wt-other: #475569;
  --wt-race: #b45309;
}
[data-theme="dark"] {
  --wt-base_z2: #6c9bff;
  --wt-long: #a78bfa;
  --wt-tempo: #ff8a3d;
  --wt-intervals: #f472b6;
  --wt-recovery: #22d3ee;
  --wt-rest: #94a3b8;
  --wt-other: #94a3b8;
  --wt-race: #fbbf24;
}

.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}

.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-period {
  font-weight: 750; font-size: 1.02rem; letter-spacing: -.01em;
  min-width: 0; text-transform: capitalize;
}
.cal-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); cursor: pointer; transition: background .15s, border-color .15s;
}
.cal-arrow:hover { background: var(--surface-2); border-color: var(--blue); }
.cal-arrow svg { width: 18px; height: 18px; }
.cal-arrow.flip svg { transform: rotate(180deg); }

/* Przełącznik tydzień / miesiąc */
.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border);
}
.segmented button {
  border: 0; background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: .85rem; font-weight: 650;
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  min-height: 34px;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Siatka miesiąca */
.cal-month {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-dow {
  text-align: center; font-size: .7rem; font-weight: 700;
  color: var(--text-faint); text-transform: uppercase;
  letter-spacing: .04em; padding: 4px 0 6px;
}
.cal-cell {
  position: relative; display: flex; flex-direction: column;
  align-items: stretch; gap: 2px;
  min-height: 62px; padding: 5px 4px;
  border-radius: 11px; border: 1.5px solid transparent;
  background: var(--surface); cursor: pointer;
  text-align: left; font-family: inherit;
  transition: border-color .15s, background .15s, transform .12s;
}
.cal-cell:hover { border-color: var(--border-strong); }
.cal-cell:focus-visible { outline: none; box-shadow: var(--focus); }
.cal-cell.outside { opacity: .38; }
.cal-cell.today { border-color: var(--blue); background: var(--blue-soft); }
.cal-cell.selected { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange-soft); }
.cal-cell.drop-target {
  border-color: var(--orange); border-style: dashed;
  background: var(--orange-soft); transform: scale(1.02);
}
.cal-cell.dragging { opacity: .45; }
.cal-daynum {
  font-size: .78rem; font-weight: 700; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between; gap: 2px;
}
.cal-cell.today .cal-daynum { color: var(--blue); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot, var(--text-faint)); flex: 0 0 auto;
}
.cal-dot.done::after { content: ''; }
.cal-mini-label {
  font-size: .62rem; font-weight: 650; line-height: 1.15;
  padding: 1px 3px; border-radius: 4px;
  color: #fff; background: var(--dot, var(--text-faint));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
  display: none; /* na telefonie wystarczą kolorowe kropki */
}
.cal-mini-label { text-shadow: 0 1px 1px rgba(0,0,0,.18); }
.cal-flag {
  position: absolute; top: 3px; right: 3px;
  color: var(--wt-race); display: inline-flex;
}
.cal-flag svg { width: 11px; height: 11px; }
.cal-done-mark {
  position: absolute; bottom: 3px; right: 3px;
  color: var(--green); display: inline-flex;
}
.cal-done-mark svg { width: 12px; height: 12px; stroke-width: 3; }
.cal-late-mark { color: var(--red); }

@media (min-width: 640px) {
  .cal-month { gap: 6px; }
  .cal-cell { min-height: 86px; padding: 6px; }
  .cal-daynum { font-size: .82rem; }
  .cal-mini-label { display: block; font-size: .68rem; }
}

/* Widok tygodnia — lista dni (mobile-first) */
.cal-week { display: flex; flex-direction: column; gap: 8px; }
.cal-day-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--border);
  transition: border-color .15s, background .15s;
}
.cal-day-card.today { border-color: var(--blue); background: var(--blue-soft); }
.cal-day-card.drop-target { border-color: var(--orange); border-style: dashed; background: var(--orange-soft); }
.cal-day-card.empty { background: transparent; border-style: dashed; }
.cal-day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.cal-day-name { font-weight: 700; font-size: .9rem; text-transform: capitalize; }
.cal-day-name .num { color: var(--text-faint); font-weight: 600; }
.cal-day-empty { font-size: .8rem; color: var(--text-faint); }

@media (min-width: 900px) {
  .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
  .cal-day-card { min-height: 140px; padding: 10px; }
}

/* Pozycja treningu / zawodów */
.wk-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 4px solid var(--wt, var(--text-faint));
  cursor: pointer; text-align: left; font-family: inherit;
  width: 100%; font-size: .82rem; color: var(--text);
  transition: transform .12s, box-shadow .12s, background .15s;
}
.wk-item:hover { background: var(--surface-3); }
.wk-item:active { transform: scale(.99); }
.wk-item.dragging { opacity: .4; }
.wk-item.is-done { background: color-mix(in srgb, var(--green) 9%, var(--surface-2)); }
.wk-item.is-missed { background: color-mix(in srgb, var(--red) 9%, var(--surface-2)); }
.wk-item.is-missed .wk-title { color: var(--red); }
.wk-item.is-race { border-left-color: var(--wt-race); background: color-mix(in srgb, var(--wt-race) 12%, var(--surface-2)); }
.wk-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.wk-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-meta { font-size: .72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-status { display: inline-flex; flex: 0 0 auto; }
.wk-status svg { width: 15px; height: 15px; }
.wk-status.done { color: var(--green); }
.wk-status.missed { color: var(--red); }
.wk-status.skipped { color: var(--text-faint); }
.wk-status.race { color: var(--wt-race); }
.wk-grip { color: var(--text-faint); display: inline-flex; flex: 0 0 auto; cursor: grab; }
.wk-grip svg { width: 14px; height: 14px; }

/* Karta „Najbliższy trening” */
.next-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 18px;
  background: linear-gradient(135deg, var(--orange) 0%, #fb923c 45%, var(--blue) 130%);
  color: #fff; box-shadow: var(--shadow);
}
[data-theme="dark"] .next-card {
  background: linear-gradient(135deg, #b45309 0%, #c2410c 45%, #1e40af 130%);
}
.next-card .next-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; opacity: .9;
  display: flex; align-items: center; gap: 6px;
}
.next-card .next-label svg { width: 15px; height: 15px; }
.next-card .next-type { font-size: 1.32rem; font-weight: 780; letter-spacing: -.015em; margin-top: 6px; }
.next-card .next-date { font-size: .86rem; opacity: .93; margin-top: 2px; text-transform: capitalize; }
.next-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.next-stat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 99px;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: .8rem; font-weight: 650; backdrop-filter: blur(4px);
}
.next-stat svg { width: 14px; height: 14px; }
.next-card .next-empty { font-size: .92rem; opacity: .95; margin-top: 6px; }

/* Szczegóły dnia */
.day-sheet-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-empty { text-align: center; padding: 22px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.day-empty svg { width: 34px; height: 34px; color: var(--text-faint); }

/* Formularz treningu */
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .form-row.two { grid-template-columns: 1fr 1fr; } }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.type-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 11px; border-radius: 11px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-family: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
  min-height: 46px;
}
.type-opt .swatch { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--sw, var(--text-faint)); }
.type-opt[aria-pressed="true"] {
  border-color: var(--sw, var(--blue));
  background: color-mix(in srgb, var(--sw, var(--blue)) 12%, var(--surface));
}
.feel-row { display: flex; gap: 6px; }
.feel-btn {
  flex: 1; min-height: 44px; border-radius: 11px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); font-family: inherit; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.feel-btn[aria-pressed="true"] { border-color: var(--orange); background: var(--orange-soft); color: var(--orange-strong); }

.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.sheet-actions .row { gap: 8px; }
.sheet-actions .row > * { flex: 1; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 8px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--text-muted); font-weight: 600; }
.cal-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--lg); display: inline-block; }

.cal-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; }

/* ==========================================================================
   ETAP 3 — profil (daty, cele, kilometraż), historia, okienko kontrolne
   ========================================================================== */

/* ---------------------------- Tempo / wynik ------------------------------- */

.pace-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .8rem; font-weight: 700; color: var(--text-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pace-chip svg { width: 13px; height: 13px; }
.pace-chip.is-set {
  background: var(--blue-soft); border-color: transparent;
  color: var(--blue-strong);
}
[data-theme="dark"] .pace-chip.is-set { color: #b9ceff; }

.result-pace {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.result-pace > svg, .result-pace > span:first-child svg { width: 16px; height: 16px; color: var(--orange); flex: 0 0 auto; }

/* ------------------------- Wyniki startowe (profil) ----------------------- */

.result-list { display: flex; flex-direction: column; gap: 8px; }
.result-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.result-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-distance { font-size: .82rem; font-weight: 700; color: var(--text-muted); }
.result-time { font-size: 1.06rem; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.result-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ----------------------------- Kilometraż --------------------------------- */

.volume-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .volume-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.volume-stat {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 12px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.volume-value {
  font-size: 1.28rem; font-weight: 780; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--orange) 10%, var(--blue) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.volume-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); line-height: 1.3; }

/* --------------------------------- Cele ----------------------------------- */

.goal-list { display: flex; flex-wrap: wrap; gap: 8px; }
.goal-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  background: var(--orange-soft); color: var(--orange-strong);
  font-size: .86rem; font-weight: 700;
}
.goal-pill-time { font-variant-numeric: tabular-nums; opacity: .85; }

/* wybór celów w kreatorze */
.goal-target {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.goal-target.is-on { border-color: var(--orange); background: var(--orange-soft); }
.goal-target-head { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; cursor: pointer; min-width: 0; }
.goal-target-head input { width: 19px; height: 19px; accent-color: var(--orange); flex: 0 0 auto; }
.goal-target-name { font-weight: 700; font-size: .92rem; }
.goal-target-km { font-size: .74rem; color: var(--text-faint); font-weight: 600; }
.goal-target-time { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; width: 132px; }
@media (max-width: 420px) {
  .goal-target { flex-wrap: wrap; }
  .goal-target-time { width: 100%; }
}
.goal-target-time svg { width: 15px; height: 15px; color: var(--text-faint); flex: 0 0 auto; }
.goal-target-time .input { min-height: 40px; font-size: .86rem; padding: 0 10px; }

.info-box-accent { background: var(--orange-soft); color: var(--orange-strong); }
.info-box-accent svg { color: var(--orange); }
[data-theme="dark"] .info-box-accent { color: #ffd0aa; }
.info-box strong { font-weight: 750; }

/* ------------------------------- HISTORIA --------------------------------- */

.history-toolbar { display: flex; flex-direction: column; gap: 12px; }
.history-ranges { gap: 6px; }
.history-filters { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .history-filters { grid-template-columns: 1fr 1fr; } }

.history-summary {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
@media (min-width: 560px) { .history-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.history-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 13px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.history-stat-value { font-size: 1.12rem; font-weight: 780; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.history-stat-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; }

.history-month {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 6px 4px 2px;
  font-size: .78rem; font-weight: 750; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-faint);
}
.history-month-km { font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }

.history-item {
  display: flex; flex-direction: column; gap: 9px;
  border-left: 3px solid var(--wt, var(--border-strong));
  padding: 14px 15px;
}
.history-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.history-item-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.history-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--wt, var(--text-faint)); flex: 0 0 auto; }
.history-type { font-weight: 700; font-size: .94rem; }
.history-date { font-size: .78rem; color: var(--text-faint); font-weight: 600; white-space: nowrap; }

.badge-plan {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue-strong);
  font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .03em;
}
.badge-plan svg { width: 11px; height: 11px; }
.badge-plan.is-manual { background: var(--surface-3); color: var(--text-muted); }
[data-theme="dark"] .badge-plan { color: #b9ceff; }

.history-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.history-metric {
  padding: 5px 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .82rem; font-weight: 680; font-variant-numeric: tabular-nums;
}
.history-metric.is-pace { background: var(--orange-soft); border-color: transparent; color: var(--orange-strong); }

.history-feel { display: flex; align-items: center; gap: 8px; }
.feel-dots { letter-spacing: 2px; color: var(--orange); font-size: .9rem; }

.history-diff {
  display: flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 650; color: var(--text-muted);
}
.history-diff svg { width: 14px; height: 14px; color: var(--blue); }

.history-notes {
  margin: 0; padding: 9px 11px; border-radius: 11px;
  background: var(--surface-2); font-size: .84rem; line-height: 1.45;
  color: var(--text-muted);
}
.history-actions { display: flex; gap: 6px; justify-content: flex-end; }
.history-actions .btn { padding: 6px 10px; min-height: 36px; font-size: .78rem; }
.history-actions .btn svg { width: 14px; height: 14px; }
.history-delete { color: var(--red); }
.history-delete:hover { background: var(--red-soft); }

/* --------------------------- OKIENKO KONTROLNE ---------------------------- */

.checkin-backdrop {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(8, 12, 20, .55);
  backdrop-filter: blur(3px);
  animation: checkin-fade .18s ease-out;
}
@keyframes checkin-fade { from { opacity: 0; } to { opacity: 1; } }

.checkin-card {
  width: 100%; max-width: 520px; max-height: calc(100dvh - 32px);
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px 18px 18px;
  border-radius: 22px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  animation: checkin-pop .2s ease-out;
}
@keyframes checkin-pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) {
  .checkin-backdrop { padding: 0; align-items: flex-end; }
  .checkin-card {
    max-width: none; max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
}

.checkin-progress { display: flex; align-items: center; gap: 9px; }
.checkin-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto;
  background: var(--orange-soft); color: var(--orange-strong);
}
.checkin-badge svg { width: 17px; height: 17px; }
.checkin-badge.is-success { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); }
.checkin-badge.is-muted { background: var(--surface-3); color: var(--text-muted); }

.checkin-workout {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px; border-radius: 15px;
  background: var(--surface-2);
  border-left: 3px solid var(--wt, var(--border-strong));
}
.checkin-workout-top { display: flex; align-items: center; gap: 7px; }
.checkin-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--wt, var(--text-faint)); flex: 0 0 auto; }
.checkin-workout-type { font-weight: 750; font-size: .98rem; }
.checkin-workout-date { font-size: .84rem; color: var(--text-muted); font-weight: 600; }
.checkin-workout-meta { font-size: .84rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.checkin-workout-desc { margin: 2px 0 0; font-size: .82rem; color: var(--text-faint); line-height: 1.45; }

.checkin-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }

.checkin-list { display: flex; flex-direction: column; gap: 6px; max-height: 38dvh; overflow-y: auto; }
.checkin-list-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--wt, var(--border-strong));
}
.checkin-list-title { font-weight: 680; font-size: .88rem; }

.checkin-options { display: flex; flex-direction: column; gap: 8px; }
.checkin-option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: 15px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  text-align: left; font-family: inherit; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  min-height: 60px;
}
.checkin-option:hover { border-color: var(--orange); background: var(--orange-soft); }
.checkin-option:active { transform: scale(.99); }
.checkin-option-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
  background: var(--surface-2); color: var(--orange-strong);
}
.checkin-option-icon svg { width: 17px; height: 17px; }
.checkin-option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.checkin-option-title { font-weight: 700; font-size: .9rem; color: var(--text); }
.checkin-option-sub { font-size: .78rem; color: var(--text-muted); line-height: 1.35; }
