/* ==========================================================================
   Life Dashboard — styles
   All colours are CSS custom properties so a dark theme can be added later
   by overriding them under [data-theme="dark"].
   ========================================================================== */

:root {
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-hover: #f3f6fb;
    --border: #e6eaf1;
    --border-strong: #d6dce6;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eaf1ff;

    --green: #15803d;
    --green-soft: #e7f6ec;
    --green-bar: #22a05a;
    --amber: #b45309;
    --amber-soft: #fdf2e1;
    --amber-bar: #f08c3a;
    --red: #c2410c;
    --red-soft: #fdebe6;
    --red-bar: #e5484d;
    --violet: #6d28d9;
    --violet-soft: #f1ecfe;
    --violet-bar: #8b5cf6;
    --blue: #1d4ed8;
    --blue-soft: #e8f0ff;
    --blue-bar: #3b82f6;
    --slate: #475569;
    --slate-soft: #eef1f5;
    --slate-bar: #94a3b8;
    --teal: #0f766e;
    --teal-soft: #e3f5f2;
    --teal-bar: #14b8a6;

    --sidebar-bg: #0c1426;
    --sidebar-bg-2: #111c33;
    --sidebar-text: #c3cbe0;
    --sidebar-active: #1f4fd8;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 6px 20px -8px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 40px -12px rgba(15, 23, 42, .25);

    --sidebar-w: 248px;
    --bottom-nav-h: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    --bs-body-font-family: var(--font);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--border);
    --bs-primary: var(--primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: var(--primary);
    --bs-link-color-rgb: 37, 99, 235;
    --bs-secondary-color: var(--muted);
}

/* ---------- Base ---------- */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
}

@media (max-width: 991.98px) {
    body {
        font-size: 16px;
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text);
    letter-spacing: -0.015em;
}

a {
    text-decoration: none;
}

.text-muted {
    color: var(--muted) !important;
}

.text-pre {
    white-space: pre-line;
}

.btn {
    border-radius: 10px;
    font-weight: 500;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
    box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .45);
}

.btn-light {
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-bg: var(--surface-hover);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-color: var(--text-2);
}

.btn-lg {
    border-radius: 12px;
}

.form-control,
.form-select {
    border-color: var(--border-strong);
    border-radius: 10px;
    background-color: var(--surface);
}

