/* ============================================================
   Daily Routine — stylesheet
   Aesthetic: warm cream paper, deep ink, sage accent, serif italics
   ============================================================ */

:root {
    --bg:        #FBF8F1;
    --bg-2:      #F4EFE3;
    --surface:   #FFFFFF;
    --surface-2: #FBF7EC;
    --ink:       #1F1B16;
    --ink-2:     #3D362E;
    --muted:     #7A7062;
    --muted-2:   #A8A092;
    --line:      #E5DECC;
    --line-2:    #D8CFB9;

    --accent:    #2F5E3B;          /* deep sage */
    --accent-2:  #C26339;          /* terracotta */
    --warn:      #B8722A;
    --danger:    #B0382E;

    --shadow-sm: 0 1px 2px rgba(31, 27, 22, .04), 0 0 0 1px rgba(31, 27, 22, .04);
    --shadow:    0 2px 8px rgba(31, 27, 22, .06), 0 0 0 1px rgba(31, 27, 22, .04);
    --shadow-lg: 0 8px 24px rgba(31, 27, 22, .08), 0 0 0 1px rgba(31, 27, 22, .04);

    --radius:    14px;
    --radius-sm: 8px;
    --radius-lg: 22px;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-image:
        radial-gradient(circle at 20% 0%, rgba(194, 99, 57, .04), transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(47, 94, 59, .04), transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    padding-bottom: 80px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 500; font-family: var(--font-body); letter-spacing: 0; line-height: 1.35; }

em { font-style: italic; font-family: var(--font-display); color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ============================================================ TOPBAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(251, 248, 241, .85);
    backdrop-filter: saturate(150%) blur(8px);
    -webkit-backdrop-filter: saturate(150%) blur(8px);
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
}
.brand-mark {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}
.brand-mark::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: var(--bg);
    border-radius: 50%;
}
.brand-mark::after {
    content: '';
    position: absolute;
    inset: 12px;
    background: var(--accent);
    border-radius: 50%;
}
.brand-name em { color: var(--accent-2); }

.topnav { display: flex; gap: 4px; }
.topnav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 500;
    font-size: .92rem;
    transition: all .18s ease;
}
.topnav a:hover { color: var(--ink); background: var(--bg-2); }
.topnav a.is-active { color: var(--ink); background: var(--bg-2); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-name { font-size: .9rem; color: var(--muted); }
.logout {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    display: grid; place-items: center;
    color: var(--muted);
    font-size: 1.1rem;
    transition: all .18s;
}
.logout:hover { border-color: var(--ink); color: var(--ink); }

/* ============================================================ CONTAINER */
.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 36px 24px 60px;
}

/* ============================================================ FLASH */
.flash {
    max-width: 980px;
    margin: 16px auto 0;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: .92rem;
    border: 1px solid;
}
.flash-ok    { background: #EFF5EC; border-color: #C8DCBC; color: #2A4A20; }
.flash-error { background: #FBEBE9; border-color: #ECC4BD; color: #5C1F18; }

/* ============================================================ DASHBOARD HERO (refreshed) */
.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 36px;
    align-items: end;
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.hero-text { min-width: 0; }
.hero-eyebrow {
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 1rem;
    font-style: italic;
    margin: 0 0 6px;
    letter-spacing: 0.01em;
}
.hero-eyebrow em {
    color: var(--accent);
    font-style: italic;
}
.hero-text h1 {
    font-size: 3rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.05;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
}
.hero-meta {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

.hero-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.hero-progress {
    display: flex;
    justify-content: center;
}
.hero-day-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}
.hero-today-btn {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: .82rem;
    font-weight: 500;
    transition: all .15s ease;
    text-decoration: none;
}
.hero-today-btn:hover {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

/* Make the ring slightly more refined */
.ring {
    --pct: 0;
    --size: 88px;
    width: var(--size); height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--bg-2) 0);
    position: relative;
    display: grid; place-items: center;
    transition: background .4s ease;
}
.ring-inner {
    position: absolute;
    inset: 7px;
    background: var(--bg);
    border-radius: 50%;
    display: grid; place-items: center;
    text-align: center;
}
.ring-num {
    font-family: var(--font-display);
    font-size: 1.85rem;
    line-height: 1;
    color: var(--ink);
}
.ring-of {
    font-size: .68rem;
    color: var(--muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ============================================================ NEXT UP INDICATOR */
.next-up {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    margin-bottom: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.next-up-label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: .1em;
    background: color-mix(in srgb, var(--accent-2) 12%, transparent);
    padding: 4px 10px;
    border-radius: 999px;
}
@keyframes pulseRing {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 50%, transparent); }
    50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-2) 0%,  transparent); }
}
.next-up-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-2);
    animation: pulseRing 1.6s ease-out infinite;
    flex-shrink: 0;
}
.next-up-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--ink);
    flex: 1;
    min-width: 0;
}
.next-up-time {
    color: var(--muted);
    font-size: .92rem;
}
.next-up-done {
    border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.next-up-done em {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--accent);
    font-size: 1.1rem;
}

