@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ============ Design tokens ============ */
:root {
    /* surfaces — cool graphite */
    --bg: #0e0f12;
    --surface: #16181d;
    --surface-2: #1c1f26;
    --border: #262a31;
    --border-strong: #363b45;

    /* text — chalk */
    --text: #f4f5f7;
    --muted: #969ba6;
    --dim: #656b76;

    /* signature accent — molten orange */
    --accent: #ff5a26;
    --accent-hover: #ff6f42;
    --accent-soft: rgba(255, 90, 38, 0.12);
    --on-accent: #180a04;

    /* secondary — steel (data, sparingly) */
    --steel: #6ea8d8;
    --steel-soft: rgba(110, 168, 216, 0.13);

    /* semantic */
    --danger: #ff4d4d;
    --danger-soft: rgba(255, 77, 77, 0.12);
    --good: #46d17f;
    --good-soft: rgba(70, 209, 127, 0.12);

    --radius: 10px;
    --radius-lg: 14px;
    --maxw: 900px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 80% -10%, rgba(255, 90, 38, 0.06), transparent 70%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ============ Brand ============ */
.brand {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.1em;
    line-height: 1;
}
.brand:hover { text-decoration: none; }
.brand .arrow { color: var(--accent); font-weight: 700; }

/* ============ App nav ============ */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(14, 15, 18, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}
.nav-links { display: flex; align-items: center; gap: 0.35rem; }
.nav-links > a {
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}
.nav-links > a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links > a.active { color: var(--accent); background: var(--accent-soft); }
.logout-form { margin: 0; display: inline; }

/* account menu */
.nav-links > a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links > a.active { color: var(--accent); background: var(--accent-soft); }
.logout-form { margin: 0; display: inline; }

.nav-account {
    position: relative;
}

.nav-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-account-btn:hover,
.nav-account-btn.active {
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
}

.nav-account-caret {
    font-size: 0.7rem;
    transition: transform 0.15s;
}

.nav-account.open .nav-account-caret {
    transform: rotate(180deg);
}

.nav-account-menu {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 210px;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
    z-index: 60;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition:
            opacity 0.16s ease,
            transform 0.16s ease,
            visibility 0.16s ease;
}

.nav-account.open .nav-account-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.nav-account-menu a,
.nav-account-logout {
    width: 100%;
    justify-content: flex-start;
    padding: 0.55rem 0.7rem;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
}

.nav-account-menu a:hover,
.nav-account-logout:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.nav-account-logout {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

/* ============ Language switch (dropdown) ============ */
.nav-lang { position: relative; }
.nav-lang-btn {
    display: inline-flex; align-items: center; gap: 0.25rem;
    background: transparent; border: 1px solid var(--border);
    color: var(--muted); cursor: pointer;
    padding: 0.35rem 0.55rem; margin: 0; border-radius: 8px;
    font-size: 0.8rem; font-weight: 600;
}
.nav-lang-btn:hover { color: var(--text); border-color: var(--border-strong); }
.nav-lang-caret { font-size: 0.65rem; transition: transform 0.15s; }
.nav-lang.open .nav-lang-caret { transform: rotate(180deg); }

.nav-lang-menu {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 84px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 8px; padding: 0.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 50;
}
.nav-lang.open .nav-lang-menu { display: block; }
.nav-lang-menu a {
    display: block; padding: 0.4rem 0.6rem; border-radius: 6px;
    color: var(--muted); font-size: 0.85rem; font-weight: 600;
}
.nav-lang-menu a:hover { background: var(--surface-2); color: var(--text); }
.nav-lang-menu a.active { color: var(--accent); }

/* ============ Layout ============ */
.page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}
.eyebrow {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    margin: 0 0 0.35rem;
}
.page-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 1.9rem;
    line-height: 1.05;
    margin: 0;
}
.detail-hero {
    align-items: center;
    padding-bottom: 0.35rem;
}
.detail-hero-main {
    min-width: 0;
}
.detail-hero .page-title {
    font-size: 2.25rem;
}
.detail-legacy-date-title {
    display: none;
}
.detail-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}
.detail-hero-action {
    margin: 0;
    flex: none;
}
.detail-hero-action .btn {
    white-space: nowrap;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}
.back-link::before {
    content: "\2190";
    color: var(--accent);
    font-weight: 700;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.error-wrap {
    text-align: left;
}

.error-card {
    max-width: 520px;
}

.error-code {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.75rem 0 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.error-code strong {
    color: var(--accent);
    font-size: 1rem;
}

/* ============ Buttons ============ */
button, .btn {
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.1rem;
    background: var(--accent);
    color: var(--on-accent);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: var(--text); }

.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ============ Forms ============ */
form { display: flex; flex-direction: column; gap: 0.85rem; }

input, textarea, select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }
input[type="file"] { color: var(--muted); font-size: 0.85rem; padding: 0.55rem 0.7rem; }
input[type="file"]::file-selector-button {
    margin-right: 0.75rem; padding: 0.4rem 0.8rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
}

.field-label {
    font-size: 0.78rem; font-weight: 500; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.35rem;
}
.check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.9rem; color: var(--text); }
.check input { width: auto; }
.row-inline { display: flex; gap: 0.85rem; align-items: center; flex-wrap: wrap; }
.row-inline input[type="number"] { max-width: 150px; }

/* ============ Card / auth ============ */
.auth-wrap {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1.5rem; padding: 2rem;
}
.card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}
.card h1 {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase; letter-spacing: 0.03em;
    font-size: 1.4rem; font-weight: 600; margin: 0 0 1.3rem;
}
.alt { margin: 1.3rem 0 0; text-align: center; font-size: 0.88rem; color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.msg { padding: 0.65rem 0.85rem; border-radius: var(--radius); font-size: 0.86rem; margin-bottom: 1rem; }
.msg.error   { color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger); }
.msg.success { color: var(--good);   background: var(--good-soft);   border: 1px solid var(--good); }

/* language switch on auth pages */
.auth-lang {
    position: absolute; top: 1.2rem; right: 1.4rem;
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.82rem; font-weight: 600;
}
.auth-lang a { color: var(--muted); }
.auth-lang a:hover { color: var(--text); }
.auth-lang a.active { color: var(--accent); }
.auth-lang-sep { color: var(--border-strong); }

