/* ============================================================
   TALINGA — Main Stylesheet
   Sections: 1. Fonts & Base | 2. Auth Pages | 3. App Shell/Sidebar
   4. Dashboard (Quote, Stats) | 5. Entry Cards | 6. Insights (Charts)
   7. Admin (Health, Bar Chart) | 8. Buttons | 9. Responsive
   ============================================================ */

/* ---------- 1. Fonts & Base ---------- */
/* Fonts are stored inside the project (css/fonts), so pages load fast
   even on a slow connection and the design still works offline. */
@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/quicksand-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/quicksand-latin-500-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/quicksand-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/quicksand-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Caveat';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/caveat-latin-500-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Caveat';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/caveat-latin-600-normal.woff2') format('woff2');
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    background: #F5F5F5;
    margin: 0;
    padding: 0;
    color: #333;
}

.subtext {
    color: #999;
}

label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

input, textarea {
    width: 100%;
    padding: 12px 16px;
    margin: 6px 0 14px;
    border: 1.5px solid #DDDDDD;
    border-radius: 16px;
    font-family: 'Quicksand', sans-serif;
    font-size: 15px;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #B3141C;
}

button, .cta-button {
    width: 100%;
    padding: 13px;
    background: #1F1F1F;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}

button:hover, .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
    background: #000000;
}

button:active, .cta-button:active {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}


/* ---------- 2. Auth Pages (Login / Register) ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    max-width: 380px;
    width: 100%;
    background: #fff;
    padding: 32px 28px;
    border-radius: 28px;
    box-shadow: 0 4px 18px rgba(179,20,28,.1);
}

.auth-box h2 {
    color: #B3141C;
    margin-bottom: 0;
    font-size: 28px;
    font-weight: 700;
}

.tagline {
    color: #999;
    font-size: 13px;
    margin-top: 2px;
    margin-bottom: 20px;
}

.auth-box p {
    font-size: 14px;
    color: #666;
}

.auth-box a {
    color: #B3141C;
    font-weight: 600;
    text-decoration: none;
}

.auth-box a:hover {
    text-decoration: underline;
}

.error {
    color: #c0392b;
    font-size: 13px;
}

.success {
    color: #B3141C;
    font-size: 13px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 40px;
}

.toggle-icon {
    position: absolute;
    right: 14px;
    top: 18px;
    cursor: pointer;
    user-select: none;
    font-size: 16px;
    transition: transform .1s ease;
}

.toggle-icon:active {
    transform: scale(0.85);
}


/* ---------- 3. App Shell / Sidebar Navigation ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    background: #fff;
    padding: 28px 0;
    box-shadow: 1px 0 8px rgba(0,0,0,.04);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    padding: 0 28px 32px;
    font-weight: 700;
    font-size: 30px;
    color: #B3141C;
}

.sidebar .brand span {
    display: block;
    font-family: 'Caveat', cursive;
    font-size: 17px;
    color: #999;
    font-weight: 500;
    margin-top: 2px;
}

.sidebar nav {
    flex: 1;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 28px;
    color: #777;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-radius: 0 30px 30px 0;
    margin-right: 18px;
    transition: background .12s ease, transform .1s ease;
}

.sidebar nav a.active {
    background: #FCE8E8;
    color: #B3141C;
}

.sidebar nav a:hover:not(.active) {
    background: #F5F5F5;
}

.sidebar nav a:active {
    transform: scale(0.97);
}

.sidebar .logout-link {
    padding: 13px 28px;
    color: #1F1F1F;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: transform .1s ease;
}

.sidebar .logout-link:active {
    transform: scale(0.97);
}

.main-content {
    margin-left: 230px;
    padding: 36px 44px;
    width: 100%;
}


/* ---------- 4. Dashboard: Quote Box & Stat Cards ---------- */
.quote-box {
    background: linear-gradient(135deg, #B3141C, #D32F2F);
    color: #fff;
    padding: 22px 26px;
    border-radius: 22px;
    margin: 20px 0 28px;
    position: relative;
}

.quote-box .quote-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: .8;
    margin-bottom: 6px;
}

.quote-box .quote-text {
    font-family: 'Caveat', cursive;
    font-size: 24px;
    line-height: 1.4;
}

.stat-card {
    flex: 1;
    min-width: 150px;
    background: #fff;
    border-radius: 20px;
    padding: 18px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #B3141C;
}


/* ---------- 5. Entry Cards & Insight/Crisis Boxes ---------- */
.entry-card {
    background: #fff;
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.entry-card-header strong {
    font-size: 15.5px;
    font-weight: 600;
}

.entry-card-header form {
    margin: 0;
}

.entry-date {
    color: #A0A0A0;
    font-size: 12px;
}

.entry-content {
    margin-top: 10px;
    color: #444;
    line-height: 1.5;
}

.insight-box {
    background: #FCE8E8;
    padding: 12px 16px;
    border-radius: 16px;
    margin-top: 12px;
    font-size: 14px;
    color: #B3141C;
}

.crisis-box {
    background: #EAE0F5;
    border-left: 4px solid #6C3FA8;
    border-radius: 16px;
    padding: 18px 22px;
    margin-bottom: 20px;
    color: #4a2d75;
}

.crisis-box-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 8px;
}

.crisis-box p {
    margin: 0;
    line-height: 1.6;
    font-size: 14.5px;
}

.mood-emoji-badge {
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F5F5;
    flex-shrink: 0;
}

.mood-badge-simple {
    background: #FCE8E8;
    color: #B3141C;
    font-size: 12.5px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 12px;
}


/* ---------- 6. Insights: Pie Chart & Week Strip ---------- */
.pie-chart {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    font-size: 14.5px;
    font-weight: 600;
    color: #444;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.week-strip {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.week-day {
    background: #fff;
    border-radius: 16px;
    padding: 10px 6px;
    width: 56px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.week-day.today {
    background: #B3141C;
}

.week-day.today .week-day-letter,
.week-day.today .week-day-date {
    color: #fff;
}

.week-day-letter {
    display: block;
    font-size: 12px;
    color: #999;
    font-weight: 700;
}

.week-day-emoji {
    display: block;
    font-size: 20px;
    margin: 4px 0;
}

.week-day-date {
    display: block;
    font-size: 12px;
    color: #999;
    font-weight: 600;
}


/* ---------- 7. Admin: Bar Chart & System Health ---------- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    height: 140px;
    margin-top: 16px;
    padding: 0 4px;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    height: 100%;
}

.bar-value {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.bar {
    width: 26px;
    background: #B3141C;
    border-radius: 8px 8px 0 0;
    min-height: 6px;
    transition: height .3s ease;
}

.bar-label {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    font-weight: 600;
}

.health-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.health-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.health-ok {
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46,204,113,.6);
}

.health-down {
    background: #e74c3c;
    box-shadow: 0 0 6px rgba(231,76,60,.6);
}


/* ---------- 8. Buttons: Delete ---------- */
.delete-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: #F5F5F5;
    color: #c0392b;
    border: none;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, transform .1s ease;
}

.delete-btn:hover {
    background: #FADCDC;
}

.delete-btn:active {
    transform: scale(0.9);
}


