/* ═══════════════════════════════════════
   Трекер привычек — Minimal Dark Theme (Apple-grade)
   ═══════════════════════════════════════ */

:root {
    --bg:          #000000;
    --surface:     #111113;
    --surface-2:   #1a1a1e;
    --surface-3:   #26262c;
    --border:      rgba(255, 255, 255, 0.08);
    --border-light:rgba(255, 255, 255, 0.12);

    --text:        #f5f5f7;
    --text-2:      #a1a1a6;
    --text-3:      #6e6e73;

    --green:       #34d399;
    --green-dim:   rgba(52, 211, 153, 0.12);
    --green-done:  #10b981;
    --amber:       #fbbf24;
    --amber-dim:   rgba(251, 191, 36, 0.12);
    --violet:      #a78bfa;
    --violet-dim:  rgba(167, 139, 250, 0.12);
    --red:         #ef4444;

    --radius-s:    10px;
    --radius-m:    16px;
    --radius-l:    22px;
    --radius-full: 100px;

    --font-sans:   -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', system-ui, Roboto, sans-serif;
    --font-mono:   'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.app {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: max(calc(env(safe-area-inset-top, 0px) + 14px), 30px);
    padding-bottom: max(calc(env(safe-area-inset-bottom, 0px) + 20px), 32px);
    padding-left: max(env(safe-area-inset-left, 0px), 16px);
    padding-right: max(env(safe-area-inset-right, 0px), 16px);
}


/* ──────────────── Header ──────────────── */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    gap: 8px;
    min-height: 44px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.app-brand-icon {
    font-size: 18px;
    line-height: 1;
}

.app-title {
    font-size: 21px;
    font-weight: 750;
    color: var(--text);
    letter-spacing: -0.4px;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    max-width: 140px;
}

.user-chip-icon {
    font-size: 12px;
    opacity: 0.8;
}

.user-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-push-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-push-toggle.active {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.35);
    color: var(--green);
}

.btn-push-toggle:active {
    transform: scale(0.94);
}


/* ──────────────── Progress Hero ──────────────── */

.progress-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.hero-status-pill {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    text-align: center;
    max-width: 100%;
    line-height: 1.35;
}

.ring-area {
    position: relative;
    width: 126px;
    height: 126px;
}

.progress-ring {
    transform: rotate(-90deg);
    width: 126px;
    height: 126px;
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: var(--green);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 351.86;
    stroke-dashoffset: 351.86;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ring-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: baseline;
    gap: 1px;
}

.ring-percent {
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ring-unit {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-3);
}

.stats-row {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-around;
    padding-top: 2px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-streak {
    color: var(--amber);
}

.streak-icon {
    font-size: 14px;
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-3);
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
}


/* ──────────────── Sections ──────────────── */

.section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 2px;
}

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

.section-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.section-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-subtle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon-subtle:active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    transform: scale(0.94);
}

.btn-create-habit {
    background: var(--green);
    border: none;
    color: #060907;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-create-habit:active {
    opacity: 0.85;
    transform: scale(0.97);
}


/* ──────────────── Habit Cards ──────────────── */

.habits-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.habit-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
}

.habit-card.completed {
    border-color: rgba(52, 211, 153, 0.25);
}

.habit-card.saved {
    border-color: rgba(167, 139, 250, 0.25);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.habit-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.habit-emoji {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.habit-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.habit-name {
    font-size: 16px;
    font-weight: 650;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.habit-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 1px;
}

.habit-time {
    font-size: 11.5px;
    color: var(--text-3);
    font-weight: 500;
    font-family: var(--font-mono);
}

.habit-badge-rest {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.04);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.habit-badge-challenge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.25);
    color: var(--violet);
    font-size: 10.5px;
    font-weight: 650;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
}

.habit-badge-challenge:active {
    background: rgba(167, 139, 250, 0.22);
}

.habit-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.habit-streak {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--amber);
    white-space: nowrap;
}

.btn-habit-config {
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-habit-config:active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    transform: scale(0.95);
}

/* Progress bar inside habit */
.habit-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.progress-current {
    color: var(--text);
    font-weight: 700;
}

