/* Entity Manager V (Story 5645, rebuilt 2026-10-19) -- only what V adds on top
   of /entity-manager-iv/entity-manager-iv.css: the record pane drawn on Story
   5639 (Phase 2) -- the section bar, the field cards, the section bands, + Add
   to this record, and the + Add and All sheets. */

/* A phone shows the record full screen: the list's pills, search and filters
   step aside while a record is open (Back brings them back). */
@media (max-width: 899px) {
    body.emiv-show-detail .ed-header,
    body.emiv-show-detail .emiv-controls,
    body.emiv-show-detail .emiv-filters,
    body.emiv-show-detail .emiv-moremenu { display: none !important; }
}

.emiv-detail { background: #F4F5F8; }

/* The band: name, its kind, and the roll-up of the record tools. */
.emv-band-name { display: flex; flex-direction: column; min-width: 0; }
.emv-band-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emv-band-type { font-size: 12px; font-weight: 400; opacity: 0.8; }
.emv-rollup {
    margin-left: auto;
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.emv-rollup .ef-caret { color: #fff; font-size: 14px; }
/* The site-wide button:hover / :active gray (picasso-base.css) outranks a single class and
   sticks after a tap on the phone: a white caret on it vanished. Keep it on the band color. */
.emv-rollup:hover, .emv-rollup:focus { background: rgba(255,255,255,0.30); }
.emv-rollup:active { background: rgba(255,255,255,0.40); }
/* Story 5658: the page header's own roll-up -- on the dark title band, the
   pills, search, + New and the filters fold under the title. */
.emv-head-rollup { flex: 0 0 auto; }
.emv-head-tools.ef-tools-collapsed { display: none; }
.emv-pane { background: #fff; border-bottom: 1px solid #E4E6EC; }
.emv-pane .emiv-detail-actions { padding: 10px 12px; gap: 8px; }
.emv-pane .emiv-btn { padding: 8px 14px; font-size: 13px; }
.emv-pane.ef-tools-collapsed .emv-tools { display: none; }
.emv-pane.ef-tools-collapsed { border-bottom: 0; }

/* The section bar: chips that wrap, pinned while the record scrolls. */
.emv-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    background: #F4F5F8;
    border-bottom: 1px solid #E4E6EC;
}
/* At the desk the chips and the two fixed buttons wrap as one row; on a
   phone the chips scroll sideways in a single row (the bar stays one line
   tall while it is pinned) and + Add / All stay at the right end. */
.emv-bar-chips, .emv-bar-fixed { display: contents; }
@media (max-width: 899px) {
    .emv-bar { flex-wrap: nowrap; align-items: center; padding: 8px 0 8px 12px; }
    .emv-bar-chips {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .emv-bar-chips::-webkit-scrollbar { display: none; }
    .emv-bar-fixed {
        display: flex;
        flex: 0 0 auto;
        gap: 6px;
        padding: 0 12px 0 8px;
        box-shadow: -8px 0 8px -6px rgba(0,0,0,0.18);
    }
}
/* + Add, All and Arrange: their own row under the record header's roll-up
   (Tony, 2026-11-08), not on the section bar. */
.emv-sec-tools { padding: 0 12px 10px; }
.emv-pane .emv-sec-tools .emv-bar-fixed {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    box-shadow: none;
}
@media (max-width: 899px) {
    .emv-bar { padding-right: 12px; }
}
.emv-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: #1D2330;
    border: 1px solid #DCDFE7;
    border-radius: 16px;
    padding: 5px 11px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.emv-chip:hover { border-color: #4F46E5; }
.emv-chip-n {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #EEF0F5;
    color: #555B6B;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 18px;
}
.emv-chip.attn { background: #FDEEE5; border-color: #F2B48F; color: #B3471A; }
.emv-chip.attn .emv-chip-n { background: #C9541B; color: #fff; }
.emv-chip.zero { border-style: dashed; color: #6B7385; }
.emv-chip.add { color: #4F46E5; border: 1px dashed #4F46E5; font-weight: 600; }
.emv-chip.all { font-weight: 600; }

/* Arrange (Leonardo Terms "Arrange"): the bands shrink to their headers and show a grip. */
.emv-chip.arrange { font-weight: 700; font-size: 15px; padding-left: 11px; padding-right: 11px; }
.emv-chip.arrange.on, .emv-chip.arrange.on:hover { background: #4F46E5; color: #fff; border-color: #4F46E5; }
.emv-grip {
    display: none;
    flex: 0 0 auto;
    padding: 4px 6px; margin-right: 4px;
    color: #6B7385; letter-spacing: -3px;
    border: 1px solid #D6D9E0; border-radius: 6px; background: #fff;
    cursor: grab; touch-action: none; user-select: none;
}
.emv-grip:hover { background: #EEF0FF; border-color: #A5A0F0; color: #4F46E5; }
.emv-grip:active { cursor: grabbing; }
.emv-arranging .emv-grip { display: inline-block; }
.emv-arranging .emv-fold-body,
.emv-arranging .emv-fold-chev,
.emv-arranging .emv-band-add,
.emv-arranging .emv-full { display: none !important; }
.emv-arranging .emv-fold-head { border-bottom: 0; }
.emv-band.dragging { opacity: .55; outline: 2px dashed #4F46E5; outline-offset: -2px; }
.emv-arrange-note {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
    padding: 10px 12px; border-radius: 10px;
    background: #EEF0FF; border: 1px solid #C7C4F5; color: #312E81; font-size: 13px;
}
.emv-arrange-note > span:first-child { flex: 1 1 260px; }
.emv-arrange-btns { display: inline-flex; align-items: center; gap: 12px; }

/* The body: cards and bands on gray. */
.emv-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.emv-cards, .emv-bands { display: flex; flex-direction: column; gap: 10px; }
.emv-fold {
    background: #fff;
    border: 1px solid #E1E4EB;
    border-radius: 10px;
    overflow: hidden;
}
.emv-fold[hidden] { display: none; }
.emv-fold-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    background: #FAFBFC;
    border-bottom: 1px solid #EEF0F4;
}
.emv-fold.collapsed .emv-fold-head { border-bottom: 0; }
.emv-fold-toggle {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    padding: 8px 6px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    color: #1D2330;
    text-align: left;
    cursor: pointer;
}
.emv-fold-chev {
    flex: 0 0 auto;
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #4F46E5;
    transition: transform .15s;
}
.emv-fold.collapsed .emv-fold-chev { transform: rotate(-90deg); }
.emv-fold.collapsed > .emv-fold-body { display: none; }
.emv-count {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #EEF0F5;
    color: #555B6B;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 20px;
}
.emv-count:empty { display: none; }
.emv-attn .emv-count { background: #C9541B; color: #fff; }
.emv-attn .emv-fold-head { background: #FFF6F0; }

.emv-card-edit, .emv-band-add {
    flex: 0 0 auto;
    background: #fff;
    color: #4F46E5;
    border: 1px solid #C7C4F5;
    border-radius: 6px;
    padding: 5px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.emv-band-add { padding: 3px 11px; font-size: 16px; line-height: 1.2; }
.emv-full { flex: 0 0 auto; font-size: 13px; color: #4F46E5; text-decoration: none; padding: 4px 2px; }
.emv-full:hover { text-decoration: underline; }

.emv-fold-body { padding: 4px 12px 10px; }
.emv-fold-body .emiv-fields { padding: 0; }
.emv-fold-body .emiv-field:last-child { border-bottom: 0; }
.emv-fold-body > .ed-pane { padding: 6px 0 0; }
.emv-attn .emiv-attention { padding: 8px 0 0; }

/* Tabs (Story 5655): the section bar's chips are tabs; only the chosen one's
   content shows. .emv-body carries data-tab: details (the whole record: the
   field cards, every band that has something in it, + Add to this record),
   attention (Needs attention), or a section key (that one band, .emv-tab-on).
   While Arrange is on, every band shows. */
.emv-body.emv-tabbed:not([data-tab="details"]) > .emv-cards,
.emv-body.emv-tabbed:not([data-tab="details"]) > .emv-foot,
.emv-body.emv-tabbed:not([data-tab="attention"]) > .emv-attn { display: none; }
.emv-body.emv-tabbed[data-tab="attention"] > .emv-bands:not(.emv-arranging) { display: none; }
.emv-body.emv-tabbed:not([data-tab="details"]) > .emv-bands:not(.emv-arranging) > .emv-band:not(.emv-tab-on) { display: none; }
.emv-chip.on, .emv-chip.on:hover { background: #4F46E5; color: #fff; border-color: #4F46E5; }
.emv-chip.on .emv-chip-n { background: rgba(255,255,255,0.25); color: #fff; }
.emv-chip.attn.on, .emv-chip.attn.on:hover { background: #C9541B; border-color: #C9541B; color: #fff; }
.emv-chip.zero.on { border-style: solid; }

/* Settling: the bands wait until every section has answered. */
.emv-bands.emv-settling > .emv-band { display: none; }
.emv-bands:not(.emv-settling) > .emv-settle-msg { display: none; }

/* + Add to this record, and the line naming the empties. */
.emv-addall {
    width: 100%;
    background: #fff;
    color: #4F46E5;
    border: 1.5px dashed #8E89EE;
    border-radius: 10px;
    padding: 14px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.emv-emptyline { margin: 10px 4px 24px; text-align: center; font-size: 12.5px; color: #7A8090; }
.emv-linkbtn { background: none; border: 0; padding: 0; font: inherit; color: #4F46E5; cursor: pointer; text-decoration: underline; }

/* The + Add and All sheets: a bottom sheet on the phone, a centered box at the desk. */
.emv-sheet-bg {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15,18,25,0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.emv-sheet {
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    max-height: 86dvh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.2);
}
@media (min-width: 900px) {
    .emv-sheet-bg { align-items: center; }
    .emv-sheet { border-radius: 14px; }
}
.emv-sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; }
.emv-sheet-head h2 { flex: 1 1 auto; margin: 0; font-size: 17px; }
.emv-sheet-body { overflow-y: auto; padding: 4px 16px 18px; }
.emv-sheet-find {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #DCDFE7;
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
    font-size: 14px;
    margin-bottom: 6px;
}
.emv-add-group[hidden] { display: none; }
.emv-add-title { margin: 12px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: #6B7385; }
.emv-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.emv-add-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #DCDFE7;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
    font-size: 14px;
    color: #1D2330;
    text-align: left;
    cursor: pointer;
}
.emv-add-item[hidden] { display: none; }
.emv-add-item:hover { border-color: #4F46E5; }
.emv-add-item .plus { color: #4F46E5; font-weight: 700; }
.emv-add-item .nm { flex: 1 1 auto; min-width: 0; }
.emv-add-item .n { font-size: 12px; color: #6B7385; }

.emv-all-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #EEF0F4; }
.emv-all-go {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: none;
    border: 0;
    padding: 11px 2px;
    font: inherit;
    font-size: 14px;
    color: #1D2330;
    text-align: left;
    cursor: pointer;
}
.emv-all-row.empty .emv-all-go { color: #A3A9B6; }
.emv-always { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #6B7385; white-space: nowrap; cursor: pointer; }

/* The record's own tool buttons (Delete, Close the log ...): Delete at the far right. */
.emv-actions { display: contents; }
.emiv-btn.emv-danger { background: #fff; color: #B42318; border: 1px solid #E5A29B; margin-left: auto; }
.emiv-btn.emv-danger:hover { background: #FEF3F2; }

/* A record's own sections (Calls, Calendar, Log, Spent, Secure fields) and their chips. */
.emv-band-own > .emv-fold-head { background: #F3F2FE; }
.emv-chip.own { border-color: #C7C4F5; }
.emv-spent .vh-kpi.vh-spent { grid-column: auto; margin-bottom: 4px; }

/* All: the list of every section (arranging is Arrange, below). */
.emv-all-hint { font-size: 12.5px; color: #6B7385; margin: 0 0 6px; }
.emv-always-fixed { color: #A3A9B6; cursor: default; }

/* The vehicle's expense accounts sheet. */
.emv-sheet-hint { font-size: 12px; color: #6B7385; margin-top: 4px; }
.emv-sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.emv-sheet .field label { display: block; font-size: 13px; color: #555B6B; margin-bottom: 4px; }

@media print {
    .emv-fold.collapsed > .emv-fold-body { display: block !important; }
    .emv-bar, .emv-foot, .emv-rollup, .emv-tools, .emv-card-edit, .emv-band-add, .emv-full { display: none !important; }
    .emv-bar { position: static; }
}

/* A chosen record takes the page (body.emv-focus): on a wide screen the list folds
   to a rail on the left and the header folds away; List on the rail brings them back.
   (On a phone the record already has the screen; the header hides with the list.) */
.emv-rail { display: none; }
@media (min-width: 900px) {
    body.emv-focus .ed-header,
    body.emv-focus .emiv-controls,
    body.emv-focus .emiv-filters,
    body.emv-focus .emiv-moremenu,
    body.emv-focus .emiv-master { display: none !important; }
    body.emv-focus .emv-rail {
        display: flex; flex-direction: column; align-items: center; gap: 8px;
        flex: 0 0 34px;
        padding: 12px 0;
        background: #F3F2FE; color: #4F46E5;
        border: 0; border-right: 1px solid #DCDAF7; border-radius: 0;
        font: inherit; font-size: 13px; font-weight: 600;
        cursor: pointer;
    }
    body.emv-focus .emv-rail:hover, body.emv-focus .emv-rail:active { background: #E6E4FD; }
    /* Hide list: the same strip, beside the list while a record is open. */
    body.emv-has-record:not(.emv-focus) .emv-rail-hide {
        display: flex; flex-direction: column; align-items: center; gap: 8px;
        flex: 0 0 34px;
        padding: 12px 0;
        background: #F3F2FE; color: #4F46E5;
        border: 0; border-left: 1px solid #DCDAF7; border-right: 1px solid #DCDAF7; border-radius: 0;
        font: inherit; font-size: 13px; font-weight: 600;
        cursor: pointer;
    }
    body.emv-has-record:not(.emv-focus) .emv-rail-hide:hover,
    body.emv-has-record:not(.emv-focus) .emv-rail-hide:active { background: #E6E4FD; }
    body.emv-focus .emv-rail-hide { display: none; }
    .emv-rail-label { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: 0.5px; }
}

/* 2026-11-10: sort and Search in are two quiet chips beside the search box,
   always in reach, in place of the band of sort pills behind the funnel. */
.emv-hchip {
    flex: 0 0 auto;
    background: #fff;
    color: #4F46E5;
    border: 1px solid #DCDAF7;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.emv-hchip:hover { border-color: #4F46E5; }
.emiv-searchin.emv-hchip.emiv-searchin-on { background: #F3F2FE; border-color: #4F46E5; }

/* 2026-11-10: Tax years and Health bands (entity-manager-v-extras.js), the Overview's lines. */
.emv-linked-list { margin: 0; padding: 4px 12px 12px 28px; }
.emv-linked-list li { font-size: 14px; line-height: 1.8; }
.emv-linked-list a { color: #0A66C2; text-decoration: none; font-weight: 600; }
.emv-linked-list a:hover { text-decoration: underline; }
.emv-linked-meta { color: #555; font-size: 13px; }
.emv-health-line { font-size: 13px; line-height: 1.5; color: #333; padding-left: 4px; }
.emv-health-line b { color: #555; font-weight: 600; }
.emv-health-line.is-allergy, .emv-health-line.is-allergy b { color: #9B1C1C; }
