:root {
    --bg-body: #f8fafc;
    --bg-sidebar: #0f172a;
    --bg-card: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --text-on-dark: #e2e8f0;

    --primary: #aacf51;
    --primary-hover: #84cc16;
    /* Lime-500 (Clean vibrant hover) */
    --primary-soft: #ecfccb;
    /* Lime-100 */
    --accent-light: #f7fee7;
    /* Lime-50 */

    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    --radius: 10px;

    --input-bg: #ffffff;
    --toggle-bg: #f1f5f9;
    --day-cell-bg: #f1f5f9;
    --day-cell-color: #94a3b8;
    --day-cell-border: #fff;
    --radio-border: #cbd5e1;
    --modal-bg: #ffffff;
}

html {
    scrollbar-gutter: stable;
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-sidebar: #020617;
    --bg-card: #1e293b;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-on-dark: #e2e8f0;

    /* Theme Overrides for Dark Mode */
    --primary-soft: #365314;
    /* Lime-900 */
    --accent-light: #1a2e05;
    /* Lime-950 */

    --border: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);

    --input-bg: #0f172a;
    --toggle-bg: #334155;
    --day-cell-bg: #334155;
    --day-cell-color: #94a3b8;
    --day-cell-border: #1e293b;
    --radio-border: #475569;
    --modal-bg: #1e293b;
}

* {
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

.visible-mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .visible-mobile-only {
        display: block;
    }
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background: var(--bg-body);
    height: 100vh;
    overflow: hidden;
}

/* ─── Layout ─── */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid #1e293b;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-on-dark);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    /* prevents scroll issues */
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(20, 184, 166, 0.15);
    color: var(--primary);
}

.nav-item svg {
    opacity: 0.8;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #1e293b;
}

/* ─── Main Content ─── */
.main-content {
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    box-shadow: var(--shadow-sm);
    animation: fadeSlideUp 0.3s ease-out;
}

h2 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

/* ─── Form Elements ─── */
.field-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    background: var(--input-bg);
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.field-group-horizontal {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

/* Toggle Pill Style */
.toggle-group {
    display: inline-flex;
    background: var(--toggle-bg);
    padding: 4px;
    border-radius: 20px;
}

.toggle-option {
    position: relative;
    cursor: pointer;
}

.toggle-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.toggle-pill {
    display: inline-block;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 16px;
    color: var(--text-muted);
    transition: all 0.2s;
}

/* Checked State */
.toggle-option input:checked+.toggle-pill {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.3);
}

/* Modern Radio Style */
.radio-group-modern {
    display: flex;
    gap: 1.5rem;
}

.radio-modern {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.radio-modern input {
    display: none;
}

.radio-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--radio-border);
    position: relative;
}

.radio-modern input:checked~.radio-dot {
    border-color: var(--primary);
    background: #fff;
}

.radio-modern input:checked~.radio-dot::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--primary);
    border-radius: 50%;
}

.radio-modern input:checked~span:last-child {
    color: var(--text-main);
    font-weight: 500;
}

/* Buttons */
.actions {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

button.primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: filter 0.2s;
}

button.primary:hover {
    filter: brightness(1.1);
}

button.secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

button.secondary:hover {
    background: var(--toggle-bg);
    border-color: var(--text-muted);
}

.full-width-btn {
    width: 100%;
}

.small-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.text-btn:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* ─── Settings ─── */
.setting-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ─── Admin Panel ─── */
.admin-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.admin-user-row:hover {
    background: var(--toggle-bg);
    border-color: var(--primary);
}