/* ============ Tags ============ */
.tag {
    font-family: 'Oswald', sans-serif;
    font-size: 0.68rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.18rem 0.5rem; border-radius: 6px;
    background: var(--accent-soft); color: var(--accent);
}
.tag-steel { background: var(--steel-soft); color: var(--steel); }
.tag-muted { background: var(--surface-2); color: var(--muted); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-success { background: rgba(70, 209, 127, 0.14); color: #46d17f; }

/* ============ Empty state ============ */
.empty {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}
.empty a { font-weight: 600; }

/* ============ Home dashboard ============ */
.hero-name { color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.tile {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, transform 0.12s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tile-title {
    font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 1.05rem; font-weight: 600; margin-bottom: 0.35rem;
    display: flex; align-items: center; gap: 0.4rem;
}
.tile-title .arrow { color: var(--accent); }
.tile-desc { font-size: 0.88rem; color: var(--muted); }

/* ============ Admin ============ */
.admin-table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    table-layout: auto;
}

.admin-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
}

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

.admin-id {
    color: var(--muted);
    width: 1%;
    white-space: nowrap;
}

.admin-table td,
.admin-table th {
    max-width: 240px;
}

.admin-table td {
    overflow-wrap: anywhere;
}

.admin-table .tag {
    white-space: nowrap;
    line-height: 1.25;
}

.admin-op-action {
    display: block;
    color: var(--text);
    font-weight: 700;
    line-height: 1.35;
}

.admin-op-code {
    display: block;
    margin-top: 0.15rem;
    color: var(--dim);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.admin-table form {
    margin: 0;
    display: inline-flex;
}

.admin-table button.btn-sm,
.admin-table .btn-sm {
    white-space: nowrap;
}

.system-log-table th:nth-child(1),
.system-log-table td:nth-child(1) {
    width: 150px;
}

.system-log-table th:nth-child(2),
.system-log-table td:nth-child(2) {
    width: 120px;
}

.system-log-table th:nth-child(3),
.system-log-table td:nth-child(3) {
    width: 210px;
}

.system-log-table th:nth-child(4),
.system-log-table td:nth-child(4) {
    width: 110px;
}

.system-log-table th:nth-child(5),
.system-log-table td:nth-child(5) {
    width: 82px;
}

.system-log-table th:nth-child(7),
.system-log-table td:nth-child(7) {
    width: 112px;
}

.admin-user-name {
    font-weight: 600;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.admin-actions form {
    margin: 0;
    display: inline-flex;
}

.admin-emoji {
    font-size: 1.35rem;
    width: 1%;
    white-space: nowrap;
}

.admin-section-head {
    padding: 1rem 1.15rem 0;
}

.admin-section-head.compact {
    padding: 0;
    margin-bottom: 0.85rem;
}

.admin-activity-types-card {
    margin-top: 1.25rem;
}

.admin-library-tabs {
    margin-bottom: 1.25rem;
}

.admin-activity-create-card {
    margin-bottom: 1rem;
}

.admin-activity-form {
    margin: 0;
}

.admin-activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    align-items: end;
}

.admin-activity-check {
    margin: 0;
    min-height: 43px;
    align-items: center;
}

.admin-activity-type-list {
    margin-top: 1rem;
}

.admin-activity-type-card {
    max-width: none;
}

.admin-activity-type-head {
    margin-bottom: 0.9rem;
    align-items: center;
    flex-wrap: wrap;
}

.admin-activity-type-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1;
}

.admin-activity-type-title strong {
    overflow-wrap: anywhere;
}

.admin-tracks-group { margin: 0.8rem 0; }
.admin-tracks-checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.4rem; }
.admin-tracks-checks .check { font-size: 0.88rem; }

.admin-inline-input {
    min-width: 8rem;
    padding: 0.45rem 0.55rem;
}

.admin-emoji-input,
.admin-order-input {
    min-width: 4rem;
    max-width: 5rem;
}

.admin-inline-check {
    margin: 0;
    white-space: nowrap;
}

.admin-edit-card {
    max-width: none;
}

.admin-form-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.admin-privacy-note {
    margin: 0 0 1rem;
}

.admin-filter-card {
    max-width: none;
    margin-bottom: 1rem;
    padding: 1.25rem;
}

.admin-filter-card form {
    gap: 0.7rem;
}

.admin-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}

.admin-check-filtered-form {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    display: inline-flex;
}

