/* Household Folio — page styles. Loaded by household-folio.php. */

:root {
    --bg:           #F7F4EE;
    --text:         #1C1917;
    --muted:        #78716C;
    --muted-light:  #A8A29E;
    --rule:         #D6D0C8;
    --accent:       #2D4A3E;
    --accent-light: #EEF3F1;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Masthead ── */
.masthead {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg);
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 52px;
    flex-shrink: 0;
}
.masthead-wordmark {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    text-decoration: none;
}
.masthead-right { display: flex; align-items: center; gap: 1.5rem; }
.masthead-email {
    font-size: 0.75rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}
.masthead-email:hover { color: var(--accent); }
.masthead-signout {
    font-size: 0.75rem;
    color: var(--muted-light);
    text-decoration: none;
    transition: color 0.15s;
}
.masthead-signout:hover { color: var(--accent); }

/* ── Breadcrumb ── */
.breadcrumb {
    position: sticky;
    top: 52px;
    z-index: 99;
    background-color: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 0 2rem;
    height: 36px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.breadcrumb-inner { display: flex; align-items: center; gap: 0.4rem; }
.breadcrumb-link {
    font-size: 0.75rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}
.breadcrumb-link:hover { color: var(--accent); }
.breadcrumb-sep { font-size: 0.65rem; color: var(--muted-light); user-select: none; }
.breadcrumb-current { font-size: 0.75rem; color: var(--text); }

/* ── Page ── */
.page {
    flex: 1;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 3.5rem 2rem 6rem;
}
.page-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
}
.page-header-text { min-width: 0; }
.hf-header-actions { display: flex; gap: 0.75rem; align-items: center; flex-shrink: 0; }
.page-eyebrow {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted-light);
    margin-bottom: 0.75rem;
}
.page-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.page-desc {
    font-size: 0.9375rem;
    color: var(--muted);
    line-height: 1.65;
    max-width: 620px;
}

/* ── Buttons ── */
.hf-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    border-radius: 4px;
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.hf-btn-primary {
    background-color: var(--accent);
    border: 1px solid var(--accent);
    color: #FFFFFF;
}
.hf-btn-primary:hover { background-color: #253D33; border-color: #253D33; }
.hf-btn-secondary {
    background-color: transparent;
    border: 1px solid var(--rule);
    color: var(--text);
}
.hf-btn-secondary:hover { border-color: var(--muted); }
.hf-btn-danger {
    background-color: #B3261E;
    border: 1px solid #B3261E;
    color: #FFFFFF;
}
.hf-btn-danger:hover { background-color: #8C1D17; border-color: #8C1D17; }
.hf-btn-danger[disabled] { background-color: #B3261E; border-color: #B3261E; }
.hf-btn[disabled] { opacity: 0.6; cursor: default; }

/* ── Icon buttons (row actions) ── */
.hf-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--muted-light);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.hf-icon-btn svg { width: 15px; height: 15px; display: block; }
.hf-icon-btn:hover { background-color: var(--accent-light); color: var(--accent); }
.hf-icon-btn.hf-icon-delete:hover { background-color: #FBEAE9; color: #B3261E; }

/* ── Toolbar (search) ── */
.hf-toolbar {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.hf-search-wrap { position: relative; flex: 1 1 240px; max-width: 360px; }
.hf-search-wrap svg {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--muted-light);
    pointer-events: none;
}
.hf-search {
    width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text);
    background-color: #FFFFFF;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 0.6rem 0.7rem 0.6rem 2.1rem;
    transition: border-color 0.15s;
}
.hf-search:focus { outline: none; border-color: var(--accent); }

.hf-filter-wrap { flex: 0 0 auto; }
.hf-filter {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text);
    background-color: #FFFFFF;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 0.6rem 2rem 0.6rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 14px;
}
.hf-filter:focus { outline: none; border-color: var(--accent); }

/* ── Table ── */
.hf-table-wrap {
    border: 1px solid var(--rule);
    border-radius: 8px;
    background-color: #FFFFFF;
    overflow-x: auto;
}
.hf-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.hf-table thead th {
    text-align: left;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-light);
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
}
.hf-table tbody td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--rule);
    color: var(--muted);
    vertical-align: middle;
}
.hf-table tbody tr:last-child td { border-bottom: none; }
.hf-table tbody tr:hover { background-color: var(--accent-light); }
.hf-cell-name a {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.0625rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.hf-cell-name a:hover { color: var(--accent); }
.hf-empty { color: var(--muted-light); }
.hf-col-actions, .hf-cell-actions { width: 1%; white-space: nowrap; text-align: right; }
.hf-row-actions { display: flex; gap: 0.15rem; justify-content: flex-end; }
.hf-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── No results ── */
.hf-no-results {
    padding: 2.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}
.hf-no-results[hidden] { display: none; }

/* ── Pagination ── */
.hf-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.hf-pagination:empty { display: none; }
.hf-page-summary { font-size: 0.75rem; color: var(--muted); }
.hf-page-controls { display: flex; align-items: center; gap: 0.25rem; }
.hf-page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.hf-page-btn:hover:not(:disabled):not(.active) { background-color: var(--accent-light); color: var(--accent); }
.hf-page-btn.active { background-color: var(--accent); border-color: var(--accent); color: #FFFFFF; cursor: default; }
.hf-page-btn:disabled { color: var(--muted-light); cursor: default; }
.hf-page-gap { color: var(--muted-light); padding: 0 0.15rem; font-size: 0.8125rem; }

/* ── Detail view ── */
.hf-detail-header { align-items: flex-start; }
.hf-detail-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.hf-summary-block { margin-bottom: 3.5rem; }
.hf-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem 2rem;
}
.hf-summary-item dt {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-light);
    margin-bottom: 0.4rem;
}
.hf-summary-item dd {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
}
.hf-summary-totals {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
}
.hf-summary-income { color: var(--accent); }
.hf-detail-link {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s;
}
.hf-detail-link:hover { color: var(--accent); }