/* ============================================================ TIME-OF-DAY BANDS */
.band {
    margin-bottom: 28px;
}
.band-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 4px;
}
.band-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-2);
    flex-shrink: 0;
}
.band-morning   .band-dot { background: #E8B53D; }
.band-midday    .band-dot { background: #E07845; }
.band-afternoon .band-dot { background: #C26339; }
.band-evening   .band-dot { background: #7C5E94; }
.band-night     .band-dot { background: #3B5A8C; }

.band-head h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 400;
    color: var(--ink-2);
    margin: 0;
    letter-spacing: 0.01em;
}
.band-count {
    font-size: .72rem;
    color: var(--muted);
    background: var(--bg-2);
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 500;
    margin-left: auto;
}

/* ============================================================ STAGGERED CARD ENTRANCE */
@keyframes cardFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
    .routine-card {
        opacity: 0;
        animation: cardFadeUp 0.45s ease-out forwards;
        animation-delay: calc(var(--i, 0) * 35ms);
    }
}

/* ============================================================ TREND CHART */
.trend-block { padding-top: 24px; }
.trend-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.trend-head h2 {
    font-style: italic;
    font-weight: 400;
    margin: 0;
    font-size: 1.4rem;
}
.trend-head h2 em { color: var(--accent); }
.trend-svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 180px;
}
.trend-empty {
    text-align: center;
    padding: 24px;
    font-style: italic;
    font-family: var(--font-display);
}

/* ============================================================ DAY OF WEEK BARS */
.dow-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    align-items: end;
    margin-top: 10px;
}
.dow-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.dow-bar-wrap {
    width: 100%;
    height: 110px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.dow-bar {
    width: 70%;
    background: color-mix(in srgb, var(--accent) 75%, transparent);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 2px;
    transition: height .5s ease;
}
.dow-col.is-best .dow-bar {
    background: var(--accent);
}
.dow-col.is-best::after {
    content: 'best';
    position: absolute;
    top: 6px;
    font-size: .6rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.dow-col.is-best { position: relative; }
.dow-pct {
    font-family: var(--font-display);
    font-size: .92rem;
    color: var(--ink);
    line-height: 1;
}
.dow-col.is-best .dow-pct { color: var(--accent); font-weight: 500; }
.dow-label {
    font-size: .72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ============================================================ PERSONAL BEST CARD */
.best-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 26px;
    margin-bottom: 22px;
    background: linear-gradient(120deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 80%, var(--accent-2)) 100%);
    color: var(--bg);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}
.best-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(251, 248, 241, .12), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.best-card-text { position: relative; min-width: 0; }
.best-card-label {
    margin: 0 0 4px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(251, 248, 241, .75);
    font-weight: 600;
}
.best-card-text h2 {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.6rem;
    color: var(--bg);
    line-height: 1.15;
    overflow-wrap: break-word;
}
.best-card-num {
    text-align: right;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
}
.best-num {
    display: block;
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 400;
    color: var(--bg);
    line-height: 1;
}
.best-unit {
    display: block;
    font-size: .72rem;
    color: rgba(251, 248, 241, .8);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-top: 4px;
}

/* card-block h2 italic accent */
.card-block h2 em {
    color: var(--accent);
    font-style: italic;
}

/* ============================================================ DASHBOARD HERO (refreshed) — END */

.date-nav {
    width: 38px; height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    display: grid; place-items: center;
    color: var(--muted);
    font-size: 1.05rem;
    transition: all .2s ease;
    background: var(--surface);
    text-decoration: none;
}
.date-nav:hover {
    border-color: var(--ink);
    color: var(--ink);
    transform: translateY(-1px);
}

/* ============================================================ ROUTINE CARDS */
.routines-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.routine-card {
    display: grid;
    grid-template-columns: 86px 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: all .2s ease;
}
.routine-card:hover {
    border-color: var(--line-2);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.routine-card.is-done {
    background: var(--surface-2);
    opacity: .7;
}
.routine-card.is-done h3 {
    text-decoration: line-through;
    text-decoration-color: var(--muted-2);
    text-decoration-thickness: 1px;
}
.routine-card.is-skipped { opacity: .5; }

.routine-time { display: flex; flex-direction: column; gap: 2px; }
.t-main {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--ink);
    line-height: 1;
}
.t-dur {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.routine-cat {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    background: color-mix(in srgb, var(--cat) 12%, transparent);
    color: var(--cat);
    margin-bottom: 6px;
}
.routine-body h3 {
    margin: 2px 0;
    color: var(--ink);
    font-size: 1.05rem;
}
.routine-notes {
    margin: 4px 0 0;
    font-size: .85rem;
    color: var(--muted);
}

.routine-actions {
    display: flex; gap: 8px;
}
.btn-done, .btn-skip {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    display: grid; place-items: center;
    transition: all .18s;
}
.btn-done:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}
.btn-skip:hover {
    border-color: var(--muted);
    color: var(--ink);
}
.routine-card.is-done .btn-done {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}
.routine-card.is-skipped .btn-skip {
    border-color: var(--muted);
    background: var(--bg-2);
    color: var(--ink);
}

/* ============================================================ EMPTY STATE */
.empty {
    text-align: center;
    padding: 60px 24px;
    background: var(--surface);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-lg);
}
.empty-line {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--ink);
    margin: 0 0 8px;
}
.empty p { color: var(--muted); margin: 0 0 20px; }

/* ============================================================ WEEK VIEW */
.week-hero {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}
.week-hero-text { text-align: center; flex: 1; }
.week-hero-text h1 { font-size: 2.2rem; font-style: italic; }
.week-hero-text p { color: var(--muted); margin: 4px 0 0; }

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}
.week-day {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    transition: all .2s;
}
.week-day:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.week-day.is-today { border-color: var(--accent); border-width: 2px; padding: 13px; }

.week-day-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 10px;
}
.wd-name {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.wd-num {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--ink);
}
.week-day-bar {
    height: 3px;
    background: var(--bg-2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}
.week-day-fill {
    height: 100%;
    background: var(--accent);
    transition: width .3s ease;
}
.week-day-list { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.week-item {
    font-size: .72rem;
    padding: 4px 6px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--cat) 8%, transparent);
    border-left: 2px solid var(--cat);
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.week-item.is-done {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    opacity: .55;
}
.wi-time { color: var(--muted); margin-right: 4px; }
.week-day-empty {
    margin: 0; color: var(--muted-2); font-size: 1rem;
}
.week-more { font-size: .7rem; color: var(--muted); margin: 4px 0 0; }
.week-day-foot {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    font-size: .75rem;
    color: var(--muted);
    text-align: right;
    font-family: var(--font-display);
}

/* ============================================================ PAGE HEAD */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 2.4rem; font-style: italic; font-weight: 400; }
.page-head p { color: var(--muted); margin: 6px 0 0; font-style: italic; font-family: var(--font-display); }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============================================================ FORM (routine) */
.card-form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}
.card-form h2 {
    font-style: italic;
    font-weight: 400;
    margin-bottom: 22px;
}
.card-form form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.card-form label, .card-form .full {
    display: flex; flex-direction: column;
    gap: 6px;
}
.card-form .full { grid-column: 1 / -1; }
.card-form span, .label-text {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: .01em;
}
.card-form input, .card-form select, .card-form textarea {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    color: var(--ink);
    transition: border-color .15s;
}
.card-form input:focus, .card-form select:focus, .card-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

.dow {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.dow-pill {
    cursor: pointer;
    user-select: none;
}
.dow-pill input { display: none; }
.dow-pill span {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--bg);
    transition: all .15s;
}
.dow-pill input:checked + span {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 8px;
}

/* ============================================================ BUTTONS */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 11px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    transition: all .18s;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-2);
}
.btn-secondary:hover { border-color: var(--ink); }
.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* ============================================================ MANAGE ROUTINES */
.routines-manage {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}
.manage-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--cat);
    border-radius: var(--radius);
    transition: all .2s;
    cursor: pointer;
}
.manage-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.manage-time {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--ink);
}
.manage-cat {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    color: var(--cat);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 4px;
}
.manage-card h3 { margin: 0; font-size: 1.05rem; }
.manage-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .82rem;
}
.manage-streak {
    text-align: center;
    padding-left: 14px;
    border-left: 1px solid var(--line);
}
.streak-num {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--accent);
    line-height: 1;
}
.streak-label {
    display: block;
    font-size: .7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-top: 2px;
}