.form-control:focus,
.form-select:focus {
    border-color: #93b4f7;
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.form-label {
    font-weight: 500;
    font-size: .9rem;
    color: var(--text-2);
    margin-bottom: .35rem;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.switch-lg .form-check-input {
    width: 2.6em;
    height: 1.4em;
    margin-top: .05em;
}

.switch-lg .form-check-label {
    padding-left: .35rem;
    padding-top: .1rem;
}

.dropdown-menu {
    border-color: var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: .35rem;
    font-size: .92rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: .5rem .75rem;
}

.dropdown-item i {
    color: var(--muted);
    margin-right: .25rem;
}

.dropdown-item.text-danger i {
    color: inherit;
}

.modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.modal-footer .btn {
    min-height: 44px;
}

@media (max-width: 575.98px) {
    .modal-fullscreen-sm-down .modal-content {
        border-radius: 0;
    }

    .modal-footer {
        padding-bottom: calc(.75rem + var(--safe-bottom));
    }
}

/* ---------- App shell ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 1030;
    flex-direction: column;
    padding: 20px 14px;
    background: radial-gradient(120% 60% at 0% 100%, rgba(240, 140, 58, .22), transparent 60%),
        linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
}

.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #fff;
    padding: 4px 8px 22px;
}

.sidebar-brand strong {
    display: block;
    font-size: 1.05rem;
}

.sidebar-brand small {
    display: block;
    color: #8e9bb8;
    font-size: .75rem;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-weight: 500;
    border: 0;
    background: none;
    text-align: left;
    transition: background .15s, color .15s;
}

.sidebar-link i {
    opacity: .85;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 6px 18px -8px rgba(37, 99, 235, .8);
}

.sidebar-quote {
    margin-top: auto;
    padding: 18px 10px;
}

.sidebar-quote .quote {
    color: #fff;
    font-size: 1.15rem;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    margin-bottom: .35rem;
}

.sidebar-quote .sub {
    color: #8e9bb8;
    font-size: .82rem;
    margin: 0;
}

.sidebar-logout {
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: 10px;
}

.app-main {
    min-height: 100vh;
}

.app-content {
    padding: 16px 16px calc(var(--bottom-nav-h) + 28px + var(--safe-bottom));
    max-width: 1500px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    .app-main {
        margin-left: var(--sidebar-w);
    }

    .app-content {
        padding: 28px 32px 48px;
    }
}

.mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    background: rgba(244, 246, 250, .86);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.mobile-topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
}

.mobile-topbar .brand-mark {
    width: 30px;
    height: 30px;
    font-size: .85rem;
    border-radius: 8px;
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--text);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
}

.bottom-nav>a,
.bottom-nav>button:not(.bottom-nav-add) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 500;
    border: 0;
    background: none;
}

.bottom-nav i {
    font-size: 1.15rem;
}

.bottom-nav .active {
    color: var(--primary);
}

.bottom-nav-add {
    justify-self: center;
    width: 56px;
    height: 56px;
    margin-top: -22px;
    border-radius: 50%;
    border: 4px solid var(--bg);
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 8px 20px -6px rgba(37, 99, 235, .6);
}

.bottom-nav-add:active {
    transform: scale(.96);
}

.more-menu {
    height: auto !important;
    border-radius: 18px 18px 0 0;
    padding-bottom: var(--safe-bottom);
}

.more-link {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 6px;
    border: 0;
    background: none;
    color: var(--text);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.more-link i {
    color: var(--muted);
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.page-subtitle {
    color: var(--muted);
    margin: 2px 0 0;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

@media (min-width: 992px) {
    .page-title {
        font-size: 1.75rem;
    }
}

.btn-quick-add {
    align-items: center;
    gap: 8px;
    padding: .6rem 1.2rem;
}

.user-chip {
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 500;
    padding-left: 8px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.back-link:hover {
    color: var(--text);
}

/* ---------- Panels ---------- */
.card-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

@media (min-width: 768px) {
    .card-panel {
        padding: 20px 22px;
    }
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 650;
    margin: 0;
    display: flex;
    align-items: center;
}

.panel-link {
    font-size: .85rem;
    font-weight: 500;
    white-space: nowrap;
}

.notice {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: .92rem;
}

.notice-muted {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
}

/* ---------- Dashboard layout ---------- */
.dash-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dash-main,
.dash-rail {
    display: contents;
}

.dash-order-1 {
    order: 1;
}

.dash-order-2 {
    order: 2;
}

.dash-order-3 {
    order: 3;
}

.dash-order-4 {
    order: 4;
}

.dash-order-5 {
    order: 5;
}

.dash-order-6 {
    order: 6;
}

.dash-order-8 {
    order: 8;
}

@media (min-width: 1200px) {
    .dash-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        gap: 20px;
        align-items: start;
    }

    .dash-main,
    .dash-rail {
        display: flex;
        flex-direction: column;
        gap: 20px;
        min-width: 0;
    }
}

@media (min-width: 1500px) {
    .dash-grid {
        grid-template-columns: minmax(0, 1fr) 380px;
    }
}

/* ---------- Summary cards ---------- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (min-width: 768px) {
    .summary-grid-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .summary-grid-5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.summary-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}

a.summary-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    color: var(--text);
}

.summary-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.summary-body {
    display: contents;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.summary-value small {
    font-size: .9rem;
    color: var(--muted);
    font-weight: 500;
}

.summary-label {
    grid-column: 1 / -1;
    color: var(--text-2);
    font-size: .88rem;
    font-weight: 500;
    margin-top: 8px;
}

.summary-link {
    grid-column: 1 / -1;
    color: var(--primary);
    font-size: .8rem;
    font-weight: 500;
    margin-top: 2px;
}

.summary-link i {
    font-size: .7rem;
}

@media (max-width: 575.98px) {
    .summary-card {
        padding: 14px;
    }

    .summary-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .summary-link {
        display: none;
    }
}

/* ---------- Tones ---------- */
.tone-green,
.tone-violet,
.tone-blue,
.tone-amber,
.tone-red,
.tone-slate,
.tone-waiting,
.tone-active,
.tone-complete {
    --tone: var(--slate);
    --tone-soft: var(--slate-soft);
    --tone-bar: var(--slate-bar);
}

.tone-green,
.tone-complete {
    --tone: var(--green);
    --tone-soft: var(--green-soft);
    --tone-bar: var(--green-bar);
}

.tone-amber {
    --tone: var(--amber);
    --tone-soft: var(--amber-soft);
    --tone-bar: var(--amber-bar);
}

.tone-red {
    --tone: var(--red);
    --tone-soft: var(--red-soft);
    --tone-bar: var(--red-bar);
}

.tone-violet {
    --tone: var(--violet);
    --tone-soft: var(--violet-soft);
    --tone-bar: var(--violet-bar);
}

.tone-blue,
.tone-active {
    --tone: var(--blue);
    --tone-soft: var(--blue-soft);
    --tone-bar: var(--blue-bar);
}

.tone-waiting {
    --tone: var(--violet);
    --tone-soft: var(--violet-soft);
    --tone-bar: var(--violet-bar);
}

.summary-card.tone-violet,
.summary-card.tone-blue,
.summary-card.tone-amber,
.summary-card.tone-green,
.summary-card.tone-slate {
    background: linear-gradient(180deg, color-mix(in srgb, var(--tone-soft) 55%, var(--surface)) 0%, var(--surface) 70%);
}

.summary-icon,
.area-icon,
.simple-icon {
    background: var(--tone-soft);
    color: var(--tone);
}

/* ---------- Badges ---------- */
.badge-status,
.badge-priority {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.status-green {
    background: var(--green-soft);
    color: var(--green);
}

.status-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.status-red {
    background: var(--red-soft);
    color: var(--red);
}

.status-waiting {
    background: var(--violet-soft);
    color: var(--violet);
}

.status-active {
    background: var(--blue-soft);
    color: var(--blue);
}

.status-complete {
    background: var(--teal-soft);
    color: var(--teal);
}

.badge-priority {
    padding: 2px 8px;
    font-size: .72rem;
}

.priority-low {
    background: var(--slate-soft);
    color: var(--slate);
}

.priority-medium {
    background: var(--amber-soft);
    color: var(--amber);
}

.priority-high {
    background: var(--red-soft);
    color: var(--red);
}

.priority-critical {
    background: var(--red);
    color: #fff;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot-green {
    background: var(--green-bar);
}

.status-dot-amber {
    background: var(--amber-bar);
}

.status-dot-red {
    background: var(--red-bar);
}

.status-dot-waiting {
    background: var(--violet-bar);
}

.status-dot-active {
    background: var(--blue-bar);
}

.status-dot-complete {
    background: var(--teal-bar);
}

.badge-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    padding: 4px 2px;
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
}

.pill-waiting {
    background: var(--violet-soft);
    color: var(--violet);
}

.pill-doing {
    background: var(--blue-soft);
    color: var(--blue);
}

/* ---------- Progress ---------- */
.progress-thin {
    height: 7px;
    border-radius: 999px;
    background: var(--slate-soft);
    flex: 1;
}

.progress-thin .progress-bar {
    border-radius: 999px;
    background: var(--tone-bar);
    transition: width .5s ease;
}

.area-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 10px;
}