.progress-total {
    color: var(--text-3);
    font-weight: 500;
}

.progress-pct {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: var(--radius-full);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.done {
    background: var(--green-done);
}

/* Action buttons */
.habit-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 11px 6px;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
}

.action-btn:active {
    transform: scale(0.96);
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--green);
}

.save-btn {
    width: 44px;
    flex-shrink: 0;
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid rgba(167, 139, 250, 0.18);
    color: var(--violet);
    padding: 10px 0;
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.save-btn:active {
    transform: scale(0.93);
    background: rgba(167, 139, 250, 0.2);
}

/* Binary (checkbox-style) button */
.binary-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-2);
    padding: 11px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.binary-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.08);
}

.binary-btn.done {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--green);
    font-weight: 650;
    cursor: default;
}

.binary-btn.done:active {
    transform: none;
}

/* Save active flag */
.saved-flag {
    font-size: 12.5px;
    color: var(--violet);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
    color: var(--violet);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    background: var(--surface);
    border-radius: var(--radius-m);
}

.empty-title {
    font-size: 15px;
    font-weight: 650;
    color: var(--text-2);
    margin-bottom: 6px;
}

.empty-desc {
    font-size: 13px;
    color: var(--text-3);
    line-height: 1.45;
}

.empty-desc strong {
    color: var(--text-2);
}


/* ──────────────── Heatmap (GitHub Style) ──────────────── */

.heatmap-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.heatmap-scroll-area {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.heatmap-layout {
    display: flex;
    gap: 4px;
    min-width: max-content;
}

.heatmap-labels-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 18px; /* Offset for month row */
    margin-right: 4px;
}

.hm-day-label {
    height: 14px;
    font-size: 9.5px;
    font-weight: 600;
    color: var(--text-3);
    line-height: 14px;
    text-align: right;
    font-family: var(--font-mono);
}

.hm-week-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hm-month-header {
    height: 14px;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-3);
    line-height: 14px;
    text-transform: capitalize;
    font-family: var(--font-sans);
}

.hm-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.hm-cell:active {
    transform: scale(1.3);
}

.hm-level-0 {
    background: rgba(255, 255, 255, 0.06);
}

.hm-level-1 {
    background: rgba(46, 213, 115, 0.3);
}

.hm-level-2 {
    background: rgba(46, 213, 115, 0.55);
}

.hm-level-3 {
    background: rgba(46, 213, 115, 0.8);
}

.hm-level-4 {
    background: #2ed573;
    box-shadow: 0 0 6px rgba(46, 213, 115, 0.45);
}

.hm-future {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.07);
    cursor: default;
}

.hm-future:active {
    transform: none;
}

.heatmap-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-3);
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}


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

.hidden {
    display: none !important;
}

/* ──────────────── Modal ──────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    padding: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-sheet {
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px max(calc(env(safe-area-inset-bottom, 0px) + 16px), 24px) 20px;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
    animation: sheetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheetSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.sheet-drag-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-light);
    margin: 0 auto 8px auto;
    opacity: 0.6;
}

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

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    border: none;
    color: var(--text-3);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.modal-close:active {
    background: var(--surface-3);
}

.modal-desc {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.45;
}

.reasons-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: 45vh;
}

.reason-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 14px 14px;
    font-size: 14px;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-s);
    transition: background 0.1s ease, transform 0.08s ease;
    font-family: var(--font-sans);
}

.reason-btn:active {
    transform: scale(0.98);
    background: var(--violet-dim);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--violet);
}


/* ──────────────── Toast ──────────────── */