/* ============================================================ STATS */
.stats-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
}
.stat-card.big {
    background: linear-gradient(135deg, #1F1B16 0%, #3D362E 100%);
    color: var(--bg);
    border-color: var(--ink);
}
.stat-label {
    font-size: .78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0 0 10px;
}
.stat-card.big .stat-label { color: rgba(251, 248, 241, .6); }
.stat-num {
    font-family: var(--font-display);
    font-size: 2.6rem;
    line-height: 1;
    margin: 0 0 6px;
    font-weight: 400;
}
.stat-card.big .stat-num { font-size: 3.4rem; }
.pct {
    font-size: 1.4rem;
    color: var(--muted);
    margin-left: 4px;
}
.stat-card.big .pct { color: rgba(251, 248, 241, .5); }
.stat-sub {
    font-size: .85rem;
    color: var(--muted);
    margin: 0;
    font-style: italic;
    font-family: var(--font-display);
}
.stat-card.big .stat-sub { color: rgba(251, 248, 241, .7); }

.card-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
}
.card-block h2 {
    font-style: italic;
    font-weight: 400;
    margin-bottom: 20px;
    font-size: 1.4rem;
}
.card-block h2 .muted { font-style: normal; font-size: .85rem; }

.cat-bars { display: flex; flex-direction: column; gap: 14px; }
.cat-row {
    display: grid;
    grid-template-columns: 90px 1fr 50px 70px;
    gap: 14px;
    align-items: center;
}
.cat-name {
    font-weight: 500;
    color: var(--cat);
    font-size: .92rem;
}
.cat-bar {
    height: 10px;
    background: var(--bg-2);
    border-radius: 999px;
    overflow: hidden;
}
.cat-bar-fill {
    height: 100%;
    background: var(--cat);
    border-radius: 999px;
    transition: width .4s ease;
}
.cat-pct {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--ink);
}
.cat-count {
    font-size: .82rem;
    color: var(--muted);
    text-align: right;
}

.streak-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.streak-list li {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.streak-dot { width: 10px; height: 10px; border-radius: 50%; }
.streak-title { font-weight: 500; }
.streak-val {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 1.05rem;
}

/* Heatmap */
.heatmap {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}
.heat-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--bg-2);
}
.heat-0 { background: var(--bg-2); }
.heat-1 { background: color-mix(in srgb, var(--accent) 25%, var(--bg-2)); }
.heat-2 { background: color-mix(in srgb, var(--accent) 50%, var(--bg-2)); }
.heat-3 { background: color-mix(in srgb, var(--accent) 75%, var(--bg-2)); }
.heat-4 { background: var(--accent); }

.heat-legend {
    display: flex; gap: 4px; align-items: center;
    font-size: .78rem; color: var(--muted);
}
.heat-legend .heat-cell {
    width: 14px; height: 14px;
    aspect-ratio: auto;
}

/* ============================================================ AUTH */
.auth-body {
    background: var(--bg);
    background-image:
        radial-gradient(circle at 20% 10%, rgba(194, 99, 57, .08), transparent 50%),
        radial-gradient(circle at 90% 90%, rgba(47, 94, 59, .08), transparent 50%);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    box-shadow: var(--shadow-lg);
}
.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}
.auth-brand .brand-mark {
    width: 44px; height: 44px;
    margin: 0 auto 16px;
}
.auth-brand h1 {
    font-size: 1.8rem;
    margin-bottom: 6px;
    font-weight: 500;
}
.auth-brand p {
    color: var(--muted);
    font-style: italic;
    font-family: var(--font-display);
    margin: 0;
}

.auth-form {
    display: flex; flex-direction: column; gap: 14px;
}
.auth-form label {
    display: flex; flex-direction: column; gap: 6px;
}
.auth-form span {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
}
.auth-form input {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    color: var(--ink);
    transition: border-color .15s;
}
.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}
.auth-form button {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    padding: 13px;
}

.auth-alt {
    text-align: center;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: .9rem;
}
.auth-alt a { color: var(--accent); font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }

.form-error {
    background: #FBEBE9;
    border: 1px solid #ECC4BD;
    color: #5C1F18;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: .9rem;
}

/* ============================================================ PRAYER STRIP */
.prayer-strip {
    margin-bottom: 28px;
    padding: 20px 22px;
    background: linear-gradient(135deg, #FBF7EC 0%, #F4EFE3 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}
.prayer-strip::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(47, 94, 59, .08), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.prayer-strip-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    position: relative;
}
.prayer-strip-head h2 {
    font-style: italic;
    font-weight: 400;
    font-size: 1.25rem;
    margin: 0;
}
.prayer-strip-head .muted { font-size: .82rem; font-style: normal; }
.prayer-strip-count {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--accent);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 4px 12px;
    border-radius: 999px;
}

.prayer-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    position: relative;
}
.prayer-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .2s ease;
    position: relative;
}
.prayer-cell:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.prayer-cell .p-name {
    font-family: var(--font-display);
    font-size: .92rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1;
}
.prayer-cell .p-time {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 2px;
}
.prayer-cell .p-mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--line);
    margin-top: 4px;
    display: grid; place-items: center;
    color: white;
    background: transparent;
    transition: all .2s;
}
.prayer-cell.is-prayed {
    background: var(--accent);
    border-color: var(--accent);
}
.prayer-cell.is-prayed .p-name,
.prayer-cell.is-prayed .p-time { color: rgba(251, 248, 241, .92); }
.prayer-cell.is-prayed .p-mark {
    background: var(--bg);
    border-color: var(--bg);
    color: var(--accent);
}
.prayer-cell.is-next {
    border-color: var(--accent-2);
    border-width: 2px;
    padding: 11px 7px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 12%, transparent);
}
.prayer-cell.is-next.is-prayed {
    box-shadow: none;
    border-width: 1px;
    padding: 12px 8px;
}