.area-pct {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-2);
    min-width: 38px;
    text-align: right;
}

.area-progress-lg .progress-thin {
    height: 9px;
}

/* ---------- Area cards ---------- */
.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.area-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.area-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.area-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.area-card-title {
    flex: 1;
    font-size: .98rem;
    font-weight: 600;
    margin: 0;
    min-width: 0;
}

.area-card-title a {
    color: var(--text);
}

.area-card-title a::before {
    /* stretched link keeps whole card tappable */
}

.area-icon {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    flex-shrink: 0;
    font-size: 1rem;
}

.area-icon-lg {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    font-size: 1.5rem;
}

.area-outcome {
    color: var(--text-2);
    font-size: .88rem;
    margin: 10px 0 12px;
    line-height: 1.45;
}

.area-card .area-progress+.area-outcome {
    margin-top: 0;
}

.area-next {
    display: flex;
    flex-direction: column;
    font-size: .86rem;
    margin-top: auto;
}

.area-next-label {
    color: var(--primary);
    font-weight: 500;
    font-size: .78rem;
}

.area-next-title {
    color: var(--text);
    font-weight: 500;
}

.area-ms {
    color: var(--muted);
    font-size: .8rem;
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.area-cycle {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: .82rem;
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 12px;
}

.area-cycle i {
    margin-top: 3px;
    color: var(--muted);
}

/* ---------- Area page ---------- */
.area-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.area-hero-main {
    flex: 1 1 280px;
    min-width: 0;
}

.area-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}