/* ---------- 9. Responsive (Mobile) ---------- */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px 0;
        box-shadow: 0 2px 6px rgba(0,0,0,.05);
    }
    .sidebar .brand {
        padding: 0 16px;
        display: flex;
        align-items: center;
    }
    .sidebar .brand span {
        display: none;
    }
    .sidebar nav {
        display: flex;
        flex: none;
    }
    .sidebar nav a {
        border-radius: 20px;
        margin: 0 6px;
        padding: 8px 16px;
        white-space: nowrap;
    }
    .sidebar .logout-link {
        padding: 8px 16px;
        white-space: nowrap;
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .quote-box .quote-text {
        font-size: 20px;
    }
    .week-strip {
        justify-content: center;
    }
    .week-day {
        width: 42px;
        padding: 8px 4px;
    }
}.nav-badge {
    background: #1F1F1F;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
}
.checkin-btn {
    width: auto; background: #fff; border: 1.5px solid #DDDDDD; border-radius: 50%;
    width: 46px; height: 46px; font-size: 22px; padding: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .1s ease, border-color .12s ease;
}
.checkin-btn:hover { border-color: #B3141C; transform: translateY(-2px); }
.checkin-btn:active { transform: scale(0.9); }
/* ---------- Re-analyze button (Past Journal) ---------- */
.reanalyze-btn {
    width: auto;
    padding: 8px 18px;
    font-size: 13.5px;
    background: #B3141C;
}

.reanalyze-btn:hover {
    background: #8E0F16;
    box-shadow: 0 4px 12px rgba(179,20,28,.3);
}
/* ---------- Re-analyze button (Past Journal) ---------- */
.reanalyze-btn {
    width: auto;
    padding: 8px 18px;
    font-size: 13.5px;
    background: #B3141C;
}

.reanalyze-btn:hover {
    background: #8E0F16;
    box-shadow: 0 4px 12px rgba(179,20,28,.3);
}
/* ---------- Insights page: compact card layout ---------- */
.insights-wrap {
    max-width: 1100px;
}

.insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.insight-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.card-title {
    font-weight: 700;
    font-size: 15px;
    color: #333;
    margin-bottom: 14px;
}

.mood-summary {
    display: flex;
    align-items: center;
    gap: 24px;
}

.pie-sm {
    width: 130px;
    height: 130px;
}

.emotion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.emotion-chip {
    background: #F5F5F5;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.insight-card .week-strip {
    flex-wrap: nowrap;
    margin-top: 0;
    gap: 8px;
}

.insight-card .week-day {
    flex: 1;
    width: auto;
    min-width: 0;
    box-shadow: none;
    background: #F5F5F5;
}

.insight-card .week-day.today {
    background: #B3141C;
}

.pattern-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.pattern-stat {
    background: #F5F5F5;
    border-radius: 16px;
    padding: 14px;
    text-align: center;
}

.pattern-value {
    font-size: 22px;
    font-weight: 700;
    color: #B3141C;
}

.pattern-stat .subtext {
    font-size: 13px;
}

@media (max-width: 1000px) {
    .insights-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .pattern-stats {
        grid-template-columns: 1fr;
    }
    .mood-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* ---------- Write Entry page ---------- */
.write-wrap {
    max-width: 1100px;
}

.write-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

.write-card {
    padding: 22px 24px;
}

.write-card textarea {
    resize: vertical;
    line-height: 1.6;
}

.word-count {
    text-align: right;
    font-size: 12px;
    color: #A0A0A0;
    margin: -8px 0 12px;
}

.write-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.write-side .entry-card {
    margin-bottom: 0;
}

.side-title {
    font-weight: 700;
    font-size: 15px;
    color: #333;
    margin-bottom: 6px;
}

.side-text {
    font-size: 13.5px;
    color: #777;
    margin: 0;
    line-height: 1.5;
}

.prompt-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.prompt-chip {
    width: 100%;
    text-align: left;
    background: #F5F5F5;
    color: #B3141C;
    border: 1.5px solid transparent;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
}

.prompt-chip:hover {
    background: #FCE8E8;
    border-color: #B3141C;
    transform: translateY(-1px);
    box-shadow: none;
}

.prompt-chip:active {
    transform: scale(0.98);
}

#saveBtn:disabled {
    background: #B3141C;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1000px) {
    .write-grid {
        grid-template-columns: 1fr;
    }
}
/* ---------- Past Journal page ---------- */
.journal-wrap {
    max-width: 1100px;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.journal-header h1 {
    margin-bottom: 4px;
}

.journal-header .subtext {
    margin-top: 0;
}

.journal-search input {
    width: 280px;
    margin: 0 0 16px;
    background: #fff;
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 16px;
    background: #fff;
    color: #666;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    transition: background .12s ease, transform .1s ease;
}

.filter-chip:hover {
    background: #FCE8E8;
}

.filter-chip:active {
    transform: scale(0.96);
}

.filter-chip.active {
    background: #B3141C;
    color: #fff;
}

.clear-link {
    font-size: 13px;
    color: #1F1F1F;
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.emotion-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}

.tag-positive { background: #E1F5EA; color: #1E7A5C; }
.tag-negative { background: #FBE7E1; color: #B5523A; }
.tag-neutral  { background: #EFEFEF; color: #666; }
.tag-pending  { background: #FFF4D6; color: #8A6A10; }

/* Collapsed: only 2 lines of the entry are shown */
.entry-body .entry-content {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entry-body .entry-more {
    display: none;
}

/* Expanded: full entry + AI insight */
.entry-body.expanded .entry-content {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.entry-body.expanded .entry-more {
    display: block;
}

.entry-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.entry-actions form {
    margin: 0;
}

.toggle-btn {
    width: auto;
    background: none;
    color: #B3141C;
    padding: 6px 0;
    font-size: 13.5px;
    font-weight: 600;
}

.toggle-btn:hover {
    background: none;
    box-shadow: none;
    transform: none;
    text-decoration: underline;
}

.toggle-btn:active {
    transform: none;
}

@media (max-width: 600px) {
    .journal-search,
    .journal-search input {
        width: 100%;
    }
}
/* ---------- Dashboard page ---------- */
.dash-wrap {
    max-width: 1100px;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.dash-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.subtext.small {
    font-size: 13px;
}

.checkin-done {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
}

.mood-emoji-badge.big {
    width: 52px;
    height: 52px;
    font-size: 28px;
}

.checkin-mood {
    font-weight: 700;
    font-size: 18px;
    color: #333;
}

.checkin-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dash-card .checkin-row {
    margin-top: 12px;
}

.link-btn {
    display: inline;
    width: auto;
    background: none;
    color: #B3141C;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
}

.link-btn:hover {
    background: none;
    box-shadow: none;
    transform: none;
    text-decoration: underline;
}

.link-btn:active {
    transform: none;
}

.dash-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.dash-stat {
    background: #F5F5F5;
    border-radius: 16px;
    padding: 12px 8px;
    text-align: center;
}

.dash-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #B3141C;
}

.dash-quote {
    display: flex;
    flex-direction: column;
    margin: 16px 0 28px;
}

.quote-cta {
    align-self: flex-start;
    margin-top: 16px;
    background: #fff;
    color: #B3141C;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 24px;
    transition: transform .1s ease, box-shadow .15s ease;
}

.quote-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.quote-cta:active {
    transform: scale(0.96);
}

.dash-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-section-head h3 {
    margin: 0 0 12px;
}

.view-all {
    color: #B3141C;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
}

.view-all:hover {
    text-decoration: underline;
}

.recent-entry {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform .1s ease, box-shadow .15s ease;
}

.recent-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.privacy-note {
    font-size: 12px;
    color: #999;
    margin-top: 28px;
}

@media (max-width: 1000px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}
/* ---------- Settings page ---------- */
.settings-wrap {
    max-width: 1100px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
    margin-top: 20px;
    align-items: start;
}

.settings-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #B3141C;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
    background: #F5F5F5;
    border-radius: 16px;
    padding: 12px 16px;
}

.input-disabled {
    background: #F0F0F0;
    color: #999;
    cursor: not-allowed;
}

.btn-inline {
    width: auto;
    padding: 10px 22px;
}

.logout-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 22px;
    border-radius: 24px;
    background: #F5F5F5;
    color: #1F1F1F;
    font-weight: 700;
    text-decoration: none;
    transition: background .12s ease, transform .1s ease;
}

.logout-btn:hover {
    background: #FBE7E1;
}

.logout-btn:active {
    transform: scale(0.96);
}

.support-card {
    background: #EEF6FB;
}

.hotline-list {
    margin: 10px 0 0;
    padding-left: 18px;
    font-size: 14px;
    color: #333;
    line-height: 1.8;
}

.btn-danger-outline {
    width: auto;
    margin-top: 14px;
    padding: 9px 20px;
    background: #fff;
    color: #c0392b;
    border: 1.5px solid #c0392b;
}

.btn-danger-outline:hover {
    background: #FDECEA;
    box-shadow: none;
}

.delete-form {
    margin-top: 14px;
}

.btn-danger {
    width: auto;
    padding: 10px 20px;
    background: #c0392b;
}

.btn-danger:hover {
    background: #a93226;
    box-shadow: 0 4px 12px rgba(192,57,43,.3);
}

@media (max-width: 1000px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
/* ---------- Admin dashboard ---------- */
.admin-wrap {
    max-width: 1100px;
}

.ok-note {
    background: #E1F5EA;
    color: #1E7A5C;
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.stat-grid .stat-card {
    min-width: 0;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.admin-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.group-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.group-name {
    width: 70px;
    font-size: 13.5px;
    font-weight: 600;
    color: #555;
}

.group-track {
    flex: 1;
    height: 10px;
    background: #F5F5F5;
    border-radius: 6px;
    overflow: hidden;
}

.group-fill {
    height: 100%;
    border-radius: 6px;
}

.fill-positive { background: #2BA37E; }
.fill-negative { background: #E1735A; }
.fill-neutral  { background: #B8B8B8; }

.group-pct {
    width: 40px;
    text-align: right;
    font-size: 13px;
    color: #777;
    font-weight: 600;
}

.activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #E8E8E8;
}

.activity-row:last-child {
    border-bottom: none;
}

.activity-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #FCE8E8;
    color: #B3141C;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-text {
    flex: 1;
    font-size: 14px;
    color: #555;
}

.activity-time {
    font-size: 12px;
    color: #A0A0A0;
    white-space: nowrap;
}

@media (max-width: 1000px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }
}
/* ---------- Manage Users page ---------- */
.stat-grid.three {
    grid-template-columns: repeat(3, 1fr);
}

.users-card {
    margin-top: 16px;
    padding-top: 10px;
}

.users-head,
.users-row {
    display: grid;
    grid-template-columns: 2.4fr 0.6fr 1fr 0.7fr 1fr 1fr 44px;
    gap: 12px;
    align-items: center;
}

.users-head {
    font-size: 12px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 10px 0;
    border-bottom: 1px solid #E8E8E8;
}

.users-row {
    padding: 12px 0;
    border-bottom: 1px solid #E8E8E8;
    font-size: 14px;
    color: #444;
}

.users-row:last-child {
    border-bottom: none;
}

.u-student {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.u-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.u-actions form {
    margin: 0;
}

.status-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.status-active   { background: #E1F5EA; color: #1E7A5C; }
.status-inactive { background: #EFEFEF; color: #666; }
.status-none     { background: #FFF4D6; color: #8A6A10; }

@media (max-width: 900px) {
    .users-head {
        display: none;
    }
    .users-row {
        grid-template-columns: 1fr 1fr;
    }
    .u-student {
        grid-column: 1 / -1;
    }
    .u-cell::before {
        content: attr(data-label) ": ";
        color: #999;
        font-size: 12px;
    }
    .stat-grid.three {
        grid-template-columns: 1fr;
    }
}
/* ---------- Reports page ---------- */
.report-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.report-toolbar h1 {
    margin-bottom: 4px;
}

.report-toolbar .subtext {
    margin-top: 0;
}

.print-btn {
    width: auto;
    padding: 9px 18px;
    font-size: 13.5px;
    background: #B3141C;
}

.print-btn:hover {
    background: #8E0F16;
    box-shadow: 0 4px 12px rgba(179,20,28,.3);
}

.hbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.hbar-label {
    width: 130px;
    font-size: 13.5px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hbar-track {
    flex: 1;
    height: 10px;
    background: #F5F5F5;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}

.hbar-fill {
    height: 100%;
    border-radius: 6px;
}

.hbar-seg {
    height: 100%;
}

.hbar-value {
    width: 40px;
    text-align: right;
    font-size: 13px;
    color: #777;
    font-weight: 600;
}

.legend-inline {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 12.5px;
    color: #666;
    font-weight: 600;
}

.print-only {
    display: none;
}

/* Printing: hide the menu and buttons, keep the charts and their colors */
@media print {
    .sidebar,
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block;
        font-size: 12px;
        color: #666;
    }
    body {
        background: #fff;
    }
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    .admin-card,
    .stat-card {
        box-shadow: none;
        border: 1px solid #DDDDDD;
        break-inside: avoid;
    }
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
/* ---------- Flagged Entries page ---------- */
.flag-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: start;
}

.flag-card {
    background: #fff;
    border-radius: 20px;
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    border-left: 4px solid #6C3FA8;
}

.flag-card.is-reviewed {
    border-left-color: #B8B8B8;
    opacity: .85;
}

.flag-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flag-head .status-pill {
    margin-left: 6px;
}

.flag-title {
    font-weight: 700;
    margin-top: 14px;
    color: #333;
}

.flag-card .entry-content {
    margin-top: 6px;
}

.flag-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.flag-actions form {
    margin: 0;
}

.btn-review {
    width: auto;
    padding: 8px 18px;
    font-size: 13.5px;
    background: #B3141C;
}

.btn-review:hover {
    background: #8E0F16;
    box-shadow: 0 4px 12px rgba(179,20,28,.3);
}

.flag-link {
    font-size: 13.5px;
    font-weight: 600;
    color: #B3141C;
    text-decoration: none;
}

.flag-link:hover {
    text-decoration: underline;
}

.status-review { background: #EAE0F5; color: #6C3FA8; }
.status-done   { background: #EFEFEF; color: #666; }

.protocol-card {
    position: sticky;
    top: 20px;
}

.protocol-list {
    padding-left: 18px;
    margin: 10px 0 0;
    font-size: 13.5px;
    color: #555;
    line-height: 1.6;
}

.protocol-list li {
    margin-bottom: 6px;
}

@media (max-width: 1000px) {
    .flag-layout {
        grid-template-columns: 1fr;
    }
    .protocol-card {
        position: static;
    }
}
/* ---------- System Health page ---------- */
.health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.health-warn {
    background: #F2B84B;
    box-shadow: 0 0 6px rgba(242,184,75,.6);
}

.record-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid #E8E8E8;
    font-size: 14px;
    color: #555;
}

.record-row strong {
    color: #B3141C;
}

.backup-btn {
    display: inline-block;
    margin-top: 14px;
    padding: 10px 22px;
    border-radius: 24px;
    background: #B3141C;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    transition: transform .1s ease, box-shadow .15s ease;
}

.backup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(179,20,28,.3);
}

.backup-btn:active {
    transform: scale(0.96);
}

@media (max-width: 1000px) {
    .health-grid {
        grid-template-columns: 1fr;
    }
}
/* ---------- AI content loading in the background ---------- */
.ai-loading {
    color: #8A8A8A;
    font-style: italic;
    animation: aiPulse 1.4s ease-in-out infinite;
}

.quote-box .ai-loading {
    color: rgba(255,255,255,.8);
}

@keyframes aiPulse {
    0%, 100% { opacity: .45; }
    50% { opacity: 1; }
}

.ai-fade-in {
    animation: aiFadeIn .5s ease;
}

@keyframes aiFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* ---------- Trimex Colleges theme: login and sign-up pages ---------- */
.auth-body {
    background: #1F1F1F;
}

.auth-slides {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #1F1F1F;
}

.auth-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 1.6s ease, transform 8s ease;
}

.auth-slide.active {
    opacity: 1;
    transform: scale(1);
}

/* Dark-to-red fade over the photos so the text stays readable */
.auth-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(20,20,20,.85) 0%, rgba(20,20,20,.55) 50%, rgba(179,20,28,.70) 100%);
}

.auth-body .auth-page {
    position: relative;
    z-index: 1;
    gap: 70px;
}

.auth-intro {
    color: #fff;
    max-width: 380px;
}

.auth-school-logo {
    display: block;
    width: 86px;
    height: 86px;
    object-fit: contain;
    margin-bottom: 18px;.auth-school-logo {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
    object-position: left bottom;
    margin-bottom: 6px;
}

.auth-intro h1 {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1.05;
    margin: 0;
    color: #fff;
}
}

.auth-intro h1 {
    font-size: 58px;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.auth-intro-tagline {
    font-family: 'Caveat', cursive;
    font-size: 28px;
    color: #FFD2D4;
    margin: 0 0 16px;
}

.auth-intro-text {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255,255,255,.88);
    margin: 0;
}

.auth-school-name {
    margin: 22px 0 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,.7);
}

.auth-body .auth-box {
    border-top: 6px solid #B3141C;
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
}

.auth-body .auth-box h2 {
    font-size: 24px;
}

.auth-box-logo {
    display: none;
    width: 58px;
    height: 58px;
    object-fit: contain;
    margin: 0 auto 10px;
}

@media (max-width: 860px) {
    .auth-intro {
        display: none;
    }
    .auth-box-logo {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-slide {
        transition: none;
        transform: none;
    }
}

/* ---------- Trimex logo above "talinga" in the sidebar ---------- */
.sidebar .brand {
    text-align: center;
    text-transform: uppercase;
    font-size: 32px;
    letter-spacing: 2px;
    line-height: 1.1;
}

.sidebar .brand span {
    text-transform: none;
    letter-spacing: 0;
}

.sidebar .brand::before {
    content: "";
    display: block;
    width: 100%;
    max-width: 170px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 4px;
    background: url('../images/trimex-logo.png') no-repeat center bottom / contain;
}

@media (max-width: 768px) {
    .sidebar .brand {
        text-align: left;
        font-size: 24px;
    }
    .sidebar .brand::before {
        width: 36px;
        max-width: none;
        margin: 0 8px 0 0;
        background-position: center;
    }
}
/* Bigger TALINGA wordmark on login and sign up (placed last so it always applies) */
.auth-body .auth-intro .auth-school-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    object-position: left bottom;
    margin-bottom: 6px;
}

.auth-body .auth-intro h1 {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1.05;
    margin: 0;
    color: #fff;
}
/* ---------- Phone layout (placed last so it always applies) ---------- */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    /* Top bar: logo + TALINGA on the left, Logout on the right */
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
        width: auto;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        overflow: visible;
        padding: 10px 14px 0;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,.06);
    }

    .sidebar .brand {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0;
        font-size: 20px;
        letter-spacing: 1px;
        text-align: left;
    }

    .sidebar .brand span {
        display: none;
    }

    .sidebar .brand::before {
        width: 34px;
        height: 34px;
        max-width: none;
        aspect-ratio: auto;
        margin: 0;
        background-position: center;
    }

    .sidebar .logout-link {
        padding: 8px 4px;
        font-size: 14px;
        white-space: nowrap;
    }

    /* Menu: one row of buttons you can swipe left and right */
    .sidebar nav {
        order: 3;
        flex: 0 0 100%;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 10px 0;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar nav a {
        flex: 0 0 auto;
        gap: 6px;
        margin: 0;
        padding: 8px 14px;
        border-radius: 20px;
        font-size: 13.5px;
        white-space: nowrap;
        background: #F5F5F5;
    }

    .sidebar nav a.active {
        background: #B3141C;
        color: #fff;
    }

    .main-content {
        margin-left: 0;
        width: auto;
        padding: 18px 16px 40px;
    }

    .main-content h1 {
        font-size: 26px;
    }
}