.prayer-prompt {
    margin-bottom: 24px;
    padding: 14px 20px;
    background: var(--surface-2);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius);
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
}
.prayer-prompt em {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-2);
}
.prayer-prompt a {
    color: var(--accent);
    font-weight: 600;
    margin-left: 8px;
}
.prayer-prompt a:hover { text-decoration: underline; }

/* ============================================================ SETTINGS PAGE */
.settings-form .card-block { margin-bottom: 16px; }
.settings-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.settings-form label span {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
}
.settings-form input,
.settings-form select {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    color: var(--ink);
    transition: border-color .15s;
}
.settings-form input:focus,
.settings-form select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}
.settings-form input:disabled {
    color: var(--muted);
    background: var(--bg-2);
}

.toggle-row {
    display: grid !important;
    grid-template-columns: 24px 1fr;
    gap: 14px !important;
    align-items: start !important;
    flex-direction: row !important;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin-bottom: 18px !important;
    cursor: pointer;
}
.toggle-row input[type="checkbox"] {
    width: 20px; height: 20px;
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
}
.toggle-text strong {
    display: block;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}
.toggle-text em {
    font-style: italic;
    font-family: var(--font-display);
    font-size: .9rem;
    color: var(--muted);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.settings-grid .full { grid-column: 1 / -1; }

.settings-hint {
    margin: 14px 0 0;
    font-size: .85rem;
    color: var(--muted);
    line-height: 1.55;
}
.settings-hint a { color: var(--accent); text-decoration: underline; }
.settings-hint em { font-style: italic; font-family: var(--font-display); color: var(--ink-2); }

/* ============================================================ TEMPLATES */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
.template-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 3px solid var(--tone, var(--accent));
    transition: all .2s;
}
.template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.template-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.template-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-style: italic;
    font-weight: 400;
    color: var(--ink);
    margin: 0;
}
.template-count {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    background: var(--bg-2);
    padding: 3px 10px;
    border-radius: 999px;
}
.template-subtitle {
    font-style: italic;
    font-family: var(--font-display);
    color: var(--muted);
    font-size: .95rem;
    margin: 0;
}
.template-preview {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.template-preview li {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 10px;
    padding: 6px 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: .87rem;
}
.template-preview .tp-time {
    color: var(--muted);
    font-family: var(--font-display);
}
.template-preview .tp-title { color: var(--ink-2); }
.template-preview .tp-more {
    grid-template-columns: 1fr;
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
    font-style: italic;
    font-family: var(--font-display);
    background: transparent;
    padding: 4px;
}
.apply-template { margin-top: 6px; justify-content: center; }

/* ============================================================ CATEGORIES */
.cat-form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: end;
}
.cat-form label { display: flex; flex-direction: column; gap: 6px; }
.cat-form span { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.cat-form input[type=text] {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    color: var(--ink);
}
.cat-form input[type=text]:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

.cat-color-field { display: flex; flex-direction: column; gap: 6px; }
.cat-palette {
    display: flex;
    gap: 6px;
}
.swatch { cursor: pointer; }
.swatch input { display: none; }
.swatch span {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c);
    border: 2px solid transparent;
    transition: all .15s;
    box-shadow: 0 0 0 0 transparent;
}
.swatch input:checked + span {
    border-color: var(--bg);
    box-shadow: 0 0 0 2px var(--ink);
    transform: scale(1.05);
}

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cat-item {
    display: grid;
    grid-template-columns: 14px 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.cat-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--cat);
}
.cat-item-name {
    font-weight: 500;
    color: var(--ink);
}
.cat-item-meta {
    font-size: .82rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 10px;
}
.cat-system {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    background: var(--bg-2);
    color: var(--muted);
    padding: 2px 8px;
    border-radius: 999px;
    font-style: normal;
}
.cat-delete {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: grid; place-items: center;
    transition: all .15s;
}
.cat-delete:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}
.cat-delete:disabled { opacity: .35; cursor: not-allowed; }

/* ============================================================ MONTH VIEW */
.month-hero {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}
.month-hero-text { text-align: center; flex: 1; }
.month-hero-text h1 {
    font-size: 2.4rem;
    font-weight: 400;
}
.month-hero-text h1 em {
    font-style: italic;
    color: var(--accent);
}
.month-hero-text p {
    color: var(--muted);
    margin: 6px 0 0;
    font-family: var(--font-display);
    font-style: italic;
}