.area-hero .area-progress {
    max-width: 520px;
    margin-bottom: 0;
}

.area-hero-actions {
    margin-left: auto;
}

.cycle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .cycle-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cycle-grid dt {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 500;
}

.cycle-grid dd {
    margin: 0;
    font-weight: 600;
    font-size: .92rem;
}

.inline-add {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--surface-2);
}

.inline-add .form-control {
    border: 0;
    background: transparent;
    padding-left: 0;
    box-shadow: none;
}

.completed-details {
    margin-top: 14px;
}

.completed-details summary {
    cursor: pointer;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 500;
    padding: 6px 0;
}

.entry-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.entry-buttons .btn {
    padding: .5rem .25rem;
    font-size: .82rem;
    min-height: 40px;
}

.entry-btn-win i {
    color: var(--green);
}

.entry-btn-problem i {
    color: var(--red);
}

.entry-btn-decision i {
    color: var(--amber);
}

.entry-btn-note i {
    color: var(--blue);
}

/* ---------- Item rows (actions, milestones, areas) ---------- */
.item-list {
    display: flex;
    flex-direction: column;
}

.item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border);
    min-height: 52px;
    background: var(--surface);
}

.item:last-child {
    border-bottom: 0;
}

.item-check {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    cursor: pointer;
    margin: -4px -4px -4px -6px;
}

.item-check .form-check-input {
    width: 1.3em;
    height: 1.3em;
    margin: 0;
    border-radius: 6px;
    border-color: var(--border-strong);
    cursor: pointer;
}

.item-check .form-check-input:checked {
    background-color: var(--green-bar);
    border-color: var(--green-bar);
}

.item-body {
    flex: 1 1 0;
    min-width: 0;
}

.item-title {
    font-weight: 500;
    color: var(--text);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.item-desc {
    color: var(--muted);
    font-size: .86rem;
    margin-top: 2px;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    color: var(--muted);
    font-size: .8rem;
    margin-top: 2px;
}

.item-meta:empty {
    display: none;
}

.item-side {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.item-due {
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
}

.due-overdue {
    color: var(--red);
    font-weight: 600;
}

.due-today {
    color: var(--amber);
    font-weight: 600;
}

.btn-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted-2);
    transition: background .15s, color .15s;
}

.btn-icon:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-icon.is-on {
    color: #f5a524;
}

.item.is-complete .item-title {
    text-decoration: line-through;
    text-decoration-color: var(--muted-2);
    color: var(--muted);
}

.item.is-complete .badge-priority {
    opacity: .5;
}

.item.just-completed {
    animation: complete-flash .9s ease;
}

@keyframes complete-flash {
    0% {
        background: var(--green-soft);
    }

    100% {
        background: var(--surface);
    }
}

.item-compact {
    padding: 9px 0;
    min-height: 0;
}

.item-compact .item-title {
    font-size: .9rem;
}

