:root {
  --ink: #1f2933; --muted: #5d6b78; --bg: #eef1f5; --card: #fff; --line: #d9dee5;
  --side: #0c3654; --side-ink: #c9d2dc; --accent: #4a4fc9; --accent-ink: #fff;
  font: 16px/1.5 system-ui, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }

/* App shell: sidebar + top bar */
.shell { display: flex; min-height: 100vh; }
.sidebar { flex: 0 0 6.5rem; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; align-items: stretch; padding: .9rem .45rem; gap: .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: grid; place-items: center; color: #6d72f0; }
.logo img { width: 2.4rem; height: 2.4rem; display: block; }
#tabs { display: flex; flex-direction: column; gap: .35rem; flex: 1; }
#admin-tab { margin-top: auto; }
#tabs button { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 100%; padding: .65rem .2rem; border: 0; border-radius: .45rem; background: transparent; color: var(--side-ink); font-size: .82rem; line-height: 1.2; text-align: center; }
#tabs button:hover { background: rgba(255,255,255,.07); color: #fff; }
#tabs button[aria-current="page"] { background: var(--accent); color: #fff; }
/* Icons are white PNGs: dimmed to roughly #C9D2DC when not selected, full white on hover/selected. */
.tab-icon { width: 1.9rem; height: 1.9rem; display: block; opacity: .78; }
#tabs button:hover .tab-icon, #tabs button[aria-current="page"] .tab-icon { opacity: 1; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { height: 2.1rem; width: auto; display: block; padding-right: 1rem; border-right: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 1.3rem; font-weight: 500; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.menu { position: relative; }
.icon-button { position: relative; display: grid; place-items: center; padding: .4rem; border: 0; background: transparent; border-radius: 50%; color: var(--ink); }
.icon-button:hover { background: var(--bg); }
.icon-button svg, .chevron { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell-icon { width: 1.6rem; height: 1.6rem; display: block; }
.badge { position: absolute; top: -.1rem; right: -.2rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; background: #d92d20; color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.15rem; text-align: center; border: 2px solid var(--card); box-sizing: content-box; }
.user-chip { display: flex; align-items: center; gap: .55rem; border: 0; background: transparent; padding: .25rem .4rem; border-radius: .5rem; color: var(--ink); }
.user-chip:hover { background: var(--bg); }
.avatar { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; font-size: .9rem; }
.user-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-name { font-weight: 500; }
.user-title { font-size: .85rem; color: var(--muted); }
.chevron { width: 1.05rem; height: 1.05rem; color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 11rem; background: var(--card); border: 1px solid var(--line); border-radius: .5rem; box-shadow: 0 8px 24px rgba(20,30,45,.14); padding: .35rem; z-index: 10; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: .45rem .7rem; border: 0; border-radius: .35rem; background: transparent; color: var(--ink); text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); }
.dropdown-empty { margin: 0; padding: .45rem .7rem; color: var(--muted); white-space: nowrap; }

body.signed-out .sidebar, body.signed-out .topbar { display: none; }

/* Content */
main { width: 100%; max-width: 1400px; margin: 0 auto; padding: 1rem 1.5rem; }
section { background: var(--card); padding: 1.15rem; border: 1px solid var(--line); border-radius: .65rem; margin: 1rem 0; }
/* Sign-in screen: centered card on a soft background */
body.signed-out { background: linear-gradient(160deg, #eef1f8 0%, #e3e8f2 55%, #d9e0ee 100%); }
body.signed-out main { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; max-width: none; }
body.signed-out #message { width: 100%; max-width: 25rem; margin: 0 0 1rem; }
#signin { width: 100%; max-width: 25rem; margin: 0; padding: 2.4rem 2.2rem 1.6rem; border: 0; border-radius: .9rem; box-shadow: 0 12px 40px rgba(12,54,84,.14), 0 2px 6px rgba(12,54,84,.06); }
.signin-logo { display: block; width: 11rem; height: auto; margin: 0 auto 1.6rem; }
#signin h1 { font-size: 1.35rem; font-weight: 600; text-align: center; margin-bottom: 1.5rem; color: #0c3654; }
#login label { font-weight: 500; font-size: .92rem; margin-bottom: 1rem; }
#login input { padding: .6rem .7rem; border-radius: .45rem; }
#login input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
#login button { width: 100%; padding: .7rem; margin-top: .4rem; border-radius: .45rem; font-weight: 600; }
.signin-notice { margin: 1.4rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); text-align: center; font-size: .8rem; color: var(--muted); }
.signin-notice p { margin: 0 0 .8rem; }
.signin-alert { margin: -.6rem 0 1.2rem; text-align: center; color: #b42318; font-weight: 500; font-size: .95rem; }
.signin-company { display: block; height: 1.6rem; width: auto; margin: 0 auto; opacity: .85; }
.blank { min-height: 16rem; display: grid; place-items: center; color: var(--muted); }
h1, h2 { margin: 0 0 .45rem; }
h2 { font-size: 1.15rem; }
p { margin: .3rem 0 .9rem; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 1px solid #a9b4c2; background: #f5f7fa; color: var(--ink); border-radius: .35rem; padding: .45rem .8rem; }
button:disabled { opacity: .55; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
label { display: grid; gap: .2rem; margin-bottom: .65rem; font-weight: 550; }
input, select, textarea { width: 100%; min-width: 0; color: inherit; border: 1px solid #b3bdc9; border-radius: .3rem; padding: .35rem .5rem; background: white; }
textarea { resize: vertical; min-height: 4rem; }
.fields, .line { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .3rem .85rem; }
.line { padding: .65rem; margin: .5rem 0; border: 1px solid var(--line); border-radius: .3rem; }
.line button { align-self: center; justify-self: start; }
form > button + button { margin-left: .5rem; }
details { padding: .5rem .15rem; border-top: 1px solid var(--line); }
section > details { margin-top: 1rem; }
summary { cursor: pointer; }
dl { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: .2rem 1rem; }
dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
dt { font-weight: 600; }
#message { padding: .7rem; border-radius: .35rem; }
.error { background: #fbe3df; color: #75221e; }
.success { background: #deefe5; color: #164332; }
.muted { color: var(--muted); margin: 0; }

/* Admin tab */
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.admin-card { display: flex; flex-direction: column; gap: 1rem; text-align: left; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: .65rem; }
.admin-card:hover { border-color: #aab3c0; box-shadow: 0 2px 8px rgba(20,30,45,.07); }
.admin-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.admin-card-head { display: flex; gap: .85rem; align-items: flex-start; }
.admin-card-icon { flex: none; width: 2.6rem; height: 2.6rem; display: block; }
.admin-card-head div { display: grid; gap: .15rem; }
.admin-card-head strong { font-size: 1.12rem; font-weight: 500; }
.admin-card-head span { color: var(--muted); font-size: .92rem; line-height: 1.35; }
.admin-card-stat { font-size: 1.05rem; }
.admin-card-stat b { font-size: 1.35rem; }

.user-admin { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1rem; align-items: start; }
.user-admin section { margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .8rem; }
.panel-head h2 { margin: 0; }
.panel-head button { white-space: nowrap; }
.user-search { max-width: 18rem; margin-bottom: .8rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: .45rem; }
.user-table { width: 100%; border-collapse: collapse; }
.user-table th, .user-table td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.user-table th { background: #f5f7fa; font-weight: 500; }
.user-table tbody tr { cursor: pointer; }
.user-table tbody tr:hover { background: #f5f7fa; }
.user-table tbody tr.selected { background: #ecedfb; }
.user-table tbody tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: .55rem; }
.avatar.small { width: 1.8rem; height: 1.8rem; font-size: .75rem; flex: none; }
.pill { display: inline-block; padding: .1rem .65rem; border-radius: 999px; background: #e4e7ec; font-size: .9rem; }
.pill-admin { background: #efe3fb; color: #6a2ea3; }
.pill-admin-manager { background: #3b1a5c; color: #fff; }
/* Admin › Encryption */
.encryption-panel { margin-top: 1rem; }
.encryption-section { margin-top: 1rem; }
/* Job Master: kit list preview when dropping a job, and the kit saved with each job */
.kit-preview { margin: .8rem 0; display: grid; gap: .4rem; }
.kit-preview .pm-section-title { margin-top: .6rem; }
.kit-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kit-table .compact-select { min-width: 12rem; }
.encryption-form { display: grid; gap: .5rem; max-width: 34rem; }
.encryption-form button { justify-self: start; }
.recover-form { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.encryption-tables details { border: 1px solid var(--line); border-radius: .4rem; margin: .4rem 0; padding: .3rem .7rem; }
.encryption-tables summary { cursor: pointer; padding: .3rem 0; }
.encryption-fields td.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.encryption-fields td.wrap { white-space: normal; min-width: 16rem; }
.encryption-save { margin-top: .8rem; max-width: none; }
.lock-note-admin { margin: -.3rem 0 .7rem; padding: .45rem .7rem; border-radius: .4rem; background: #fdf0d5; color: #6b4600; }
.status.is-active { color: #1d7a3e; }
.status.is-inactive { color: var(--muted); }

.user-form h2 { margin-bottom: .8rem; }
.switch-field { display: grid; gap: .3rem; margin-bottom: .65rem; }
.switch-label { font-weight: 550; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 400; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider { position: relative; width: 2.8rem; height: 1.55rem; border-radius: 999px; background: #c3cad4; transition: background .15s; flex: none; }
.slider::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(1.25rem); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .4rem; }
form > .form-buttons button + button { margin-left: 0; }

.pill-editor { background: #dff1e6; color: #1d6a3a; }
.pill-viewer { background: #dcebfb; color: #1d5a9e; }
.pill-inactive { background: #e4e7ec; color: #3d4955; }
.role-summary { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.field-help { margin: .1rem 0 0; font-weight: 400; font-size: .88rem; color: var(--muted); }
input.readonly { background: #f0f2f5; color: var(--muted); cursor: default; }

.admin-column { display: grid; gap: 1rem; min-width: 0; }
.password-setup h2 { margin-bottom: .15rem; }
.password-setup form { margin-top: .9rem; }
.length-field { max-width: 30rem; }
.length-field input { max-width: 11rem; }
.rule-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .7rem 1.2rem; margin: .3rem 0 1rem; }
.setup-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: .8rem; }
.password-checks { list-style: none; margin: .35rem 0 0; padding: 0; font-weight: 400; font-size: .88rem; color: var(--muted); }
.password-checks li.met { color: #1d7a3e; }

/* System Audit Log */
.audit-filters { display: grid; grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(9rem, 1fr)); gap: .6rem; margin-bottom: .8rem; }
@media (max-width: 760px) { .audit-filters { grid-template-columns: 1fr 1fr; } }
.audit-table td { font-size: .92rem; vertical-align: top; }
.audit-table td.wrap { white-space: normal; min-width: 14rem; }
.audit-table tr.audit-detail { cursor: default; background: #f8f9fb; }
.audit-table tr.audit-detail:hover { background: #f8f9fb; }
.audit-detail td { white-space: normal; padding: .8rem 1rem 1rem; }
.audit-detail dl { margin: 0 0 .7rem; font-size: .88rem; }
.change-table { border-collapse: collapse; width: 100%; font-size: .88rem; background: var(--card); }
.change-table th, .change-table td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.change-table th { background: #f0f2f5; font-weight: 500; }
.action-create { background: #dff1e6; color: #1d6a3a; }
.action-update { background: #dcebfb; color: #1d5a9e; }
.action-delete, .action-login_failed { background: #fbe3df; color: #8a2a20; }
.action-login, .action-logout, .action-export { background: #e4e7ec; color: #3d4955; }

/* Account dialog (change password, icon color) */
#account-dialog { width: min(24rem, calc(100% - 2rem)); padding: 1.6rem 1.6rem 1.3rem; border: 0; border-radius: .8rem; color: var(--ink); background: var(--card); box-shadow: 0 18px 50px rgba(12,54,84,.25); }
#account-dialog::backdrop { background: rgba(12,54,84,.35); }
#account-dialog:focus, #account-dialog:focus-visible { outline: none; }
#account-dialog h2 { margin-bottom: 1rem; }
.dialog-status { margin: .8rem 0 0; padding: .55rem .7rem; border-radius: .35rem; font-size: .9rem; }
.color-preview { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; font-weight: 500; }
.avatar.large { width: 3rem; height: 3rem; font-size: 1.1rem; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, 2.2rem); gap: .55rem; margin-bottom: 1rem; }
.swatch { width: 2.2rem; height: 2.2rem; padding: 0; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.swatch[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px #fff; }
.custom-color { display: flex; align-items: center; justify-content: space-between; gap: .8rem; font-weight: 500; margin-bottom: 1.1rem; }
.custom-color input { width: 4rem; height: 2.2rem; padding: .15rem; cursor: pointer; }
.head-buttons { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.button-link { display: inline-block; padding: .45rem .8rem; border: 1px solid #a9b4c2; border-radius: .35rem; background: #f5f7fa; color: var(--ink); text-decoration: none; white-space: nowrap; }
.button-link:hover { background: #eceff3; }

/* Engineering Vault */
.eng-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.eng-card { display: flex; flex-direction: column; padding: 0; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; }
.eng-card:hover { border-color: #aab3c0; box-shadow: 0 2px 8px rgba(20,30,45,.07); }
.eng-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.eng-card-title { padding: .8rem 1rem; font-size: 1.12rem; font-weight: 500; border-bottom: 1px solid var(--line); }
.eng-card-body { display: grid; gap: .3rem; padding: 1rem 1rem 1.1rem; }
.eng-card-body svg { width: 3.2rem; height: 3.2rem; color: #2b3540; margin-bottom: .6rem; }
.eng-card-body strong { font-size: .95rem; font-weight: 600; letter-spacing: .02em; }
.eng-card-body span { color: var(--muted); font-size: .92rem; line-height: 1.4; }
.eng-editor { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1rem; align-items: start; }
.eng-editor section { margin: 0; }
@media (max-width: 960px) { .eng-editor { grid-template-columns: 1fr; } }
.eng-editor h3 { font-size: 1rem; margin: .4rem 0 .3rem; }
.bom-lines .line { grid-template-columns: 1fr 1fr; gap: .1rem .6rem; }
.bom-lines .line > label:first-of-type, .bom-lines .line > p { grid-column: 1 / -1; }
.add-line { margin-bottom: .9rem; }
.bom-add-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.bom-lines .wi-line { border-left: 3px solid #0c3654; }
.wi-plan-head { margin: .9rem 0 .3rem; }
/* Part details (Part Master Viewer) */
.part-detail-grid { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(18rem, 1.6fr); gap: 1.5rem; margin-top: .4rem; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; align-content: start; }
.detail-list dt { color: var(--muted); font-size: .88rem; }
.detail-list dd { margin: 0; white-space: normal; overflow-wrap: anywhere; }
.detail-heading { margin: 0 0 .35rem; font-size: .85rem; letter-spacing: .04em; color: #0c3654; }
.part-detail-grid section + section { margin-top: 1.1rem; }
.part-detail-panel td:nth-child(2) { min-width: 0; }
.detail-files { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.detail-files li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.detail-file-name { overflow-wrap: anywhere; }
.pdf-open { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; }
.pdf-open img { width: 16px; height: 16px; }
.pdf-open.disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 820px) { .part-detail-grid { grid-template-columns: 1fr; } }
/* BOM tree (BOM Master Viewer) */
.bom-tree-panel { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.bom-tree, .bom-tree ul { list-style: none; margin: 0; padding: 0; }
.bom-tree ul { margin-left: 1.1rem; padding-left: .9rem; border-left: 1px dashed #b9c2ce; }
.bom-tree li { margin: .15rem 0; }
.bom-tree summary { cursor: pointer; list-style-position: outside; }
.bom-tree summary::marker { color: #5b6b7d; }
/* Fixed right-hand columns, so quantities and totals line up at every depth (the description absorbs the indent). */
.tree-row { display: grid; grid-template-columns: 3.4rem 9rem minmax(8rem, 1fr) 7rem 8.5rem 13rem; align-items: center; gap: .6rem; padding: .3rem .4rem; border-radius: .3rem; }
.bom-tree div.tree-row { margin-left: 1rem; }
.tree-row:hover { background: #f3f5f8; }
.tree-root { font-weight: 600; }
.tree-number { text-align: left; font-weight: 600; }
.tree-desc { white-space: normal; overflow-wrap: anywhere; }
.tree-qty { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tree-rev { white-space: nowrap; font-size: .85rem; }
.tree-tag { display: inline-block; text-align: center; font-size: .68rem; font-weight: 700; letter-spacing: .03em; padding: .1rem .3rem; border-radius: .25rem; background: #eef0f4; color: #3d4955; }
.tree-tag.top { background: #0c3654; color: #fff; }
.tree-tag.sub { background: #e8eefc; color: #23408e; }
.tree-tag.wi { background: #e6f4ea; color: #1e6b3a; }
.tree-tag.warn { background: #fbe3df; color: #8a2a20; }
.tree-tag.labor { background: #fdf0d5; color: #6b4600; }
/* Labor summary on the top row and each sub-assembly row: visible while the branch is collapsed */
.tree-labor-chip { display: inline-block; margin-left: .5rem; padding: .05rem .45rem; border-radius: 999px; background: #fdf0d5; color: #6b4600; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.bom-labor-total { margin: .35rem 0 0; color: #0c3654; }
/* BOM labor lines and the labor summary (BOM Master Editor) */
.bom-lines .labor-line { border-left: 3px solid #c58a1a; }
.bom-lines .labor-line > label:nth-of-type(4) { grid-column: 1 / -1; }
.bom-lines .labor-line.no-cost > label:nth-of-type(2) { grid-column: 1 / -1; }  /* minutes alone when the cost is hidden */
.labor-totals { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: .8rem 0 .4rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.labor-totals dt, .labor-totals dd { margin: 0; }
.labor-totals dd { text-align: right; font-variant-numeric: tabular-nums; }
.labor-totals .strong { font-weight: 700; color: #0c3654; }
.labor-table td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .tree-row { grid-template-columns: 3rem 1fr auto; }
  .tree-desc, .tree-rev, .tree-qty.muted { grid-column: 2 / -1; }
}
.plan-source { font-size: .75rem; padding: .05rem .5rem; background: #e8eefc; color: #23408e; }
.wi-plan-table td, .wi-plan-table th { padding: .3rem .5rem; font-size: .85rem; }
.part-docs { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.part-docs h3 { font-size: .95rem; margin: .6rem 0 .2rem; }
.part-docs form button { margin-bottom: .4rem; }
.pill-hold { background: #fdf0d5; color: #8a5a00; }
.vault-filters { grid-template-columns: minmax(12rem, 2fr) minmax(9rem, 1fr); }
.eng-placeholder { min-height: 10rem; text-align: center; }

/* Part Master sub tabs */
.sub-tabs { display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.sub-tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: .6rem 1rem; margin-bottom: -1px; color: var(--muted); font-weight: 500; }
.sub-tabs button:hover { color: var(--ink); }
.sub-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Part Master Editor */
.part-list { margin: 0 0 1rem; }
.part-viewer td:nth-child(2) { white-space: normal; min-width: 13rem; }
.part-viewer .user-table th, .part-viewer .user-table td { padding: .55rem .55rem; }
.part-list-table { max-height: 15rem; overflow-y: auto; }
.part-list-table thead th { position: sticky; top: 0; z-index: 1; }
.pm-editor { display: block; }
.pm-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .4rem 0 .9rem; }
.pm-header h2 { margin: 0; font-size: 1.3rem; font-weight: 500; letter-spacing: .02em; }
.pm-header p { margin: .1rem 0 0; }
.pm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .pm-grid { grid-template-columns: 1fr; } }
.pm-column { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
/* A column's contents may not widen it: a wide table (e.g. measuring points, min-width) scrolls in its own
   .table-wrap instead of spilling under the other column. */
.pm-column > * { min-width: 0; max-width: 100%; }
.pm-column .table-wrap { max-width: 100%; }
.pm-column section { margin: 0; }
.pm-section-title { margin: 0 0 .8rem; font-size: 1rem; font-weight: 600; letter-spacing: .03em; color: #2b3540; }
.pm-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
@media (max-width: 520px) { .pm-pair { grid-template-columns: 1fr; } }
.segmented { display: inline-flex; border: 1px solid #b3bdc9; border-radius: .45rem; overflow: hidden; width: fit-content; }
.segmented label { display: block; margin: 0; font-weight: 500; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; padding: .4rem 1.1rem; }
.segmented input:checked + span { background: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.segmented input:disabled + span { opacity: .6; cursor: default; }
.drop-zone { display: grid; gap: .2rem; place-items: center; text-align: center; padding: 1.2rem; margin-bottom: .8rem; border: 2px dashed #b3bdc9; border-radius: .6rem; background: #f8f9fb; cursor: pointer; font-weight: 400; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--accent); background: #f1f1fd; outline: none; }
.drop-zone span { color: var(--muted); font-size: .85rem; }
.doc-chips { display: grid; gap: .5rem; }
.doc-chip { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); }
.doc-chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.doc-badge { flex: none; min-width: 2.6rem; padding: .15rem .35rem; border-radius: .3rem; background: #e3e4fa; color: #2f33a0; font-size: .72rem; font-weight: 700; text-align: center; }
.doc-name { flex: 1; min-width: 0; display: grid; text-align: left; padding: 0; border: 0; background: none; }
.doc-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.doc-name small { color: var(--muted); }
.doc-name:disabled { opacity: 1; cursor: default; }
.doc-action { flex: none; font-size: .85rem; padding: .25rem .55rem; }
a.doc-action { color: var(--accent); }
.pm-flow-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.pm-flow-head .pm-section-title { margin: 0; }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none; counter-reset: none; }
.stepper li { position: relative; display: grid; justify-items: center; gap: .35rem; text-align: center; }
.stepper li + li::before { content: ""; position: absolute; top: 1rem; right: 50%; width: 100%; height: 3px; background: #d4d9e1; z-index: 0; }
.stepper .bubble { position: relative; z-index: 1; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: #e4e7ec; color: #3d4955; font-weight: 600; }
.stepper li.current .bubble { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px #e3e4fa; }
.stepper .step-label { font-size: .82rem; color: var(--muted); }
.stepper li.current .step-label { color: var(--ink); font-weight: 600; }
.pm-hint { margin: .8rem 0 0; font-size: .9rem; }
.pager { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.pager button { padding: .1rem .6rem; font-size: 1.1rem; line-height: 1.4; }
.preview-name { margin: 0 0 .5rem; font-weight: 500; overflow-wrap: anywhere; }
.preview-stage { height: 32rem; border: 1px solid var(--line); border-radius: .45rem; background: #f0f2f5; overflow: hidden; display: grid; }
.preview-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-stage img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
.preview-stage pre { margin: 0; padding: 1rem; overflow: auto; white-space: pre-wrap; background: #fff; font-size: .88rem; }
.preview-message { margin: auto; padding: 1rem; text-align: center; display: grid; gap: .5rem; border-radius: .45rem; }
p.preview-message { color: var(--muted); }
button.signed { background: #0c3654; border-color: #0c3654; }

/* Change requests (ECR) */
#bell-menu { min-width: 20rem; max-width: 26rem; }
.dropdown-heading { margin: .2rem .7rem .4rem; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dropdown .task-item { white-space: normal; line-height: 1.35; font-size: .92rem; border-left: 3px solid var(--accent); border-radius: 0 .35rem .35rem 0; margin-bottom: .2rem; }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; margin: 0 0 .6rem; }
.link-button:hover { text-decoration: underline; }
.link-button.inline { margin: 0; }
.check-group { border: 0; padding: 0; margin: 0 0 .65rem; display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.check-group legend { font-weight: 550; margin-bottom: .3rem; padding: 0; }
.check-group label { display: flex; align-items: center; gap: .35rem; margin: 0; font-weight: 400; }
.check-group input { width: auto; }
.check-group .field-help { flex-basis: 100%; }
.role-cell { white-space: normal !important; min-width: 9rem; }
.role-tag { display: inline-block; margin: .1rem .25rem .1rem 0; padding: .05rem .45rem; border-radius: .3rem; background: #eef0f4; font-size: .78rem; color: #3d4955; }
.signoffs .pill { position: absolute; }
.signoffs { position: relative; }
.signoffs > .pill { top: 1.15rem; right: 1.15rem; }
.signoffs .stepper { margin-bottom: 1rem; }
.signoff-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.signoff-table th { text-align: left; padding: .7rem 0 .3rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
.signoff-table td { padding: .45rem .4rem .45rem 0; border-bottom: 1px solid #eef0f4; vertical-align: middle; }
.signoff-role { font-weight: 500; width: 7.5rem; }
.signoff-done { color: #1d7a3e; }
.signoff-actions { text-align: right; white-space: nowrap; }
.signoff-actions button { padding: .3rem .6rem; font-size: .85rem; margin-left: .3rem; }
.signoff-actions small { white-space: normal; display: block; text-align: left; }
.sig-history { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .9rem; }
.sig-history li { padding-left: .7rem; border-left: 3px solid #c3cad4; }
.sig-history li.sig-approved, .sig-history li.sig-released { border-color: #1d7a3e; }
.sig-history li.sig-rejected { border-color: #b42318; }
.sig-history li.sig-acknowledged { border-color: var(--accent); }
.sig-history p { margin: .2rem 0 0; color: var(--muted); }

/* ECR packets */
.ecr-items { margin: 0 0 1rem; }
.ecr-item-table td.wrap { white-space: normal; min-width: 10rem; }
.ecr-item-table td input { min-width: 14rem; padding: .3rem .45rem; }
.item-adder { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem .8rem; margin-top: .8rem; }
.item-adder label { flex: 1 1 18rem; max-width: 26rem; margin: 0; }
.item-adder .field-help { flex-basis: 100%; margin: 0; }
.item-picker { display: grid; gap: .35rem; max-height: 14rem; overflow-y: auto; padding: .2rem 0; }

/* My Tasks */
.task-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .8rem; margin: .4rem 0 1.2rem; }
.task-card { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--card); }
.task-card b { font-size: 1.6rem; line-height: 1; }
.task-card.empty { opacity: .55; }
.task-empty { margin: 0; }
.task-table td:nth-child(2), .task-table td:nth-child(4) { white-space: normal; min-width: 12rem; }
.view-button { display: inline-grid; place-items: center; padding: .25rem .4rem; }
.view-button img { width: 16px; height: 16px; display: block; }

/* BOM Master */
.inline-check { display: flex; align-items: center; gap: .45rem; margin: 0; font-weight: 400; }
.inline-check input { width: auto; }
.rev-history { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.rev-history li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.rev-history .link-button.current { color: var(--ink); font-weight: 700; text-decoration: none; cursor: default; }

/* Purchasing */
.purch-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; margin: 0 0 1rem; }
.purch-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); }
.eng-card-body strong.purch-big { font-size: 1.5rem; font-weight: 600; letter-spacing: 0; color: var(--ink); }
.eng-card-body strong.purch-alert { color: #b42318; }
.dialog-close { position: absolute; top: .7rem; right: .7rem; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; }
.dialog-close:hover { background: var(--bg); color: var(--ink); }
#account-dialog h2 { padding-right: 2rem; }
.purch-table td { vertical-align: middle; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.row-button { padding: .28rem .6rem; font-size: .85rem; white-space: nowrap; }
.recent-title { margin-top: 1.4rem; }
.icon-row-button { display: inline-grid; place-items: center; padding: .25rem .4rem; }
.icon-row-button img { width: 16px; height: 16px; display: block; }
.row-actions small { white-space: nowrap; align-self: center; }
.po-total { margin: -.2rem 0 .7rem; font-size: .9rem; color: #1d6a3a; font-weight: 500; }
.po-total.needs-approval { color: #8a5a00; }
.rev-indicator { margin: .35rem 0 0; padding: .45rem .6rem; border-radius: .35rem; background: #e7f4ec; color: #1d6a3a; font-weight: 500; font-size: .9rem; }
.rev-indicator:empty { display: none; }
.rev-indicator.blocked { background: #fbe3df; color: #8a2a20; }
.task-detail { display: block; margin-top: .2rem; color: var(--muted); white-space: normal; }
.cancel-note { color: #8a2a20; }
.user-table tbody tr.notice-row { cursor: default; }
.user-table tbody tr.notice-row:hover { background: transparent; }
.task-card.clickable { cursor: pointer; }
.task-card.clickable:hover { border-color: #aab3c0; }
.user-table tbody tr.task-hidden td, .user-table tbody tr.task-completed td { color: var(--muted); }
.task-table td:last-child { white-space: nowrap; }
.task-table td small { display: block; }
.purch-table td small { display: block; }
.purch-table .nowrap { white-space: nowrap; }
.purch-table td:nth-child(2) { white-space: normal; min-width: 9rem; }
.compact-select { width: auto; min-width: 11rem; }

/* Viewer (read-only) accounts: no add/edit/delete controls in Engineering Vault. */
body.read-only .write-only { display: none !important; }

@media (max-width: 900px) { .user-admin { grid-template-columns: 1fr; } }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; height: auto; flex: none; flex-direction: row; padding: .4rem; }
  .logo { display: none; }
  #tabs { flex-direction: row; flex: 1; overflow-x: auto; }
  #tabs button { flex: 1 0 4.5rem; font-size: .72rem; padding: .45rem .2rem; }
  #tabs button br { display: none; }
  #admin-tab { margin-top: 0; }
  .topbar { padding: .6rem 1rem; }
  .user-text { display: none; }
  .brand { height: 1.6rem; padding-right: .7rem; }
  .topbar h1 { font-size: 1.05rem; }
  main { padding: 1rem; }
}

/* Purchase requests */
#account-dialog.wide { width: min(62rem, calc(100% - 2rem)); }
.pr-cart { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.3rem 0 .8rem; padding: .55rem .65rem; background: #f3f5f8; border-radius: .45rem; }
.pr-cart > .muted { font-size: .85rem; margin-right: .2rem; }
.pr-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; font-size: .82rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.pr-chip:hover { border-color: var(--accent); }
.pr-chip .pill { font-size: .72rem; }
.pr-vendor-help { margin-top: -.5rem; }
.pr-items-title { margin: .4rem 0 .4rem; font-size: 1rem; }
.pr-items { min-width: 46rem; }
.pr-items th, .pr-items td { padding: .35rem .4rem; vertical-align: middle; }
.pr-items input { width: 100%; margin: 0; padding: .4rem .45rem; box-sizing: border-box; }
.pr-items .pr-qty { width: 5rem; }
.pr-items .pr-no { width: 2.2rem; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-items .pr-pn { width: 8.5rem; }
.pr-items .pr-link { width: 11rem; }
.pr-items .pr-cost { width: 6.5rem; }
.pr-items .pr-line-total { width: 6rem; white-space: nowrap; text-align: right; }
.pr-items .pr-remove { width: 2rem; }
.pr-remove-button { padding: .2rem .45rem; border: 0; background: transparent; color: var(--muted); font-size: 1rem; }
.pr-remove-button:hover { color: #b42318; }
.pr-add-line { margin: .5rem 0 .8rem; }
.pr-view-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.pr-facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: 0 0 .9rem; font-size: .92rem; }
.pr-facts dt { color: var(--muted); }
.pr-facts dd { margin: 0; overflow-wrap: anywhere; }
.danger-link { color: #b42318; }

/* My Tasks: team filters */
.task-filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.task-filters .compact-select { width: auto; }
#tasks-view .sub-tabs { margin-top: -.4rem; }
#tasks-view .who > span:last-child { display: flex; flex-direction: column; }

/* Multi-line purchase orders */
.po-items { min-width: 46rem; table-layout: fixed; }
.po-items th:nth-child(2), .po-items td:nth-child(2) { width: auto; }
.po-items .po-no { width: 1.8rem; color: var(--muted); }
.po-items .po-rev { width: 9.5rem; }
.po-items select { width: 100%; margin: 0; padding: .4rem .45rem; box-sizing: border-box; }
.po-line-info { display: block; white-space: normal; overflow-wrap: anywhere; margin-top: .2rem; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.po-line-info.blocked { color: #8a2a20; font-weight: 500; }
.po-receive { min-width: 40rem; }
.po-receive input { max-width: 8rem; }
.po-view-lines { margin-bottom: .9rem; }
.po-approve-lines { margin: -.2rem 0 .8rem 1.1rem; padding: 0; font-size: .88rem; }
.po-pdf-frame { display: block; width: 100%; height: min(70vh, 46rem); border: 1px solid var(--line); border-radius: .45rem; background: #f3f5f8; }
.form-buttons a.button-link.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Admin: company information */
.company-setup { margin-top: 1rem; }
.company-logo-row { display: flex; gap: 1rem; align-items: center; margin: .2rem 0 1rem; padding: .8rem; background: #f3f5f8; border-radius: .45rem; }
.company-logo { max-width: 11rem; max-height: 4rem; object-fit: contain; background: #fff; padding: .4rem; border-radius: .35rem; border: 1px solid var(--line); }
.company-logo-row .field-help { margin: .2rem 0 .5rem; }
.company-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.company-form .company-wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .company-form { grid-template-columns: 1fr; } .company-logo-row { flex-direction: column; align-items: flex-start; } }
.form-buttons:has(> :nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
.form-buttons > a.button-link { display: flex; align-items: center; justify-content: center; text-align: center; }
.po-receive td small, .po-view-lines td small { display: block; }

/* Quality: equipment, calibration, PM, observations */
.pill-fail { background: #fde4e1; color: #a3261b; }
.overdue-date { color: #b42318; font-weight: 600; }
.equip-thumb { display: block; width: 2.8rem; height: 2.8rem; object-fit: cover; border-radius: .35rem; border: 1px solid var(--line); background: #f3f5f8; }
.equip-nophoto { display: grid; place-items: center; color: var(--muted); font-size: .68rem; font-weight: 600; text-transform: uppercase; }
.equip-table td { vertical-align: middle; }
.equip-detail { display: grid; grid-template-columns: minmax(12rem, 18rem) 1fr; gap: 1.2rem; align-items: start; margin-bottom: 1rem; }
.equip-photo-side { display: grid; gap: .6rem; }
.equip-photo-side .head-buttons { justify-content: flex-start; }
.equip-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: .5rem; border: 1px solid var(--line); background: #f3f5f8; }
div.equip-photo { font-size: .9rem; font-weight: 500; text-transform: none; }
.equip-status-line { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .7rem; }
.fact-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 .8rem; font-size: .92rem; }
.fact-list dt { color: var(--muted); }
.equip-actions { justify-content: flex-start; margin: .2rem 0 1rem; }
.quality-subhead { margin: 1.1rem 0 .5rem; font-size: 1rem; font-weight: 600; }
.pre-wrap { white-space: pre-wrap; }
.check-field { display: flex; align-items: center; gap: .45rem; font-weight: 500; }
.check-field input { width: auto; }
.quality-fieldset { border: 1px solid var(--line); border-radius: .45rem; padding: .6rem .9rem .2rem; margin: 0 0 .8rem; }
.quality-fieldset legend { padding: 0 .3rem; font-weight: 600; }
.pm-instructions { padding: .7rem .9rem; margin-bottom: .9rem; background: #f3f5f8; border-radius: .45rem; }
.pm-instructions p { margin: .3rem 0 0; }
#account-dialog.extra-wide { width: min(78rem, calc(100% - 2rem)); }
.obs-header { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 .9rem; }
.obs-entry { min-width: 60rem; table-layout: fixed; }
.obs-entry td { padding-left: .3rem; padding-right: .3rem; }
.obs-entry input, .obs-entry select { margin: 0; padding: .35rem .4rem; box-sizing: border-box; }
.obs-entry th:nth-child(1) { width: 1.8rem; }
.obs-entry th:nth-child(2) { width: 10.5rem; }
.obs-entry th:nth-child(3), .obs-entry th:nth-child(5), .obs-entry th:nth-child(6), .obs-entry th:nth-child(9) { width: 5.6rem; }
.obs-entry th:nth-child(4) { width: 4.6rem; }
.obs-entry th:nth-child(7) { width: 4.2rem; }
.obs-entry th:nth-child(8) { width: 11rem; }
.obs-entry th:nth-child(11) { width: 4.4rem; }
.obs-entry th:nth-child(12) { width: 2.6rem; }
@media (max-width: 900px) { .obs-header { grid-template-columns: repeat(2, minmax(0, 1fr)); } .equip-detail { grid-template-columns: 1fr; } }
#quality-view td small, .quality-table td small { display: block; }

/* Invoices, receipts and payments (POs and purchase requests) */
.money-section { margin: 1rem 0 .4rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .55rem; background: #f8f9fb; }
.money-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.money-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.money-summary { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.money-table { background: #fff; }
.money-table tr.voided td { color: var(--muted); text-decoration: line-through; }
.money-table tr.voided td:last-child { text-decoration: none; }
.money-docs { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .35rem; }
.money-docs li { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.money-docs .row-button { margin-left: auto; }
.money-buttons { justify-content: flex-start; margin-top: .7rem; }
.purch-table .row-actions { flex-wrap: wrap; min-width: 9.5rem; }
.money-table { font-size: .9rem; }
.money-table th, .money-table td { padding-left: .5rem; padding-right: .5rem; }
.money-table td:last-child { width: 1%; }

/* Lots, dock receiving, lot stock status */
.dock-scan { display: flex; gap: .4rem; }
.dock-scan input { width: 15rem; }
.soon-date { color: #8a5a00; font-weight: 600; }
.po-receive input[type=date] { min-width: 8.5rem; }
.lot-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.lot-stat { display: grid; gap: .15rem; text-align: left; padding: .9rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: .65rem; }
.lot-stat:hover { border-color: #aab3c0; }
.lot-stat strong { font-size: 1.5rem; font-weight: 600; }
.lot-stat span { font-weight: 500; }
.lot-stat small { color: var(--muted); }
.lot-stat.alert strong { color: #b42318; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
th.sorted-asc::after { content: " ▲"; font-size: .7em; }
th.sorted-desc::after { content: " ▼"; font-size: .7em; }
.lot-groups tr.selected td { background: #eef0fb; }
.lot-list-title { display: flex; align-items: center; gap: .7rem; }

/* Part revisions and draft locks */
.rev-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -.2rem 0 .8rem; padding: .5rem .7rem;
  background: var(--card); border: 1px solid var(--line); border-radius: .5rem; }
.rev-bar select { width: auto; min-width: 18rem; }
.rev-bar button { width: 2rem; height: 2rem; padding: 0; }
.rev-bar-note { margin-left: auto; }
.lock-banner { margin: 0 0 .8rem; padding: .55rem .8rem; border-radius: .45rem; background: #fdf0d5; color: #6b4600; font-weight: 500; }
.lock-banner.mine { background: #e8eefc; color: #23408e; }
.lock-note { display: block; white-space: nowrap; }
.lock-icon { width: 1rem; height: 1rem; vertical-align: -.15rem; cursor: help; }

/* Part Master: incoming inspection plan; Quality: inspection entry */
.plan-table { width: 100%; table-layout: fixed; font-size: .9rem; }
.plan-table th, .plan-table td { padding-left: .25rem; padding-right: .25rem; }
.plan-table input { margin: 0; padding: .3rem .3rem; box-sizing: border-box; width: 100%; }
.plan-table input[type=number] { -moz-appearance: textfield; }
.plan-table input[type=number]::-webkit-inner-spin-button, .plan-table input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* Columns: # · point · nominal · ± tol · min · max · units · responsible · remove. Each has a fixed width (the point
   takes the rest, at least 10rem) and the table a minimum width, so a narrow window scrolls the table sideways
   (.table-wrap) instead of squeezing or overlapping the fields. */
.plan-table { min-width: 48rem; }
.plan-table.hide-responsible { min-width: 39rem; }
.plan-table th:nth-child(1) { width: 1.8rem; }
.plan-table th:nth-child(2) { min-width: 10rem; }
.plan-table th:nth-child(3), .plan-table th:nth-child(5), .plan-table th:nth-child(6) { width: 5rem; }
.plan-table th:nth-child(4) { width: 4.4rem; }
.plan-table th:nth-child(7) { width: 4.8rem; }
.plan-table th:nth-child(8) { width: 8.5rem; }
.plan-table th:nth-child(9) { width: 2.6rem; }
.plan-table select { margin: 0; padding: .3rem .3rem; box-sizing: border-box; width: 100%; min-width: 7.5rem; }
.plan-table input { min-width: 0; }
.plan-table .row-button { padding: .2rem .4rem; }
.plan-help { margin-bottom: .6rem; }
.inspect-entry { min-width: 52rem; }
.inspect-entry td small { display: inline; margin-left: .3rem; }
.inspect-entry th:nth-child(4) { width: 12rem; }
.inspect-entry th:nth-child(5) { width: 8rem; }
.inspect-entry th:nth-child(7) { width: 5rem; }
.inspect-entry td:nth-child(5) input { width: 5.5rem; }
.eng-card-body img.card-icon { display: block; width: 3.4rem; height: 3.4rem; object-fit: contain; justify-self: center; margin: 0 auto .6rem; }
.eng-card-body span.card-icon.tinted { display: block; width: 3.4rem; height: 3.4rem; justify-self: center; margin: 0 auto .6rem; background: #0c3654; mask-size: contain; mask-repeat: no-repeat; mask-position: center; -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center; }
.eng-card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eng-card-body svg { display: block; justify-self: center; margin: 0 auto .6rem; }
.tab-icon-wrap { position: relative; display: inline-flex; }
.tab-badge { top: -.35rem; right: -.65rem; border-color: var(--side); }
#tabs button[aria-current="page"] .tab-badge { border-color: var(--accent); }
.copy-tracking img { width: 20px; height: 20px; }
.pdf-button img { width: 20px; height: 20px; }
.purch-table .row-actions.one-line { flex-wrap: nowrap; white-space: nowrap; }
.po-receive select { min-width: 8rem; }
.receive-docs { margin-top: .4rem; }
.loc-code { font-family: ui-monospace, Consolas, monospace; font-weight: 600; letter-spacing: .03em; }
.loc-table { max-width: 44rem; }
.loc-table th:nth-child(1) { width: 6rem; }
.loc-table th:nth-child(3) { width: 7rem; }
.loc-table th:nth-child(4) { width: 3rem; }
.loc-table input { margin: 0; }
.loc-table td:first-child input { font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
#unsaved-dialog { width: min(34rem, calc(100% - 2rem)); padding: 1.4rem 1.6rem 1.2rem; border: 0; border-radius: .8rem; color: var(--ink); background: var(--card); box-shadow: 0 18px 50px rgba(12,54,84,.25); }
#unsaved-dialog::backdrop { background: rgba(12,54,84,.35); }
#unsaved-dialog h2 { margin: 0 0 .6rem; }
#unsaved-dialog p { margin: 0 0 1.1rem; color: var(--muted); }
.unsaved-buttons { grid-template-columns: repeat(3, 1fr) !important; }
.unsaved-buttons button { white-space: nowrap; }
.cal-points-title { margin: .9rem 0 .2rem; font-size: .95rem; }
.cal-points input { min-width: 4.5rem; }
.cal-points input.out-of-tol { border-color: #c0392b; background: rgba(192, 57, 43, .08); }
.cal-point-list { margin: 0; padding-left: 1.1rem; }
.cal-points.with-readings td:nth-last-child(2) { min-width: 7rem; white-space: nowrap; }
.cal-points.with-readings td:nth-child(2) input { min-width: 8rem; }
.cal-points th:nth-child(1) { width: 1.6rem; }
.cal-points th:nth-child(2) { width: auto; }
.cal-points th:nth-child(3) { width: 5rem; }
.cal-points th:nth-child(4) { width: 4.2rem; }
.cal-points th:nth-child(5) { width: 5rem; }
.cal-points th:nth-child(6) { width: 2.4rem; }
.cal-points.with-readings th:nth-child(6), .cal-points.with-readings th:nth-child(7) { width: 5.5rem; }
.cal-points.with-readings th:nth-child(8) { width: 6.8rem; }
.cal-points.with-readings th:nth-child(9) { width: 2.4rem; }
.ref-standard .std-list { display: grid; gap: .4rem; margin-bottom: .3rem; }
.ref-standard .std-row { display: flex; gap: .4rem; align-items: center; }
.ref-standard .std-row select { flex: 1; margin: 0; }
.equip-table th, .equip-table td { padding-left: .45rem; padding-right: .45rem; }
.equip-table .row-actions { flex-wrap: nowrap; }
.equip-table td:first-child, .equip-table th:first-child { padding-left: .7rem; }
.trash-button:hover { border-color: #c0392b; }
dialog form button.danger, dialog form button.primary.danger { background: #b42318; border-color: #b42318; color: #fff; }
.cal-overall { margin-top: .8rem; }
.cal-overall select:disabled { opacity: 1; color: inherit; background: var(--surface-muted, #f3f4f6); cursor: default; }
.cal-overall-value { padding: .45rem 0 .2rem; }
.cal-overall-value .pill { font-size: .95rem; padding: .25rem .7rem; }
.pr-top { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr); }
@media (max-width: 700px) { .pr-top { grid-template-columns: 1fr; } }
.pr-table td:nth-child(5), .pr-table td:nth-child(5) * { white-space: normal; }
.pr-table td:nth-child(5) { min-width: 9rem; max-width: 14rem; }
.pr-table .row-actions { min-width: 0; }

/* searchable item picker (PO lines) */
.item-picker input { width: 100%; box-sizing: border-box; margin: 0; }
.item-picker input.invalid { border-color: #b42318; background: rgba(180, 35, 24, .06); }
.item-picker[data-group="Calibration"] input { border-left: 3px solid #0c3654; }
.item-picker-list { position: fixed; z-index: 2147483000; margin: 0; padding: .25rem 0; list-style: none; max-height: 18rem;
  overflow: auto; background: var(--surface, #fff); color: inherit; border: 1px solid var(--line, #d0d5dd); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .18); max-width: min(36rem, 92vw); }
.item-picker-list li { padding: .35rem .7rem; cursor: pointer; display: flex; gap: .5rem; align-items: baseline; }
.item-picker-list li span { color: var(--muted, #667085); font-size: .88em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-picker-list li.active, .item-picker-list li:hover { background: rgba(12, 54, 84, .09); }
.item-picker-list li.item-picker-group { cursor: default; font-size: .75rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted, #667085); padding-top: .5rem; }
.item-picker-list li.item-picker-group:hover { background: none; }
.item-picker-list li.item-picker-empty { cursor: default; color: var(--muted, #667085); }
.po-cal { display: grid; gap: .3rem; }
.po-cal select { margin: 0; }
.po-cal label { display: grid; gap: .15rem; font-size: .8rem; }
.po-cal-label { display: block; font-size: .8rem; margin-bottom: .2rem; color: #0c3654; }
.ship-address { margin: .2rem 0 .6rem; padding: .5rem .7rem; background: rgba(12, 54, 84, .05); border-radius: 6px; }
.po-items .po-rev { width: 11.5rem; }
.po-items th.po-rev { white-space: nowrap; }
.item-picker-list li.item-picker-note { cursor: default; font-size: .8rem; color: #0c3654; background: rgba(12, 54, 84, .06); }
.item-picker-list li.item-picker-note:hover { background: rgba(12, 54, 84, .06); }
.receive-tools { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; margin-top: .3rem; }
.po-cal input[type=date] { margin: 0; }
.receive-tools .link-button { white-space: nowrap; }

/* electronic sign-off popup (on top of the dialog being signed) */
.sign-dialog { width: min(60rem, calc(100% - 2rem)); padding: 1.6rem 1.6rem 1.3rem; border: 0; border-radius: .8rem;
  color: var(--ink); background: var(--card); box-shadow: 0 18px 50px rgba(12,54,84,.35); }
.sign-dialog::backdrop { background: rgba(12,54,84,.45); }
.sign-dialog h2 { margin-bottom: .6rem; }
.sign-summary { border: 1px solid var(--line, #d0d5dd); border-radius: .5rem; padding: .7rem .9rem; margin: .3rem 0 .9rem;
  background: rgba(12, 54, 84, .03); }
.sign-summary .fact-list { margin: 0 0 .5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon-text-button { display: inline-flex; align-items: center; gap: .45rem; }
.icon-text-button img { width: 18px; height: 18px; filter: brightness(0) invert(1); }
.ops-cards { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.purch-alert-text { color: #b42318; }
.move-facts { margin: .2rem 0 .6rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.move-desc { display: block; }

/* part drawings & documents in inspection / observation dialogs */
.inspect-docs { margin: .6rem 0 .9rem; border: 1px solid var(--line, #d0d5dd); border-radius: .5rem; padding: .5rem .7rem .7rem; }
.inspect-docs summary { cursor: pointer; font-weight: 600; padding: .15rem 0; }
.inspect-docs-bar { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: .4rem 0; }
.inspect-docs-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.inspect-doc-chip { padding: .25rem .6rem; border-radius: 999px; font-size: .85rem; }
.inspect-doc-chip.active { background: #0c3654; color: #fff; border-color: #0c3654; }
.inspect-docs-tools { display: flex; gap: .6rem; align-items: center; }
.inspect-docs-stage { height: min(60vh, 34rem); }
.inspect-doc-open { white-space: nowrap; }

/* Document Vault: controlled documents */
.vault-title { margin: 1rem 0 .4rem; }
.doc-open-step { border: 1px dashed var(--line, #d0d5dd); border-radius: .5rem; padding: .6rem .8rem .8rem; margin-bottom: .9rem; }
.doc-open-button { margin-top: .3rem; }
.drop-zone.disabled { opacity: .55; cursor: not-allowed; }
.rev-files { display: flex; flex-wrap: wrap; gap: .25rem .8rem; margin: .15rem 0 .35rem; font-size: .9rem; }

/* View as PDF / download the original: two small icon buttons wherever files are listed. */
.file-buttons { display: inline-flex; gap: .3rem; flex: none; vertical-align: middle; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--line); border-radius: .4rem; background: var(--card); color: var(--accent); cursor: pointer; }
.icon-button:hover { border-color: var(--accent); }
.icon-button img { width: 1.15rem; height: 1.15rem; }
.icon-button.waiting img { opacity: .35; }
.rev-file { display: inline-flex; align-items: center; gap: .35rem; margin-right: .8rem; }
.rev-file .icon-button { width: 1.6rem; height: 1.6rem; }
.preview-message .file-buttons { margin-top: .6rem; }

/* ECR affected items: Move… and the trash button sit on one line. */
.item-actions { white-space: nowrap; }
.item-actions .icon-row-button { margin-left: .5rem; vertical-align: middle; }
.ecr-items td.wrap input { width: 100%; min-width: 9rem; box-sizing: border-box; }

/* Measuring points: who takes the in process reading (hidden for incoming inspection) */
.hide-responsible .plan-responsible { display: none; }
/* Production › Jobs: the job work screen */
.job-work-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: start; }
.job-clocks { display: flex; gap: .8rem; }
.job-clock { display: grid; gap: .1rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: .5rem; min-width: 7.5rem; text-align: center; }
.job-clock strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.job-start { margin: .6rem 0; }
.job-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .6rem 0; }
.job-controls input { max-width: 16rem; }
.job-wi { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.job-lot-table td.num, .job-measure-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lot-chip { display: inline-flex; align-items: center; gap: .2rem; margin: .1rem .3rem .1rem 0; padding: .05rem .45rem; border-radius: .3rem; background: #eef0f4; font-size: .85rem; white-space: nowrap; }
.lot-chip.fifo-warn { background: #fdf0d5; color: #6b4600; }
.job-lot-add { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.job-lot-qty, .job-measure-value { width: 6.5rem; }
.fifo-note { flex-basis: 100%; color: #8a5a00; font-size: .82rem; }
.job-measure-table td:last-child { display: flex; flex-wrap: wrap; gap: .3rem; }
.job-checklist { margin: .3rem 0 .6rem; padding-left: 1.2rem; }
.job-checklist .met { color: #1d6a3a; list-style: "✓ "; }
@media (max-width: 700px) { .job-work-top { grid-template-columns: 1fr; } }

/* Kit Master: lots pulled for a job at kitting */
.lot-chip.kitted { background: #dff1e6; color: #1d6a3a; }

/* Kit Master: lot · qty (with its unit) · Kit / WIP, each column wide enough not to squeeze */
.kit-table { min-width: 60rem; }
.kit-table .kit-col-lot { min-width: 15rem; }
.kit-table .kit-col-lot select { width: 100%; }
.kit-table .kit-col-qty { width: 9rem; white-space: nowrap; }
.kit-table .kit-col-actions { width: 9rem; white-space: nowrap; }
.kit-table .kit-col-actions button + button { margin-left: .35rem; }
.qty-with-unit { display: inline-flex; align-items: center; gap: .35rem; }
.qty-with-unit .qty-unit { color: var(--muted); font-size: .85rem; min-width: 1.5rem; }

/* Production › Jobs Viewer: the picked job, read only */
.job-viewer-detail { margin-top: 1rem; }
.job-work-page .panel-head { margin-bottom: .4rem; }

/* Job Work: a measuring point's spec, target on top and limits under it */
.spec-cell { display: grid; gap: .05rem; white-space: nowrap; }
.spec-cell strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.spec-cell small { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* Developer Feedback: help button form (top bar) and Admin › Developer Feedback. Priority colours: red High,
   orange Medium, blue Low. */
.pill-priority-high { background: #fde4e1; color: #b42318; font-weight: 600; }
.pill-priority-medium { background: #fdead7; color: #b54708; font-weight: 600; }
.pill-priority-low { background: #dcebfb; color: #1d5a9e; font-weight: 600; }
.feedback-form { display: grid; gap: .8rem; }
.feedback-form > p.muted { margin: 0; }
.feedback-form input[readonly] { background: var(--bg); color: var(--muted); }
.feedback-form textarea { min-height: 11rem; resize: vertical; }
.feedback-where { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.feedback-where[hidden] { display: none; }
.priority-choice { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.priority-choice legend { padding: 0; margin-bottom: .35rem; font-weight: 500; }
.priority-option { --tone: #1d5a9e; --tint: #eef5fd; position: relative; display: grid; gap: .1rem; padding: .6rem .75rem .6rem 2.2rem;
  border: 2px solid var(--line); border-left: 6px solid var(--tone); border-radius: .55rem; cursor: pointer; font-weight: 400; }
.priority-option input { position: absolute; left: .75rem; top: .8rem; margin: 0; accent-color: var(--tone); }
.priority-option strong { color: var(--tone); }
.priority-option span { font-size: .85rem; color: var(--muted); }
.priority-option:has(input:checked) { border-color: var(--tone); background: var(--tint); }
.priority-option:has(input:focus-visible) { outline: 2px solid var(--tone); outline-offset: 2px; }
.priority-high { --tone: #d92d20; --tint: #fef3f2; }
.priority-medium { --tone: #e8710a; --tint: #fff6ed; }
.priority-low { --tone: #1d6fd1; --tint: #eff6ff; }
@media (max-width: 640px) { .feedback-where, .priority-choice { grid-template-columns: 1fr; } }
.feedback-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .6rem; margin-bottom: .6rem; align-items: center; }
.feedback-filters input[type=search] { grid-column: span 2; }
.feedback-filters .inline-date { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.feedback-filters .inline-date input { flex: 1; min-width: 0; }
.feedback-table td.feedback-comment { white-space: pre-wrap; min-width: 18rem; max-width: 34rem; }
.feedback-table tr.priority-row-high td:first-child { box-shadow: inset 4px 0 #d92d20; }
.feedback-table tr.priority-row-medium td:first-child { box-shadow: inset 4px 0 #e8710a; }
.feedback-table tr.priority-row-low td:first-child { box-shadow: inset 4px 0 #1d6fd1; }
.feedback-table tr { cursor: default; }
.feedback-status-by { font-size: .78rem; margin-top: .2rem; }

/* Admin cards: all in one row on desktop (compact), wrapping only on narrow screens. */
.admin-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .75rem; }
.admin-card { gap: .6rem; padding: .8rem .85rem; min-width: 0; }
.admin-card-head { gap: .6rem; }
.admin-card-icon { width: 2.1rem; height: 2.1rem; }
.admin-card-head strong { font-size: 1rem; line-height: 1.25; }
.admin-card-head span { font-size: .82rem; line-height: 1.3; }
.admin-card-stat { font-size: .95rem; margin-top: auto; }
.admin-card-stat b { font-size: 1.2rem; }

/* User menu icons (top right), shown as drawn on a transparent background. */
#user-menu button { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.menu-icon { flex: none; width: 1.15rem; height: 1.15rem; display: block; object-fit: contain; background: transparent; }

/* Top bar help (Developer Feedback) button: just the icon, no border or box. */
#help-button, #about-button, #site-map-button { border: 0; background: transparent; box-shadow: none; width: auto; height: auto; padding: .4rem; border-radius: 50%; }
#help-button:hover, #about-button:hover, #site-map-button:hover { background: var(--bg); border: 0; }
#help-button img, #about-button img, #site-map-button img { width: 1.6rem; height: 1.6rem; }

/* Quality › NCRs */
.ncr-section { margin-top: 1.1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.ncr-form { display: grid; gap: .7rem; }
.ncr-disposition { display: grid; grid-template-columns: minmax(12rem, 1.2fr) minmax(10rem, 1fr) minmax(12rem, 1.4fr); gap: .6rem;
  align-items: end; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.ncr-disposition > strong { align-self: center; }
@media (max-width: 760px) { .ncr-disposition { grid-template-columns: 1fr; } }
.ncr-signers { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .5rem; }
.ncr-signers li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem .7rem; border: 1px solid var(--line);
  border-radius: .5rem; }
.ncr-signers li strong { min-width: 7.5rem; }
.ncr-signers li .row-button { margin-left: auto; }
.ncr-signers li .row-button + .row-button { margin-left: 0; }
.pill-group { display: inline-flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.checkbox-group { border: 0; padding: 0; margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.checkbox-group legend { padding: 0; margin-bottom: .3rem; font-weight: 500; }
.ncr-facts dd { white-space: pre-wrap; }
.ncr-section td { white-space: normal; }

/* Equipment manual link (Quality › Calibration list): looks like the PDF and trash buttons beside it. */
a.manual-button { border: 1px solid #a9b4c2; background: #f5f7fa; border-radius: .35rem; text-decoration: none; }
a.manual-button:hover { border-color: var(--accent); }
.manual-button img { width: 20px; height: 20px; }

/* A button row that keeps every button on one line, sharing the width (e.g. the calibration request preview). */
.form-buttons.one-row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.form-buttons.one-row > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 640px) { .form-buttons.one-row { grid-auto-flow: row; } }

/* About dialog */
.about-box { display: grid; gap: .9rem; justify-items: start; }
.about-box .about-logo { width: 9rem; height: auto; }
.about-box dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.about-box dt { color: var(--muted); }
.about-box dd { margin: 0; font-weight: 500; }
/* Developer Feedback: picking bugs to email to the developer */
.feedback-email-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 .6rem; }
.feedback-table td.feedback-pick, .feedback-table th.feedback-pick { width: 2rem; text-align: center; }
.feedback-table td.feedback-pick input { width: 1.05rem; height: 1.05rem; }
#account-dialog.about-dialog { width: min(30rem, calc(100% - 2rem)); }
.about-box dd a { white-space: nowrap; }
@media (max-width: 480px) { .about-box dd a { white-space: normal; overflow-wrap: anywhere; } }

/* Developer Feedback: comments wrap in a narrower column so the Status dropdown keeps its width. */
.feedback-table td.feedback-comment { min-width: 12rem; max-width: 20rem; width: 20rem; overflow-wrap: anywhere; }
.feedback-table td:last-child, .feedback-table th:last-child { min-width: 9.5rem; width: 9.5rem; }
.feedback-table td:last-child select { width: 100%; min-width: 8.5rem; }

/* Raise an NCR: lots to hold */
.ncr-lot-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 640px) { .ncr-lot-filters { grid-template-columns: 1fr; } }
.ncr-lot-wrap { max-height: 22rem; overflow-y: auto; }
.ncr-lot-table th { position: sticky; top: 0; z-index: 1; }
.ncr-lot-table tbody tr { cursor: pointer; }
.ncr-lot-table .ncr-lot-pick { width: 2rem; text-align: center; }
.ncr-lot-table .ncr-lot-pick input { width: 1.05rem; height: 1.05rem; }
.ncr-lot-table td.wrap { white-space: normal; min-width: 12rem; }

/* Quality › MRB: the NCMR link in the table */
.user-table .link-button { margin: 0; }

/* Admin › System Settings › Remote Access */
.remote-access h3 { margin-top: 1.1rem; }
.remote-url { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 1px solid var(--line);
  border-radius: .5rem; background: var(--bg); }
.remote-url strong { font-size: 1.25rem; letter-spacing: .01em; word-break: break-all; }
.remote-checks ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .4rem; }
.remote-check { display: flex; gap: .6rem; align-items: flex-start; }
.remote-check > div { display: grid; }
.remote-mark { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; flex: none;
  background: var(--bg); font-weight: 700; }
.remote-check.ok .remote-mark { background: #dff1e6; color: #1d6a3a; }
.remote-check.bad .remote-mark { background: #fde4e1; color: #a3261b; }
.remote-steps section { margin: .4rem 0 .9rem; }
.remote-steps h4 { margin: .6rem 0 .3rem; }
.remote-steps p { margin: .25rem 0; }
.remote-command { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; padding: .5rem .6rem; background: #0f1b2a;
  border-radius: .45rem; }
.remote-command code { flex: 1; min-width: 0; color: #e6edf5; font-family: ui-monospace, Consolas, monospace; font-size: .85rem;
  white-space: pre-wrap; word-break: break-all; }

/* Databases: the user-menu dialog, the sign-in picker and Admin › Network › Database Management */
.db-choices { display: grid; gap: .4rem; margin: .2rem 0 .6rem; }
.db-choice { display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .5rem;
  cursor: pointer; font-weight: 400; }
.db-choice:has(input:checked) { border-color: var(--accent); background: #f1f2fd; }
.db-choice span { font-weight: 500; }
.signin-db[hidden] { display: none; }
#login select { padding: .6rem .7rem; border-radius: .45rem; }
#login select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.db-path { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; word-break: break-all; white-space: normal; }
.db-manage .db-add { margin-top: 1rem; }
.db-manage .db-add > button { margin-top: .6rem; }
#account-dialog .db-choice { display: flex; justify-content: flex-start; text-align: left; }
#account-dialog .db-choice input { width: auto; margin: 0; flex: none; }
#account-dialog .db-choice small { margin-left: .2rem; }

/* Top bar: the current database, subtle */
.db-indicator { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .55rem .15rem .4rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); font-size: .8rem; line-height: 1.3; white-space: nowrap; background: var(--bg); }
.db-indicator[hidden] { display: none; }
.db-indicator img { width: .95rem; height: .95rem; opacity: .7; }
@media (max-width: 560px) { .db-indicator { font-size: .72rem; padding: .1rem .45rem .1rem .35rem; } }
/* The title gives way first on narrow screens, so the database chip and the user menu always fit. */
.topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.db-indicator { flex: none; }
@media (max-width: 480px) { .db-indicator img { display: none; } .db-indicator { padding: .1rem .45rem; } }

/* Admin › Data Import */
.import-panel { margin-top: 1rem; }
.import-stage { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.import-stage h3 { margin: 0 0 .3rem; }
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .4rem .9rem; margin: .8rem 0 .4rem; }
.import-count { margin: .6rem 0 .4rem; }
.import-preview { max-height: 26rem; overflow: auto; }
.import-preview th { position: sticky; top: 0; z-index: 1; vertical-align: bottom; }
.import-preview th small { display: block; font-size: .78rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.import-preview td { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.import-preview tbody tr { cursor: default; }
.import-preview .import-skip td { color: #9aa5b1; background: #f8f9fb; }
.import-preview .import-heading td { font-weight: 600; background: #f1f2fb; }
.import-preview td.import-mapped { background: #f3f4fd; }
.import-preview th.import-mapped { background: #e6e7fa; }
.import-rowno { color: var(--muted); font-variant-numeric: tabular-nums; }
.import-subhead { margin: 1rem 0 .1rem; }
.import-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: .3rem .9rem; margin-top: .5rem; }
.import-map select.import-duplicate { border-color: #b42318; box-shadow: 0 0 0 1px #b42318; }
.import-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.import-rows tr.import-done { cursor: default; color: var(--muted); }
.import-note { color: #8a5a00; }
.import-source { margin: 0 0 .9rem; }
.import-source summary { cursor: pointer; color: var(--accent); }
.import-source > div { max-height: 14rem; overflow: auto; margin-top: .4rem; border: 1px solid var(--line); border-radius: .45rem; }
.import-source th { width: 40%; white-space: normal; }
.import-source .import-source-value { white-space: pre-wrap; }
.import-source tr { cursor: default; }
.form-buttons.import-buttons { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .form-buttons.import-buttons { grid-template-columns: 1fr 1fr; } }
/* Admin settings: Save is grayed out until something changes; after saving it reads "✓ Saved" */
button.primary.save-done:disabled { opacity: 1; background: #dff1e6; border-color: #b7dfc5; color: #1d6a3a; cursor: default; }
button.primary:disabled:not(.save-done) { cursor: default; }
/* Data Import stage 2: tick rows to commit (one signature) or discard together */
.import-bulk { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .2rem 0 .6rem; }
.import-discard { display: inline-flex; align-items: center; gap: .45rem; color: #b42318; }
.import-discard img { width: 16px; height: 16px; display: block; }
.import-discard:not(:disabled):hover { border-color: #c0392b; background: #fdf1f0; }
.import-rows td.import-tick, .import-rows th:first-child { width: 2.2rem; text-align: center; cursor: default; }
/* Searchable dropdowns (stock locations): a text box over the real select, which stays in the form hidden */
.select-search { position: relative; display: block; }
.select-search > input { width: 100%; box-sizing: border-box; margin: 0; padding-right: 1.8rem; }
.select-search::after { content: "▾"; position: absolute; right: .65rem; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--muted); font-size: .85rem; }
.select-search > input.invalid { border-color: #b42318; background: rgba(180, 35, 24, .06); }
.select-search > select.select-search-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; margin: 0;
  padding: 0; border: 0; opacity: 0; pointer-events: none; }
.select-search.compact { display: inline-block; min-width: 6.5rem; }
.select-search.filter { display: inline-block; min-width: 14rem; }
.select-search-list li.chosen strong::after { content: " ✓"; color: var(--accent); }
.select-search-list li.disabled { cursor: not-allowed; opacity: .5; }
/* Stock locations: sub-locations (indented under their main location), the worked-out full code, duplicate codes */
.loc-table tr.loc-sub td { background: #fafbfc; }
.loc-table td.loc-sub-mark { color: var(--muted); text-align: right; padding-right: .3rem; }
.loc-table td.loc-full { font-family: ui-monospace, Consolas, monospace; font-weight: 600; color: var(--ink); white-space: nowrap; }
.loc-table tr.loc-sub td.loc-full { color: #3d4955; }
.loc-table td.loc-actions { white-space: nowrap; text-align: right; }
.loc-table td.loc-actions .row-button { display: inline-flex; vertical-align: middle; }
.loc-table td.loc-actions .row-button + .row-button { margin-left: .3rem; }
.loc-table .loc-add-sub { width: auto; padding: 0 .5rem; font-size: .85rem; }
.loc-table tr.loc-duplicate td { background: #fde4e1; }
.loc-table tr.loc-duplicate td.loc-full { color: #b42318; }
.loc-table tr.loc-duplicate input:first-child { border-color: #b42318; }
.loc-duplicate-note { margin: .5rem 0 0; }
/* Stock locations table (main / sub-location columns); Document Types keeps the plain .loc-table layout */
.stock-loc-table { max-width: 62rem; }
.stock-loc-table th:nth-child(1), .stock-loc-table th:nth-child(2) { width: 7rem; }
.stock-loc-table th:nth-child(3) { width: 7.5rem; }
.stock-loc-table th:nth-child(4) { width: auto; }
.stock-loc-table th:nth-child(5) { width: 6rem; }
.stock-loc-table th:nth-child(6) { width: 6.5rem; }
.stock-loc-table tr.loc-sub td:nth-child(2) input { font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.stock-loc-table td:nth-child(4) input { width: 100%; }
/* Location inputs: Warehouse (left) + Location within it (right), 50/50 on one row; the real select stays hidden */
.loc-pair { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; width: 100%; }
.loc-pair-half { display: grid; gap: .15rem; min-width: 0; }
.loc-pair-caption { font-size: .8rem; font-weight: 500; color: var(--muted); }
.loc-pair > select.loc-pair-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; margin: 0; padding: 0;
  border: 0; opacity: 0; pointer-events: none; }
.loc-pair .select-search { width: 100%; }
.loc-pair .select-search > input:disabled { background: #f3f4f6; color: var(--muted); cursor: not-allowed; }
.loc-pair.compact { gap: .3rem; min-width: 16rem; }
.loc-pair.compact .select-search.compact { min-width: 0; display: block; }
.loc-pair.filter { width: 36rem; max-width: 100%; }
.loc-pair.own-label .loc-pair-caption { font-size: inherit; font-weight: inherit; color: inherit; }
.loc-pair.own-label { gap: .5rem .9rem; }
.pm-pair > label.loc-field-wide { grid-column: 1 / -1; }
.pm-pair:has(> label.loc-field-wide) { grid-auto-flow: row dense; }  /* no empty slot beside the field above it */
/* Long lists: a page at a time */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: .5rem 0 .2rem; }
.pager-count { color: var(--muted); font-size: .92rem; }
.pager-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.pager-button { min-width: 2.1rem; padding: .25rem .5rem; }
.pager-button.current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); opacity: 1; }
.pager-gap { color: var(--muted); padding: 0 .15rem; }
.pager-size { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 400; font-size: .92rem; color: var(--muted); }
.pager-size input { width: 5.5rem; }
/* Equipment maintenance log */
.maint-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.maint-subhead .link-button { white-space: nowrap; }
.maint-table td .maint-summary { display: inline-block; max-width: 34rem; white-space: normal; }
.maint-details { margin: .2rem 0 .8rem; padding: .6rem .8rem; background: #f8f9fb; border: 1px solid var(--line); border-radius: .45rem;
  max-height: 22rem; overflow: auto; }
.maint-table td small { display: block; }
.maint-refs[hidden] { display: none; }
.maint-refs > label[hidden] { display: none; }
.icon-text-button-plain { display: inline-flex; align-items: center; gap: .4rem; }
.icon-text-button-plain img { width: 18px; height: 18px; display: block; }
/* icon + label on link-buttons too (View certificate); a light icon on the dark primary button */
a.button-link.icon-text-button-plain { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.form-buttons .icon-text-button-plain { justify-content: center; }
.primary.icon-text-button-plain img { filter: brightness(0) invert(1); }
.ecr-ack-list { list-style: none; padding: 0; margin: .2rem 0 .8rem; display: grid; gap: .35rem; }
.ecr-preview .ecr-preview-title { margin: 1rem 0 .35rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.spare-kinds { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: .2rem 0 .8rem; }
.spare-loc-warning { margin: .3rem 0 .8rem; padding: .55rem .75rem; border: 1px solid #e8c77a; border-left-width: 4px; border-radius: 6px; background: #fdf6e3; color: #6b4600; font-size: .9rem; }
.spare-loc-warning[hidden] { display: none; }
.spare-on-hand { max-width: calc(50% - .5rem); }
input[name=PART_ON_HAND]:disabled { background: #eef0f3; color: #4a5260; cursor: not-allowed; }
/* Roles and their cards (Admin › User & Role Management › Roles) */
.dept-line { display: block; margin-top: .15rem; color: var(--muted); font-size: .76rem; }
.access-roles .panel-head { align-items: flex-start; gap: 1rem; }
.access-role-table td { vertical-align: top; }
.role-cards { display: grid; gap: .15rem; font-size: .84rem; white-space: normal; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: .9rem; margin: .4rem 0 1rem; }
.role-tab { margin: 0; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: .6rem; background: #f9fafb; }
.role-tab-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .35rem; }
.role-tab-head h3 { margin: 0; font-size: .98rem; }
.role-tab-head small { margin-right: auto; color: var(--muted); }
.role-tab-head .link-button { font-size: .8rem; white-space: nowrap; }
.role-card-table { width: 100%; border-collapse: collapse; }
.role-card-table td { padding: .32rem .2rem; border-top: 1px solid var(--line); vertical-align: middle; }
.role-card-table td:first-child small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.25; }
.role-card-table td:last-child { width: 5.6rem; }
.role-card-table select { width: 100%; padding: .25rem .3rem; }
.role-card-table tr.has-view select { border-color: #4a7fd4; background: #eef4ff; }
.role-card-table tr.has-edit select { border-color: #079455; background: #ecfdf3; font-weight: 600; }
.role-card-table tr:not(.has-view):not(.has-edit) strong { color: var(--muted); font-weight: 500; }
.role-link { cursor: help; }
.access-role-table { table-layout: fixed; width: 100%; }
.access-role-table th:first-child { width: 13rem; }
.access-role-table th:last-child { width: 4rem; }
.access-role-table td { white-space: normal; }
.role-name strong { display: block; }
.role-name small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.3; }