.month-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.month-grid {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 18px;
}
.month-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.month-dow span {
    text-align: center;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 6px 0;
}
.month-cells {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.month-cell {
    aspect-ratio: 1;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--ink);
    text-decoration: none;
    transition: all .15s;
    border: 2px solid transparent;
    overflow: hidden;
}
.month-cell:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.month-cell.is-other-month {
    opacity: .35;
    background: transparent;
}
.month-cell.is-today {
    border-color: var(--accent-2);
}
.month-cell.is-future { opacity: .55; }
.month-cell.is-future .mc-stat { opacity: .65; }

.month-cell .mc-day {
    font-family: var(--font-display);
    font-size: 1.05rem;
    line-height: 1;
    color: var(--ink);
}
.month-cell.is-today .mc-day {
    color: var(--accent-2);
    font-weight: 500;
}
.month-cell .mc-stat {
    align-self: flex-end;
    font-size: .68rem;
    color: var(--muted);
}
.month-cell .mc-ratio {
    font-family: var(--font-display);
    font-size: .82rem;
    color: var(--ink);
}
.month-cell .mc-divider { color: var(--muted-2); margin: 0 1px; }
.month-cell .mc-future-marker {
    font-size: .68rem;
    color: var(--muted);
    background: var(--surface);
    border-radius: 999px;
    padding: 1px 7px;
    border: 1px solid var(--line);
}

/* Heatmap-style fills for completion intensity */
.month-cell.lvl-0 { background: var(--bg-2); }
.month-cell.lvl-1 { background: color-mix(in srgb, var(--accent) 18%, var(--bg-2)); }
.month-cell.lvl-2 { background: color-mix(in srgb, var(--accent) 38%, var(--bg-2)); }
.month-cell.lvl-3 {
    background: color-mix(in srgb, var(--accent) 65%, var(--bg-2));
}
.month-cell.lvl-3 .mc-day,
.month-cell.lvl-3 .mc-ratio { color: white; }
.month-cell.lvl-3 .mc-divider { color: rgba(255,255,255,.6); }
.month-cell.lvl-4 {
    background: var(--accent);
}
.month-cell.lvl-4 .mc-day,
.month-cell.lvl-4 .mc-ratio { color: white; }
.month-cell.lvl-4 .mc-divider { color: rgba(255,255,255,.6); }

.month-cell.is-other-month.lvl-0 { background: transparent; }

.month-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: .82rem;
    color: var(--muted);
}
.month-legend .legend-cell {
    aspect-ratio: 1;
    width: 16px;
    border-radius: 3px;
    padding: 0;
    border: 0;
    cursor: default;
}
.month-legend .legend-cell:hover { transform: none; box-shadow: none; }

/* ============================================================ ARCHIVED ROUTINES */
.archived-block { margin-top: 32px; }

.archived-details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.archived-details summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 22px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink-2);
    font-size: 1rem;
    transition: background .15s;
}
.archived-details summary::-webkit-details-marker { display: none; }
.archived-details summary:hover { background: var(--bg); }
.archived-details summary em {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink);
    font-size: 1.15rem;
    margin-right: 6px;
}
.archived-hint {
    color: var(--muted);
    font-size: .82rem;
    font-style: italic;
    font-family: var(--font-display);
}
.archived-list {
    border-top: 1px solid var(--line);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.archived-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-left: 3px solid var(--cat);
    border-radius: var(--radius);
    opacity: .85;
}
.archived-time {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--muted);
}
.archived-body h3 { margin: 0; color: var(--ink-2); font-size: 1rem; }
.archived-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .82rem;
    font-style: italic;
    font-family: var(--font-display);
}

/* ============================================================ DAY TOOLBAR & SHARE */
.day-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}
.day-toolbar .btn-secondary {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.day-toolbar .btn-secondary:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================================ REFLECTION NOTES */
.routine-reflection {
    /* Hidden until the routine has a completion (done/skipped) */
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}
.routine-card.is-done .routine-reflection,
.routine-card.is-skipped .routine-reflection {
    display: block;
}

.reflection-text {
    margin: 0 0 8px;
    color: var(--ink-2);
    font-style: italic;
    font-family: var(--font-display);
    font-size: .95rem;
    line-height: 1.45;
}
.reflection-mark {
    color: var(--accent);
    font-style: normal;
    font-weight: 500;
    margin: 0 2px;
}
.btn-reflect {
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
    padding: 4px 0;
    cursor: pointer;
    transition: color .15s;
}
.btn-reflect:hover { color: var(--accent); }

.reflection-editor {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.reflection-editor[hidden] { display: none; }
.reflection-editor textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink);
    resize: vertical;
    min-height: 60px;
    transition: border-color .15s;
}
.reflection-editor textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}
.reflection-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.reflection-actions button { padding: 6px 14px; font-size: .85rem; }