.admin-check-filtered-form button {
    width: auto;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-detail-grid .stat-card {
    min-height: 0;
    padding: 1rem 1.1rem;
}

.admin-detail-grid .stat-value {
    font-size: 1.55rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.stat-value-small {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem !important;
    line-height: 1.35 !important;
    font-weight: 700;
    word-break: break-word;
}

.system-summary-card {
    margin-bottom: 1.25rem;
}

.system-summary-card .tpl-head {
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
}

.system-summary-card .tpl-meta {
    margin: 0.25rem 0 0.95rem;
    max-width: 760px;
}

.system-summary-card .ai-output {
    margin: 0.85rem 0 1rem;
    line-height: 1.55;
}

.system-summary-latest {
    margin: 0.9rem 0 1rem;
}

.system-summary-latest .tpl-meta {
    margin-bottom: 0.45rem;
}

.system-summary-card form {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    margin: 0;
}

.system-summary-card form button {
    width: auto;
}

.system-summary-log-link {
    margin-left: 0.5rem;
    vertical-align: top;
}

/* ============ Exercise grid ============ */
.exercise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.exercise-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    display: flex; flex-direction: column;
    transition: border-color 0.15s;
}
.exercise-card:hover { border-color: var(--border-strong); }
.ex-photo { width: 100%; height: 140px; object-fit: cover; display: block; }
.ex-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); font-size: 2.4rem; opacity: 0.35;
}
.ex-body { padding: 0.95rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ex-name { font-weight: 600; font-size: 1rem; }
.ex-tags { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.ex-desc { font-size: 0.85rem; color: var(--muted); }
.ex-summary { line-height: 1.45; }
.library-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.library-metric {
    min-width: 0;
    padding: 0.22rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
}
.library-metric strong {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.library-metric span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.library-panel { display: none; }
.library-panel.active { display: block; }
.exercise-library-tabs { margin-bottom: 1.25rem; }
.activity-library-card .ex-photo {
    height: 96px;
}
.activity-library-icon {
    opacity: 0.55;
}
.activity-library-icon span {
    font-size: 2.2rem;
}

/* ============ Template builder ============ */
.te-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.te-row .te-exercise { flex: 1; }
.te-row .te-sets, .te-row .te-reps { width: 78px; flex: none; }
.te-btn {
    width: auto; flex: none; padding: 0.55rem 0.65rem;
    background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--border); border-radius: 8px; font-weight: 600;
}
.te-btn:hover { color: var(--text); background: var(--surface); }
.te-btn.remove:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ============ Template list ============ */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.template-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.15rem 1.35rem;
    transition: border-color 0.15s;
}
.template-card:hover { border-color: var(--border-strong); }
.tpl-head { display: flex; align-items: center; gap: 0.6rem; }
.tpl-name {
    font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.03em;
    font-weight: 600; font-size: 1.15rem;
}
.tpl-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.tpl-desc { font-size: 0.88rem; color: var(--muted); margin-top: 0.55rem; }
.tpl-exercises { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.info-note {
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}
.info-note strong {
    color: var(--text);
    margin-right: 0.35rem;
}
.chip {
    font-size: 0.78rem; padding: 0.2rem 0.6rem; border-radius: 999px;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.tpl-actions { margin-top: 1rem; }
.tpl-actions form { margin: 0; display: contents; }
.tpl-actions > a,
.tpl-actions form > button { flex: 1; }
.tpl-actions form:first-of-type > button { flex: 2; }

.support-ticket-card {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.support-filter-card {
    margin-bottom: 1.25rem;
}

.support-ticket-meta {
    margin-top: 0.45rem;
}

.support-message,
.support-reply-content {
    white-space: pre-wrap;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 0.95rem 1rem;
    line-height: 1.55;
}

.support-message-block {
    display: grid;
    gap: 0.55rem;
}

.support-replies {
    display: grid;
    gap: 0.85rem;
    margin-top: 0;
}

.support-subtitle {
    margin: 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.support-reply {
    display: grid;
    gap: 0.55rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.support-replies .support-reply:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.support-reply-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.support-author-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.55rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-family: 'Oswald', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.support-author-support {
    border-color: rgba(255, 90, 38, 0.42);
    background: var(--accent-soft);
    color: var(--accent);
}

.support-author-user {
    border-color: rgba(95, 168, 255, 0.38);
    background: rgba(95, 168, 255, 0.12);
    color: #7db6ff;
}

.support-detail-head {
    align-items: flex-start;
    margin-bottom: 1rem;
}

.support-detail-title-wrap {
    min-width: 0;
}

.support-detail-title-wrap .page-title {
    overflow-wrap: anywhere;
}

.support-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: none;
    margin-top: 0.25rem;
}

.support-detail-actions form {
    display: inline-flex;
    margin: 0;
    width: auto;
}

.support-reply-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.support-reply-form button {
    justify-self: start;
}

.support-ticket-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.support-ticket-card > .support-ticket-actions:first-child {
    justify-content: flex-end;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.support-closed-note {
    margin: 0.1rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.support-closed-meta {
    margin-top: -0.55rem;
}

.support-help-card,
.support-user-history,
.support-ticket-list {
    display: grid;
    gap: 1rem;
}

.support-summary-list {
    display: grid;
    gap: 0.7rem;
}

.support-summary-card {
    display: grid;
    gap: 0;
    color: inherit;
    text-decoration: none;
}

.support-summary-card:hover {
    text-decoration: none;
}

.support-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    line-height: 1.25;
    margin-bottom: 0.35rem;
}

.support-summary-head .tpl-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.support-summary-meta,
.support-summary-last {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.support-summary-meta {
    margin-bottom: 0.55rem;
}

.support-summary-last {
    margin-bottom: 0.45rem;
}

.support-summary-card .tpl-meta {
    margin-top: 0;
    line-height: 1.35;
}

.support-summary-preview {
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.support-new-form {
    display: grid;
    gap: 0.65rem;
}

.support-new-form button {
    justify-self: start;
}

.support-thread {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 1rem;
}

.support-thread .support-message,
.support-thread .support-reply-content {
    background: var(--surface);
}

.support-reply-admin .support-reply-content {
    border-color: var(--accent);
    background: rgba(255, 90, 38, 0.08);
}

.support-reply-user .support-reply-content {
    border-color: rgba(95, 168, 255, 0.38);
    background: rgba(95, 168, 255, 0.09);
}

/* ============ Template plan rows ============ */
.te-row {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.7rem; margin-bottom: 0.5rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.te-name { flex: 1; font-weight: 600; font-size: 0.95rem; min-width: 0; }
.te-row .te-sets, .te-row .te-reps { width: 80px; margin: 0; }
.te-actions { display: inline-flex; gap: 0.3rem; }
.te-btn {
    width: 30px; height: 30px; padding: 0; margin: 0; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border);
    color: var(--muted); cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.te-btn:hover { color: var(--text); border-color: var(--accent); }
.te-btn.remove:hover { color: var(--danger); border-color: var(--danger); }
.te-muscles { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin-right: auto; }
.te-name { flex: 0 1 auto; font-weight: 600; font-size: 0.95rem; }

/* ============ Workout screen ============ */
.workout-head { margin-bottom: 1.75rem; }
.we-block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.15rem 1.35rem; margin-bottom: 1rem;
    position: relative;
}
.we-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.85rem; }
.we-name {
    font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.03em;
    font-weight: 600; font-size: 1.1rem;
}

.sets-table { width: 100%; border-collapse: collapse; margin-bottom: 0.9rem; font-variant-numeric: tabular-nums; }
.sets-table th {
    text-align: left; color: var(--muted); font-weight: 500;
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border);
}
.sets-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.sets-table tr:last-child td { border-bottom: none; }
.set-num { color: var(--accent); font-weight: 600; }

.set-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: nowrap; }
.set-form input { flex: 1; min-width: 0; width: auto; }

/* ============ Inline set form + delete set ============ */
.set-form-inline {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
    margin-top: 0.7rem;
}
.set-form-inline {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: nowrap;
    margin-top: 0.7rem;
}
.set-form-inline input { flex: 1; min-width: 0; width: auto; margin: 0; }
.set-form-inline button { flex: none; white-space: nowrap; }
.del-set-btn {
    background: transparent; border: none; color: var(--muted);
    cursor: pointer; font-size: 0.9rem; padding: 0.2rem 0.4rem; margin: 0;
}
.del-set-btn:hover { color: var(--danger); }
.sets-table th:last-child, .sets-table td:last-child { text-align: right; width: 1%; white-space: nowrap; }

/* validation */
input:user-invalid, select:user-invalid, textarea:user-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
}

/* add exercise */
.add-exercise .we-name { color: var(--muted); }
.add-exercise .set-form select { flex: 1; }
.set-form button { flex: none; white-space: nowrap; }

/* ============ Stats ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.3rem;
}
.stat-hero { border-color: var(--accent); background:
        linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); }
.stat-label {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase; letter-spacing: 0.08em;
    font-size: 0.7rem; color: var(--muted); margin-bottom: 0.4rem;
}
.stat-value {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem; font-weight: 600; line-height: 1;
    font-variant-numeric: tabular-nums;
    display: flex; align-items: baseline; gap: 0.4rem;
}
.stat-unit { font-size: 0.85rem; color: var(--muted); font-weight: 500; letter-spacing: 0.03em; }
.stat-muted { color: var(--muted); font-weight: 500; }

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.25rem;
}
.chart-head { margin-bottom: 1rem; }
.chart-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem; font-weight: 600; margin: 0;
    text-transform: uppercase; letter-spacing: 0.03em;
}

.pr-list { display: flex; flex-direction: column; }
.pr-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 0; border-bottom: 1px solid var(--border);
}
.pr-row:last-child { border-bottom: none; }
.pr-name { font-weight: 600; }
.pr-date { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-value {
    font-family: 'Oswald', sans-serif;
    font-size: 1.4rem; font-weight: 600;
    color: var(--accent); font-variant-numeric: tabular-nums;
    display: flex; align-items: baseline; gap: 0.35rem;
}
.stats-points-note { margin-top: -0.35rem; margin-bottom: 1.25rem; }
.stats-points-grid { margin-bottom: 1.5rem; }
.stats-insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}
.points-mix {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.points-mix-bar {
    display: flex;
    height: 0.75rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.points-mix-bar span {
    display: block;
    min-width: 0;
}
.points-mix-strength { background: var(--accent); }
.points-mix-activity { background: var(--steel); }
.points-mix-empty {
    color: var(--muted);
    font-size: 0.9rem;
}
.stats-list {
    display: flex;
    flex-direction: column;
}
.stats-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.stats-list-row:last-child { border-bottom: 0; }
.stats-list-row > span { color: var(--text); }
.stats-list-row strong {
    color: var(--accent);
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

/* ============ Clickable rows (history) ============ */
.row-link { text-decoration: none; color: inherit; display: block; }
.row-link:hover { text-decoration: none; }

/* ============ Log-a-workout form ============ */
.log-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.strength-grid {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(240px, 1fr);
    gap: 1rem;
    align-items: end;
}
.log-field { display: flex; flex-direction: column; gap: 0.35rem; }
.log-field.log-grow { flex: 1; min-width: 200px; }
.log-start { width: auto; white-space: nowrap; }
.strength-submit {
    grid-column: 1 / -1;
    width: 100%;
}
.workout-log-card { max-width: none; margin-bottom: 1.5rem; }
.mode-tabs {
    position: relative;
    display: inline-flex;
    gap: 0;
    padding: 0.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    overflow: hidden;
}
.mode-tabs::before {
    content: "";
    position: absolute;
    top: 0.25rem;
    bottom: 0.25rem;
    left: 0.25rem;
    width: calc(50% - 0.25rem);
    border-radius: 6px;
    background: var(--accent);
    transition: transform 0.2s ease;
    z-index: 0;
}
.mode-tabs.is-activity::before {
    transform: translateX(100%);
}
.mode-tab {
    position: relative;
    z-index: 1;
    flex: 1 0 8rem;
    width: auto;
    padding: 0.45rem 0.8rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.15s ease;
}
.mode-tab:hover {
    color: var(--text);
    background: transparent;
}
.mode-tab.active {
    color: var(--on-accent);
    background: transparent;
}
.mode-panel { display: none; }
.mode-panel.active { display: block; }
.activity-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
}
.activity-type-picker {
    position: relative;
}
.activity-type-picker.open {
    z-index: 60;
}
.activity-type-trigger {
    width: 100%;
    justify-content: space-between;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.activity-type-trigger:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
.activity-type-trigger::after {
    content: "▼";
    color: var(--muted);
    font-size: 0.7rem;
    margin-left: 0.75rem;
    transition: transform 0.15s ease, color 0.15s ease;
}
.activity-type-picker.open .activity-type-trigger::after {
    transform: rotate(180deg);
    color: var(--accent);
}
.activity-type-picker.open .activity-type-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.activity-type-menu {
    position: absolute;
    z-index: 70;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    display: none;
    padding: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.32);
}
.activity-type-picker.open .activity-type-menu {
    display: block;
}
.we-block:has(.activity-type-picker.open) {
    z-index: 50;
}
.activity-type-search {
    margin-bottom: 0.5rem;
}
.activity-type-options {
    max-height: 230px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    scrollbar-gutter: stable;
    display: grid;
    gap: 0.25rem;
    padding-right: 0.25rem;
}
.activity-type-options::-webkit-scrollbar {
    width: 8px;
}
.activity-type-options::-webkit-scrollbar-track {
    background: transparent;
}
.activity-type-options::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}
.activity-type-options::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}
.activity-type-option {
    width: 100%;
    justify-content: flex-start;
    padding: 0.45rem 0.55rem;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
}
.activity-type-option:hover {
    background: var(--surface-2);
    color: var(--text);
}
.activity-type-option.selected {
    background: var(--accent-soft);
    color: var(--accent);
}
.activity-type-option.selected:hover {
    background: var(--accent-soft);
    color: var(--accent);
}
.activity-type-option.is-hidden {
    display: none;
}
.activity-type-empty {
    display: none;
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}
.activity-notes { grid-column: span 2; }
.activity-submit {
    align-self: end;
    grid-column: 1 / -1;
    width: 100%;
}
.activity-card { position: relative; }
.activity-note {
    margin: 0.65rem 0 0;
    color: var(--text);
    white-space: pre-wrap;
}
@media (max-width: 520px) {
    .detail-hero {
        align-items: stretch;
    }
    .detail-hero .page-title {
        font-size: 1.9rem;
    }
    .detail-hero-action,
    .detail-hero-action .btn {
        width: 100%;
    }
    .log-row { align-items: stretch; }
    .log-field.log-grow, .log-field { width: 100%; }
    .log-start { width: 100%; }
    .strength-grid { grid-template-columns: 1fr; }
    .mode-tabs { width: 100%; }
    .mode-tab { flex: 1; justify-content: center; }
    .activity-grid { grid-template-columns: 1fr; }
    .activity-notes { grid-column: auto; }
    .activity-submit { grid-column: auto; }
}

/* ============ Exercises section (shared frame) ============ */
.exercises-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.1rem;
    margin-bottom: 1.5rem;
}
.section-head { margin-bottom: 0.8rem; }
.section-title {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 1.05rem;
    color: var(--text);
}

