/* Colours for the sign-in pages (plain HTML). The MudBlazor pages use the same values from MainLayout's MudTheme. */
:root {
    --bg: #f6f7fb; --surface: #ffffff; --fg: #1f2430; --muted: #5d6475; --border: #dfe3ee;
    --primary: #4f46e5; --primary-hover: #4338ca; --primary-fg: #ffffff;
    --err-bg: #fdecec; --err-fg: #8f1d1d; --ok-bg: #e7f7ee; --ok-fg: #14532d;
    --primary-soft: #ecebfd; --on-soft: #2f2a9c; --tile: #f4f5fa;
    --card-shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 6px 18px rgba(31, 36, 48, .07);
}
:root[data-theme="dark"] {
    --bg: #14141f; --surface: #1e1e2d; --fg: #e8eaf2; --muted: #a9aec0; --border: #36384e;
    --primary: #8b93ff; --primary-hover: #a3a9ff; --primary-fg: #10101c;
    --err-bg: #3b1d22; --err-fg: #ffb4b4; --ok-bg: #173627; --ok-fg: #a7f0c4;
    --primary-soft: #2b2a45; --on-soft: #cfd2ff; --tile: #15151f;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .35);
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 16px;
}
a { color: var(--primary); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---- sign-in pages ---- */
.auth-shell { max-width: 440px; margin: 0 auto; padding: 16px 16px 40px; box-sizing: border-box; }
.auth-top { display: flex; justify-content: flex-end; }
.theme-toggle {
    background: transparent; color: var(--fg); border: 1px solid var(--border); border-radius: 999px;
    width: 40px; height: 40px; font-size: 20px; cursor: pointer;
}
.auth-logo {
    width: 60px; height: 60px; border-radius: 16px; background: var(--primary); color: var(--primary-fg);
    display: grid; place-items: center; margin: 0 auto 12px;
}
.auth-brand { text-align: center; font-size: 26px; font-weight: 700; }
.auth-tag { text-align: center; color: var(--muted); margin: 6px 0 22px; }
.auth-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px 24px 28px;
    box-shadow: var(--card-shadow);
}
.auth-quote { text-align: center; color: var(--muted); margin: 22px 8px 0; font-size: 15px; line-height: 1.45; }
.auth-quote-author { display: block; margin-top: 2px; }
/* The round light/dark button shows a moon in light mode and a sun in dark mode. */
.theme-toggle .ico-sun, :root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: inline; }
/* Password field with a "Show" button inside it. */
.pw-wrap { position: relative; }
.auth-card .pw-wrap input { padding-right: 76px; }
.pw-show {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 40px; padding: 0 10px;
    background: transparent; border: 0; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; border-radius: 8px;
}
.pw-show:focus-visible { outline: 3px solid var(--primary); }
.auth-card .auth-forgot { text-align: right; margin: 12px 0 0; font-weight: 600; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; }
.auth-card p { margin: 6px 0 14px; line-height: 1.45; }
.auth-footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.auth-card hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0 14px; }

.auth-card label { display: block; font-weight: 600; margin: 14px 0 6px; }
.auth-card label.check { font-weight: 400; margin: 8px 0 0; display: flex; align-items: center; gap: 8px; }
.auth-card label.check input { width: 20px; height: 20px; }
.auth-card input:not([type=checkbox]), .auth-card select {
    width: 100%; box-sizing: border-box; min-height: 48px; padding: 10px 12px; font-size: 16px;
    background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 10px;
}
.auth-card input:focus-visible, .auth-card select:focus-visible, .btn:focus-visible, .theme-toggle:focus-visible, a:focus-visible {
    outline: 3px solid var(--primary); outline-offset: 2px;
}
h1:focus { outline: none; }

.btn {
    display: block; box-sizing: border-box; width: 100%; min-height: 48px; margin-top: 20px; padding: 12px 18px;
    font-size: 16px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
    border-radius: 10px; border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--primary); border-color: var(--primary); margin-top: 8px; }
.btn:disabled, .btn.is-busy { opacity: .7; cursor: progress; }
.btn.is-busy::before {
    content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ht-spin .8s linear infinite;
}
@keyframes ht-spin { to { transform: rotate(360deg); } }

.alert { border-radius: 10px; padding: 12px 14px; margin: 14px 0; line-height: 1.45; }
.alert-error { background: var(--err-bg); color: var(--err-fg); }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }

/* ---- the signed-in pages (MudBlazor) ---- */
.ht-appbar { border-bottom: 1px solid var(--border); }
.ht-brand { font-weight: 700; white-space: nowrap; }
.ms-brand-link { display: flex; align-items: center; color: inherit; text-decoration: none; }
.ht-appbar .mud-button-root { white-space: nowrap; }
/* Notices keep the normal text colour (dark on light, light on dark) so they are easy to read; the icon and border carry the colour. */
.ht-notice .mud-alert-message { color: var(--fg); }
.ht-notice .mud-alert-message strong { overflow-wrap: anywhere; }
.ht-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 12px 16px 24px; }