/* ============================================================ NOTIFICATION BANNER */
.notif-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-2);
    border-radius: var(--radius);
}
.notif-banner-text strong {
    display: block;
    font-weight: 600;
    color: var(--ink);
    font-size: .95rem;
    margin-bottom: 2px;
}
.notif-banner-text em {
    font-style: italic;
    font-family: var(--font-display);
    color: var(--muted);
    font-size: .85rem;
}
.notif-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.notif-banner-actions button {
    padding: 8px 16px;
    font-size: .85rem;
}

/* ============================================================ DUE-NOW PULSE */
@keyframes dueNowPulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 35%, transparent); }
    50%      { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent-2) 0%,  transparent); }
}
.routine-card.is-due-now {
    border-color: var(--accent-2);
    animation: dueNowPulse 1.6s ease-out 6;
    background: color-mix(in srgb, var(--accent-2) 5%, var(--surface));
}

/* ============================================================ WELCOME / ONBOARDING */
.welcome-hero {
    text-align: center;
    margin: 24px 0 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.welcome-eyebrow {
    color: var(--accent);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1rem;
    margin: 0 0 8px;
}
.welcome-hero h1 {
    font-size: 2.6rem;
    font-weight: 400;
    margin-bottom: 10px;
}
.welcome-hero h1 em { color: var(--accent-2); }
.welcome-sub {
    color: var(--muted);
    font-style: italic;
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin: 0;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.welcome-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent-tone, var(--accent));
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all .2s;
}
.welcome-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-top-width: 5px;
    padding-top: 26px;
}
.welcome-card-num {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-style: italic;
    color: var(--accent-tone, var(--accent));
    opacity: .55;
    line-height: 1;
}
.welcome-card h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--ink);
    margin: 0;
    line-height: 1.2;
}
.welcome-card h2 em {
    font-style: italic;
    color: var(--accent-tone, var(--accent));
}
.welcome-card p {
    color: var(--muted);
    margin: 0;
    font-size: .95rem;
    line-height: 1.55;
}
.welcome-card p em {
    font-style: italic;
    font-family: var(--font-display);
    color: var(--ink-2);
}
.welcome-card-cta {
    margin-top: auto;
    padding-top: 6px;
    color: var(--accent-tone, var(--accent));
    font-weight: 600;
    font-size: .92rem;
    transition: transform .2s;
}
.welcome-card:hover .welcome-card-cta {
    transform: translateX(3px);
}

.welcome-skip {
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
    padding: 16px;
    font-style: italic;
    font-family: var(--font-display);
}
.welcome-skip a {
    color: var(--accent);
    font-weight: 600;
    margin-left: 4px;
    text-decoration: none;
}
.welcome-skip a:hover { text-decoration: underline; }

/* ============================================================ ROUTINES SEARCH/FILTER */
.routines-filter {
    display: grid;
    grid-template-columns: 1fr 200px auto;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filter-search {
    position: relative;
    display: flex;
    align-items: center;
}
.filter-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.filter-search input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    color: var(--ink);
    transition: border-color .15s;
}
.filter-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}
.filter-search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.routines-filter select {
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font: inherit;
    color: var(--ink);
    cursor: pointer;
}
.routines-filter select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

.filter-count {
    font-size: .82rem;
    color: var(--muted);
    font-style: italic;
    font-family: var(--font-display);
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

.filter-empty {
    text-align: center;
    padding: 32px;
    color: var(--muted);
    font-size: 1.05rem;
    background: var(--surface);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-lg);
    margin: 0;
}
.filter-empty em {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-2);
}

/* ============================================================ MOBILE BOTTOM NAV */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(251, 248, 241, .96);
    backdrop-filter: saturate(150%) blur(10px);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    border-top: 1px solid var(--line);
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
    z-index: 100;
}
.mobile-nav a {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: .82rem;
    font-weight: 500;
    color: var(--muted);
    border-radius: var(--radius-sm);
    transition: color .15s;
}
.mobile-nav a.is-active { color: var(--ink); font-weight: 600; }