/* exercise blocks + add-exercise become lighter tiles inside the frame */
.exercises-section .we-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin: 0 0 0.7rem 0;
    padding: 1rem 1.1rem;
}
.exercises-section .we-block:last-child { margin-bottom: 0; }

/* ============ Workout photos ============ */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item form { position: absolute; top: 5px; right: 5px; margin: 0; }
.photo-del {
    width: 26px; height: 26px; padding: 0; margin: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(14, 15, 18, 0.75); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 6px;
    font-size: 0.8rem; line-height: 1;
}
.photo-del:hover { background: var(--danger); color: #fff; }

/* ============ Account ============ */
.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 0.5rem;
}

/* ============ Invites ============ */

.invite-list { display: flex; flex-direction: column; gap: 0.6rem; }
.invite-row {
    display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
    padding: 0.7rem 0.9rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.invite-code {
    font-family: monospace; font-size: 1.05rem; font-weight: 600;
    letter-spacing: 0.1em; color: var(--accent);
    user-select: all;   /* klik zaznacza cały kod do skopiowania */
}
.invite-status { display: inline-flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.invite-copy-btn { margin: 0; }
.invite-generate-btn { display: block; margin-bottom: 1.5rem; }
.is-hidden { display: none !important; }

/* ============ Coach ============ */
.coach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    align-items: start;
}
.ai-output {
    white-space: pre-wrap;
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text);
}
#aiReviewOut { margin-bottom: 1rem; }

