/* =====================================================================
   Fire doors register — extra pieces on top of inventory.css (.iv).
   The window is a full-height sheet; everything here is fd-* scoped.
   ===================================================================== */

.fd-root { position: fixed; inset: 0; z-index: 48; background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fd-root[hidden] { display: none; }
.fd-win {
    width: 100%; max-width: 1280px; height: min(92vh, 980px);
    background: var(--iv-sub); border-radius: 18px; box-shadow: 0 25px 60px rgba(15, 23, 42, .3);
    display: flex; flex-direction: column; overflow: hidden; animation: iv-pop .18s ease-out;
}

/* header */
.fd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; background: var(--iv-panel); border-bottom: 1px solid var(--iv-border-strong); }
.fd-title { display: flex; align-items: center; gap: 12px; margin-inline-end: auto; min-width: 0; }
.fd-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--iv-bad-bg); color: var(--iv-bad); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fd-ico .ti { font-size: 22px; }
.fd-title h3 { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.3; }
.fd-title .sub { font-size: 12.5px; color: var(--iv-text-2); }
.fd-head .actions { display: flex; align-items: center; gap: 8px; }

/* dropdown menu */
.fd-menu { position: relative; }
.fd-menu-panel {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; min-width: 210px;
    background: var(--iv-panel); border: 1px solid var(--iv-border-strong); border-radius: var(--iv-radius);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14); padding: 6px;
}
.fd-menu-panel button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 13.5px; text-align: left; color: #334155; }
.fd-menu-panel button:hover { background: var(--iv-sub); color: var(--iv-text); }
.fd-menu-panel button .ti { font-size: 17px; color: var(--iv-muted); }

/* body */
.fd-main { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 8px; }
.fd-main .iv-kpis { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fd-main .iv-kpi { padding: 10px 14px; }
.fd-main .iv-kpi .value { font-size: 22px; }
.fd-main .iv-toolbar .iv-input { width: auto; flex: 1; min-width: 200px; max-width: 360px; height: 38px; font-size: 13.5px; }
.fd-main .iv-toolbar .iv-select { width: auto; max-width: 240px; height: 38px; font-size: 13.5px; }
.fd-main .iv-chip.on .ti { color: #fff; }

/* table */
.fd-table th.sort { cursor: pointer; user-select: none; }
.fd-table th.sort:hover { color: var(--iv-text); }
.fd-table th .ti { font-size: 13px; vertical-align: -1px; }
.fd-table td { padding: 8px 12px; }
.fd-table th { padding: 11px 12px; }
.fd-table th.chk, .fd-table td.chk { width: 36px; padding-inline: 8px 4px; text-align: center; }
.fd-table tbody tr.click:hover { background: var(--iv-hover); }
.fd-table tbody tr.sel, .fd-table tbody tr.sel:hover { background: var(--iv-accent-bg); }
.fd-table .proj { font-weight: 700; color: var(--iv-text); white-space: nowrap; }
.fd-table .door { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fd-table .spec { color: var(--iv-text-2); font-size: 13px; white-space: nowrap; }
.fd-table tr.grp td { background: #f1f5f9; cursor: pointer; font-size: 13px; padding: 9px 12px; }
.fd-table tr.grp .ti { color: var(--iv-muted); }
.fd-table tr.grp .n { color: var(--iv-text-2); font-weight: 500; margin-inline-start: 10px; }

/* inline-editable cells: look like text until hovered/focused */
.fd-cell {
    height: 32px; padding: 0 8px; width: 100%; min-width: 0;
    border: 1px solid transparent; border-radius: 8px; background: transparent; outline: none;
    font-size: 13px; color: var(--iv-text); transition: border-color .12s, background .12s;
}
.fd-cell.sticker { width: 130px; font-family: ui-monospace, monospace; font-weight: 700; direction: ltr; text-align: center; }
.fd-cell.date { width: 140px; direction: ltr; text-align: center; }
.fd-cell:hover { border-color: var(--iv-border-input); background: var(--iv-panel); }
.fd-cell:focus { border-color: var(--iv-accent); background: var(--iv-panel); box-shadow: 0 0 0 3px var(--iv-accent-soft); }
.fd-cell.empty:not(:focus) { background: var(--iv-sub); border-color: var(--iv-border-strong); border-style: dashed; }
.fd-cell.bad { border-color: var(--iv-bad) !important; background: var(--iv-bad-bg) !important; color: #9f1239; }
.fd-cell.saving { opacity: .55; }
.fd-ro { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 13px; }
.fd-ro.mono { font-family: ui-monospace, monospace; font-weight: 700; direction: ltr; }
.fd-ro .ti { color: var(--iv-accent); font-size: 14px; }
.fd-est { display: block; font-size: 11px; color: var(--iv-warn); text-align: center; margin-top: 1px; white-space: nowrap; }
.fd-late { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 4px; font-size: 11px; font-weight: 700; color: var(--iv-bad); white-space: nowrap; }

.fd-bulk { position: sticky; top: 0; z-index: 3; flex-wrap: wrap; }
.fd-bulk .cnt { font-weight: 700; font-size: 13.5px; margin-inline-end: auto; }
.fd-bulk button .ti { font-size: 15px; vertical-align: -2px; margin-inline-end: 3px; }

/* footer */
.fd-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 20px; background: var(--iv-panel); border-top: 1px solid var(--iv-border-strong); font-size: 12.5px; color: var(--iv-text-2); }
.fd-pager { display: flex; align-items: center; gap: 8px; }

/* drawer + sub-sheets sit above the window */
.fd-root .iv-scrim { z-index: 52; }
.fd-root .iv-drawer { z-index: 53; }
.fd-root .iv-modal-scrim { z-index: 56; }
.fd-specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.fd-specs > div { background: var(--iv-sub); border: 1px solid var(--iv-border); border-radius: 10px; padding: 8px 12px; }
.fd-specs .label { font-size: 11.5px; color: var(--iv-text-2); }
.fd-specs .value { font-size: 14px; font-weight: 700; margin-top: 1px; }
.fd-hist { font-size: 13px; }
.fd-hist > div { padding: 9px 0; border-bottom: 1px solid var(--iv-border); }
.fd-hist .when { font-size: 11.5px; color: var(--iv-muted); direction: ltr; text-align: left; }
.fd-drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--iv-border-strong); }
.fd-drawer-foot .iv-btn { flex: 1; }
.fd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.fd-grid.three { grid-template-columns: repeat(3, 1fr); }
.fd-grid .full { grid-column: 1 / -1; }
.fd-preview { max-height: 220px; overflow-y: auto; border: 1px solid var(--iv-border-strong); border-radius: 10px; margin-top: 12px; font-size: 13px; }
.fd-preview > div { display: flex; justify-content: space-between; padding: 7px 12px; border-bottom: 1px solid var(--iv-border); }
.fd-preview > div:last-child { border-bottom: 0; }

@media (max-width: 767px) {
    .fd-root { padding: 0; align-items: stretch; }
    .fd-win { height: 100%; max-height: none; border-radius: 0; }
    .fd-head { padding: 12px 14px; }
    .fd-head .actions { width: 100%; }
    .fd-head .actions .fd-grow { flex: 1; }
    .fd-main { padding: 12px 12px 8px; }
    .fd-main .iv-kpis { grid-template-columns: repeat(3, 1fr); }
    .fd-main .iv-toolbar .iv-input, .fd-main .iv-toolbar .iv-select { max-width: none; flex: 1 1 100%; }
    .fd-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
    .fd-grid, .fd-grid.three, .fd-specs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