/* ── Income calculation details ── */
.hf-income-breakdown {
    list-style: none;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background-color: #FFFFFF;
    margin-bottom: 1rem;
    overflow: hidden;
}
.hf-income-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--rule);
}
.hf-income-row:last-child { border-bottom: none; }
.hf-income-row-main { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.hf-income-row-label { font-size: 0.875rem; color: var(--text); }
.hf-income-row-tool {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-light);
}
.hf-income-row-amount {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}
.hf-income-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.25rem 0;
    font-size: 0.8125rem;
    color: var(--muted);
}
.hf-income-total span:last-child {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent);
}
.hf-section { margin-top: 0.5rem; }
.hf-section + .hf-section { margin-top: 4rem; }
.hf-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.hf-section-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
}
.hf-section-count { font-size: 0.75rem; color: var(--muted-light); }
.hf-section-head-right { display: flex; align-items: center; gap: 0.85rem; }
.hf-btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }

/* ── Notes list ── */
.hf-notes {
    list-style: none;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background-color: #FFFFFF;
    overflow: hidden;
}
.hf-note {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--rule);
}
.hf-note:last-child { border-bottom: none; }
.hf-note-main { min-width: 0; }
.hf-note-text {
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.4rem;
}
.hf-note-meta {
    font-size: 0.6875rem;
    color: var(--muted-light);
    display: flex;
    gap: 0.35rem;
}
.hf-note-edited { font-style: italic; }
.hf-note-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }

/* ── Saved results list ── */
.hf-results {
    list-style: none;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background-color: #FFFFFF;
    overflow: hidden;
}
.hf-result {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--rule);
}
.hf-result:last-child { border-bottom: none; }
.hf-result-main { min-width: 0; }
.hf-result-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.2rem;
}
.hf-result-summary {
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.45;
    margin-bottom: 0.35rem;
}
.hf-result-meta {
    font-size: 0.6875rem;
    color: var(--muted-light);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.hf-result-tool {
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.hf-result-sep { color: var(--muted-light); }
.hf-result-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }

/* ── Empty state ── */
.empty-state {
    border: 1px solid var(--rule);
    border-radius: 8px;
    background-color: #FFFFFF;
    padding: 3.5rem 2rem;
    text-align: center;
}
.empty-state-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.empty-state-text {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 440px;
    margin: 0 auto 1.5rem;
}

/* ── Modal ── */
.hf-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background-color: rgba(28, 25, 23, 0.45);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.hf-modal-overlay.open { display: flex; }
.hf-modal {
    background-color: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 10px;
    width: 100%;
    max-width: 460px;
    padding: 1.75rem;
    box-shadow: 0 20px 50px rgba(28, 25, 23, 0.2);
    /* Tall modals (calculation details, tool picker) scroll inside the viewport
       instead of clipping. Overlay padding is 1.5rem top+bottom = 3rem. */
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}
.hf-modal-wide { max-width: 600px; }
.hf-modal-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.35rem;
}