/* ============ BMI scale ============ */
.bmi-cat {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 0.78rem; font-weight: 600; margin-top: 0.3rem;
}
.bmi-scale { position: relative; margin: 1rem 0 0.5rem; }
.bmi-track { display: flex; height: 14px; border-radius: 999px; overflow: hidden; }
.bmi-seg { height: 100%; }
.bmi-marker {
    position: absolute; top: -4px; width: 3px; height: 22px;
    background: var(--text); border-radius: 2px;
    transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface);
}
.bmi-legend { display: flex; }
.bmi-legend span { text-align: center; font-size: 0.72rem; color: var(--muted); }

/* ============ Exercise picker drawer ============ */
.drawer-overlay {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0; visibility: hidden; transition: opacity 0.2s;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }

.drawer {
    position: fixed; top: 0; right: 0; z-index: 50;
    height: 100%; width: min(430px, 92vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border);
}
.drawer-head h2 {
    font-family: 'Oswald', sans-serif; text-transform: uppercase;
    letter-spacing: 0.03em; font-size: 1.2rem; font-weight: 600; margin: 0;
}
.drawer-close {
    width: 34px; height: 34px; padding: 0; margin: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--border); border-radius: 8px;
}
.drawer-close:hover { color: var(--text); }

.drawer-search { padding: 0.9rem 1.3rem; border-bottom: 1px solid var(--border); }

