/* =============================================================================
   Dashboard — main tabs, sub-tabs, cards, sparkline, summaries
   ============================================================================= */

.main-tabs, .sub-tabs {
    display: flex;
    gap: 4px;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--nr-bg);
    border-bottom: 1px solid var(--nr-border);
}
.main-tabs::-webkit-scrollbar,
.sub-tabs::-webkit-scrollbar { display: none; }

.main-tab, .sub-tab {
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--nr-text-mute);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}
.main-tab:hover, .sub-tab:hover { color: var(--nr-text); }
.main-tab.is-active, .sub-tab.is-active {
    color: #1F1F1F;
    background: var(--nr-yellow);
}
[data-theme="dark"] .main-tab.is-active,
[data-theme="dark"] .sub-tab.is-active { color: #1F1F1F; }

.sub-tabs {
    border-bottom: 0;
    padding-top: 0.5rem;
    padding-bottom: 0;
}
.sub-tab {
    background: var(--nr-surface);
    border: 1px solid var(--nr-border);
    font-size: 0.82rem;
}

.dash {
    max-width: 880px;
    margin: 0 auto;
    padding: 1rem 1rem 5rem;
}

.dash-greet {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin: 0.5rem 0 1.25rem;
}
.dash-title { font-size: 1.6rem; margin: 0 0 0.25rem; font-weight: 700; }
.dash-quote { color: var(--nr-text-mute); margin: 0; font-size: 0.95rem; line-height: 1.5; }
.dash-sub   { color: var(--nr-text-mute); margin: 0 0 1.5rem; }

.dash-streak {
    display: flex; flex-direction: column; align-items: center;
    background: var(--nr-surface);
    border: 1px solid var(--nr-border);
    border-radius: 14px;
    padding: 0.6rem 0.9rem;
    min-width: 72px;
}
.streak-flame { font-size: 1.4rem; line-height: 1; }
.streak-num   { font-size: 1.3rem; font-weight: 700; line-height: 1; margin-top: 0.15rem; }
.streak-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nr-text-mute); }

.dash-card {
    background: var(--nr-surface);
    border: 1px solid var(--nr-border);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}
.card-h    { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 600; }
.card-sub  { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--nr-text-mute); margin-bottom: 0.4rem; }
.card-empty{ color: var(--nr-text-mute); font-size: 0.9rem; margin: 0.25rem 0; }

/* ----- Today snapshot ----- */
.snapshot-row {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 1rem;
    align-items: center;
}
@media (max-width: 600px) {
    .snapshot-row { grid-template-columns: auto 1fr; gap: 0.75rem; }
    .workout-status { grid-column: 1 / -1; padding-top: 1rem; }
}

.points-ring {
    position: relative;
    width: 80px; height: 80px;
}
.points-ring-fill {
    stroke: var(--nr-yellow);
    transition: stroke-dasharray 0.4s ease;
}
.points-ring.is-over .points-ring-fill { stroke: #FF8E72; }
.points-ring.is-over .ring-num         { color: #FF8E72; }
.ring-inner {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    line-height: 1;
}
.ring-num    { font-size: 1.2rem; font-weight: 700; }
.ring-target { font-size: 0.7rem; color: var(--nr-text-mute); }
.workout-burned { margin-top: 0.35rem; font-size: 0.72rem; color: var(--nr-text-mute); }
.ring-label  { position: absolute; bottom: -1.1rem; left: 0; right: 0; text-align: center;
               font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--nr-text-mute); }

.meal-ticks { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.meal-ticks .card-sub { width: 100%; }
.tick {
    width: 28px; height: 28px;
    border-radius: 999px;
    border: 1px solid var(--nr-border);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 600;
    color: var(--nr-text-mute);
    background: var(--nr-bg);
}
.tick.is-on { background: var(--nr-lime); color: #1F1F1F; border-color: transparent; }

.workout-line { font-size: 0.95rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--nr-border); margin-right: 0.4rem; vertical-align: middle; }
.dot.dot-on { background: var(--nr-lime); }

/* ----- Quick actions ----- */
.qa-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}
@media (max-width: 600px) {
    .qa-grid { grid-template-columns: repeat(2, 1fr); }
}
.qa {
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
    padding: 0.85rem 0.5rem;
    background: var(--nr-surface);
    border: 1px solid var(--nr-border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--nr-text);
    font-size: 0.78rem;
    text-align: center;
}
.qa:hover { background: var(--nr-bg); border-color: var(--nr-yellow); }
.qa-icon { font-size: 1.5rem; line-height: 1; }

/* ----- Sparkline ----- */
.sparkline-wrap { width: 100%; }
.sparkline { width: 100%; height: 120px; display: block; }
.sparkline-meta { display: flex; justify-content: space-between; font-size: 0.85rem; margin-top: 0.5rem; color: var(--nr-text); }
.sparkline-meta .muted { color: var(--nr-text-mute); font-size: 0.75rem; }

/* ----- Summary cards ----- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}
@media (max-width: 600px) {
    .summary-grid { grid-template-columns: 1fr; }
}
.summary-card {
    background: var(--nr-surface);
    border: 1px solid var(--nr-border);
    border-radius: 14px;
    padding: 1rem;
    text-align: center;
}
.sc-num { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.sc-lbl { color: var(--nr-text-mute); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.4rem; }

/* ----- Coming soon placeholder ----- */
.coming-soon-card {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--nr-text-mute);
}
.cs-icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.coming-soon-card .dash-title { color: var(--nr-text); }

/* ----- Plan upsell ----- */
.upsell { border-color: var(--nr-yellow); }

/* Password peek toggle — eye button overlaid on right side of password inputs */
.password-wrap {
    position: relative;
    display: block;
}
.password-wrap input[type="password"],
.password-wrap input[type="text"] {
    padding-right: 2.6rem;     /* room for the eye button */
}
.password-peek {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--nr-text-mute);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.password-peek:hover { color: var(--nr-text); background: rgba(0,0,0,0.05); }
@media (prefers-color-scheme: dark) {
    .password-peek:hover { background: rgba(255,255,255,0.06); }
}

/* Goals tab — list, cards, history */
.empty-goals { text-align: center; padding: 2rem 1rem; }
.empty-goals .cs-icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.empty-goals .card-empty { max-width: 36ch; margin: 0.5rem auto 1.25rem; }

.goal-list { display: flex; flex-direction: column; gap: 0.75rem; }
.goal-card { padding: 1.1rem; }
.goal-meta {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.78rem; color: var(--nr-text-mute);
    margin-bottom: 0.4rem;
}
.goal-type-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: var(--nr-yellow);
    color: #1F1F1F;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
}
.goal-type-pill.small { font-size: 0.68rem; }
.goal-status { color: var(--nr-text-mute); }
.goal-h     { margin: 0 0 0.35rem; font-size: 1.05rem; font-weight: 600; }
.goal-dates { margin: 0; color: var(--nr-text-mute); font-size: 0.85rem; }

.goal-history { list-style: none; padding: 0; margin: 0; }
.goal-history li {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--nr-border);
    font-size: 0.9rem;
}
.goal-history li:last-child { border-bottom: 0; }

/* Goals — type picker grid + direction toggle + projection card */
.goal-type-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
}
@media (min-width: 640px) {
    .goal-type-grid { grid-template-columns: repeat(3, 1fr); }
}
.goal-type-card {
    display: block;
    padding: 1.25rem 1rem;
    background: var(--nr-surface);
    border: 1px solid var(--nr-border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--nr-text);
    transition: border-color 0.15s, transform 0.05s;
}
.goal-type-card:hover { border-color: var(--nr-yellow); transform: translateY(-1px); }
.goal-type-card.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.goal-type-card.is-disabled:hover { border-color: var(--nr-border); transform: none; }
.gtc-icon { font-size: 2rem; line-height: 1; display: block; margin-bottom: 0.5rem; }
.gtc-h    { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 600; }
.gtc-sub  { margin: 0; color: var(--nr-text-mute); font-size: 0.85rem; line-height: 1.45; }

.dir-toggle {
    display: flex; gap: 0.5rem; align-items: stretch;
    background: var(--nr-bg); border: 1px solid var(--nr-border);
    padding: 4px; border-radius: 12px; margin-bottom: 1rem;
}
/* Use .dir-toggle .dir-opt (specificity 0,2,0) to beat .auth-form label (0,1,1)
   which would otherwise impose display:block and margin-top:0.9rem on these labels. */
.dir-toggle .dir-opt {
    flex: 1; cursor: pointer; padding: 0.55rem 0.6rem;
    border-radius: 9px; font-weight: 600; text-align: center;
    color: var(--nr-text-mute);
    margin: 0;
    display: flex; align-items: center; justify-content: center;
}
.dir-toggle .dir-opt input { position: absolute; opacity: 0; pointer-events: none; }
.dir-toggle .dir-opt:has(input:checked) { background: var(--nr-yellow); color: #1F1F1F; }

.projection {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.95rem;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.45;
    border: 1px solid var(--nr-border);
    background: var(--nr-surface);
    color: var(--nr-text);
}
.projection.is-safe   { border-color: rgba(168, 225, 12, 0.55); background: rgba(168, 225, 12, 0.10); }
.projection.is-unsafe { border-color: rgba(185, 28, 28, 0.45);  background: #FEE2E2; color: #991B1B; }
.projection.is-warn   { border-color: rgba(255, 180, 0, 0.55);  background: rgba(255, 210, 63, 0.15); color: #92620A; }
@media (prefers-color-scheme: dark) {
    .projection.is-unsafe { background: #3B1414; color: #FCA5A5; }
    .projection.is-warn   { background: rgba(255, 210, 63, 0.1); color: #FFD23F; }
}

/* Amber variant of the flash banner (gain-rate warning) */
.flash-banner--warn {
    background: rgba(255, 210, 63, 0.25);
    border: 1px solid rgba(255, 180, 0, 0.4);
    color: var(--nr-text);
}

/* Goals — body-comp progress block */
.goal-progress { margin-top: 0.85rem; }
.goal-progress-bar {
    height: 8px;
    background: var(--nr-bg);
    border: 1px solid var(--nr-border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.goal-progress-bar > span {
    display: block; height: 100%;
    background: linear-gradient(90deg, var(--nr-yellow), var(--nr-lime));
    transition: width 0.3s ease;
}
.goal-progress-meta {
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: var(--nr-text-mute);
}
.goal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    margin: 0.85rem 0 0;
}
.goal-stats > div {
    background: var(--nr-bg);
    border: 1px solid var(--nr-border);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}
.goal-stats dt {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--nr-text-mute); margin: 0 0 0.15rem;
}
.goal-stats dd {
    margin: 0; font-size: 1rem; font-weight: 600;
}