.toast {
    position: fixed;
    top: max(calc(env(safe-area-inset-top, 0px) + 20px), 64px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 12px 22px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    max-width: 90vw;
    text-overflow: ellipsis;
    overflow: hidden;
    pointer-events: none;
}

.toast.hidden {
    display: none;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.empty-state {
    background: var(--surface);
    border-radius: var(--radius-m);
    padding: 24px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px dashed var(--border);
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.empty-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-primary {
    background: var(--green);
    color: #0b0f0d;
    border: none;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
}

.btn-primary:active {
    opacity: 0.85;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
}

.btn-secondary:active {
    background: var(--surface-3);
}

.modal-sheet-form {
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    padding-bottom: max(calc(env(safe-area-inset-bottom, 0px) + 24px), 32px);
}

.habit-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.half {
    flex: 1;
    min-width: 0;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    font-family: var(--font-sans);
    letter-spacing: -0.01em;
}

.form-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.form-label-hint {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-3);
    font-family: var(--font-sans);
}

.form-hint {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border);
    padding: 10px 12px;
    border-radius: 12px;
}

.form-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 0 14px;
    height: 46px;
    font-size: 15px; /* Prevents auto-zoom on mobile iOS */
    border-radius: 12px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--green);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(46, 213, 115, 0.15);
}

.emoji-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.emoji-opt {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 22px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.emoji-opt:active {
    transform: scale(0.94);
}

.emoji-opt.selected {
    border-color: var(--green);
    background: rgba(46, 213, 115, 0.14);
    box-shadow: 0 0 12px rgba(46, 213, 115, 0.2);
}

/* ──────────────── Schedule Picker ──────────────── */

.schedule-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}

.sched-btn {
    background: transparent;
    border: none;
    color: var(--text-2);
    padding: 9px 4px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    font-family: var(--font-sans);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.sched-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    font-weight: 700;
}

.schedule-block {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.weekdays-chips {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.wday-chip {
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-3);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.wday-chip.active {
    background: var(--green);
    color: #0b0f0d;
    border-color: var(--green);
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
}

.mday-chip {
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.mday-chip.active {
    background: var(--green);
    color: #0b0f0d;
    border-color: var(--green);
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.sched-presets {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-3);
    padding-top: 2px;
}

.preset-link {
    background: none;
    border: none;
    color: var(--green);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.preset-link:active {
    opacity: 0.7;
}

.preset-sep {
    color: var(--border-light);
}

/* Rest day badge for habits */
.habit-card.rest-day {
    opacity: 0.6;
    background: rgba(18, 22, 26, 0.6);
}

.habit-badge-rest {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-3);
    background: var(--surface-3);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px dashed var(--border);
}

.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.type-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-2);
    padding: 12px 10px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-family: var(--font-sans);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.type-btn .type-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.type-btn .type-sub {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-3);
}

.type-btn.active {
    background: rgba(46, 213, 115, 0.08);
    border-color: rgba(46, 213, 115, 0.5);
    box-shadow: 0 0 16px rgba(46, 213, 115, 0.12);
}

.type-btn.active .type-title {
    color: #ffffff;
}

.type-btn.active .type-sub {
    color: var(--green);
}

/* ──────────────── Time Window Card & iOS Switch ──────────────── */

.time-window-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.time-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.time-window-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.time-window-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #ffffff;
    font-family: var(--font-sans);
}

.time-window-subtitle {
    font-size: 11.5px;
    color: var(--text-3);
    font-family: var(--font-sans);
}

.ios-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.14);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 26px;
}

.ios-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.ios-switch input:checked + .ios-slider {
    background-color: var(--green);
}

.ios-switch input:checked + .ios-slider:before {
    transform: translateX(18px);
}

.time-range-wrap {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.time-range-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    padding: 0 12px;
    height: 44px;
    box-sizing: border-box;
}

.time-prefix {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-right: 8px;
    font-family: var(--font-sans);
}

.time-clean-input {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    width: 100%;
    outline: none;
    padding: 0;
    -webkit-appearance: none;
}

.time-arrow {
    color: var(--text-3);
    font-size: 14px;
    font-weight: 700;
}

/* ──────────────── Challenge Invite Button ──────────────── */

.btn-challenge-invite {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.28);
    color: #c084fc;
    min-height: 44px;
    width: 100%;
    padding: 0 16px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-challenge-invite:active {
    background: rgba(168, 85, 247, 0.22);
    transform: scale(0.985);
}

/* ──────────────── Modal Actions ──────────────── */

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.btn-submit {
    background: var(--green);
    color: #0b0f0d;
    border: none;
    height: 48px;
    min-height: 48px;
    font-size: 15.5px;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(46, 213, 115, 0.28);
}

.btn-submit:active {
    opacity: 0.88;
    transform: scale(0.985);
}

.btn-delete {
    background: transparent;
    color: #f87171;
    border: none;
    height: 42px;
    min-height: 42px;
    font-size: 14.5px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-delete:active {
    background: rgba(248, 113, 113, 0.12);
}

/* ──────────────── Push Notification Modal Styles ──────────────── */

.modal-sheet-push {
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-icon {
    font-size: 18px;
}

.push-status-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.push-status-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.push-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
    transition: all 0.2s ease;
}

.push-indicator.active {
    background: var(--green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.push-status-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.btn-push-action {
    background: var(--green);
    color: #0b0f0d;
    border: none;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.btn-push-action.active {
    background: var(--surface-3);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn-push-action:active {
    opacity: 0.85;
}

.ios-guide {
    background: rgba(59, 130, 246, 0.08);
    border: 1px dashed rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-m);
    padding: 14px 16px;
}

.ios-guide-title {
    font-size: 13px;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 8px;
}

.ios-steps {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.45;
}

.ios-steps strong {
    color: var(--text);
}

.ios-icon {
    font-size: 14px;
    padding: 1px 4px;
    background: var(--surface-3);
    border-radius: 4px;
}

.push-schedule-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-item {
    background: var(--surface-2);
    border-radius: var(--radius-s);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.schedule-icon {
    font-size: 20px;
    line-height: 1.2;
}

.schedule-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.schedule-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.schedule-time {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--green);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.schedule-desc {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.35;
}

.btn-test-push {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    padding: 12px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background 0.15s ease;
}

.btn-test-push:active {
    background: var(--surface-3);
}

/* ──────────────── PWA Installation Blocker ──────────────── */

.pwa-standalone #pwa-install-overlay {
    display: none !important;
}

body.pwa-blocked {
    overflow: hidden !important;
}

body.pwa-blocked .app {
    filter: blur(10px);
    pointer-events: none;
    user-select: none;
    opacity: 0.15;
}

.pwa-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(10, 12, 14, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(calc(env(safe-area-inset-top, 0px) + 16px), 20px) 16px max(calc(env(safe-area-inset-bottom, 0px) + 16px), 20px) 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pwa-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-l);
    padding: 24px 20px;
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: pwaCardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaCardFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pwa-badge-top {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--green);
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.08em;
}

.pwa-hero-icon {
    position: relative;
    margin: 4px 0 2px 0;
}

.pwa-logo {
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
    line-height: 1.25;
}

.pwa-subtitle {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-2);
}

.pwa-os-guide {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 16px 14px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwa-os-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-os-icon {
    font-size: 16px;
}

.pwa-os-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.pwa-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwa-step-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-2);
}

.pwa-step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--border-light);
    color: var(--green);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pwa-step-content strong {
    color: var(--text);
}

.pwa-inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    vertical-align: middle;
    color: var(--text);
    font-family: system-ui, -apple-system;
}

.btn-pwa-primary {
    width: 100%;
    background: var(--green);
    color: #0b0f0d;
    border: none;
    font-size: 13.5px;
    font-weight: 700;
    padding: 12px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.15s ease;
}

.btn-pwa-primary:active {
    opacity: 0.85;
}

.pwa-footer {
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.pwa-bypass-btn {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-s);
    transition: color 0.15s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pwa-bypass-btn:hover,
.pwa-bypass-btn:active {
    color: var(--text-2);
}

/* ──────────────── Invite Modal ──────────────── */

.invite-banner {
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: var(--radius-m);
    padding: 12px 14px;
}

.invite-banner-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.45;
}

.invite-banner-text strong {
    color: var(--violet);
}

.invite-habit-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 14px;
}

.invite-habit-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.invite-emoji {
    font-size: 30px;
    line-height: 1;
    background: var(--surface-3);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-m);
    flex-shrink: 0;
}

.invite-habit-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.invite-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.invite-target {
    font-size: 13px;
    color: var(--green);
    font-weight: 600;
}

.invite-schedule {
    font-size: 12px;
    color: var(--text-2);
}

.modal-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    padding: 12px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background 0.15s ease;
}

.btn-secondary:active {
    background: var(--surface-3);
    color: var(--text);
}

.btn-full {
    width: 100%;
}

/* ──────────────── Challenge Modal ──────────────── */

.ch-info-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 10px 14px;
}

.ch-members-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.btn-ch-share {
    background: var(--surface-3);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-ch-share:active {
    background: var(--green-dim);
    color: var(--green);
    border-color: var(--green);
}

.ch-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.ch-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-3);
}

.ch-participants-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ch-participant-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ch-participant-card.is-me {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.05);
}

.ch-p-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ch-p-name-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ch-p-name {
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
}

.ch-p-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.ch-p-tag.tag-me {
    background: rgba(52, 211, 153, 0.2);
    color: var(--green);
}

.ch-p-tag.tag-creator {
    background: rgba(251, 191, 36, 0.2);
    color: var(--amber);
}

.ch-p-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

.ch-p-val strong {
    color: var(--text);
}

.ch-p-alltime {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.ch-stat-pill {
    background: var(--surface-3);
    border-radius: var(--radius-s);
    padding: 4px 8px;
    font-size: 11.5px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ch-stat-pill strong {
    color: var(--text);
}

/* ──────────────── Join Code & Safari PWA Invite Banner ──────────────── */

.section-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-join-code {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-join-code:active {
    background: var(--surface-3);
    color: var(--text);
    transform: scale(0.97);
}

.code-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.code-input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 1px;
}

.btn-paste-code {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    padding: 0 12px;
    height: 44px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-paste-code:active {
    background: var(--surface-3);
}

/* Safari PWA Invite Banner */
.pwa-invite-banner {
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: var(--radius-m);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
    text-align: left;
}

.pwa-invite-badge {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    color: var(--violet);
    background: rgba(167, 139, 250, 0.15);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
}

.pwa-invite-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
}

.pwa-invite-code-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.pwa-code-label {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pwa-code-number {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 800;
    color: var(--green);
    letter-spacing: 3px;
}

.btn-pwa-copy {
    width: 100%;
    background: var(--surface-3);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 650;
    padding: 8px 12px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
}

.btn-pwa-copy:active {
    background: var(--green-dim);
    color: var(--green);
    border-color: var(--green);
}

.pwa-invite-instructions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pwa-inst-text {
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.45;
}

.pwa-inst-text strong {
    color: var(--text);
}

/* ──────────────── Nudge / Ping Friend in Challenge ──────────────── */

.btn-nudge {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.16), rgba(245, 158, 11, 0.22));
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
}

.btn-nudge:active {
    transform: scale(0.95);
    background: rgba(245, 158, 11, 0.35);
}

.badge-nudged {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 8px;
    font-family: var(--font-sans);
}

.badge-completed {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--green);
    background: rgba(46, 213, 115, 0.1);
    padding: 4px 10px;
    border-radius: 8px;
    font-family: var(--font-sans);
}

.ch-p-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

/* ──────────────── Weekly Digest Modal ──────────────── */

.modal-sheet-digest {
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    padding-bottom: max(calc(env(safe-area-inset-bottom, 0px) + 24px), 32px);
}

.digest-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
}

.digest-hero-card {
    background: linear-gradient(135deg, rgba(46, 213, 115, 0.12), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(46, 213, 115, 0.28);
    border-radius: 20px;
    padding: 22px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.digest-hero-val {
    font-size: 52px;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.02em;
    line-height: 1;
    font-family: var(--font-sans);
}

.digest-hero-label {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 600;
}

.digest-dates {
    font-size: 11.5px;
    color: var(--text-3);
    font-weight: 500;
    margin-top: 2px;
}

.digest-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.digest-stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.digest-stat-card.full-width {
    grid-column: 1 / -1;
}

.digest-stat-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.digest-stat-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.digest-stat-num {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-sans);
}

.digest-stat-sub {
    font-size: 12px;
    color: var(--text-2);
}

.digest-quote-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--text);
    text-align: center;
}