.item-compact .item-meta {
    font-size: .76rem;
}

.drag-handle {
    color: var(--muted-2);
    cursor: grab;
    padding: 6px 2px;
    touch-action: none;
}

.sortable-ghost {
    opacity: .4;
    background: var(--primary-soft);
}

.milestone-item.is-complete .area-icon {
    opacity: .6;
}

.area-row .item-meta .badge-status {
    font-size: .7rem;
    padding: 1px 8px;
}

.archive-item {
    flex-wrap: wrap;
}

.danger-zone {
    background: var(--red-soft);
    border-radius: 12px;
    padding: 12px;
    margin-top: 4px;
}

@media (max-width: 575.98px) {
    .action-item:not(.item-compact) {
        flex-wrap: wrap;
    }

    .action-item:not(.item-compact) .item-body {
        flex-basis: calc(100% - 80px);
    }

    .action-item:not(.item-compact) .item-side {
        width: 100%;
        padding-left: 34px;
        justify-content: flex-start;
        margin-top: -4px;
    }

    .action-item:not(.item-compact) .item-side .dropdown {
        margin-left: auto;
    }

    .action-item:not(.item-compact) .item-due {
        min-width: 0;
        text-align: left;
    }
}

/* ---------- Simple lists (waiting, wins) ---------- */
.simple-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.simple-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.simple-list li:last-child {
    border-bottom: 0;
}

.simple-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    flex-shrink: 0;
    font-size: .85rem;
}

.simple-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

.simple-title {
    font-weight: 500;
    font-size: .9rem;
    overflow-wrap: anywhere;
}

.simple-meta {
    color: var(--muted);
    font-size: .78rem;
}

.simple-date {
    color: var(--muted);
    font-size: .78rem;
    white-space: nowrap;
}

.wins-panel {
    background: linear-gradient(180deg, color-mix(in srgb, var(--green-soft) 45%, var(--surface)) 0%, var(--surface) 140px);
}

.overdue-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: .86rem;
    font-weight: 500;
}

.overdue-note:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.overdue-note i:first-child {
    color: var(--amber);
}

/* ---------- Activity ---------- */
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    align-items: flex-start;
}

.activity-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--slate-soft);
    color: var(--slate);
    font-size: .75rem;
    flex-shrink: 0;
}

.kind-milestone .activity-icon,
.kind-action .activity-icon,
.kind-win .activity-icon {
    background: var(--green-soft);
    color: var(--green);
}

.kind-waiting .activity-icon {
    background: var(--violet-soft);
    color: var(--violet);
}

.kind-note .activity-icon {
    background: var(--blue-soft);
    color: var(--blue);
}

.kind-problem .activity-icon {
    background: var(--red-soft);
    color: var(--red);
}

.kind-decision .activity-icon {
    background: var(--amber-soft);
    color: var(--amber);
}

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: .86rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.activity-label {
    color: var(--muted);
}

.activity-area {
    font-size: .76rem;
    color: var(--muted);
}

.activity-date {
    font-size: .76rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ---------- Entries ---------- */
.entry-list {
    display: flex;
    flex-direction: column;
}

.entry-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.entry-item:last-child {
    border-bottom: 0;
}

.entry-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
    font-size: .85rem;
}

.type-note .entry-icon {
    background: var(--blue-soft);
    color: var(--blue);
}

.type-win .entry-icon {
    background: var(--green-soft);
    color: var(--green);
}

.type-problem .entry-icon {
    background: var(--red-soft);
    color: var(--red);
}

.type-decision .entry-icon {
    background: var(--amber-soft);
    color: var(--amber);
}

.entry-body {
    flex: 1;
    min-width: 0;
}

.entry-head {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: .78rem;
    color: var(--muted);
}

.entry-type {
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .7rem;
}

.entry-title {
    font-size: .95rem;
    font-weight: 600;
    margin: 4px 0 2px;
}

.entry-content {
    font-size: .9rem;
    color: var(--text-2);
    overflow-wrap: anywhere;
    margin-top: 2px;
}

