/* ──────────────────────────────────────────────────────────────────────────
   MyMovement — Desktop styles (v0.1)
   Clean, minimal, 3DM-adjacent. Sidebar + main layout.
   ────────────────────────────────────────────────────────────────────────── */

:root {
    --bg: #0f6bc2;               /* solid accent used in hover/row backgrounds */
    --bg-gradient: linear-gradient(180deg, #0f6bc2 0%, #052a4f 100%);  /* page bg, darkens downward */
    --panel: #f8fafc;            /* off-white containers */
    --border: #cbd5e1;
    --border-strong: #94a3b8;
    --text: #0f172a;             /* near-black text */
    --text-muted: #475569;
    --text-faint: #94a3b8;
    --primary: #1e3a8a;          /* dark navy — buttons, active, links */
    --primary-hover: #172554;    /* deeper navy */
    --primary-soft: #dbeafe;     /* very light blue — backgrounds for done/active */
    --primary-deep: #1e3a8a;     /* text color on primary-soft */
    --danger: #b91c1c;
    --danger-hover: #991b1b;
    --accent: #e07b2e;           /* orange — kept for secondary accent if needed */
    --success: #1e3a8a;          /* blue for success/done */
    --shadow:
        inset 0 1px 0 0 rgba(255,255,255,0.95),   /* crisp white highlight along top edge */
        0 1px 2px rgba(0,0,0,0.15),                /* tight shadow right below */
        0 8px 24px rgba(0,0,0,0.35);               /* deep drop shadow */
    --radius: 8px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-gradient);
    line-height: 1.5;
    min-height: 100vh;
}

h1, h2, h3 { margin: 0 0 0.5em 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; color: var(--text); }
h3 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 1.2em; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 24px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.brand-mark {
    width: 32px; height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
}
.brand-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.sidebar nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.08s;
}
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    padding: 12px 12px 4px 12px;
    margin-top: 6px;
}

.nav-link-child {
    padding-left: 24px;
    font-size: 13px;
}

.sidebar-footer {
    padding: 12px 20px 0;
    border-top: 1px solid var(--border);
}
.sidebar-footer-label {
    color: var(--text-faint);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.main {
    padding: 32px 40px;
    max-width: 1200px;
    width: 100%;
}

/* ── Page header ─────────────────────────────────────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    gap: 16px;
}
.page-header h1 { margin-bottom: 4px; color: white; }
.page-header .muted { color: rgba(255,255,255,0.7); }
.page-header-actions { display: flex; gap: 8px; align-items: center; }
.breadcrumbs {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 4px;
}
.breadcrumbs a { color: rgba(255,255,255,0.9); }
.breadcrumbs a:hover { color: white; }

/* ── Cards / dashboard ───────────────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.card.stub { opacity: 0.55; }
.card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.card-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
}
.card-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.card-meta a { font-size: 12px; }

/* ── Panels ──────────────────────────────────────────────────────────────── */

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrapper {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.data-table .actions { text-align: right; }

/* ── Badges / links ──────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-active   { background: var(--primary-soft); color: var(--primary-deep); }
.badge-draft    { background: #fef3c7; color: #92400e; }
.badge-archived { background: #e5e7eb; color: #4b5563; }

.link-primary  { color: var(--primary); font-weight: 500; }
.link-secondary { color: var(--text-muted); font-size: 13px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.08s, border-color 0.08s;
    font-family: inherit;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: white; text-decoration: none; }
.btn-secondary {
    background: transparent; color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.btn-danger {
    background: var(--danger); border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px 24px 24px 24px;
}
.form-section {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}
.form-section:last-of-type { border-bottom: none; }
.form-section h2 { margin-bottom: 4px; }
.form-section .muted { margin-top: 0; margin-bottom: 12px; }

.form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}
.form-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-row .required { color: var(--danger); }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: white;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}
.form-row textarea { resize: vertical; min-height: 60px; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.form-actions {
    padding-top: 16px;
    display: flex;
    gap: 8px;
}

/* ── View pages ──────────────────────────────────────────────────────────── */

.view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.view-section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.view-section:last-child { margin-bottom: 0; }

.data-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 6px 16px;
    margin: 0;
}
.data-list dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.data-list dd { margin: 0; color: var(--text); }

.prose {
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.video-block {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: #000;
    margin-bottom: 8px;
}
.video-embed {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 0;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
    background: var(--panel);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
}
.empty-state h2 { margin-bottom: 8px; }
.empty-state .btn { margin-top: 12px; }

/* ── Filter tabs ─────────────────────────────────────────────────────────── */

.filter-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.filter-tab {
    padding: 8px 14px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.08s, border-color 0.08s;
}
.filter-tab:hover {
    color: white;
    text-decoration: none;
    border-bottom-color: rgba(255,255,255,0.5);
}
.filter-tab.active {
    color: white;
    border-bottom-color: white;
    font-weight: 600;
}
.filter-count {
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: 600;
}
.filter-tab.active .filter-count { background: white; color: var(--primary); }

/* ── Pills (exercise type) ───────────────────────────────────────────────── */

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}
.pill-movement { background: #e0e7ff; color: #3730a3; }
.pill-drill    { background: #fef3c7; color: #92400e; }
.pill-warm_up  { background: #f3e8dc; color: #6b4a1d; }

/* Session scheduling type pills */
.pill-scheduling-planned { background: #dbeafe; color: #1e40af; }
.pill-scheduling-adhoc   { background: #ffe4e6; color: #9f1239; }

/* Session status badges */
.badge-session-scheduled   { background: #e5e7eb; color: #374151; }
.badge-session-in_progress { background: #dbeafe; color: #1e40af; }
.badge-session-complete    { background: var(--primary-soft); color: var(--primary-deep); }
.badge-session-skipped     { background: #e5e7eb; color: #6b7280; }
.badge-session-overdue     { background: #fee2e2; color: #991b1b; }

/* Assessment type pills */
.pill-assessment-movement           { background: #e0e7ff; color: #3730a3; }
.pill-assessment-pitching_mechanics { background: #fef3c7; color: #92400e; }
.pill-assessment-hitting_mechanics  { background: #ffe4e6; color: #9f1239; }

/* Assessment status badges */
.badge-assessment-active    { background: var(--primary-soft); color: var(--primary-deep); }
.badge-assessment-complete  { background: #dbeafe; color: #1e40af; }
.badge-assessment-archived  { background: #e5e7eb; color: #4b5563; }

/* ── Session-exercises table (compact) ───────────────────────────────── */

.sx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 12px;
}
.sx-table th, .sx-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.sx-table th {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    background: var(--bg);
}
.sx-table tr:last-child td { border-bottom: none; }
.sx-table input[type="text"] {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: white;
}
.sx-table input[type="text"]:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}
.sx-table .sx-name {
    font-weight: 500;
    color: var(--text);
    margin-right: 6px;
}
.sx-col-name         { width: 18%; }
.sx-col-type         { width: 10%; }
.sx-col-category     { width: 14%; }
.sx-col-prescription { width: 25%; }
.sx-col-notes        { width: 28%; }
.sx-col-remove       { width: 5%; }

.sx-batch-form {
    margin-bottom: 8px;
}

.btn-trash {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    color: var(--text-faint);
    border-radius: 4px;
    line-height: 1;
}
.btn-trash:hover {
    background: #fee2e2;
    color: var(--danger);
}
.sx-col-remove { text-align: center; }

.sx-save-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sx-placeholder-row td {
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Chips (for linked-assessment bubbles) */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 12px;
}
.chip a { color: var(--text); font-weight: 500; }
.chip-type { color: var(--text-muted); font-size: 11px; }
.chip-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}
.chip-remove:hover { color: var(--danger); }

/* ── Form hints ──────────────────────────────────────────────────────────── */

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

/* ── Media section ──────────────────────────────────────────────────────── */

.media-row {
    margin-bottom: 16px;
}
.media-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.media-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.references-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 12px;
    margin-bottom: 16px;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { background: var(--bg); color: var(--danger); border-color: var(--danger); }

/* ── Inline add forms (<details>/<summary>) ─────────────────────────────── */

.inline-add {
    margin: 12px 0;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
}
.inline-add[open] { background: var(--panel); border-style: solid; }
.inline-add summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    user-select: none;
    padding: 4px 0;
}
.inline-add summary:hover { color: var(--primary-hover); }
.inline-form {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}
.inline-form .form-row { margin-bottom: 10px; }

/* ── Image gallery ───────────────────────────────────────────────────────── */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 16px;
}
.image-tile {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.image-tile img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.image-caption {
    padding: 6px 8px;
    font-size: 12px;
    color: var(--text);
}
.image-delete {
    position: absolute;
    top: 6px; right: 6px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(2px);
}

.image-tile-primary {
    max-width: 400px;
    border: 2px solid var(--primary);
    position: relative;
}
.image-tile-primary img {
    height: auto;
    max-height: 320px;
    object-fit: contain;
    background: var(--bg);
}

.media-sub-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.placeholder-tile {
    padding: 24px;
    background: var(--bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
    max-width: 400px;
    margin-bottom: 8px;
}

.image-tile-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.btn-sm {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}
.btn-sm:hover { background: var(--primary); color: white; border-color: var(--primary); }

.form-minimal {
    max-width: 520px;
}

.build-hint { margin-top: -8px; margin-bottom: 16px; }

/* ── Calendar ───────────────────────────────────────────────────────────── */

.cal-month-label {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-weekday {
    background: var(--bg);
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: center;
}

.cal-day {
    background: var(--panel);
    min-height: 100px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.08s;
}
.cal-day:hover { background: var(--bg); text-decoration: none; }

.cal-day-out { background: #fafafc; color: var(--text-faint); }
.cal-day-out .cal-day-num { color: var(--text-faint); }

.cal-day-today {
    background: #dbeafe;
}
.cal-day-today .cal-day-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
}

.cal-day-num {
    font-size: 13px;
    font-weight: 500;
}

.cal-placements {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}
.cal-placement {
    font-size: 11px;
    padding: 2px 6px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Login page ─────────────────────────────────────────────────────────── */

.login-body {
    background: linear-gradient(135deg, #0f6bc2 0%, #1e3a8a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 380px;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.login-card h1 {
    margin: 0 0 24px 0;
    font-size: 22px;
}
.login-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}
.btn-full { width: 100%; padding: 10px; margin-top: 8px; }

/* ── Sidebar user block ─────────────────────────────────────────────────── */

.sidebar-user {
    padding: 8px 20px;
    margin-bottom: 8px;
}
.sidebar-user-name {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.sidebar-logout-form { margin: 0; }
.sidebar-logout-btn {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}
.sidebar-logout-btn:hover { color: var(--primary-hover); }

/* ── Phone PWA ──────────────────────────────────────────────────────────── */

.phone-body {
    background: var(--bg-gradient);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.phone-header {
    background: var(--primary);
    color: white;
    padding: env(safe-area-inset-top, 12px) 16px 12px 16px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.phone-brand {
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.01em;
}
.phone-back {
    color: white;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.phone-back-arrow {
    font-size: 18px;
    line-height: 1;
    font-weight: 900;
}
.phone-back:hover { color: white; text-decoration: underline; }
.phone-logout-form { margin: 0; }
.phone-logout-btn {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: var(--shadow);
}
.phone-logout-btn:active {
    background: var(--bg);
    color: var(--text);
}

.phone-main {
    padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 32px) 16px;
    max-width: 640px;
    margin: 0 auto;
}

.phone-today-label {
    font-size: 26px;
    font-weight: 700;
    margin: 4px 0 16px 0;
    line-height: 1.1;
    color: white;
}
.phone-today-date {
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    font-weight: 500;
}

.phone-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.75);
    margin: 24px 0 8px 0;
    font-weight: 600;
}

.phone-card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.05s;
}
.phone-card:active { transform: scale(0.98); text-decoration: none; color: var(--text); }
.phone-card-muted { opacity: 0.75; }
.phone-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}
.phone-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.phone-card-progress {
    font-size: 13px;
    color: var(--text-muted);
}

.phone-empty {
    padding: 20px;
    text-align: center;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
}

.phone-placement-title {
    font-size: 22px;
    font-weight: 700;
    margin: 4px 0 4px 0;
    color: white;
}
.phone-placement-meta {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 16px;
}
.phone-complete-banner {
    background: var(--primary-soft);
    color: var(--primary-deep);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

.phone-exercises {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phone-ex {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
}
.phone-ex-done {
    background: var(--primary-soft);
    border-color: #93c5fd;
}
.phone-ex-done .phone-ex-name { text-decoration: line-through; color: var(--text-muted); }

.phone-ex-header {
    display: flex;
    gap: 12px;
    align-items: center;
}

.phone-ex-toggle-form { margin: 0; }
.phone-ex-check {
    width: 42px;
    height: 42px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: white;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
}
.phone-ex-done .phone-ex-check {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.phone-ex-title {
    flex: 1;
    min-width: 0;
}

.phone-ex-body {
    /* Full-width — spans under the header row */
}
.phone-ex-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}
.phone-ex-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}
.phone-ex-cat {
    font-size: 11px;
    color: var(--text-muted);
}
.phone-ex-prescription {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}
.phone-ex-details {
    margin-top: 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--panel);
    overflow: hidden;
}
.phone-ex-details-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg);
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    list-style: none;            /* hide Firefox / standard marker */
}
.phone-ex-details-summary::-webkit-details-marker { display: none; }
.phone-ex-details-summary::marker { content: ""; }

.phone-ex-details-summary::after {
    content: "▼";
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 8px;
    transition: transform 0.2s;
}
.phone-ex-details[open] .phone-ex-details-summary::after {
    transform: rotate(180deg);
}
.phone-ex-details-summary:hover,
.phone-ex-details-summary:active {
    background: #e0e7ff;
}
.phone-ex-details[open] .phone-ex-details-summary {
    background: #e0e7ff;
    border-bottom: 1px solid var(--border);
}

/* Body of the details panel (everything except summary) */
.phone-ex-details-body {
    padding: 12px 16px 14px 16px;
}
.phone-ex-details-body > *:first-child { margin-top: 0; }
.phone-ex-details-body p {
    margin: 0 0 10px 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}
.phone-ex-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin: 16px 0 6px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.phone-ex-section:first-child { margin-top: 0; }
.phone-ex-prose {
    white-space: pre-wrap;
    line-height: 1.5;
}

.phone-ex-desc { margin-top: 10px !important; }
.phone-ex-img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--bg);
    margin-top: 8px;
    display: block;
}
.phone-ex-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #000;
    margin-top: 8px;
}
.phone-ex-video iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 0;
}
.phone-ex-tutorial-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--primary);
}

/* ── Phone mini calendar ──────────────────────────────────────────────── */

.phone-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 4px;
}
.phone-cal-month-label {
    font-weight: 600;
    font-size: 15px;
    color: white;
}
.phone-cal-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    color: white;
    text-decoration: none;
    background: rgba(255,255,255,0.15);
}
.phone-cal-nav-btn:active { background: #d9e2f0; }

.phone-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    box-shadow: var(--shadow);
}
.phone-cal-dow {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.phone-cal-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
}
.phone-cal-cell:active { background: var(--bg); }
.phone-cal-out { color: var(--text-faint); }
.phone-cal-today {
    background: var(--primary);
    color: white;
    font-weight: 600;
}
.phone-cal-today:active { background: var(--primary-hover); color: white; }
.phone-cal-num {
    line-height: 1;
}
.phone-cal-dot {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
}
.phone-cal-today .phone-cal-dot { background: white; }
.phone-cal-has:not(.phone-cal-today) { background: #e0e7ff; }

/* ── Flash / toast messages ─────────────────────────────────────────────── */

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}
.flash-ok    { background: var(--primary-soft); color: var(--primary-deep); border: 1px solid #f6d5b3; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Utility ─────────────────────────────────────────────────────────────── */

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