/* ── Tool picker (Add Calculation) ── */
.hf-tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.hf-tool-card {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background-color: #FFFFFF;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.hf-tool-card:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 4px 14px rgba(28, 25, 23, 0.06);
}
@media (max-width: 520px) {
    .hf-tool-grid { grid-template-columns: 1fr; }
}
.hf-modal-desc { font-size: 0.8125rem; color: var(--muted); margin-bottom: 1.5rem; }
.hf-modal-desc .hf-delete-strong { color: var(--text); font-weight: 500; }
.hf-field { margin-bottom: 1.1rem; }
.hf-field label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.45rem;
}
.hf-field .hf-optional { color: var(--muted-light); text-transform: none; letter-spacing: 0; font-weight: 400; }
.hf-field input,
.hf-field select,
.hf-field textarea {
    width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text);
    background-color: #FFFFFF;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.6rem 0.7rem;
    transition: border-color 0.15s;
}
.hf-field textarea { resize: vertical; line-height: 1.5; min-height: 6rem; }
.hf-field input:focus,
.hf-field select:focus,
.hf-field textarea:focus { outline: none; border-color: var(--accent); }
.hf-field select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.hf-property-new { margin-top: 0.6rem; }
.hf-property-new[hidden] { display: none; }
.hf-modal-error {
    display: none;
    font-size: 0.8125rem;
    color: #B3261E;
    margin-bottom: 1rem;
}
.hf-modal-error.show { display: block; }
.hf-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ── Footer ── */
.footer {
    border-top: 1px solid var(--rule);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.footer span { font-size: 0.75rem; color: var(--muted-light); }

/* ── Mobile / tablet refinements ── */
@media (max-width: 768px) {
    .masthead-email { display: none; }
    .masthead { padding: 0 1.25rem; }
    .breadcrumb { padding: 0 1.25rem; }
    .footer { padding: 1.25rem; flex-wrap: wrap; gap: 0.35rem 1rem; }

    .page { padding: 2rem 1.25rem 4rem; }

    /* Header: stack the title above its actions; actions become full-width rows */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    .hf-header-actions { flex-wrap: wrap; }
    .hf-header-actions .hf-btn { flex: 1 1 auto; text-align: center; }

    /* Detail view: the 2–4 action buttons wrap into a tidy grid instead of overflowing */
    .hf-detail-header { align-items: stretch; }
    .hf-detail-actions { flex-wrap: wrap; gap: 0.5rem; }
    .hf-detail-actions .hf-btn { flex: 1 1 8rem; text-align: center; }

    .page-title { overflow-wrap: anywhere; }

    .hf-section + .hf-section { margin-top: 2.5rem; }
    .hf-section-head { flex-wrap: wrap; }

    /* Comfortable touch targets */
    .hf-btn { min-height: 44px; padding: 0.7rem 1rem; }
    .hf-btn-sm { min-height: 36px; padding: 0.45rem 0.8rem; }
    .hf-icon-btn { width: 40px; height: 40px; }
    .hf-icon-btn svg { width: 17px; height: 17px; }
    .hf-page-btn { min-width: 38px; height: 38px; }

    /* 16px form controls stop iOS Safari from auto-zooming on focus */
    .hf-field input,
    .hf-field select,
    .hf-field textarea,
    .hf-search,
    .hf-filter { font-size: 16px; }
}

@media (max-width: 640px) {
    .hf-col-members, .hf-cell-members { display: none; }
}

@media (max-width: 600px) {
    /* Modals: pin to the top so tall content scrolls, fit the narrow viewport,
       and give the action buttons full-width tap targets */
    .hf-modal-overlay { padding: 1rem; align-items: flex-start; }
    .hf-modal { padding: 1.5rem 1.25rem; max-height: calc(100vh - 2rem); }
    .hf-modal-wide { max-width: 100%; }
    .hf-modal-actions { gap: 0.5rem; }
    .hf-modal-actions .hf-btn { flex: 1 1 auto; text-align: center; }
}
