/* ---------- App shell ---------- */
html, body { font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif; }
.app-bar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-left: 4px; }
.brand-mark { background: #0F9D8A; color: #fff; font-weight: 700; border-radius: 6px; padding: 2px 7px; font-size: .85rem; letter-spacing: .5px; }
.brand-text { font-weight: 600; font-size: 1.05rem; }
.app-drawer { border-right: 1px solid #E2E8F0; }
.app-main { min-height: 100vh; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-crumb { font-size: .8rem; color: #64748B; margin-bottom: 2px; }
.page-crumb a { color: #1F3A5F; text-decoration: none; }

.card-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #E2E8F0; }
.section { padding: 16px; }
.text-muted { color: #64748B; }
.small { font-size: .8rem; }
.cursor-pointer { cursor: pointer; }
.nowrap { white-space: nowrap; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat-card { display: block; background: #fff; border: 1px solid #E2E8F0; border-radius: 8px; padding: 14px 16px; text-decoration: none; color: inherit; transition: border-color .15s; }
.stat-card:hover { border-color: #1F3A5F; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: #1F3A5F; line-height: 1.1; }
.stat-label { color: #64748B; font-size: .8rem; margin-top: 4px; }
.stat-alert .stat-value { color: #C62828; }

/* ---------- Chips and dates ---------- */
.type-chip { display: inline-block; color: #fff; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; letter-spacing: .3px; }
.status-chip { margin: 0 !important; }
.due-late { color: #C62828; font-weight: 600; }
.due-today { color: #ED6C02; font-weight: 600; }
.row-late td:first-child { box-shadow: inset 3px 0 0 #C62828; }
.row-hold { opacity: .7; }

/* ---------- Schedule filters ---------- */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding: 12px 16px; border-bottom: 1px solid #E2E8F0; align-items: center; }

/* ---------- Detail pages ---------- */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; font-size: .875rem; }
.kv dt { color: #64748B; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prewrap { white-space: pre-wrap; }
.suggest-card { border: 1px dashed #0F9D8A; border-radius: 8px; padding: 10px 12px; background: #F0FBF9; }
.suggest-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #DDF2EE; }
.suggest-row:last-child { border-bottom: 0; }
.check-row { display: grid; grid-template-columns: 1fr 260px; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid #E2E8F0; }
.check-row:last-child { border-bottom: 0; }

/* ---------- Team load ---------- */
.load-cell { text-align: center; border-radius: 6px; padding: 4px 2px; font-size: .8rem; }
.load-0 { background: #F1F5F9; color: #94A3B8; }
.load-1 { background: #E0F2F1; }
.load-2 { background: #FFF3E0; }
.load-3 { background: #FFEBEE; color: #B71C1C; font-weight: 600; }
.load-leave { background: repeating-linear-gradient(45deg, #ECEFF1, #ECEFF1 6px, #F8FAFC 6px, #F8FAFC 12px); color: #607D8B; }

/* ---------- Timesheet ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; }
.day-total { font-weight: 600; }

/* ---------- Notifications ---------- */
.notif-title { font-weight: 600; font-size: .85rem; }
.notif-msg { font-size: .8rem; color: #475569; }
.notif-time { font-size: .72rem; color: #94A3B8; }
.unread-item { background: #F0F7FF; }

/* ---------- Sign-in pages (static, Bootstrap) ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #1F3A5F 0%, #24507F 55%, #0F9D8A 140%); padding: 24px; }
.auth-card { background: #fff; border-radius: 12px; padding: 32px; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.auth-card-wide { max-width: 980px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.auth-logo { background: #0F9D8A; color: #fff; font-weight: 700; border-radius: 8px; padding: 8px 10px; }
.auth-title { font-weight: 700; font-size: 1.2rem; color: #1F3A5F; }
.auth-sub { color: #64748B; font-size: .85rem; }
.auth-card .btn-primary { background: #1F3A5F; border-color: #1F3A5F; }

/* ---------- Blazor error / validation ---------- */
#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 2000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* ---------- Sections and file splits ---------- */
.stat-static:hover { border-color: #E2E8F0; }
.section-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid #E2E8F0; background: #F8FAFC; }
.section-pill { display: flex; flex-direction: column; gap: 2px; border: 1px solid #E2E8F0; border-radius: 8px; padding: 6px 10px; background: #fff; text-decoration: none; color: inherit; min-width: 150px; }
.section-pill:hover { border-color: #1F3A5F; }
.section-pill-name { font-weight: 600; font-size: .85rem; }
.section-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; padding: 12px 16px; font-size: .875rem; }
.section-facts span { display: block; color: #64748B; font-size: .75rem; }
.split-scroll { overflow-x: auto; }
.split-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.split-table th, .split-table td { padding: 6px 10px; border-top: 1px solid #E2E8F0; text-align: left; vertical-align: middle; }
.split-table th { color: #64748B; font-weight: 600; font-size: .72rem; line-height: 1.2; background: #F8FAFC; vertical-align: bottom; }
.split-table th.num { min-width: 64px; max-width: 92px; white-space: normal; }
.split-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.split-table td.file { white-space: nowrap; font-family: Consolas, "Courier New", monospace; font-size: .8rem; }
.split-table .desc { min-width: 160px; }
.split-table .sel { width: 36px; padding-right: 0; }
.split-table tfoot td { font-weight: 700; background: #F1F5F9; }
.split-table tr.not-counted td { color: #94A3B8; }
.qty-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.selection-bar { position: sticky; top: 72px; z-index: 5; background: #fff; }
.split-table tr.not-assigned td { color: #B45309; }
.split-table .qty-diff { color: #C62828; font-weight: 600; }
.section-code { display: inline-block; margin-left: 6px; font-size: .75rem; font-weight: 700; background: #1F3A5F; color: #fff; border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
.type-tag { display: inline-block; font-size: .7rem; font-weight: 600; border-radius: 10px; padding: 1px 8px; white-space: nowrap; background: #ECEFF1; color: #455A64; }
.type-live { background: #E0F2F1; color: #00695C; }
.type-proof { background: #E3F2FD; color: #1565C0; }
.type-absample { background: #F3E5F5; color: #6A1B9A; }
.type-intel { background: #FFF3E0; color: #E65100; }

/* Parts of a task (DP and LP of a DPLP task) */
.task-parts { display: grid; gap: 10px; }
.task-part { border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px 12px; }
.task-part .kv { grid-template-columns: 90px minmax(0, 1fr); }

/* Part statuses (DP / LP) under a task's status in lists */
.part-statuses { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.part-status { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; white-space: nowrap; }
.part-status .part-code { font-weight: 600; min-width: 2.2em; color: var(--mud-palette-text-secondary); }
.part-status .status-chip { margin: 0; height: 20px; }
.part-status-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 4px; padding: 6px 12px; min-height: 40px; }
.part-status-field .label { font-size: 0.8rem; color: var(--mud-palette-text-secondary); }
.line-sections { display: inline-block; width: fit-content; align-self: flex-start; margin-left: 6px; font-size: 0.75rem; padding: 1px 6px; border-radius: 8px; background: var(--mud-palette-action-default-hover); color: var(--mud-palette-text-secondary); white-space: nowrap; }

/* Fields pulled from PrintIQ */
.piq-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.piq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; font-size: .875rem; }
.piq-field { min-width: 0; padding: 4px 8px; border-left: 3px solid #E2E8F0; }
.piq-field-warn { border-left-color: #C62828; background: #FDECEA; }
.piq-label { display: block; color: #64748B; font-size: .75rem; }
.piq-value { display: flex; align-items: center; gap: 4px; overflow-wrap: anywhere; min-height: 28px; }
.piq-edit { margin-left: auto; opacity: .55; }
.piq-field:hover .piq-edit { opacity: 1; }
.piq-hint { color: #64748B; font-size: .7rem; font-style: italic; }
.piq-missing { color: #C62828; font-weight: 600; }
.piq-alert .mud-alert-message { width: 100%; }
.piq-ops { font-size: .8rem; }
.piq-ops td { vertical-align: top; }
.piq-json { max-height: 420px; overflow: auto; font-size: .75rem; background: #F8FAFC; border: 1px solid #E2E8F0; padding: 8px; white-space: pre; }
.op-chip { display: inline-block; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 10px; background: #EEF2FF; color: #3730A3; font-size: .75rem; }

/* Postage group on a section */
.postage-group { border: 1px solid #CBD5E1; border-radius: 6px; background: #F8FAFC; padding: 4px 8px 4px; }
.postage-group-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; padding: 4px 8px 0; }
.postage-facts { padding: 8px; }