/* Same friendly type and plain (not upper-case) buttons as the sign-in pages. */
.mud-typography, .mud-button-root, .mud-input, .mud-input-slot, .mud-input-label { font-family: inherit; }
.mud-button-root { text-transform: none; font-weight: 700; letter-spacing: 0; }
.ms-page { max-width: 1072px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.ms-logo {
    width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: var(--primary-fg);
    display: grid; place-items: center; margin-right: 12px; flex: none;
}
.ms-logo svg { width: 20px; height: 20px; }
.ms-round { border: 1px solid var(--border); margin: 0 8px; }
.ms-muted { color: var(--muted); }
.ms-small { font-size: 14px; }
.ms-link { color: var(--primary); font-weight: 700; text-decoration: none; padding: 10px 4px; flex: none; }
.ms-link:hover { text-decoration: underline; }

.ms-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.ms-head h1 { font-size: 30px; margin: 0; line-height: 1.2; }
.ms-head p { margin: 4px 0 0; color: var(--muted); }
@media (max-width: 599px) { .ms-head .ms-cta { width: 100%; } .ms-head h1 { font-size: 26px; } }

/* The thought of the day */
.ms-quote { display: flex; align-items: center; gap: 16px; background: var(--primary-soft); border-radius: 16px; padding: 18px 22px; margin-top: 20px; }
.ms-quote-body { flex: 1; min-width: 0; }
.ms-quote-mark { color: var(--primary); font-size: 36px; line-height: 1; align-self: flex-start; font-family: Georgia, serif; }
.ms-quote-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-soft); }
.ms-quote-text { font-size: 20px; margin: 4px 0; line-height: 1.4; }
.ms-quote-author { color: var(--muted); }
@media (max-width: 599px) { .ms-quote { flex-direction: column; align-items: flex-start; } .ms-quote-text { font-size: 18px; } }

/* Goal cards */
.ms-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
@media (max-width: 959px) { .ms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .ms-grid { grid-template-columns: minmax(0, 1fr); } }
.ms-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--card-shadow); padding: 22px; }
.ms-goal { display: flex; flex-direction: column; }
.ms-goal-head { display: flex; align-items: center; gap: 12px; }
.ms-goal-title { flex: 1; min-width: 0; }
.ms-goal-name { font-size: 18px; line-height: 1.2; margin: 0; }
.ms-badge {
    width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center;
    font-size: 22px; flex: none;
}
.ms-big { font-size: 44px; font-weight: 700; color: var(--primary); margin-top: 14px; line-height: 1.1; }
.ms-big-unit { font-size: 18px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.ms-bar { height: 10px; border-radius: 999px; background: var(--border); margin-top: 10px; overflow: hidden; }
.ms-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.ms-next { margin-top: 8px; }
.ms-celebrate { background: var(--primary-soft); color: var(--on-soft); font-weight: 700; border-radius: 10px; padding: 10px 14px; margin-top: 12px; }
.ms-tiles { display: flex; gap: 12px; margin-top: auto; padding-top: 14px; }
.ms-tile { flex: 1; min-width: 0; background: var(--tile); border-radius: 12px; padding: 14px; }
.ms-tile-ok { background: var(--ok-bg); color: var(--ok-fg); }
.ms-tile-num { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.ms-tile-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ms-tile-ok .ms-tile-label { color: var(--ok-fg); }
.ms-goal-compact .ms-big { font-size: 38px; }

.ms-add-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 200px;
    border: 2px dashed var(--border); border-radius: 16px; color: var(--fg); text-decoration: none; padding: 24px; text-align: center;
}
.ms-add-card:hover { border-color: var(--primary); }
.ms-add-plus {
    width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-size: 28px; margin-bottom: 6px;
}
.ms-add-title { font-weight: 700; font-size: 17px; }

/* Add / edit goal */
.ms-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; margin-top: 20px; }
@media (max-width: 899px) { .ms-form-layout { grid-template-columns: minmax(0, 1fr); } .ms-preview { display: none; } }
.ms-preview { position: sticky; top: 84px; }
.ms-preview-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.ms-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.ms-step-head h2 { font-size: 18px; margin: 0; }
.ms-step {
    width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--primary-fg);
    display: grid; place-items: center; font-weight: 700; flex: none;
}
.ms-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 599px) { .ms-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ms-choice {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 88px; padding: 12px 8px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface);
    color: var(--fg); font: inherit; font-weight: 600; text-align: center; cursor: pointer;
}
.ms-choice:hover:not(:disabled) { border-color: var(--primary); }
.ms-choice:disabled { opacity: .6; cursor: progress; }
.ms-choice:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.ms-choice[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--on-soft); }
.ms-choice[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 6px; right: 10px; color: var(--primary); }
.ms-choice-emoji { font-size: 26px; line-height: 1; }

#blazor-error-ui {
    background: var(--err-bg); color: var(--err-fg); display: none; padding: 12px 16px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }
