/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scrollbar-gutter: stable;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    color-scheme: light dark;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--gray-900);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--gray-300);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.nav-links a:hover {
    background: var(--gray-700);
    color: white;
}

.nav-links a.active {
    background: var(--primary);
    color: white;
}

.nav-user {
    margin-left: auto;
    color: var(--gray-300);
}

/* Container */
.container {
    min-width: 610px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Footer */
.footer {
    background: var(--gray-100);
    color: var(--gray-500);
    text-align: center;
    padding: 1rem;
    font-size: 0.875rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Date navigation */
.date-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 230;
}

.date-nav button {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--gray-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.date-nav button:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.date-nav .current-date {
    font-weight: 600;
    width: 160px;
    text-align: center;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.date-nav .current-date:hover {
    background: var(--gray-100);
}

.date-picker-wrapper {
    position: relative;
    display: inline-block;
}

.calendar-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 280px;
}

.calendar-dropdown.active {
    display: block;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.calendar-header button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: var(--gray-600);
}

.calendar-header button:hover {
    background: var(--gray-100);
}

.calendar-month-year {
    font-weight: 600;
    font-size: 1rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    padding: 0.25rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.calendar-day:hover {
    background: var(--gray-100);
}

.calendar-day.other-month {
    color: var(--gray-400);
}

.calendar-day.today {
    background: var(--gray-200);
    font-weight: 600;
}

.calendar-day.selected {
    background: var(--primary);
    color: white;
}

.calendar-day.selected:hover {
    background: var(--primary-dark);
}

.calendar-day.has-reservation {
    border-bottom: 3px solid var(--success);
}

/* Filters */
.filters-toggle-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--gray-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.filters-toggle-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.filters-toggle-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filters {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.filters-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.filter-toggle input {
    cursor: pointer;
}

.filter-btn-wrapper,
.tooltip-btn-wrapper {
    position: relative;
    overflow: visible;
}

@keyframes tooltip-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
    50% { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
}

.filter-btn-wrapper.has-tooltip,
.tooltip-btn-wrapper.has-tooltip {
    z-index: 201;
}

.filter-btn-wrapper.has-tooltip .filters-toggle-btn,
.tooltip-btn-wrapper.has-tooltip > button {
    animation: tooltip-pulse 1.5s ease-in-out infinite;
    border-color: var(--primary);
    color: var(--primary);
}

.tooltip-btn-wrapper.has-tooltip .current-date,
.date-picker-wrapper.has-tooltip .current-date {
    display: inline-block;
    animation: tooltip-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.tooltip-backdrop {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    background: rgba(0, 0, 0, 0.15);
    z-index: 200;
    pointer-events: none;
}

.filter-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    min-width: 170px;
    z-index: 202;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    text-align: center;
    overflow: visible;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.filter-tooltip::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 10px;
    width: 10px;
    height: 10px;
    background: white;
    border-left: 1px solid var(--gray-200);
    border-top: 1px solid var(--gray-200);
    transform: rotate(45deg);
}

.filter-tooltip p {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.filter-tooltip.date-picker {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.filter-tooltip.date-picker::before {
    left: 50%;
    right: auto;
    transform: translateX(-50%) rotate(45deg);
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Appointments */
.appointments {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.appointment {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) auto auto;
    gap: 1rem;
    align-items: center;
    padding: 0.6rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
    border-left: 4px solid var(--gray-300);
    overflow: visible;
}

.appointment.status-open {
    border-left-color: var(--success);
}

.appointment.status-closed {
    border-left-color: var(--danger);
}

.appointment.status-subscribed {
    border-left-color: var(--primary);
    background: #eff6ff;
}

.appointment.status-waiting {
    border-left-color: var(--warning);
    background: #fefce8;
}

.appointment.is-past {
    opacity: 1;
    border-left-color: var(--gray-300);
    background: var(--gray-50);
}

.appointment.is-past .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.appointment.is-past .btn-icon.is-past {
    opacity: 0.5;
}

.appointment.is-past .btn-icon.is-past.has-friends {
    color: var(--gray-500);
    border-color: var(--gray-300);
}

.appointment-time {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.appointment-name {
    font-weight: 500;
}

.appointment-spots {
    font-size: 0.875rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spots-icon {
    display: none;
}

@media (max-width: 640px) {
    .spots-icon {
        display: inline;
    }
}

.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-icon.status-subscribed {
    color: var(--primary);
}

.status-icon.status-waiting {
    color: var(--warning);
}

.status-icon.status-full {
    color: var(--danger);
}

.appointment-friends {
    display: flex;
    gap: 0.25rem;
}

.friend-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.appointment-actions {
    display: flex;
    gap: 0.5rem;
    overflow: visible;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    background: #f97316;
    color: white;
}

.btn-warning:hover {
    background: #ea580c;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.375rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn-icon:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-icon.has-friends {
    color: var(--success);
    border-color: var(--success);
}

.btn-icon.has-friends:hover {
    background: #dcfce7;
}

.btn-icon.btn-1rm {
    color: #7c3aed;
    border-color: #7c3aed;
}

.btn-icon.btn-1rm:hover {
    background: #ede9fe;
}

.btn-icon.btn-benchmark {
    color: #d97706;
    border-color: #d97706;
}

.btn-icon.btn-benchmark:hover {
    background: #fef3c7;
}

.benchmark-label {
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 2px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.benchmark-form {
    margin-bottom: 1rem;
}

.benchmark-form .form-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.benchmark-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 140px;
}

.benchmark-form .form-group-narrow {
    flex: 0 0 110px;
    min-width: 90px;
}

.benchmark-form .form-group-submit {
    flex: 0 0 auto;
}

.benchmark-form--modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 0.5rem;
}

.benchmark-form--modal .form-row > :nth-child(1) {
    grid-column: 1 / -1;
}

.benchmark-form--modal .form-group-submit .btn {
    width: 100%;
    justify-content: center;
}

.benchmark-form label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
}

.benchmark-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.benchmark-table th {
    text-align: left;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

.benchmark-table td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.benchmark-time {
    font-weight: 600;
}

.benchmark-date {
    font-size: 0.75rem;
}

.benchmark-empty {
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem 0;
}

.radio-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.25rem;
}

.radio-inline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-rx {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-scaled {
    background: #fef3c7;
    color: #d97706;
}

@media (max-width: 640px) {
    .benchmark-form .form-row {
        flex-direction: column;
    }
    .benchmark-form .form-group,
    .benchmark-form .form-group-narrow {
        flex: 1;
        min-width: 0;
        width: 100%;
    }
}

.one-rm-chart-container {
    padding: 1rem;
    height: 260px;
    position: relative;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: white;
    color: var(--gray-900);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control-inline {
    display: inline-block;
    width: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
}

.one-rm-form {
    margin-bottom: 1rem;
}

.one-rm-form .form-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.one-rm-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 140px;
}

.one-rm-form .form-group-narrow {
    flex: 0 0 110px;
    min-width: 90px;
}

.one-rm-form .form-group-narrow:has(input[type="date"]) {
    flex: 0 0 145px;
    min-width: 130px;
}

.one-rm-form .form-group-submit {
    flex: 0 0 auto;
}

/* Modal form: 2-row grid on all screen sizes */
.one-rm-form--modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 0.5rem;
}

.one-rm-form--modal .form-row > :nth-child(1) {
    grid-column: 1 / -1;
}

.one-rm-form--modal .form-row > :nth-child(2) {
    grid-column: 1;
}

.one-rm-form--modal .form-row > :nth-child(3) {
    grid-column: 2;
}

.one-rm-form--modal .form-group-submit .btn {
    width: 100%;
    justify-content: center;
}

.one-rm-form label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
}

.one-rm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.one-rm-table th {
    text-align: left;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

.one-rm-table td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.one-rm-weight {
    font-weight: 600;
}

.one-rm-date {
    font-size: 0.75rem;
}

.one-rm-empty {
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem 0;
}

.one-rm-pct-section {
    padding: 1rem 1rem 1.25rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    justify-content: center;
}

.one-rm-pct-pct {
    color: #111;
}

.one-rm-pct-kg {
    color: inherit;
}

.one-rm-pct-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.one-rm-pct-label {
    font-size: 1.125rem;
    font-weight: 700;
}

.one-rm-pct-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.one-rm-big-weight {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    min-width: 7rem;
    text-align: center;
}

.one-rm-pct-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    touch-action: manipulation;
    background: var(--primary, #2563eb);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    flex-shrink: 0;
}

.one-rm-pct-btn:hover {
    background: var(--primary-dark, #1d4ed8);
}

.one-rm-pct-btn:active {
    transform: scale(0.93);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.125rem 0.25rem;
}

.btn-delete:hover {
    color: var(--danger);
}

.friend-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--success);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}

.table tr:hover {
    background: var(--gray-50);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-warning {
    background: #fef9c3;
    color: var(--warning);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.badge-info {
    background: #dbeafe;
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    min-width: 320px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    max-height: 400px;
    overflow-y: auto;
}

/* People list */
.people-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.person-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.person-item:last-child {
    border-bottom: none;
}

.person-item.is-friend {
    background: #eff6ff;
    margin: 0 -1rem;
    padding: 0.5rem 1rem;
}

.person-item.is-self {
    background: #f0fdf4;
    margin: 0 -1rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.person-name {
    font-weight: 500;
}

.add-friend-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Utilities */
.text-muted {
    color: var(--gray-500);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Schedule modal */
.schedule-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.schedule-section {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.schedule-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.schedule-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.schedule-section-content {
    font-size: 0.9375rem;
    color: var(--gray-700);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Table scroll wrapper */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .container {
        min-width: unset;
        width: 100%;
        padding: 0;
    }

    .card {
        padding: 0.75rem 1rem;
        border-radius: 0;
    }

    .filters {
        border-radius: 0;
        margin-bottom: 0;
        padding: 0.75rem 1rem;
    }

    .filters-toggle-btn {
        margin: 0;
    }

    .navbar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0;
    }

    .nav-brand {
        flex: 1 0 auto;
    }

    .nav-links {
        order: 3;
        width: 100%;
        padding: 0.5rem 0;
        border-top: 1px solid var(--gray-700);
        gap: 0.25rem;
    }

    .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .nav-user {
        margin-left: auto;
        gap: 0.5rem;
        font-size: 0.875rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
        padding: 0.75rem 1rem 0;
    }

    .page-header h1 {
        display: none;
    }

    .date-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .calendar-dropdown {
        position: fixed;
        left: 1rem;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        min-width: unset;
        width: auto;
    }

    .appointment {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 0.5rem 0.75rem;
    }

    .appointment-time {
        grid-column: 1;
        grid-row: 1;
        align-self: start;
        white-space: nowrap;
    }

    .appointment-info {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
    }

    .appointment-spots {
        grid-column: 1;
        grid-row: 2;
        align-self: center;
        font-size: 0.8rem;
    }

    .appointment-actions {
        grid-column: 2;
        grid-row: 2;
        justify-content: flex-end;
        align-self: center;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .col-userid {
        display: none;
    }

    .modal-content {
        padding: 1rem;
        min-width: unset;
        width: calc(100vw - 2rem);
        max-height: 80vh;
        overflow-y: auto;
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
    }

    .btn-icon {
        padding: 0.5rem;
    }

    .login-card {
        padding: 1.5rem 1rem;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .one-rm-form .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        align-items: end;
    }

    .one-rm-form .form-row > :nth-child(1) {
        grid-column: 1 / -1;
    }

    .one-rm-form .form-row > :nth-child(2) {
        grid-column: 1;
    }

    /* date field (3-child form) or save button (3-child form without date) */
    .one-rm-form .form-row > :nth-child(3) {
        grid-column: 2;
    }

    /* save button when date is present (4-child form) */
    .one-rm-form .form-row > :nth-child(4) {
        grid-column: 1 / -1;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    /* save button full-width when it sits in col 2 (no-date form) */
    .one-rm-form .form-group-submit .btn {
        width: 100%;
        justify-content: center;
    }

    .one-rm-form .form-group,
    .one-rm-form .form-group-narrow {
        min-width: unset;
        flex: unset;
        width: auto;
    }
}

/* Google Sync settings */
.gsync-connected,
.gsync-unconnected {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gsync-status-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.375rem;
}

.gsync-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    background: #dcfce7;
    color: #15803d;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.gsync-email {
    font-size: 0.875rem;
    color: var(--gray-600, #4b5563);
}

.gsync-calendar-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--gray-600, #4b5563);
    margin-bottom: 0.75rem;
}

.gsync-last-sync {
    font-size: 0.8125rem;
    color: var(--gray-500, #6b7280);
    margin-bottom: 1rem;
}

.gsync-status-ok {
    color: var(--success, #16a34a);
    font-weight: 600;
    margin-left: 0.25rem;
}

.gsync-status-err {
    color: var(--danger, #dc2626);
    margin-left: 0.25rem;
}

.gsync-result {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.gsync-result--ok {
    background: #dcfce7;
    color: #15803d;
}

.gsync-result--warn {
    background: #fef3c7;
    color: #92400e;
}

.gsync-result--err {
    background: #fee2e2;
    color: #dc2626;
}

.gsync-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.gsync-spinner {
    font-size: 0.875rem;
    color: var(--gray-500, #6b7280);
}

.gsync-disconnect {
    border-top: 1px solid var(--gray-200, #e5e7eb);
    padding-top: 1rem;
    margin-top: 0.25rem;
}

.gsync-disconnect-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--danger, #dc2626);
    margin: 0 0 0.5rem;
    opacity: 0.7;
}

.gsync-disconnect-hint {
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
    margin: 0.375rem 0 0;
}

.gsync-btn-disconnect {
    background: transparent;
    border: 1px solid var(--danger, #dc2626);
    color: var(--danger, #dc2626);
}

.gsync-btn-disconnect:hover {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #b91c1c;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    background: white;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(60,64,67,0.15);
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
    background: #f8faff;
    box-shadow: 0 2px 6px rgba(60,64,67,0.2);
    color: #3c4043;
}

.alert-danger {
    padding: 0.75rem 1rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 0.375rem;
}

.alert-success {
    padding: 0.75rem 1rem;
    background: #dcfce7;
    color: #15803d;
    border-radius: 0.375rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #f1f5f9;
    }

    .footer {
        background: #1e293b;
        color: #94a3b8;
    }

    /* Cards and surfaces */
    .card {
        background: #1e293b;
        box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    }

    .calendar-dropdown {
        background: #1e293b;
        border-color: #334155;
        box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    }

    .calendar-header {
        border-color: #334155;
    }

    .calendar-header button {
        color: #94a3b8;
    }

    .calendar-header button:hover {
        background: #334155;
    }

    .calendar-day:hover {
        background: #334155;
    }

    .calendar-day.today {
        background: #334155;
    }

    .calendar-day.other-month {
        color: #475569;
    }

    .filters {
        background: #1e293b;
    }

    /* Date nav */
    .date-nav button {
        background: #1e293b;
        border-color: #334155;
        color: #94a3b8;
    }

    .date-nav button:hover {
        background: #334155;
        color: #f1f5f9;
    }

    .date-nav .current-date:hover {
        background: #1e293b;
    }

    /* Filter toggle */
    .filters-toggle-btn {
        background: #1e293b;
        border-color: #334155;
        color: #94a3b8;
    }

    .filters-toggle-btn:hover {
        background: #334155;
        color: #f1f5f9;
    }

    /* Appointments */
    .appointment {
        background: #1e293b;
        border-left-color: #475569;
    }

    .appointment.status-subscribed {
        background: #172554;
    }

    .appointment.status-waiting {
        background: #422006;
    }

    .appointment.is-past {
        background: #1e293b;
        border-left-color: #475569;
    }

    .appointment-time {
        color: #cbd5e1;
    }

    .appointment-spots {
        color: #94a3b8;
    }

    /* Buttons */
    .btn-secondary {
        background: #334155;
        color: #f1f5f9;
    }

    .btn-secondary:hover {
        background: #475569;
    }

    .btn-icon {
        background: #1e293b;
        color: #94a3b8;
        border-color: #334155;
    }

    .btn-icon:hover {
        background: #334155;
        color: #f1f5f9;
    }

    .btn-icon.has-friends:hover {
        background: #14532d;
    }

    .btn-icon.btn-1rm:hover {
        background: #2e1065;
    }

    .one-rm-pct-pct {
        color: #fff;
    }

    /* Forms */
    .form-group input,
    .form-group select,
    .form-control,
    .form-control-inline {
        background-color: #1e293b;
        color: #f1f5f9;
        border-color: #475569;
    }

    .form-group label {
        color: #cbd5e1;
    }

    /* Modal */
    .modal-content {
        background: #1e293b;
    }

    .modal-close {
        color: #94a3b8;
    }

    /* Tables */
    .table th {
        background: #1e293b;
        color: #cbd5e1;
        border-color: #334155;
    }

    .table td {
        border-color: #334155;
    }

    .table tr:hover {
        background: #1e293b;
    }

    .one-rm-table th {
        border-color: #334155;
        color: #94a3b8;
    }

    .one-rm-table td {
        border-color: #1e293b;
    }

    /* People list */
    .person-item {
        border-color: #334155;
    }

    .person-item.is-friend {
        background: #172554;
    }

    .person-item.is-self {
        background: #14532d;
    }

    /* Badges */
    .badge-success {
        background: #14532d;
        color: #4ade80;
    }

    .badge-warning {
        background: #713f12;
        color: #fde047;
    }

    .badge-danger {
        background: #7f1d1d;
        color: #f87171;
    }

    .badge-info {
        background: #172554;
        color: #60a5fa;
    }

    .badge-secondary {
        background: #334155;
        color: #cbd5e1;
    }

    /* Utilities */
    .text-muted {
        color: #94a3b8;
    }

    .empty-state {
        color: #94a3b8;
    }

    .empty-state h3 {
        color: #cbd5e1;
    }

    /* Schedule modal */
    .schedule-section {
        border-color: #334155;
    }

    .schedule-section-content {
        color: #cbd5e1;
    }

    /* 1rm form label */
    .one-rm-form label {
        color: #94a3b8;
    }

    /* Google sync */
    .gsync-status-badge {
        background: #14532d;
        color: #86efac;
    }

    .gsync-email,
    .gsync-calendar-row {
        color: #94a3b8;
    }

    .gsync-last-sync {
        color: #64748b;
    }

    .gsync-disconnect {
        border-top-color: #334155;
    }

    .gsync-disconnect-hint {
        color: #64748b;
    }

    .gsync-btn-disconnect:hover {
        background: #450a0a;
        color: #fca5a5;
        border-color: #7f1d1d;
    }

    .btn-google {
        background: #1e293b;
        color: #e2e8f0;
        border-color: #334155;
        box-shadow: none;
    }

    .btn-google:hover {
        background: #263548;
        color: #f1f5f9;
    }

    .gsync-result--ok {
        background: #14532d;
        color: #86efac;
    }

    .gsync-result--warn {
        background: #451a03;
        color: #fcd34d;
    }

    .gsync-result--err {
        background: #450a0a;
        color: #fca5a5;
    }

    .alert-danger {
        background: #450a0a;
        color: #fca5a5;
    }

    .alert-success {
        background: #14532d;
        color: #86efac;
    }
}
