/* =============================================================================
   LogVault — wwwroot/app.css
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Tokens
   ----------------------------------------------------------------------------- */

:root {
    --bg: #0f0f10;
    --surface: #1c1c1f;
    --text: #f2f2f2;
    --muted: #8a8a90;
    --border: #2a2a2e;
    --accent: #7c6af7;
    --accent-text: #fff;
    --danger: #c45c5c;
    --cal: #b8a99a;
    --footer-height: 64px;
}

[data-theme="light"] {
    --bg: #f4f4f5;
    --surface: #ffffff;
    --text: #1a1a1a;
    --muted: #6b6b70;
    --border: #e2e2e6;
    --accent: #5b4fd6;
    --accent-text: #fff;
    --danger: #b42318;
    --cal: #8c7b6c;
}

/* -----------------------------------------------------------------------------
   Base
   ----------------------------------------------------------------------------- */

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

.status {
    margin-top: 1rem;
    text-align: center;
    color: var(--muted);
}

/* -----------------------------------------------------------------------------
   Layout
   ----------------------------------------------------------------------------- */

.app-shell {
    min-height: 100dvh;
    max-width: 430px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    position: relative;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem 1rem;
}

    .app-main h1 {
        text-align: center;
        margin: 0 0 1.25rem;
        font-weight: 600;
        font-size: 1.25rem;
    }

.container {
    max-width: 640px;
    margin: 2rem auto;
    padding: 0 1rem 5rem;
}

/* -----------------------------------------------------------------------------
   Home — composer
   ----------------------------------------------------------------------------- */

.composer {
    position: relative;
    width: 100%;
}

.composer-input {
    width: 100%;
    height: 48px;
    box-sizing: border-box;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0 52px 0 16px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

    .composer-input:focus {
        border-color: var(--accent);
    }

.composer-send {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

    .composer-send:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .composer-send svg {
        width: 18px;
        height: 18px;
    }

/* -----------------------------------------------------------------------------
   Home — footer
   ----------------------------------------------------------------------------- */

.app-footer {
    z-index: 50;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: calc(640px + 2rem); /* same width as the page content / header */
    height: calc(var(--footer-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-btn {
    min-width: 52px;
    flex: 1 1 20%;
    box-sizing: border-box;
    max-width: 88px;
    height: 52px;
    padding: 0 0.25rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

    .footer-btn:hover { color: var(--text); }

    .footer-btn.active {
        color: var(--accent);
        background: rgba(124, 106, 247, 0.14);
        background: color-mix(in srgb, var(--accent) 14%, transparent);
    }

    .footer-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

    .footer-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .footer-btn svg {
        width: 22px;
        height: 22px;
    }

.footer-label { font-size: 0.62rem; line-height: 1; letter-spacing: 0.01em; }

/* Signed-in pages: the fixed bottom nav (plus the iOS home-indicator area) never covers content. */
.page-body.with-nav { padding-bottom: calc(var(--footer-height) + env(safe-area-inset-bottom) + 0.75rem); }
.page-body.with-nav .container { padding-bottom: 1rem; margin-bottom: 0; }
/* Fill the space between the header and the nav (Home centres the composer) without making it scroll. */
body:has(.page-body.with-nav) { display: flex; flex-direction: column; min-height: 100dvh; }
.page-body.with-nav { flex: 1 0 auto; display: flex; flex-direction: column; box-sizing: border-box; }
.page-body.with-nav > .app-shell { flex: 1 0 auto; min-height: 0; width: 100%; }
/* Flex items with margin:auto would shrink to fit; keep the normal full widths. */
body:has(.page-body.with-nav) > .site-header { width: 100%; max-width: calc(640px + 2rem); box-sizing: border-box; }
.page-body.with-nav > .container { width: 100%; max-width: calc(640px + 2rem); box-sizing: border-box; }

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */

.button-row {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.btn {
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-google {
    background: #4285F4;
    color: white;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}

    .btn-primary:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.btn-secondary {
    background: #555;
    color: white;
}

/* -----------------------------------------------------------------------------
   Forms — Settings / EditEntry
   ----------------------------------------------------------------------------- */

.field-label {
    display: block;
    margin: 1rem 0 0.35rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-group + .form-group {
    margin-top: 0.5rem;
}

.entry-box {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

select.entry-box {
    appearance: none;
    height: 48px;
    min-height: 48px;
    padding-right: 2.5rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

/* -----------------------------------------------------------------------------
   Review — list
   ----------------------------------------------------------------------------- */

.entries {
    margin-top: 2rem;
}

.entry-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 0;
}

.entry-line {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.entry-type {
    flex-shrink: 0;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
}

.entry-preview {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.entry-finished {
    color: var(--accent);
}

.entry-row .btn {
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   Review — calendar tile
   ----------------------------------------------------------------------------- */

.entry-cal {
    flex: 0 0 52px;
    width: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--cal);
    line-height: 1;
    user-select: none;
}

.entry-cal-month {
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.entry-cal-day {
    font-size: 1.55rem;
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1;
    margin: 0.12rem 0 0.08rem;
}

.entry-cal-year {
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

/* -----------------------------------------------------------------------------
   EditEntry — datetime fields
   ----------------------------------------------------------------------------- */

.datetime-wrap {
    position: relative;
}

    .datetime-wrap .entry-box,
    .datetime-wrap .datetime-input,
    .datetime-wrap .placeholder-field {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        box-sizing: border-box;
        padding-top: 0;
        padding-bottom: 0;
    }

.datetime-input,
.datetime-input-start,
.placeholder-field {
    padding-right: 2.5rem;
}

    .datetime-input.has-clear {
        padding-right: 4.5rem;
    }

.placeholder-field {
    display: flex;
    align-items: center;
    text-align: left;
    color: var(--muted);
    cursor: pointer;
}

.datetime-wrap input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    display: none !important;
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.field-icon-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .field-icon-btn:hover {
        background-color: color-mix(in srgb, var(--accent) 35%, transparent);
        color: var(--text);
    }

.calendar-btn {
    right: 0.4rem;
}

.clear-end-btn {
    right: 2.35rem;
}

    .clear-end-btn:hover {
        background-color: color-mix(in srgb, var(--danger) 35%, transparent);
    }


/* -----------------------------------------------------------------------------
   EditEntry — health fields
   ----------------------------------------------------------------------------- */

.health-fields {
    margin-top: 0.5rem;
}

.symptom-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.symptom-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

    .symptom-chip:has(input:checked) {
        border-color: var(--accent);
        color: var(--accent);
    }

    .symptom-chip input {
        margin: 0;
    }
/* -----------------------------------------------------------------------------
   Site account header + account pages
----------------------------------------------------------------------------- */
.site-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 640px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(127, 127, 127, 0.25);
}

    .site-header .site-brand { font-weight: 600; color: inherit; text-decoration: none; }
    .site-header .site-user { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .site-header .site-links { margin-left: auto; display: flex; gap: 0.75rem; align-items: center; }
    .site-header a { color: inherit; }

.site-logout { display: inline; margin: 0; }
.footer-form { display: flex; flex: 1 1 20%; box-sizing: border-box; min-width: 52px; max-width: 88px; margin: 0; }
.footer-form .footer-btn { width: 100%; max-width: none; }

.site-link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.site-header ~ .app-shell { min-height: calc(100dvh - 2.6rem); }

.account-form { display: flex; flex-direction: column; gap: 0.85rem; }

    .account-form input[type=text], .account-form input[type=email], .account-form input[type=password] {
        width: 100%;
        box-sizing: border-box;
        padding: 0.55rem 0.7rem;
        font-size: 1rem;
        border-radius: 6px;
        border: 1px solid rgba(127, 127, 127, 0.45);
        background: transparent;
        color: inherit;
    }

.form-error { color: #c0392b; }
.form-ok { color: #2e8b57; }
.validation-message { color: #c0392b; font-size: 0.85rem; }

.connection-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }

.connection-item {
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

    .connection-item .connection-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
    .connection-badge { font-size: 0.75rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: #2e8b57; color: #fff; }

/* -----------------------------------------------------------------------------
   Log types (vault v2)
   ----------------------------------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.typed-form { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.75rem; }
.typed-field .entry-box { width: 100%; box-sizing: border-box; font-size: 16px; /* no iOS zoom on focus */ }
.typed-field.has-error .entry-box { border-color: #e5484d; }
.field-error { color: #ff6b6b; font-size: 0.8rem; margin: 0.25rem 0 0; }
.input-with-unit { display: flex; align-items: center; gap: 0.5rem; }
.input-with-unit .entry-box { flex: 1; }
.input-unit { color: var(--muted); font-size: 0.9rem; }
.check-label { display: flex; align-items: center; gap: 0.5rem; }
.check-label input { width: 1.15rem; height: 1.15rem; }

.type-badge {
    display: inline-block; font-size: 0.72rem; font-weight: 600; line-height: 1.3; padding: 0.1rem 0.45rem;
    border-radius: 999px; background: rgba(124, 106, 247, 0.18); color: var(--accent); white-space: nowrap; margin-right: 0.4rem;
    vertical-align: middle;
}
.type-badge-general { background: rgba(127, 127, 127, 0.16); color: var(--muted); }
.type-badge-health { background: rgba(46, 160, 120, 0.18); color: #4fd1a5; }
.type-badge-queue { background: rgba(214, 160, 60, 0.18); color: #e0b252; }
.entry-headline { display: block; overflow-wrap: anywhere; }
.entry-summary { font-size: 0.95rem; }
.review-filter { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.review-filter .field-label { margin: 0; }
.review-filter select { flex: 1; }

.type-group { margin-bottom: 1.25rem; }
.type-group-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1rem 0 0.4rem; }
.type-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.type-item + .type-item { border-top: 1px solid var(--border); }
.type-item.archived { opacity: 0.6; }
.type-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.9rem; color: var(--text); text-decoration: none; min-height: 44px; }
.type-icon { font-size: 1.3rem; width: 1.6rem; text-align: center; }
.type-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.type-name { font-weight: 600; }
.type-meta { font-size: 0.8rem; color: var(--muted); }
.type-flag { margin-left: 0.35rem; font-size: 0.7rem; padding: 0 0.35rem; border: 1px solid var(--border); border-radius: 6px; }
.type-flag-archived { border-color: #b58a2c; color: #d9a93c; }
.type-chevron { color: var(--muted); font-size: 1.3rem; }

.type-form .form-row { display: flex; gap: 0.75rem; align-items: flex-end; }
.type-form .grow { flex: 1; min-width: 0; }
.type-form .icon-group { width: 5rem; }
.type-form .kind-group { width: 9.5rem; }
.type-form .entry-box { width: 100%; box-sizing: border-box; font-size: 16px; }
.section-title { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
.field-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.field-card { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem; background: var(--surface); }
.field-card-actions { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem; }
.field-card-actions .spacer { flex: 1; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: transparent;
    color: var(--text); font-size: 1rem; cursor: pointer;
}
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.button-row.left { justify-content: flex-start; }
.status.small { font-size: 0.8rem; }
.archived-fields { margin: 0.75rem 0; }
.archived-fields ul { list-style: none; padding: 0; }
.archived-fields li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; }
.btn-small { padding: 0.2rem 0.6rem; font-size: 0.8rem; }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.btn-danger { background: #c4363b; color: #fff; border: none; }
.btn-danger-outline { background: transparent; color: #ff6b6b; border: 1px solid #c4363b; }

/* Sub-options on the Edit page: custom types sit with Symptoms / Pain / Mood as one set. */
.sub-options { display: flex; flex-direction: column; }
.sub-option { border-top: 1px solid var(--border); padding-top: 0.75rem; }
.sub-option-toggle { display: flex; align-items: center; gap: 0.55rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.sub-option-toggle input { width: 1.15rem; height: 1.15rem; margin: 0; }
.sub-option-name { font-size: 1rem; }
.sub-option .typed-form { margin: 0.25rem 0 0 0; padding-left: 0.25rem; }
.sub-option.is-on { border-left: 2px solid var(--accent); padding-left: 0.6rem; }

/* Log type setting on a type (General / Health). */
fieldset.applies-group { border: 0; padding: 0; margin: 0.75rem 0 1rem 0; min-width: 0; }
fieldset.applies-group legend { padding: 0; margin-bottom: 0.35rem; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.segment { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.1rem; min-height: 44px; box-sizing: border-box; cursor: pointer; color: var(--muted); }
.segment + .segment { border-left: 1px solid var(--border); }
.segment input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segment.is-on, .segment:has(input:checked) { background: rgba(124, 106, 247, 0.18); color: var(--accent); font-weight: 600; }
.segment:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.types-intro { text-align: left; }

/* Vault v4: list types (e.g. Medication) — rows on the Edit page, the picker and the list screens. */
.list-rows { display: flex; flex-direction: column; gap: 0.75rem; }
.list-row { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.75rem 0.5rem; background: rgba(127, 127, 127, 0.06); }
.list-row .typed-fields .form-group:last-child { margin-bottom: 0.5rem; }
.list-row-remove { min-height: 44px; }
.list-row-add { align-self: flex-start; min-height: 44px; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.field-link { font-size: 0.9rem; min-height: 44px; display: inline-flex; align-items: center; }
.quick-add { margin-top: 0.5rem; padding: 0.6rem; border: 1px dashed var(--border); border-radius: 10px; }
.quick-add-row { display: flex; gap: 0.5rem; align-items: stretch; }
.quick-add-row .entry-box { flex: 1 1 auto; min-width: 0; }
.quick-add-row .btn { min-height: 44px; flex: 0 0 auto; }
.item-add { margin: 0.5rem 0 1rem; }
.item-tools { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.item-tools .entry-box { flex: 1 1 auto; min-width: 0; }
.item-flag { display: inline-block; font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px; margin-left: 0.25rem; vertical-align: middle; }
.item-flag.needs-details { background: rgba(214, 160, 60, 0.18); color: #e0b252; }
.item-details { color: var(--text); }
.type-sublink { display: flex; align-items: center; min-height: 44px; padding: 0 1rem 0 3.25rem; font-size: 0.9rem; border-top: 1px solid var(--border); }
.item-fields-section { margin-top: 1.25rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* Links inside the medication list screens and the picker */
.field-link,
.status a {
    color: var(--accent);
    text-underline-offset: 2px;
}
.field-link { font-size: 0.875rem; min-height: 24px; display: inline-flex; align-items: center; }

/* List item rows with a Delete button; delete confirmation dialog */
.item-row { display: flex; align-items: center; }
.item-row .type-link { flex: 1; min-width: 0; }
.item-row-delete { margin-right: 0.6rem; min-height: 44px; flex: none; }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 90; }
.confirm-dialog {
    position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(26rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto;
    background: var(--surface, #1b1b1f); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.1rem 1.1rem 1rem; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column; gap: 0.6rem;
}
.confirm-dialog h2 { margin: 0; font-size: 1.2rem; }
.confirm-dialog p { margin: 0; }
.confirm-dialog .item-delete-name { overflow-wrap: anywhere; }
.dialog-buttons { justify-content: flex-end; margin-top: 0.4rem; }
.dialog-buttons .btn { min-height: 44px; min-width: 6.5rem; }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.confirm-dialog .status { text-align: left; }

/* -----------------------------------------------------------------------------
   Vault v5: Log screen (type grid), log form, Review day view
   ----------------------------------------------------------------------------- */

.app-main .log-title { font-size: 1.25rem; margin: 0.25rem 0 0.75rem; text-align: left; }
.log-saved { color: #4fd1a5; }
.app-main .type-group { width: 100%; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; }
.type-tile {
    display: flex; align-items: center; gap: 0.6rem; min-height: 3.5rem; padding: 0.7rem 0.8rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    color: var(--text); text-decoration: none; font-weight: 600; overflow-wrap: anywhere;
}
.type-tile:hover, .type-tile:focus-visible { border-color: var(--accent); }
.type-group[data-category="health"] .type-tile { border-left: 3px solid #4fd1a5; }
.type-tile-icon { font-size: 1.4rem; line-height: 1; }
.type-tile-name { font-size: 0.98rem; }

.log-form-title { display: flex; align-items: center; gap: 0.5rem; }
.log-time-row { display: flex; gap: 0.5rem; align-items: center; }
.log-time-row input { flex: 1; min-width: 0; }

.scale-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 0.3rem; }
.scale-btn {
    min-height: 2.75rem; padding: 0; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-weight: 700; font-size: 1rem; cursor: pointer;
}
.scale-btn.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.scale-btn.scale-high.is-on { background: var(--danger); border-color: var(--danger); }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
    padding: 0.45rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 0.92rem; cursor: pointer; line-height: 1.2;
}
.chip.is-on { background: rgba(124, 106, 247, 0.22); border-color: var(--accent); color: var(--text); font-weight: 600; }
.chip.is-extra { cursor: default; font-style: italic; }
.typed-field[aria-invalid="true"] .chip-list, .has-error .scale-row, .has-error .chip-list { outline: 1px solid var(--danger); outline-offset: 3px; border-radius: 8px; }

.review-controls { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; align-items: end; margin-bottom: 0.75rem; }
.review-controls .review-filter { margin: 0; }
.review-jump { display: flex; flex-direction: column; gap: 0.25rem; }
.review-jump .field-label { margin: 0; }
.days { display: flex; flex-direction: column; gap: 0.9rem; }
.day-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.85rem; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.day-title { font-size: 1rem; margin: 0; }
.day-count { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.day-summary { margin: 0.5rem 0 0.6rem; display: grid; gap: 0.2rem; }
.day-summary-line { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.5rem; font-size: 0.9rem; }
.day-summary-line dt { color: var(--muted); margin: 0; }
.day-summary-line dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.timeline-row { display: grid; grid-template-columns: 4.6rem 1fr auto; gap: 0.5rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.timeline-body { min-width: 0; overflow-wrap: anywhere; }
.timeline-text { font-size: 0.93rem; }
.type-badge[data-category="health"] { background: rgba(46, 160, 120, 0.18); color: #4fd1a5; }
.type-badge[data-category="general"] { background: rgba(127, 127, 127, 0.16); color: var(--muted); }
@media (max-width: 420px) {
    .review-controls { grid-template-columns: 1fr; }
    .timeline-row { grid-template-columns: 3.9rem 1fr auto; }
}
.app-main:has(.type-group) { justify-content: flex-start; }

/* v6: brand combobox, amount input, family picker / groups / management. */
.combo { position: relative; }
.combo-list {
    position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
    margin: 0; padding: 0.25rem; list-style: none; max-height: 16rem; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.combo-list li { margin: 0; }
.combo-option {
    display: block; width: 100%; min-height: 44px; padding: 0.5rem 0.75rem; text-align: left;
    background: transparent; color: inherit; border: none; border-radius: 8px; font: inherit; cursor: pointer;
}
.combo-option:hover, .combo-option.is-active, .combo-option:focus-visible { background: var(--border); }
.combo-hint { margin: 0.35rem 0 0; font-size: 0.9rem; }
.link-button {
    background: none; border: none; padding: 0 0.15rem; min-height: 32px; font: inherit; font-weight: 600;
    color: var(--accent); text-decoration: underline; cursor: pointer;
}
.amount-input { max-width: 12rem; }
.item-group-title { font-size: 1rem; margin: 1.25rem 0 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.item-group-count { font-size: 0.8rem; font-weight: 500; opacity: 0.7; border: 1px solid var(--border); border-radius: 999px; padding: 0 0.5rem; }
.family-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.75rem; }
.family-row .type-text { flex: 1 1 auto; min-width: 0; }
.family-actions { display: flex; gap: 0.4rem; flex: 0 0 auto; }
.family-actions .btn, .family-rename .btn { min-height: 44px; }
.family-rename { width: 100%; }

/* Settings > Diagnostics > Show timings (opt-in; toggled by logvault.js via html.lv-show-timings) */
.timings-section { margin-top: 2rem; border-top: 1px solid var(--border, #ddd); padding-top: 1rem; }
.timings-section h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
.lv-timings { display: none; }
html.lv-show-timings .lv-timings { display: block; }
.timings-list, .timings-taps { list-style: none; padding: 0; margin: 0.5rem 0; }
.timing { border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.timing-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.timing-op { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.timing-when { color: var(--muted, #666); }
.timing-status { color: #b00020; font-weight: 600; }
.timing-totals { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin: 0.25rem 0; }
.timing-phases { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 0.1rem; }
.timing-phases li { display: flex; justify-content: space-between; gap: 0.5rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.timing-phases li span { overflow-wrap: anywhere; min-width: 0; }
.timings-subtitle { font-size: 0.95rem; margin: 1rem 0 0.25rem; }
.timings-taps li { font-size: 0.8rem; padding: 0.15rem 0; overflow-wrap: anywhere; }
