:root {
    --brand: #e10d35;
    --brand-dark: #bc0707;
    --brand-soft: #fce8ed;
    --gold: #e10d35;
    --gold-soft: #fce8ed;
    --ink: #17191b;
    --ink-soft: #41464a;
    --ink-muted: #70767b;
    --surface: #ffffff;
    --surface-subtle: #f3f4f5;
    --line: #dfe2e4;
    --line-strong: #c7cbce;
    --success: #25875f;
    --warning: #d99127;
    --danger: #bd554b;
    --info: #4d7fa0;
    --shadow-sm: 0 1px 2px rgba(13, 17, 20, .05), 0 5px 16px rgba(13, 17, 20, .04);
    --shadow-md: 0 14px 35px rgba(13, 17, 20, .1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Roboto, Aptos, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--surface-subtle); }
body { font-size: 14px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { scroll-margin-top: 104px; }
h1:focus { outline: none; }
.app-icon { display: block; flex: 0 0 auto; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 25px; }
.page-title-wrap { min-width: 0; }
.page-kicker { display: block; color: var(--brand); font-size: .67rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 7px; }
.page-head h1 { font-family: "Arial Narrow", "Roboto Condensed", Roboto, sans-serif; font-weight: 800; text-transform: uppercase; font-size: clamp(1.8rem, 3vw, 2.45rem); letter-spacing: -.015em; line-height: 1.05; margin: 0; }
.page-head p { color: var(--ink-muted); margin: 8px 0 0; font-size: .84rem; line-height: 1.5; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.btn { min-height: 40px; padding: 0 16px; border-radius: 4px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; font-family: "Arial Narrow", "Roboto Condensed", Roboto, sans-serif; text-transform: uppercase; letter-spacing: .035em; font-weight: 800; font-size: .72rem; transition: .16s ease; cursor: pointer; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 13px rgba(225,13,53,.18); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.btn-secondary:hover { border-color: #9cacA6; color: var(--ink); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-danger { background: #fff2f0; border-color: #f0c9c4; color: #99433b; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .7rem; }
.btn-icon { font-size: 1rem; line-height: 1; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-sm); }
.card-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.card-head h2, .card-head h3 { font-size: .85rem; margin: 0; font-weight: 800; }
.card-head p { margin: 4px 0 0; color: var(--ink-muted); font-size: .69rem; }
.card-body { padding: 20px; }
.card-link { font-size: .7rem; font-weight: 800; text-decoration: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { padding: 19px; position: relative; overflow: hidden; }
.metric-card::after { content: ''; position: absolute; width: 70px; height: 70px; border-radius: 50%; background: var(--brand-soft); right: -25px; top: -28px; opacity: .75; }
.metric-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.metric-label { color: var(--ink-muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.metric-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: var(--brand); background: var(--brand-soft); font-weight: 900; }
.metric-value { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; font-weight: 800; font-size: 1.8rem; letter-spacing: -.02em; line-height: 1; }
.metric-foot { color: var(--ink-muted); font-size: .67rem; margin-top: 9px; }
.metric-foot strong { color: var(--success); }
.metric-card.warning .metric-icon { color: #9a6112; background: var(--gold-soft); }
.metric-card.warning::after { background: var(--gold-soft); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 18px; }
.dashboard-stack { display: grid; gap: 18px; }
.welcome-strip { background: linear-gradient(100deg, rgba(18,20,22,.96), rgba(18,20,22,.68)), url('/images/brand/industrial-background.jpg') center 51%/cover; color: #fff; padding: 24px 26px; border-radius: 6px; border-bottom: 4px solid var(--brand); box-shadow: 0 12px 26px rgba(13,17,20,.18); display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; position: relative; overflow: hidden; }
.welcome-strip::after { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); right: 6%; top: -120px; box-shadow: 0 0 0 35px rgba(255,255,255,.025); }
.welcome-strip h2 { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-weight: 800; font-size: 1.35rem; margin: 0 0 5px; }
.welcome-strip p { color: #d4d7d9; font-size: .73rem; margin: 0; }
.welcome-date { color: #ff3158; font-weight: 900; font-size: .68rem; letter-spacing: .06em; white-space: nowrap; }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; color: #69736f; background: #fafbf9; font-size: .61rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 900; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid #edf0ed; font-size: .75rem; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfa; }
.table-primary { display: grid; gap: 3px; }
.table-primary a, .table-primary strong { color: var(--ink); text-decoration: none; font-weight: 800; }
.table-primary a:hover { color: var(--brand); }
.table-primary small, .muted { color: var(--ink-muted); font-size: .64rem; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.date-cell { white-space: nowrap; color: var(--ink-soft); }
.avatar-name { display: flex; align-items: center; gap: 9px; }
.mini-avatar { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: #52756c; font-size: .57rem; font-weight: 900; }

.status { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 9px; border-radius: 20px; font-size: .61rem; font-weight: 850; white-space: nowrap; }
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-success, .status-completed { color: #277253; background: #e8f5ee; }
.status-warning, .status-awaitingapproval, .status-inprogress { color: #95601a; background: #fcf1de; }
.status-info, .status-ready { color: #3c6f8e; background: #eaf3f8; }
.status-muted, .status-pending, .status-skipped { color: #6f7b77; background: #eef1ef; }
.status-danger, .status-returned, .status-onhold { color: #9a463e; background: #faeae7; }

.stage-meter { min-width: 150px; }
.stage-meter-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: .62rem; }
.stage-meter-label strong { font-weight: 800; color: var(--ink-soft); }
.stage-meter-label span { color: var(--ink-muted); }
.meter { height: 4px; background: #e7ebe8; border-radius: 10px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

.workload-list { display: grid; gap: 15px; }
.workload-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 22px; gap: 10px; align-items: center; }
.workload-number { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: #edf3f0; color: var(--brand); font-size: .6rem; font-weight: 900; }
.workload-copy { display: grid; gap: 5px; }
.workload-copy span { font-size: .68rem; font-weight: 700; }
.workload-copy .meter > span { background: #79a99d; }
.workload-count { text-align: right; font-size: .7rem; font-weight: 850; }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.quick-action { min-height: 76px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; justify-content: space-between; background: #fff; transition: .16s ease; }
.quick-action:hover { border-color: #a8c7be; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.quick-action span { color: var(--brand); font-weight: 900; }
.quick-action strong { font-size: .68rem; }

.toolbar { padding: 14px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.search-box { height: 39px; min-width: 240px; flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); background: #fff; border-radius: 9px; }
.search-box > .app-icon { color: var(--ink-muted); }
.search-box input { border: 0; outline: 0; width: 100%; color: var(--ink); font-size: .76rem; background: transparent; }
.filter-select, .form-control, .form-select { min-height: 41px; border: 1px solid var(--line-strong); border-radius: 5px; background-color: #fff; color: var(--ink); padding: 0 12px; font-size: .77rem; line-height: 1.35; outline: none; color-scheme: light; }
.filter-select:hover, .form-control:hover, .form-select:hover { border-color: #9ea5aa; }
.filter-select:focus, .form-control:focus, .form-select:focus { border-color: #e10d35; box-shadow: 0 0 0 3px rgba(225,13,53,.09); }
.filter-select option, .form-select option { color: #17191b; background-color: #fff; font-size: .82rem; }
.filter-select:disabled, .form-control:disabled, .form-select:disabled { color: #596066; background-color: #eef0f2; border-color: #d5d9dc; opacity: 1; cursor: not-allowed; }
textarea.form-control { padding: 10px 11px; min-height: 92px; resize: vertical; }
.result-count { padding: 11px 16px; color: var(--ink-muted); font-size: .65rem; border-bottom: 1px solid var(--line); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: .7rem; font-weight: 800; color: var(--ink-soft); }
.form-field .hint { color: var(--ink-muted); font-size: .64rem; line-height: 1.45; }
.form-section { padding: 21px 22px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { margin-bottom: 17px; }
.form-section-title h3 { margin: 0 0 5px; font-size: .8rem; }
.form-section-title p { color: var(--ink-muted); margin: 0; font-size: .66rem; }
.form-footer { padding: 17px 22px; display: flex; justify-content: flex-end; gap: 9px; background: #fafbf9; border-radius: 0 0 14px 14px; }
.validation-message, .text-danger { color: var(--danger); font-size: .64rem; }
.invalid { border-color: var(--danger) !important; }

.detail-hero { background: linear-gradient(100deg, #fff 72%, #f1f2f3); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 6px; padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.detail-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.detail-id { color: var(--brand); font-size: .65rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.detail-hero h1 { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-weight: 800; font-size: 2rem; margin: 7px 0 4px; letter-spacing: -.01em; }
.detail-sub { color: var(--ink-muted); font-size: .73rem; }
.detail-facts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; padding-top: 21px; margin-top: 20px; border-top: 1px solid var(--line); }
.fact { display: grid; gap: 4px; }
.fact small { color: var(--ink-muted); font-size: .58rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.fact strong { font-size: .76rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(290px, .68fr); gap: 18px; align-items: start; }
.workflow-list { padding: 6px 20px 14px; }
.workflow-row { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 15px 0; border-bottom: 1px solid #edf0ed; }
.workflow-row:last-child { border-bottom: 0; }
.workflow-step { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #eef1ef; color: #77837f; font-size: .66rem; font-weight: 900; }
.workflow-row.current .workflow-step { background: var(--brand); color: #fff; box-shadow: 0 0 0 5px var(--brand-soft); }
.workflow-row.complete .workflow-step { background: var(--brand); color: #fff; }
.workflow-copy h4 { font-size: .74rem; margin: 2px 0 5px; }
.workflow-copy p { color: var(--ink-muted); font-size: .63rem; margin: 0; }
.approval-avatars { display: flex; margin-top: 8px; }
.approval-avatar { width: 23px; height: 23px; border: 2px solid #fff; border-radius: 7px; margin-left: -4px; display: grid; place-items: center; color: #fff; background: #6a8d83; font-size: .5rem; font-weight: 900; }
.approval-avatar:first-child { margin-left: 0; }
.action-panel { position: sticky; top: 94px; }
.stage-callout { padding: 19px; background: linear-gradient(135deg, #202326, #111315); color: #fff; border-radius: 6px 6px 0 0; border-bottom: 4px solid var(--brand); }
.stage-callout small { color: #ff7890; text-transform: uppercase; letter-spacing: .1em; font-size: .56rem; font-weight: 900; }
.stage-callout h3 { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-weight: 800; font-size: 1.2rem; margin: 9px 0 5px; }
.stage-callout p { color: #cfd2d4; font-size: .65rem; margin: 0; line-height: 1.55; }
.action-body { padding: 18px; }
.approval-progress { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: .66rem; }
.approval-progress strong { color: var(--brand); }
.signoff-box { border: 1px solid var(--line); background: #fbfcfa; border-radius: 10px; padding: 13px; margin: 15px 0; }
.signoff-box h4 { font-size: .7rem; margin: 0 0 5px; }
.signoff-box p { font-size: .61rem; color: var(--ink-muted); line-height: 1.5; margin-bottom: 10px; }
.upload-zone { border: 1px dashed #adc0ba; border-radius: 10px; padding: 14px; text-align: center; background: #fbfcfb; margin-top: 10px; }
.upload-zone label { cursor: pointer; color: var(--brand); font-size: .68rem; font-weight: 800; }
.upload-zone input { width: 100%; font-size: .65rem; }
.document-list, .payment-list { display: grid; gap: 9px; }
.document-row, .payment-row { padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.document-info, .payment-info { display: grid; gap: 3px; min-width: 0; }
.document-info strong, .payment-info strong { font-size: .66rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-info small, .payment-info small { font-size: .57rem; color: var(--ink-muted); }
.document-icon { width: 29px; height: 32px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 6px; background: #f3ebe2; color: #a15a41; font-size: .55rem; font-weight: 900; }
.evidence-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.evidence-columns > section { min-width: 0; }
.evidence-column-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.evidence-column-head > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--brand); background: var(--brand-soft); }
.evidence-column-head h3 { margin: 0; font-size: .76rem; }
.evidence-column-head p { margin: 3px 0 0; color: var(--ink-muted); font-size: .62rem; }
.split-row { display: flex; gap: 9px; align-items: center; }
.tabs { display: flex; gap: 3px; padding: 0 19px; border-bottom: 1px solid var(--line); }
.tab { padding: 13px 4px 11px; margin-right: 18px; border-bottom: 2px solid transparent; color: var(--ink-muted); font-size: .67rem; font-weight: 800; cursor: default; }
.tab.active { color: var(--brand); border-color: var(--brand); }

.master-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.catalogue-brand-strip { min-height: 150px; display: grid; grid-template-columns: minmax(0, 1.5fr) 210px 210px; gap: 0; margin-bottom: 16px; overflow: hidden; background: #191c1e; color: #fff; border-radius: 6px; border-bottom: 4px solid var(--brand); }
.catalogue-copy { padding: 24px; align-self: center; }
.catalogue-copy h2 { margin: 0 0 7px; font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: 1.35rem; }
.catalogue-copy p { color: #c2c6c8; margin: 0; max-width: 580px; font-size: .72rem; line-height: 1.6; }
.catalogue-image { min-height: 150px; background-position: center; background-size: cover; filter: grayscale(.35); border-left: 1px solid rgba(255,255,255,.15); }
.catalogue-image.flow { background-image: linear-gradient(rgba(225,13,53,.16), rgba(0,0,0,.18)), url('/images/brand/flow-meters.jpg'); }
.catalogue-image.iolink { background-image: linear-gradient(rgba(225,13,53,.16), rgba(0,0,0,.18)), url('/images/brand/io-link.jpg'); }
.entity-card { padding: 17px; }
.entity-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.entity-avatar { width: 42px; height: 42px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 11px; font-weight: 900; }
.entity-card h3 { font-size: .78rem; margin: 13px 0 4px; }
.entity-code { color: var(--ink-muted); font-size: .6rem; }
.entity-details { display: grid; gap: 7px; padding-top: 13px; margin-top: 13px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .64rem; }
.entity-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.stock-value { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; font-weight: 800; font-size: 1.35rem; }
.stock-low { color: var(--danger); }

.timeline { padding: 4px 20px 16px; }
.timeline-item { display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; gap: 11px; padding: 14px 0; border-bottom: 1px solid #edf0ed; }
.timeline-item:last-child { border: 0; }
.timeline-mark { width: 27px; height: 27px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 8px; font-size: .62rem; font-weight: 900; }
.timeline-copy h4 { margin: 1px 0 4px; font-size: .7rem; }
.timeline-copy p { margin: 0; color: var(--ink-muted); font-size: .63rem; line-height: 1.45; }
.timeline-time { color: var(--ink-muted); font-size: .58rem; white-space: nowrap; }

.notice { padding: 11px 13px; border-radius: 9px; margin-bottom: 14px; font-size: .68rem; line-height: 1.5; }
.notice-success { color: #205f45; background: #e7f4ed; border: 1px solid #c4e4d3; }
.notice-error { color: #8b3f37; background: #fbedeb; border: 1px solid #efcbc6; }
.form-select-sm { min-width: 130px; min-height: 34px; padding-top: 0; padding-bottom: 0; }
.check-field { display: flex; grid-template-columns: auto 1fr; align-items: center; justify-content: start; }
.check-field input { width: 16px; height: 16px; accent-color: var(--brand); }
.role-management-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.role-picker-panel { position: sticky; top: 94px; overflow: hidden; }
.role-picker-list { display: grid; padding: 8px; }
.role-picker-item { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; align-items: center; gap: 10px; padding: 10px; border: 0; border-left: 3px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.role-picker-item:hover { background: #f5f6f7; }
.role-picker-item.selected { background: var(--brand-soft); border-left-color: var(--brand); }
.role-picker-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 4px; background: #222528; color: #fff; font-size: .62rem; font-weight: 900; }
.role-picker-item.selected .role-picker-icon { background: var(--brand); }
.role-picker-copy { display: grid; gap: 3px; min-width: 0; }
.role-picker-copy strong { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: .73rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-picker-copy small { color: var(--ink-muted); font-size: .59rem; }
.role-picker-arrow { color: var(--ink-muted); font-size: 1.2rem; }
.role-editor-panel { overflow: hidden; }
.role-editor-hero { padding: 22px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; color: #fff; background: linear-gradient(120deg, #202326, #111315); border-bottom: 4px solid var(--brand); }
.role-editor-hero h2 { margin: 0; font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: 1.55rem; }
.role-editor-hero p { margin: 6px 0 0; max-width: 650px; color: #c8ccce; font-size: .68rem; line-height: 1.55; }
.role-editor-stats { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.role-editor-stats span { min-width: 74px; padding: 8px 10px; display: grid; gap: 2px; text-align: center; border: 1px solid rgba(255,255,255,.15); border-radius: 4px; color: #aeb3b6; font-size: .55rem; text-transform: uppercase; }
.role-editor-stats strong { color: #fff; font-size: .9rem; }
.access-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #f7f8f8; color: var(--ink-muted); font-size: .6rem; }
.access-legend > strong { color: var(--ink); text-transform: uppercase; letter-spacing: .05em; }
.access-legend span { display: inline-flex; align-items: center; gap: 5px; }
.access-legend i { width: 8px; height: 8px; border-radius: 50%; }
.access-legend .role-save-note { margin-left: auto; color: #277253; font-weight: 750; }
.access-legend .access-none { background: #c8cdd0; }.access-legend .access-view { background: #5d87a2; }.access-legend .access-edit { background: #e10d35; }.access-legend .access-approve { background: #d99127; }.access-legend .access-admin { background: #202326; }
.module-selector { padding: 14px 16px; display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 8px; border-bottom: 1px solid var(--line); background: #fff; }
.module-selector-item { min-width: 0; padding: 10px; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; row-gap: 2px; align-items: center; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink-soft); text-align: left; cursor: pointer; transition: .16s ease; }
.module-selector-item:hover { border-color: #9ea5aa; background: #f8f9f9; }
.module-selector-item.selected { color: var(--brand); border-color: rgba(225,13,53,.42); background: var(--brand-soft); box-shadow: inset 0 -2px var(--brand); }
.module-selector-item > span { grid-row: 1 / span 2; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; background: #eef0f2; color: var(--ink-soft); }
.module-selector-item.selected > span { color: #fff; background: var(--brand); }
.module-selector-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: .68rem; }
.module-selector-item small { color: var(--ink-muted); font-size: .58rem; }
.permission-modules { display: grid; gap: 12px; padding: 16px; background: #f4f5f6; }
.permission-module { background: #fff; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.permission-module-head { min-height: 66px; padding: 11px 14px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.permission-module-head > div { display: flex; align-items: center; gap: 10px; }
.permission-module-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; background: #202326; color: #fff; font-weight: 900; }
.permission-module-head > div > span:last-child { display: grid; gap: 3px; }
.permission-module-head strong { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: .78rem; }
.permission-module-head small { color: var(--ink-muted); font-size: .57rem; }
.permission-module-head label { display: flex; align-items: center; gap: 9px; }
.permission-module-head label > span { color: var(--ink-muted); font-size: .58rem; font-weight: 700; text-transform: uppercase; }
.permission-rule-list { display: grid; }
.permission-rule-row { min-height: 54px; padding: 9px 14px 9px 58px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #edf0f1; }
.permission-rule-row:last-child { border-bottom: 0; }
.permission-rule-row > div { display: grid; gap: 3px; }
.permission-rule-row strong { font-size: .72rem; }
.permission-rule-row small { color: var(--ink-muted); font-size: .62rem; line-height: 1.4; }
.access-select { min-width: 150px; border-left-width: 4px; background-color: #fff; color: var(--ink); font-weight: 750; }
.access-select.access-none { border-left-color: #c8cdd0; }.access-select.access-view { border-left-color: #5d87a2; }.access-select.access-edit { border-left-color: #e10d35; }.access-select.access-approve { border-left-color: #d99127; }.access-select.access-administer { border-left-color: #202326; }
.line-section-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.quote-lines { display: grid; gap: 12px; }
.quote-line { position: relative; display: grid; grid-template-columns: 30px minmax(230px, 2.1fr) minmax(90px, .55fr) minmax(130px, .8fr) minmax(130px, .85fr) minmax(170px, 1fr) minmax(120px, .7fr); align-items: start; gap: 12px; padding: 16px; border: 1px solid var(--line); border-left: 3px solid #adb2b6; border-radius: 4px; background: #fafbfb; }
.quote-line-number { width: 26px; height: 26px; display: grid; place-items: center; background: #202326; color: #fff; border-radius: 3px; font-weight: 900; font-size: .68rem; margin-top: 22px; }
.quote-line-total { display: grid; gap: 5px; margin-top: 21px; text-align: right; }
.quote-line-total small { color: var(--ink-muted); font-size: .58rem; text-transform: uppercase; font-weight: 800; }
.quote-line-total strong { font-size: .8rem; }
.line-remove { position: absolute; right: -8px; top: -8px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: #202326; color: #fff; cursor: pointer; }
.line-remove:hover { background: var(--brand); }
.quote-summary { display: flex; justify-content: flex-end; gap: 24px; margin-top: 16px; padding-top: 15px; border-top: 2px solid #202326; color: var(--ink-muted); font-size: .7rem; }
.quote-summary span { display: grid; gap: 4px; }
.quote-summary strong { color: var(--ink); font-size: .82rem; }
.quote-summary .quote-total strong { color: var(--brand); font-size: 1rem; }
.evidence-checklist { display: grid; gap: 7px; margin: 16px 0; padding: 12px; border: 1px solid var(--line); background: #f7f8f8; border-radius: 4px; }
.evidence-checklist h4 { font-size: .68rem; margin: 0 0 3px; text-transform: uppercase; letter-spacing: .06em; }
.evidence-item { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 6px; font-size: .63rem; }
.evidence-item span { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: .55rem; font-weight: 900; }
.evidence-item.done span { background: #e8f5ee; color: #277253; }
.evidence-item.missing span { background: var(--brand-soft); color: var(--brand); }
.workflow-control { display: grid; gap: 9px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.workflow-wide { width: 100%; margin-top: 9px; }
.recorded-signoff { display: grid; gap: 2px; padding-top: 9px; margin-top: 9px; border-top: 1px solid var(--line); font-size: .6rem; }
.recorded-signoff span { color: var(--ink-muted); }
.recorded-signoff p { margin: 3px 0 0; color: var(--ink-soft); font-style: italic; }
.return-control { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.return-control summary { cursor: pointer; color: var(--danger); font-size: .63rem; font-weight: 800; margin-bottom: 9px; }
.stage-meta { color: #277253 !important; margin-top: 6px !important; }
.stage-return { color: var(--danger) !important; margin-top: 6px !important; }
.empty-state { text-align: center; padding: 52px 20px; color: var(--ink-muted); }
.empty-state-icon { width: 46px; height: 46px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-soft); }
.empty-state .btn { margin-top: 16px; }
.access-denied { max-width: 680px; margin: 70px auto; padding: 36px; border-top: 4px solid var(--brand); }
.access-denied h1 { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: 1.8rem; }
.access-denied p { color: var(--ink-muted); line-height: 1.7; }
.toast-region { position: fixed; z-index: 1200; top: 92px; right: 22px; width: min(390px, calc(100vw - 32px)); display: grid; gap: 10px; pointer-events: none; }
.app-toast { pointer-events: auto; display: grid; grid-template-columns: 34px minmax(0, 1fr) 24px; gap: 11px; align-items: start; padding: 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: 5px; box-shadow: 0 15px 40px rgba(13,17,20,.2); animation: toast-in .2s ease-out; }
.app-toast .toast-symbol { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #edf3f7; color: var(--info); font-weight: 900; }
.app-toast strong { display: block; font-size: .75rem; margin: 1px 0 4px; }
.app-toast p { margin: 0; color: var(--ink-muted); font-size: .66rem; line-height: 1.45; }
.app-toast button { border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.app-toast.toast-success { border-left-color: var(--success); }
.app-toast.toast-success .toast-symbol { background: #e8f5ee; color: var(--success); }
.app-toast.toast-error { border-left-color: var(--brand); }
.app-toast.toast-error .toast-symbol { background: var(--brand-soft); color: var(--brand); }
.app-toast.toast-warning { border-left-color: var(--warning); }
.app-toast.toast-warning .toast-symbol { background: #fcf1de; color: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) translateX(10px); } }
body:has(.app-modal-backdrop) { overflow: hidden; }
.app-modal-backdrop { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 24px; background: rgba(10,12,14,.72); backdrop-filter: blur(3px); animation: modal-fade .16s ease-out; }
.app-modal { width: min(100%, 720px); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 6px; border-top: 5px solid var(--brand); box-shadow: 0 28px 80px rgba(0,0,0,.35); animation: modal-rise .18s ease-out; }
.app-modal.modal-small { width: min(100%, 520px); }
.app-modal.modal-large { width: min(100%, 980px); }
.app-modal-head { padding: 20px 22px 17px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; }
.app-modal-head h2 { margin: 0; font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: 1.35rem; }
.app-modal-head p { margin: 5px 0 0; color: var(--ink-muted); font-size: .68rem; }
.app-modal-close { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #f6f7f8; color: var(--ink); cursor: pointer; }
.app-modal-close:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.app-modal-body { overflow-y: auto; }
.app-modal-body .form-section { padding: 20px 22px; }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 7px; }
.loading { min-height: 300px; display: grid; place-items: center; color: var(--ink-muted); }
.loading::before { content: ''; width: 25px; height: 25px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 9px; }
@keyframes spin { to { transform: rotate(360deg); } }
.system-state { max-width: 720px; margin: 9vh auto 0; padding: 42px; border-top: 4px solid var(--brand); }
.system-state-icon { width: 54px; height: 54px; margin-bottom: 20px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-soft); }
.system-state-icon.error { color: var(--danger); background: #faeae7; }
.system-state h1 { margin: 0 0 10px; font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: 2rem; }
.system-state p { max-width: 560px; color: var(--ink-muted); line-height: 1.65; }
.system-state .page-actions { margin-top: 22px; }
.support-reference { padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #f6f7f8; }
.account-manage-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.account-settings-nav { padding: 10px; position: sticky; top: 94px; }
.settings-nav-list { display: grid; gap: 4px; }
.settings-nav-link { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 10px; border-radius: 5px; color: var(--ink-soft); text-decoration: none; font-size: .74rem; font-weight: 750; }
.settings-nav-link:hover { color: var(--ink); background: #f5f6f7; }
.settings-nav-link.active { color: var(--brand); background: var(--brand-soft); box-shadow: inset 3px 0 var(--brand); }
.account-settings-panel { min-width: 0; padding: 24px; }
.account-settings-panel > h3, .account-settings-panel > h4 { margin: 0 0 18px; font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-size: 1.25rem; }
.account-settings-panel > .row, .account-settings-panel > .row > [class*="col-"] { width: 100%; margin: 0; padding: 0; }
.account-settings-panel form { max-width: 620px; }
.account-settings-panel .form-floating { position: relative; margin-bottom: 14px !important; }
.account-settings-panel .form-floating .form-control { height: 52px; width: 100%; padding: 20px 13px 5px; }
.account-settings-panel .form-floating label { position: absolute; left: 13px; top: 6px; z-index: 2; height: auto; padding: 0; color: var(--ink-muted); font-size: .59rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; transform: none; }
.account-settings-panel .btn-lg { min-height: 42px; font-size: .74rem; }
.account-settings-panel .alert { padding: 12px 14px; border: 1px solid var(--line); border-radius: 5px; font-size: .72rem; }
.account-settings-panel .alert > p:first-child { display: flex; align-items: flex-start; gap: 8px; }
.alert-inline-icon { flex: 0 0 auto; color: var(--warning); }

/* Account pages */
.account-form-card > h1 { font-family: "Arial Narrow", "Roboto Condensed", sans-serif; text-transform: uppercase; font-weight: 800; font-size: 2.1rem; margin-bottom: 8px; letter-spacing: -.015em; }
.account-form-card > h1 + .row { margin-top: 22px; }
.account-form-card .row, .account-form-card [class*="col-"] { display: block; width: 100%; margin: 0; padding: 0; }
.account-form-card section > h2 { font-size: .76rem; color: var(--ink-muted); font-weight: 500; margin-bottom: 22px; }
.account-form-card section > h3, .account-form-card .col-lg-4 { display: none; }
.account-form-card hr { border: 0; border-top: 1px solid var(--line); margin: 21px 0; }
.account-form-card .form-floating { position: relative; margin-bottom: 14px !important; }
.account-form-card .form-floating .form-control { height: 52px; width: 100%; padding: 20px 13px 5px; }
.account-form-card .form-floating label { position: absolute; left: 13px; top: 6px; color: var(--ink-muted); font-size: .59rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.account-form-card .checkbox { font-size: .7rem; color: var(--ink-soft); }
.account-form-card .btn-lg { height: 50px; width: 100%; font-size: .78rem; }
.account-form-card p { font-size: .69rem; }
.account-form-card .text-secondary { font-size: .62rem; }
.account-form-card .btn-link { background: transparent; color: var(--brand); border: 0; }
.account-intro { margin: 10px 0 24px; font-size: .76rem !important; line-height: 1.65; }
.account-back-link { margin-top: 18px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); text-decoration: none; font-size: .69rem; font-weight: 750; }
.account-back-link:hover { color: var(--brand); }

@media (max-width: 1500px) {
    .module-selector { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 1200px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .master-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-facts { grid-template-columns: repeat(3, 1fr); }
    .quote-line { grid-template-columns: 30px repeat(2, minmax(0, 1fr)); }
    .quote-product { grid-column: span 2; }
}
@media (max-width: 1050px) {
    .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
    .action-panel { position: static; }
    .role-management-grid { grid-template-columns: 1fr; }
    .role-picker-panel { position: static; }
    .role-picker-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-manage-grid { grid-template-columns: 1fr; }
    .account-settings-nav { position: static; }
    .settings-nav-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .page-head { align-items: flex-start; flex-direction: column; }
    .page-actions, .page-actions .btn { width: 100%; }
    .metric-grid, .master-grid, .form-grid { grid-template-columns: 1fr; }
    .detail-top { flex-direction: column; }
    .detail-facts { grid-template-columns: repeat(2, 1fr); }
    .welcome-strip { align-items: flex-start; flex-direction: column; }
    .toolbar > * { width: 100%; min-width: 0; }
    .workflow-row { grid-template-columns: 34px minmax(0, 1fr); }
    .workflow-row > .status { grid-column: 2; justify-self: start; }
    .quote-line { grid-template-columns: 30px minmax(0, 1fr); }
    .quote-product { grid-column: auto; }
    .quote-summary { flex-direction: column; gap: 9px; }
    .catalogue-brand-strip { grid-template-columns: 1fr 1fr; }
    .catalogue-copy { grid-column: 1 / -1; }
    .role-picker-list { grid-template-columns: 1fr; }
    .module-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-nav-list { grid-template-columns: 1fr; }
    .evidence-columns { grid-template-columns: 1fr; }
    .role-editor-hero, .permission-module-head, .permission-rule-row { align-items: stretch; flex-direction: column; }
    .role-editor-stats { justify-content: flex-start; }
    .permission-rule-row { padding-left: 14px; }
    .permission-module-head label { justify-content: space-between; }
    .toast-region { top: 74px; right: 16px; }
    .app-modal-backdrop { padding: 10px; align-items: end; }
    .app-modal { max-height: calc(100vh - 20px); }
}