/* ---------- Chips & tabs ---------- */
.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.chip {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: .8rem;
    font-weight: 500;
    min-height: 32px;
}

.chip.active {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}

.tabs-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px 16px;
    padding: 2px 16px;
    -webkit-overflow-scrolling: touch;
}

.tabs-scroll::-webkit-scrollbar {
    display: none;
}

@media (min-width: 992px) {
    .tabs-scroll {
        margin: 0 0 16px;
        padding: 2px 0;
        flex-wrap: wrap;
    }
}

.tab-link {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-2);
    font-weight: 500;
    font-size: .88rem;
    background: var(--surface);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.tab-link:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.tab-link.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.tab-count {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(100, 116, 139, .15);
    font-size: .72rem;
    text-align: center;
    margin-left: 4px;
}

.tab-link.active .tab-count {
    background: rgba(255, 255, 255, .2);
}

.filters {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.filters summary {
    cursor: pointer;
    color: var(--text-2);
    font-weight: 500;
    font-size: .9rem;
    list-style: none;
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
}

.filters summary::-webkit-details-marker {
    display: none;
}

/* ---------- Empty states ---------- */
.empty-state {
    text-align: center;
    padding: 22px 12px;
}

.empty-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--muted-2);
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.empty-title {
    font-weight: 600;
    margin: 0 0 2px;
    color: var(--text-2);
}

.empty-text {
    color: var(--muted);
    font-size: .88rem;
    margin: 0 auto;
    max-width: 340px;
}

/* ---------- Quick Add ---------- */
.qa-question {
    font-weight: 600;
    margin-bottom: 10px;
}

.qa-types {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.qa-type {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-2);
    transition: all .15s;
    min-height: 68px;
    justify-content: center;
}

.qa-type i {
    font-size: 1.15rem;
    color: var(--muted);
}

.qa-type:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.btn-check:checked+.qa-type {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary) inset;
}

.btn-check:checked+.qa-type i {
    color: var(--primary);
}

.btn-check:focus-visible+.qa-type {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.qa-type-win i {
    color: var(--green);
}

.qa-type-problem i {
    color: var(--red);
}

.qa-type-decision i {
    color: var(--amber);
}

/* ---------- Icon picker ---------- */
.icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
}

.icon-option {
    display: grid;
    place-items: center;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-2);
}

.btn-check:checked+.icon-option {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

/* ---------- Weekly review ---------- */
.rating-scale {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

@media (min-width: 576px) {
    .rating-scale {
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }
}

.rating-option {
    display: grid;
    place-items: center;
    height: 46px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-2);
    transition: all .15s;
}

.rating-option:hover {
    background: var(--surface-2);
}

.btn-check:checked+.rating-option {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.priority-row {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.priority-row .form-select {
    grid-column: 2;
    font-size: .88rem;
    color: var(--text-2);
}

@media (min-width: 768px) {
    .priority-row {
        grid-template-columns: 30px minmax(0, 1.3fr) minmax(0, 1fr);
    }

    .priority-row .form-select {
        grid-column: auto;
    }
}

.priority-num {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: .82rem;
}

.priority-row.is-extra .priority-num {
    background: var(--slate-soft);
    color: var(--slate);
}

.glance-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.glance-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.glance-list li:last-child {
    border-bottom: 0;
}

.priority-list {
    margin: 0;
    padding-left: 1.4rem;
}

.priority-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.priority-list li:last-child {
    border-bottom: 0;
}

.priority-list li.is-primary .priority-title {
    font-weight: 600;
}

.priority-list li.is-complete .priority-title {
    text-decoration: line-through;
    color: var(--muted);
}

.priority-list .small {
    display: block;
}

.review-cta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.review-cta-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--slate-soft);
    color: var(--slate);
    font-size: 1.1rem;
}

@media (max-width: 575.98px) {
    .review-cta .btn {
        width: 100%;
        min-height: 46px;
    }
}

/* ---------- History ---------- */
.history-row {
    display: block;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.history-row:last-child {
    border-bottom: 0;
}

a.history-row:hover {
    background: var(--surface-2);
    color: var(--text);
}

.history-row>span {
    display: block;
}

.history-week {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-text {
    font-size: .88rem;
    color: var(--text-2);
    margin-top: 4px;
}

.history-label {
    display: inline-block;
    min-width: 92px;
    font-size: .74rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

@media (min-width: 768px) {
    .history-row {
        display: grid;
        grid-template-columns: 140px 80px minmax(0, 1fr) minmax(0, 1fr) 110px;
        gap: 16px;
        align-items: center;
        padding: 14px 8px;
    }

    .history-row>span {
        margin: 0 !important;
    }

    .history-head {
        font-size: .74rem;
        color: var(--muted);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .04em;
        padding-top: 0;
    }
}

.rating-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
}

.rating-good {
    background: var(--green-soft);
    color: var(--green);
}

.rating-mid {
    background: var(--amber-soft);
    color: var(--amber);
}

.rating-low {
    background: var(--red-soft);
    color: var(--red);
}

/* ---------- Toasts ---------- */
.toast-container {
    z-index: 1090;
    padding-top: calc(1rem + env(safe-area-inset-top, 0px)) !important;
}

.app-toast {
    border: 0;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    background: var(--text);
    color: #fff;
    font-weight: 500;
}

.app-toast .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

.app-toast.toast-success i {
    color: #4ade80;
}

.app-toast.toast-danger {
    background: #7f1d1d;
}

@media (max-width: 575.98px) {
    .toast-container {
        left: 0;
        right: 0;
    }

    .app-toast {
        width: 100%;
    }
}

/* ---------- Login ---------- */
body.guest {
    min-height: 100vh;
    background: radial-gradient(80% 60% at 50% 110%, rgba(240, 140, 58, .25), transparent 70%), linear-gradient(180deg, #0c1426, #16213d);
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 24px;
}

.login-brand .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    border-radius: 12px;
}

.login-quote {
    color: #c3cbe0;
    font-family: Georgia, serif;
    font-style: italic;
    margin-top: 24px;
}
/* ---------- Week board ---------- */
.board {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.board-col {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 0;
    padding: 10px;
}
.board-col.is-today {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}
.board-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .82rem;
    font-weight: 650;
    color: var(--text-2);
    padding: 4px 6px 8px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.board-head i {
    color: var(--muted-2);
    font-size: .75rem;
}
.board-date { color: var(--muted); }
.board-today-badge {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}
.board-col.is-today .board-head { color: var(--primary); }
.board-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 46px;
    border-radius: 8px;
}
.week-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 8px 8px 10px;
    cursor: grab;
    touch-action: auto;
}
.week-card:active { cursor: grabbing; }
.week-card:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.week-card .item-check { width: 28px; height: 28px; margin: 0; }
.week-card-body {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    cursor: inherit;
}
.week-card-body .item-title { font-size: .87rem; font-weight: 500; line-height: 1.3; }
.week-card-body .item-meta { font-size: .74rem; margin-top: 2px; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--slate-bar); }
.priority-dot.priority-medium { background: var(--amber-bar); }
.priority-dot.priority-high, .priority-dot.priority-critical { background: var(--red-bar); }
.pill-star { background: #fef3c7; color: #b45309; }
.board-add {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
    padding: 8px 6px 4px;
    text-align: left;
    border-radius: 8px;
}
.board-add:hover { color: var(--primary); }
.board-hint { font-size: .74rem; color: var(--muted); padding: 4px 6px 2px; margin: 0; }
@media (min-width: 992px) {
    .board { flex-direction: row; align-items: stretch; overflow-x: auto; padding-bottom: 8px; }
    .board-col { flex: 0 0 220px; }
    .board-col-tray { flex-basis: 240px; }
    .board-cards { max-height: calc(100vh - 260px); overflow-y: auto; }
    .board { scroll-snap-type: x proximity; }
    .board-col { scroll-snap-align: start; }
}