/* ============================================================ RESPONSIVE */
@media (max-width: 760px) {
    h1 { font-size: 1.8rem; }
    .topbar { padding: 14px 18px; }
    .topnav { display: none; }
    .topbar-right .user-name { display: none; }

    .container { padding: 22px 16px 100px; }

    .hero {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .hero-text h1 { font-size: 2.2rem; }
    .hero-eyebrow { font-size: .92rem; }
    .hero-side {
        flex-direction: row;
        justify-content: space-between;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 14px 18px;
        align-items: center;
    }
    .hero-day-nav { gap: 6px; }

    .next-up { padding: 12px 14px; font-size: .9rem; }
    .next-up-title { font-size: 1rem; }

    .band-head { padding: 0 2px; }
    .band-head h2 { font-size: .95rem; }

    .best-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 18px 22px;
    }
    .best-card-num { text-align: left; }
    .best-num { font-size: 2.4rem; }
    .best-card-text h2 { font-size: 1.3rem; }

    .dow-grid { gap: 4px; }
    .dow-bar-wrap { height: 80px; }
    .dow-pct { font-size: .78rem; }
    .dow-label { font-size: .62rem; }

    .trend-svg { max-height: 140px; }

    .routine-card {
        grid-template-columns: 70px 1fr auto;
        gap: 14px;
        padding: 14px 16px;
    }
    .routine-actions { flex-direction: column; gap: 6px; }
    .btn-done, .btn-skip { width: 36px; height: 36px; }

    .week-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .week-day {
        min-height: auto;
        flex-direction: row;
        gap: 14px;
        align-items: center;
    }
    .week-day-head {
        flex-direction: column;
        margin: 0;
        align-items: center;
        min-width: 50px;
    }
    .week-day-bar { display: none; }
    .week-day-list { flex-direction: row; gap: 6px; flex-wrap: wrap; }
    .week-day-foot { border: 0; padding: 0; margin: 0; min-width: 40px; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card.big { grid-column: 1 / -1; }
    .card-block { padding: 22px; }
    .stat-num { font-size: 2.1rem; }
    .stat-card.big .stat-num { font-size: 2.8rem; }

    .cat-row { grid-template-columns: 70px 1fr 40px; }
    .cat-count { display: none; }

    .heatmap { grid-template-columns: repeat(15, 1fr); }

    .card-form form { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn-primary,
    .form-actions .btn-secondary,
    .form-actions .btn-danger {
        width: 100%; justify-content: center;
    }

    .routines-manage { grid-template-columns: 1fr; }
    .manage-card { padding: 14px 16px; gap: 12px; }
    .manage-time { font-size: 1.05rem; }

    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .page-head .btn-primary { align-self: flex-start; }

    .mobile-nav { display: flex; }

    .prayer-strip { padding: 16px; margin-bottom: 22px; }
    .prayer-row { gap: 5px; }
    .prayer-cell { padding: 10px 4px; gap: 2px; }
    .prayer-cell .p-name { font-size: .82rem; }
    .prayer-cell .p-time { font-size: .68rem; }
    .prayer-cell .p-mark { width: 14px; height: 14px; }

    .settings-grid { grid-template-columns: 1fr; }

    .templates-grid { grid-template-columns: 1fr; }
    .template-card { padding: 18px; }

    .cat-form { grid-template-columns: 1fr; align-items: stretch; }
    .cat-palette { flex-wrap: wrap; }
    .cat-item { padding: 12px; gap: 10px; }

    .page-head-actions {
      flex-direction: row;
      width: 100%;
      align-items: stretch;
    }
    .page-head-actions a { flex: 1; justify-content: center; }

    /* Month view tightening for mobile */
    .month-hero-text h1 { font-size: 1.7rem; }
    .month-grid { padding: 10px; }
    .month-cells { gap: 3px; }
    .month-cell { padding: 5px; border-radius: 5px; }
    .month-cell .mc-day { font-size: .85rem; }
    .month-cell .mc-ratio { font-size: .68rem; }
    .month-cell .mc-future-marker { font-size: .6rem; padding: 0 5px; }
    .month-dow span { font-size: .62rem; padding: 4px 0; }

    /* Mobile nav text smaller for 6 items */
    .mobile-nav { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
    .mobile-nav a { font-size: .72rem; padding: 6px 0; }

    .archived-card { grid-template-columns: 1fr auto; }
    .archived-card .archived-time { display: none; }

    .notif-banner { padding: 12px 14px; gap: 10px; }
    .notif-banner-actions { width: 100%; }
    .notif-banner-actions button { flex: 1; }

    .welcome-hero h1 { font-size: 1.8rem; }
    .welcome-grid { grid-template-columns: 1fr; gap: 12px; }
    .welcome-card { padding: 22px 20px; }
    .welcome-card h2 { font-size: 1.25rem; }

    .routines-filter {
      grid-template-columns: 1fr;
      gap: 8px;
      padding: 10px;
    }
    .filter-count { text-align: left; }
}

@media (max-width: 380px) {
    h1 { font-size: 1.5rem; }
    .hero-text h1 { font-size: 1.8rem; }
}