.drawer-list {
    flex: 1; overflow-y: auto;
    padding: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem;
}
.picker-card { margin: 0; }
.picker-btn {
    width: 100%; text-align: left; margin: 0;
    display: flex; gap: 0.8rem; align-items: flex-start;
    padding: 0.7rem; cursor: pointer;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color 0.15s, background 0.15s;
}
.picker-btn:hover { border-color: var(--accent); background: var(--surface); }
.picker-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; }
.picker-emoji {
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; background: var(--bg); opacity: 0.55;
}
.picker-info { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.picker-name { font-weight: 600; font-size: 0.95rem; }
.picker-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.picker-desc-wrap {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.picker-desc {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--muted);
    max-height: 2.25rem;
    overflow: hidden;
    transition: max-height 0.22s ease;
}
.picker-desc-wrap:not(.expanded) .picker-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.picker-desc-wrap.expanded .picker-desc {
    display: block;
    max-height: 14rem;
}
.picker-desc-more {
    align-self: flex-start;
    font-family: 'Oswald', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}
.drawer-empty { color: var(--muted); text-align: center; padding: 1.5rem; }

/* ============ Muscle-group filter ============ */
.tag-muscle { background: rgba(127, 119, 221, 0.16); color: #b4a9f2; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.filter-chips-scroll {
    flex-wrap: nowrap; overflow-x: auto; margin-bottom: 0; padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
}
.chip-filter {
    padding: 0.35rem 0.8rem; margin: 0; white-space: nowrap;
    background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px;
    font-size: 0.82rem; font-weight: 500; cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.chip-filter:hover { color: var(--text); border-color: var(--border-strong); }
.chip-filter.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.drawer-filter { padding: 0.7rem 1.3rem 0; }

/* ============ Checkboxes ============ */

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.4rem 0.9rem;
    margin-bottom: 0.6rem;
}
.checkbox-grid .check { font-size: 0.88rem; margin: 0; }

/* ============ Region sections ============ */
.region-section { margin-bottom: 1.75rem; }
.region-title {
    font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 0.95rem; font-weight: 600; color: var(--muted);
    margin: 0 0 0.85rem; padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.picker-section { display: flex; flex-direction: column; gap: 0.6rem; }
.picker-section-title {
    font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 0.78rem; font-weight: 600; color: var(--muted);
    margin: 0.5rem 0.2rem 0.1rem;
}

/* ============ Reorder arrows ============ */
.we-actions { margin-left: auto; display: inline-flex; gap: 0.35rem; align-items: center; }

.sets-table td.set-actions, .sets-table th:last-child { width: 108px; }
.set-actions { display: flex; gap: 0.3rem; justify-content: flex-end; align-items: center; }

.move-btn {
    background: transparent; border: 1px solid var(--border);
    color: var(--muted); cursor: pointer; margin: 0;
    width: 30px; height: 30px; padding: 0; border-radius: 7px;
    font-size: 0.95rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    flex: none;
}
.move-btn:hover { color: var(--text); border-color: var(--accent); background: var(--surface-2); }

.del-set-btn {
    width: 30px; height: 30px; padding: 0; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; flex: none;
}
.del-set-btn:hover { color: var(--danger); border-color: var(--danger); }

/* smooth reorder (FLIP) */
.we-block, .sets-body tr { will-change: transform; }
.flip-anim { transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1); }

/* ============ Session details + summary ============ */
.workout-summary {
    padding: 0.9rem 0; margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.summary-item { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.7rem; }
.summary-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.muscle-tags { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.summary-stats { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: 0.9rem; color: var(--muted); }
.summary-stats strong { color: var(--text); font-size: 1.05rem; }

.details-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem; margin-bottom: 0.5rem;
}

.details-save-row { display: flex; align-items: center; gap: 0.8rem; }
.details-saved { color: var(--good, #46d17f); font-size: 0.85rem; font-weight: 500; }
.workout-summary.is-empty { display: none; }

/* ============ Privacy switches ============ */
.privacy-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.privacy-switch.compact {
    max-width: 280px;
}

.privacy-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.privacy-switch-ui {
    position: relative;
    width: 42px;
    height: 24px;
    flex: none;
    border-radius: 999px;
    background: var(--border-strong);
    border: 1px solid var(--border-strong);
    transition: background 0.16s, border-color 0.16s;
}

.privacy-switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 0.16s, background 0.16s;
}

.privacy-switch input:checked + .privacy-switch-ui {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.privacy-switch input:checked + .privacy-switch-ui::after {
    transform: translateX(18px);
    background: var(--accent);
}

.privacy-switch input:disabled + .privacy-switch-ui {
    opacity: 0.5;
}

.privacy-switch strong,
.privacy-switch small {
    display: block;
    line-height: 1.25;
}

.privacy-switch strong {
    font-size: 0.88rem;
}

.privacy-switch small {
    margin-top: 0.1rem;
    color: var(--muted);
    font-size: 0.74rem;
}

.log-publish-toggle {
    align-self: end;
}

.detail-privacy-switch {
    margin: 0 0 0.85rem;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.exercise-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.comparison-head {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comparison-controls {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.comparison-privacy {
    flex: 1;
    min-width: 240px;
}

.comparison-sort {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    margin: 0;
    align-items: flex-start;
}

.comparison-sort button {
    width: auto;
    padding: 0.42rem 0.65rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 8px;
    font-size: 0.78rem;
}

.comparison-sort button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.comparison-sort button.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.comparison-table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.comparison-table-wrap::-webkit-scrollbar {
    height: 8px;
}

.comparison-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.comparison-table-wrap::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

.comparison-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.comparison-table th,
.comparison-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.comparison-table th {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

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

.comparison-table tr.is-current td {
    background: var(--accent-soft);
}

.comparison-rank {
    color: var(--accent);
    font-weight: 700;
}

.comparison-user {
    margin-right: 0.4rem;
    color: var(--text);
    font-weight: 700;
}

/* numbers animation */
.summary-stats strong { display: inline-block; }
.num-pulse { animation: numPulse 0.42s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes numPulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.4); color: var(--accent); }
    100% { transform: scale(1); }
}
/* meuscle tags animation */
.tag-pop { animation: tagPop 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes tagPop {
    0%   { opacity: 0; transform: scale(0.6) translateY(4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.workout-summary.is-empty { display: none; }

/* ============ Hamburger toggle ============ */
.nav-toggle {
    display: none;               /* ukryty na desktopie */
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px; height: 42px;
    padding: 0; margin: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    cursor: pointer;
}
.nav-toggle-bar {
    display: block; width: 20px; height: 2px;
    background: var(--text);
    transition: transform 0.25s, opacity 0.25s;
}
/* animate into an X when open */
.nav-toggle.open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Activity heatmap ============ */
.heatmap { padding-bottom: 0.3rem; }
.heatmap-compact { overflow: visible; }

.heatmap-body { display: flex; gap: 6px; align-items: flex-start; }
.heatmap-right { display: flex; flex-direction: column; min-width: 0; }

/* weekday labels column */
.heatmap-days {
    display: grid;
    grid-template-rows: repeat(7, var(--hm-size, 13px));
    gap: 3px;
    font-size: 0.6rem;
    color: var(--muted);
    margin-top: calc(1rem + 4px);
}
.heatmap-days span {
    line-height: var(--hm-size, 13px);
    height: var(--hm-size, 13px);
    display: block;
    text-align: right;
}

/* grid of day cells */
.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, var(--hm-size, 13px));
    grid-auto-flow: column;
    grid-auto-columns: var(--hm-size, 13px);
    gap: 3px;
    width: max-content;
}
.hm-cell {
    width: var(--hm-size, 13px); height: var(--hm-size, 13px);
    border-radius: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: transform 0.1s;
}
.hm-cell:hover { transform: scale(1.25); border-color: var(--text); z-index: 1; }

.hm-l0 { background: var(--surface-2); }
.hm-l1 { background: rgba(255, 90, 38, 0.28); border-color: transparent; }
.hm-l2 { background: rgba(255, 90, 38, 0.50); border-color: transparent; }
.hm-l3 { background: rgba(255, 90, 38, 0.75); border-color: transparent; }
.hm-l4 { background: var(--accent); border-color: transparent; }

/* compact (home) = bigger cells; full (stats) = smaller so a year fits */
.heatmap-full { --hm-size: 11px; }
.heatmap-compact { --hm-size: 14px; }

/* month labels */
.heatmap-months {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--hm-size, 13px);
    gap: 3px;
    margin-bottom: 4px;
    width: max-content;
    height: 1rem;
    overflow: visible;
}
.heatmap-month-label {
    font-size: 0.68rem; color: var(--muted); white-space: nowrap;
    grid-row: 1; overflow: visible; width: 0;
}

/* legend */
.heatmap-legend {
    display: flex; align-items: center; gap: 4px;
    margin-top: 0.7rem; font-size: 0.72rem; color: var(--muted);
}
.heatmap-legend .hm-cell { width: 13px; height: 13px; }
.heatmap-legend .hm-cell:hover { transform: none; }

/* ============ Social profile ============ */
.profile-page {
    max-width: 980px;
}

.profile-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.profile-username {
    display: inline-block;
    font-family: 'Oswald', sans-serif;
    font-size: 1.65rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
    margin: 0.3rem 0;
}

.profile-username:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.profile-bio {
    margin: 0.6rem 0 0 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--muted);
    max-width: 600px;
}

.profile-identity {
    min-width: 0;
}

.profile-facts,
.profile-actions,
.profile-template-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.profile-actions {
    justify-content: flex-end;
}

.profile-actions form,
.profile-edit-card .admin-actions form {
    margin: 0;
    display: inline-flex;
}

.profile-async-section {
    margin-top: 1.25rem;
}

.profile-section-head {
    margin-bottom: 0.8rem;
}

.profile-section-head .chart-title {
    margin: 0;
}

.profile-feed-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-feed-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.profile-feed-row h3,
.profile-template-card h3 {
    margin: 0.45rem 0 0.2rem;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.profile-points {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.profile-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.profile-template-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.profile-template-exercise-list {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.profile-template-exercise-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
}

.profile-template-copy-form {
    margin-top: 0.85rem;
}


.profile-stats-grid {
    margin-bottom: 1rem;
}

.profile-heatmap-card {
    padding: 1.1rem;
}

.profile-heatmap {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    grid-auto-flow: column;
    grid-auto-columns: 12px;
    gap: 3px;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.profile-edit-card {
    max-width: none;
}

.profile-edit-section {
    margin-bottom: 1.75rem;
}

.profile-edit-section h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text);
}

.privacy-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.privacy-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.privacy-option:hover {
    border-color: var(--border-strong);
    background: var(--surface);
}

.privacy-option input[type="radio"] {
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.privacy-option input[type="radio"]:checked + .privacy-option-content strong {
    color: var(--accent);
}

.privacy-option input[type="radio"]:checked ~ * {
    border-color: var(--accent);
}

.privacy-option:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.privacy-option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.privacy-option-content strong {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.privacy-option-content small {
    font-size: 0.82rem;
    color: var(--muted);
}

.field-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: var(--muted);
}

/* ============ Nav: wyszukiwarka userów ============ */
.nav-search {
    position: relative;
}

.nav-search-input {
    width: 180px;
    padding: 0.45rem 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
}

.nav-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.nav-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    max-width: 320px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 0.35rem;
    gap: 0.15rem;
}

.nav-search-result {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: calc(var(--radius) - 2px);
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.nav-search-result:hover,
.nav-search-result:focus {
    background: var(--surface-2);
    color: var(--accent);
}

.nav-search-empty {
    padding: 0.5rem 0.65rem;
    color: var(--muted);
    font-size: 0.85rem;
}

/* ============ Social hub ============ */
/* ============ Social: pending follow requests banner ============ */
.social-requests-card {
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.social-requests-details summary {
    list-style: none;
    cursor: pointer;
}
.social-requests-details summary::-webkit-details-marker { display: none; }

.social-requests-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.social-requests-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.social-requests-caret {
    color: var(--muted);
    transition: transform 0.15s;
}
.social-requests-details[open] .social-requests-caret { transform: rotate(180deg); }

.social-requests-list {
    padding: 0 1.25rem 1.25rem;
}

.social-page {
    max-width: 1080px;
}

.social-head {
    align-items: flex-end;
}

.social-subtitle {
    margin: 0.55rem 0 0;
    max-width: 620px;
    color: var(--muted);
    font-size: 0.95rem;
}

.social-command {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.social-command-main {
    position: relative;
    min-width: 0;
}

.social-search-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text);
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.social-search-box {
    max-width: 520px;
}

.social-search-results {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    width: min(520px, 100%);
    max-height: 340px;
    overflow-y: auto;
    padding: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
    z-index: 30;
}

.social-search-result {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}

.social-search-result:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.social-search-result strong,
.social-record-body strong,
.social-friend-name {
    display: block;
    color: var(--text);
    overflow-wrap: anywhere;
}

.social-search-result small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.social-search-empty {
    padding: 0.7rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.social-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.social-tab {
    padding: 0.4rem 0.85rem;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}
.social-tab:hover { background: var(--surface-2); color: var(--text); }
.social-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.social-connections-panel {
    margin-top: 0.6rem;
    padding: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    max-height: 320px;
    overflow-y: auto;
}

.social-connections-filter {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
}

.social-connections-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.social-command-side {
    display: grid;
    grid-template-columns: repeat(4, minmax(76px, 1fr));
    gap: 0.7rem;
    min-width: 320px;
}

.social-kpi {
    padding: 0.85rem 0.95rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.social-kpi-value {
    display: block;
    color: var(--text);
    font-family: 'Oswald', sans-serif;
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.social-kpi-label {
    display: block;
    margin-top: 0.28rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.social-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 1.25rem;
    align-items: start;
}

.social-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.social-feed-list,
.social-record-list,
.social-friend-list {
    display: flex;
    flex-direction: column;
}

.social-feed-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.social-feed-item:last-child,
.social-record-row:last-child,
.social-friend-row:last-child {
    border-bottom: none;
}


.social-feed-body {
    min-width: 0;
}

.social-feed-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.social-author {
    color: var(--text);
    font-weight: 700;
}

.social-feed-item h3 {
    margin: 0.35rem 0 0.15rem;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.social-points {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.social-record-row,
.social-friend-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}

.social-record-row:hover,
.social-friend-row:hover {
    text-decoration: none;
}

.social-record-body {
    flex: 1;
    min-width: 0;
}

.social-record-value {
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.social-friend-row {
    justify-content: space-between;
}

.social-friend-flags {
    display: inline-flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 980px) {
    .social-command,
    .social-layout {
        grid-template-columns: 1fr;
    }

    .social-command-side {
        min-width: 0;
    }
}

@media (max-width: 620px) {
    .social-command-side {
        grid-template-columns: 1fr;
    }

    .social-feed-item {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .social-points {
        justify-self: start;
    }

    .social-record-row,
    .social-friend-row {
        align-items: flex-start;
    }
}

@media (max-width: 850px) {
    .nav-search-input {
        width: 100%;
    }

    .nav-search {
        width: 100%;
    }
}

/* home: grid + mini-stats side by side */
.heatmap-row { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; }
.heatmap-stats {
    display: grid; grid-template-columns: repeat(2, auto);
    gap: 0.9rem 2rem; flex: 1; min-width: 200px;
}
.hm-stat { display: flex; flex-direction: column; gap: 0.15rem; }
.hm-stat-val {
    font-family: 'Oswald', sans-serif; font-size: 1.5rem; font-weight: 600;
    color: var(--text); line-height: 1; font-variant-numeric: tabular-nums;
}
.hm-stat-label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}

/* custom hover tooltip */
.hm-tip {
    position: absolute; z-index: 100; pointer-events: none;
    transform: translate(-50%, -100%);
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 6px;
    padding: 0.35rem 0.6rem; font-size: 0.78rem; white-space: nowrap;
    opacity: 0; transition: opacity 0.12s;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* ============ Help / Changelog ============ */
.help-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.help-card {
    max-width: none;
}

.faq-list{
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}


.faq-item {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition:
            border-color 0.18s ease,
            background 0.18s ease,
            box-shadow 0.18s ease;
}

.faq-item.is-open {
    border-color: var(--border-strong);
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    user-select: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "▼";
    flex: none;
    color: var(--accent);
    font-size: 0.78rem;
    transform: rotate(0deg);
    transition: transform 0.22s ease;
}

.faq-item.is-open summary::after {
    transform: rotate(180deg);
}

.faq-item summary::marker {
    color: var(--accent);
}

.faq-item p {
    margin: 0.7rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.faq-answer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition:
            max-height 0.22s ease,
            opacity 0.16s ease,
            transform 0.2s ease,
            visibility 0.22s ease;
}

.faq-item.is-open .faq-answer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.faq-answer > p {
    margin: 0;
    padding: 0 1rem 0.95rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.changelog-post {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem;
}

.changelog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
}

.changelog-title {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.45rem;
}

.changelog-content {
    white-space: pre-wrap;
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ============ Responsive ============ */
@media (max-width: 850px) {
    .stats-insight-grid { grid-template-columns: 1fr; }
    .nav-inner { padding: 0.7rem 1rem; }
    .nav-toggle { display: flex; }

    /* linki chowają się i stają pełnoszerokościowym menu pod paskiem */
    .nav-links {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: 0 1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        z-index: 70;

        max-height: 0;
        opacity: 0;
        overflow: hidden;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px);
        transition:
                max-height 0.26s ease,
                opacity 0.18s ease,
                transform 0.22s ease,
                visibility 0.26s ease,
                padding 0.26s ease;
    }

    .nav-links.open {
        max-height: 520px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        padding: 0.6rem 1rem 0.9rem;
    }

    .nav-links > a { padding: 0.7rem 0.8rem; font-size: 0.95rem; }
    .logout-form { margin-top: 0; }

    .nav-account {
        width: 100%;
    }

    .nav-account-btn {
        width: 100%;
        justify-content: space-between;
        padding: 0.7rem 0.8rem;
        font-size: 0.95rem;
    }

    .nav-account-menu {
        display: flex;
        flex-direction: column;
        position: static;
        min-width: 0;
        margin-top: 0;
        box-shadow: none;
        border-color: var(--border);
        background: var(--surface-2);
        transform-origin: top center;

        max-height: 0;
        opacity: 0;
        overflow: hidden;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-4px);
        padding-top: 0;
        padding-bottom: 0;
        transition:
                max-height 0.22s ease,
                opacity 0.16s ease,
                transform 0.2s ease,
                visibility 0.22s ease,
                margin-top 0.22s ease,
                padding 0.22s ease;
    }

    .nav-account.open .nav-account-menu {
        max-height: 190px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        margin-top: 0.25rem;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .nav-account-menu a,
    .nav-account-logout {
        padding: 0.65rem 0.75rem;
    }

    /* --- workout: exercise header wraps so arrows/Remove stay inside the frame --- */
    .we-head { flex-wrap: wrap; gap: 0.4rem 0.5rem; }
    .we-actions { margin-left: auto; }
    .we-name { font-size: 1rem; flex-basis: 100%; }
    /* tags sit on their own row under the name; actions align right on that row */
    .we-block { padding: 1rem 0.9rem; }

    /* sets table: tighter padding so columns don't skew */
    .sets-table th, .sets-table td { padding: 0.4rem 0.3rem; font-size: 0.86rem; }
    /* ROOT FIX: let headers wrap — long PL words like "POWTÓRZENIA" otherwise
       take a whole line and push the action column outside the card.
       English ("REPS"/"WEIGHT") is short so it never showed there. */
    .sets-table th { white-space: normal; word-break: break-word; hyphens: auto; }
    .sets-table td.set-actions, .sets-table th:last-child { width: 96px; }
    .move-btn, .del-set-btn { width: 26px; height: 26px; font-size: 0.85rem; }
    .set-actions { gap: 0.2rem; flex-wrap: nowrap; justify-content: flex-end; }

    /* inline set form: keep inputs usable, allow wrap if needed */
    .set-form-inline { flex-wrap: wrap; }
    .set-form-inline input { flex: 1 1 40%; }

    /* --- stats: full-year heatmap scrolls horizontally on phones --- */
    .heatmap-full { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .heatmap-full .heatmap-body { width: max-content; }
    .heatmap-full::-webkit-scrollbar { height: 6px; }
    .heatmap-full::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
    .heatmap-full { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

    .profile-hero {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .profile-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .profile-feed-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .tile:hover { transform: none; }
}