.admin-user-row .user-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-user-row .user-meta img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.admin-user-row .user-meta .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.admin-user-row .user-meta .email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.admin-user-row .user-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-detail-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.meta-pill {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: var(--toggle-bg);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.meta-pill.status-active {
    background: var(--primary-soft);
    color: var(--primary);
}

.meta-pill.status-disabled {
    background: #fef2f2;
    color: #ef4444;
}

[data-theme="dark"] .meta-pill.status-disabled {
    background: #451a1a;
    color: #f87171;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ─── Timeline / Results ─── */
.timeline-summary {
    display: flex;
    gap: 3rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-item .value {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Read-Only Details */
.read-only-details {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.detail-value {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.horizontal-scroll,
.timeline-container {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 25px;
    /* Increase for cleaner scrollbar space */

    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.month-block {
    display: flex;
    flex-direction: column;
    min-width: max-content;
}

.month-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    font-weight: 600;
}

.days-row {
    display: flex;
}

.day-cell {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: var(--day-cell-bg);
    color: var(--day-cell-color);
    border: 1px solid var(--day-cell-border);
    /* Simulate grid gap */
}

.day-cell.empty {
    background: transparent;
    border: none;
}

.day-cell.in-range {
    background: var(--primary);
    color: #fff;
    opacity: 0.8;
}

.day-cell.is-start {
    border-radius: 6px 0 0 6px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    opacity: 1;
}

.day-cell.is-target {
    border-radius: 0 6px 6px 0;
    background: var(--primary-hover);
    color: #fff;
    font-weight: 700;
    opacity: 1;
}

.day-cell span {
    pointer-events: none;
}

/* ─── Auth ─── */
.sidebar-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sign-out-link {
    background: none;
    border: none;
    color: #94a3b8;
    padding: 0;
    font-size: 0.8rem;
    cursor: pointer;
}

.sign-out-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .app-layout {
        display: block;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        position: relative;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid #1e293b;
        flex-direction: row;
        /* Keep header items aligned if needed, but sidebar-header handles it */
        display: block;
        /* Or flex, but sidebar-header is the main child visible */
        z-index: 50;
        /* Ensure sidebar is above main content */
    }

    .sidebar-header {
        margin-bottom: 0;
        width: 100%;
        justify-content: space-between;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* Collapsible mobile menu */
    .sidebar-content {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-sidebar);
        padding: 1rem;
        border-bottom: 1px solid #1e293b;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
        z-index: 100;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .sidebar-content.mobile-menu-visible {
        display: flex !important;
        flex-direction: column;
        animation: slideDown 0.2s ease-out;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 1rem;
        gap: 1rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: 10px;
    }

    h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* Stack form labels + toggle side by side on small screens */
    .field-group-horizontal {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* Radio buttons stack vertically */
    .radio-group-modern {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Timeline summary wraps */
    .timeline-summary {
        flex-direction: column;
        gap: 1rem;
    }

    .summary-item .value {
        font-size: 1rem;
    }

    /* Results header stacks */
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Action buttons go full-width */
    .actions {
        flex-direction: column;
    }

    .actions button.primary {
        width: 100%;
    }

    .full-width-btn {
        width: 100%;
    }

    /* Login prompt stacks on mobile */
    .login-prompt {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    /* Day cells slightly smaller on mobile */
    .day-cell {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    /* Dashboard header */
    .dashboard-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem;
    }

    /* Footer inside the mobile menu */
    .sidebar-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
        border-top: 1px solid #1e293b;
        margin-left: 0;
    }

    .sidebar-nav {
        display: flex;
        position: static;
        width: auto;
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    /* ─── Mobile Body / Main Content ─── */

    body {
        overflow: auto;
        height: auto;
    }

    .main-content {
        padding: 1rem;
        gap: 1rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: 10px;
    }

    /* ─── Group Dashboard Mobile ─── */
    #group-view .content-container,
    #group-view {
        max-width: 100vw;
        overflow-x: hidden;
    }

    #group-view .header-area h1 {
        font-size: 1.25rem;
        word-break: break-word;
    }

    #group-invite-section {
        overflow: hidden;
        word-break: break-word;
    }

    #group-invite-section>div:first-child {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Members list: horizontal scroll on mobile */
    .grid-2-desktop {
        grid-template-columns: 1fr !important;
    }

    .members-list {
        flex-direction: row !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }

    .member-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    /* Tooltip below avatar on mobile */
    .member-tooltip {
        left: 50% !important;
        top: 100% !important;
        transform: translateX(-50%) !important;
        margin-left: 0 !important;
        margin-top: 8px !important;
    }

    .member-tooltip::before {
        display: none;
    }

    /* Feed items full width */
    .feed-content-body,
    .feed-actions {
        padding-left: 0;
    }

    .feed-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .feed-item {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* Timeline card overflow scroll */
    .timeline-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Utils ─── */
.hidden {
    display: none !important;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Prompt */
.login-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-soft);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.google-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* ─── Modal ─── */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-backdrop:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transform: translateY(10px);
    transition: transform 0.2s ease;
}

.modal-backdrop:not(.hidden) .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}

.modal-footer {
    margin-top: 1.5rem;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.label-text {
    font-weight: 500;
    color: var(--text-main);
}

/* Updated Day Cell Styles */
.day-cell {
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}

.day-cell:hover:not(.empty) {
    transform: scale(1.1);
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.day-cell.completed {
    background: #10b981;
    /* Green-500 */
    color: #fff;
    border-color: #059669;
}

.day-cell.has-note::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;

    /* Milestones */
    .day-cell.milestone {
        border: 2px solid #fbbf24;
        /* Amber-400 */
        position: relative;
    }

    .day-cell.milestone::after {
        content: '★';
        /* Star */
        position: absolute;
        top: -8px;
        right: -6px;
        background: #fbbf24;
        color: #fff;
        font-size: 10px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        z-index: 5;
    }

    /* Celebration Modal Animation */
    @keyframes popIn {
        0% {
            transform: scale(0.5);
            opacity: 0;
        }

        70% {
            transform: scale(1.1);
        }

        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

    .modal-content {
        animation: popIn 0.3s ease-out;
    }

    background: #f59e0b;
    /* Amber-500 */
    border-radius: 50%;
    border: 1px solid #fff;
}

/* Fix for Mobile Modal Positioning */
.modal-backdrop {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important;
    backdrop-filter: blur(3px);
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    width: 90%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Ensure celebration modal pops */
#celebration-modal .modal-content {
    border: 2px solid #f59e0b;
    text-align: center;
}

.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px;
    position: fixed;
    z-index: 10000 !important;
    /* High enough to top modals */
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 0.95rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {
        bottom: 0;
        opacity: 0;
    }

    to {
        bottom: 30px;
        opacity: 1;
    }
}

@keyframes fadeout {
    from {
        bottom: 30px;
        opacity: 1;
    }

    to {
        bottom: 0;
        opacity: 0;
    }
}

/* ─── Share & Join Styles ─── */
.share-panel button {
    width: 100%;
    margin-top: 0.5rem;
}

/* Specific fix for Copy button */
#copy-share-btn {
    width: auto !important;
    margin-top: 0 !important;
    flex-shrink: 0;
    white-space: nowrap;
}

#share-link-input {
    min-width: 0;
    /* Prevents input from overflowing flex container */
    text-overflow: ellipsis;
}

#share-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Compact Radio Cards for Check-ins */
.radio-card.compact {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.radio-card.compact .card-desc {
    display: none;
}

/* Group Dashboard */
.grid-2-desktop {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-2-desktop {
        grid-template-columns: 80px 1fr;
        /* Compact Members, Wide Feed */
    }
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    /* Center avatars */
}

.member-item {
    position: relative;
    /* For tooltip */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.member-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.member-item:hover .member-avatar {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Tooltip */
.member-tooltip {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    z-index: 50;
    display: none;
    pointer-events: none;
}

.member-tooltip::before {
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    margin-top: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent var(--border) transparent transparent;
}

.member-item:hover .member-tooltip {
    display: block;
}

.checkin-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feed-item {
    padding: 0.75rem;
    border-left: 3px solid var(--border);
    background: var(--bg-body);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.feed-item.on_track {
    border-left-color: #10b981;
}

.feed-item.struggled {
    border-left-color: #f59e0b;
}

.feed-item.missed {
    border-left-color: #ef4444;
}

.feed-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.feed-note {
    font-style: italic;
    opacity: 0.9;
}

/* ─── Social Feed Extensions ─── */
#group-share-link-display {
    display: inline-block;
    word-break: break-all;
    white-space: normal;
    max-width: 100%;
}

.feed-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Post Owner Actions (Edit/Delete) */
.post-owner-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.post-action-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    opacity: 0.4;
    transition: opacity 0.2s, background 0.2s;
}

.post-action-btn:hover {
    opacity: 1;
    background: var(--bg-body);
    border-color: var(--border);
}

.post-delete-btn:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.feed-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.feed-content-body {
    padding-left: 3rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
}

.feed-status-line {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.feed-actions {
    padding-left: 3rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.reaction-btn {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.reaction-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.reaction-btn.active {
    background: #e0f2fe;
    /* light blue */
    border-color: #0ea5e9;
    color: #0284c7;
}

.comment-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 8px;
}

.comment-toggle-btn:hover {
    color: var(--text-main);
    text-decoration: underline;
}

.comments-container {
    margin-top: 0.75rem;
    padding-left: 3rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    display: none;
    box-sizing: border-box;
    /* PREVENT WIDTH EXPANSION */
    width: 100%;
}

.comments-container.show {
    display: block;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.comment-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.comment-bubble {
    background: var(--bg-main);
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    border-top-left-radius: 2px;
    flex: 1;
}

.comment-input-wrapper {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.comment-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: var(--bg-main);
    color: var(--text-main);
    box-sizing: border-box;
    /* PREVENT WIDTH EXPANSION */
    min-width: 0;
    /* Flexbox overflow fix */
}

.post-comment-btn {
    border: none;
    background: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.post-comment-btn:disabled {
    color: var(--text-muted);
}

/* ─── Group Invite: Email Row ─── */
.group-invite-email-section {
    margin-top: 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    padding-top: 1rem;
}

[data-theme="dark"] .group-invite-email-section {
    border-top-color: rgba(255, 255, 255, 0.07);
}

.group-invite-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 0.6rem;
}

.group-invite-email-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.group-invite-email-row input[type="email"] {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.group-invite-email-row input[type="email"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(170, 207, 81, 0.2);
}

.group-invite-feedback {
    font-size: 0.8rem;
    margin-top: 0.4rem;
    color: var(--text-muted);
    min-height: 1.1em;
}

/* ─── Group Reminder Time Picker ─── */
.group-reminder-box {
    text-align: left;
    margin-bottom: 1rem;
    background: var(--bg-body);
    padding: 0.9rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.group-reminder-box label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.group-reminder-box .setting-description {
    margin-bottom: 0.6rem;
}

.group-reminder-time-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

input[type="time"].group-reminder-time {
    width: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="time"].group-reminder-time:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(170, 207, 81, 0.2);
}