:root {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    color: #273444;
    background: #f5f7fa;
    font-weight: 400;
    --accent: #176f9e;
    --accent-strong: #125d85;
    --accent-ring: rgba(23, 111, 158, .16);
    --accent-soft: #eaf4fa;
    --field-line: #cdd6e0;
    --danger: #b83f37;
    --warning: #8a6714;
    --success: #216c46;
    --text: #273444;
    --muted: #6d7b89;
    --surface: #fff;
    --page: #f5f7fa;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--page); }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.topbar-logout-form { margin: 0; }
.topbar-logout { cursor: pointer; }
.login-page { display: grid; place-items: center; padding: 1.5rem; background: #edf2f6; }
.login-shell { width: min(980px, 100%); min-height: 560px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); overflow: hidden; border: 1px solid #dce4eb; border-radius: 10px; background: #fff; box-shadow: 0 20px 55px rgba(37, 56, 73, .13); }
.login-brand-panel { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 3rem; color: #fff; background: #173c53; }
.login-brand-panel img { width: min(210px, 70%); max-height: 82px; object-fit: contain; object-position: left center; filter: brightness(0) invert(1); }
.login-brand-panel span { color: #a9c9d9; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.login-brand-panel h1 { max-width: 480px; margin: .8rem 0 0; color: #fff; font-size: 2rem; line-height: 1.22; letter-spacing: 0; }
.login-form-panel { display: grid; align-content: center; gap: 1.5rem; padding: clamp(2rem, 5vw, 4rem); }
.login-form-heading h2 { margin: .35rem 0 .45rem; color: #243747; font-size: 1.65rem; letter-spacing: 0; }
.login-form-heading p { margin: 0; color: #71808e; font-size: .86rem; line-height: 1.55; }
.login-form { display: grid; gap: 1rem; }
.login-submit { width: 100%; min-height: 44px; margin-top: .25rem; }

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: 248px;
    padding: 1.25rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e7ed;
    background: var(--surface);
    transition: transform .28s ease, box-shadow .28s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 0 .45rem 1.2rem;
    color: #1e2c3a;
    text-decoration: none;
    font-weight: 650;
}

.brand-mark {
    min-width: 38px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: #1976a8;
    font-size: .82rem;
    font-weight: 750;
}

.branch-context {
    display: grid;
    gap: .15rem;
    margin-bottom: 1.25rem;
    padding: .75rem;
    border-radius: 10px;
    background: #f3f7fa;
}

.branch-context span { font-size: .88rem; font-weight: 560; }
.branch-context small { color: var(--muted); line-height: 1.35; }
.navigation { display: grid; gap: .2rem; }
.nav-menu { overflow: hidden; border-radius: 8px; }

.nav-parent {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: .6rem .72rem;
    border: 0;
    border-radius: 8px;
    color: #526170;
    background: transparent;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
}

.nav-parent:hover, .nav-link:hover { color: #185f88; background: #f0f6fa; }
.nav-parent .chevron { color: #9aa6b1; transition: transform .25s ease; }
.nav-menu.open .nav-parent .chevron { transform: rotate(90deg); }
.submenu-clip { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), opacity .24s ease; }
.nav-menu.open .submenu-clip { grid-template-rows: 1fr; opacity: 1; }
.submenu { min-height: 0; overflow: hidden; display: grid; gap: .1rem; padding-left: .65rem; border-left: 1px solid #e1e8ee; margin-left: .72rem; }
.submenu .nav-link { padding: .48rem .65rem; font-size: .84rem; }

.nav-link {
    padding: .58rem .72rem;
    border-radius: 8px;
    color: #526170;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 440;
    transition: color .18s ease, background-color .18s ease;
}

.nav-link.active { color: #135d87; background: #e8f3f9; font-weight: 600; }
.main {
    min-height: 100vh;
    margin-left: 248px;
    padding: clamp(1.25rem, 2.5vw, 2.5rem);
    display: flex;
    flex-direction: column;
}
.content-shell {
    width: 100%;
    max-width: 1440px;
    min-height: calc(100vh - (clamp(1.25rem, 2.5vw, 2.5rem) * 2));
    margin: 0 auto;
    display: flex;
    flex: 1;
    flex-direction: column;
}
.page-content { flex: 1 0 auto; }

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: .9rem 1rem;
    border: 1px solid #e0e6ec;
    border-radius: 12px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 22px #23384d0a;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .28rem; color: #1e2b38; font-size: clamp(1.45rem, 2.4vw, 2rem); font-weight: 620; letter-spacing: 0; }
h2 { margin-bottom: .8rem; color: #263543; font-size: 1.05rem; font-weight: 620; }
.context-label { margin-bottom: .3rem; color: #71808e; font-size: .75rem; font-weight: 540; letter-spacing: .06em; text-transform: uppercase; }
.page-description { max-width: 760px; margin-bottom: 0; color: #697887; line-height: 1.55; }
.topbar-main { display: flex; min-width: 0; gap: 1rem; align-items: center; flex: 1; }
.topbar-title { min-width: 0; }
.topbar-tools { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.topbar-search { width: min(300px, 30vw); min-width: 190px; }
.topbar-search input {
    width: 100%;
    min-height: 38px;
    padding: .52rem .78rem;
    border: 1px solid var(--field-line);
    border-radius: 999px;
    color: #263445;
    background: #f8fafc;
}
.topbar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: #fff; }
.topbar-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: .48rem .72rem;
    border: 1px solid #dce3e9;
    border-radius: 9px;
    color: #40566a;
    background: #fff;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 560;
}
.topbar-link:hover { border-color: #9fb2c4; background: #f4f8fb; }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 38px;
    padding: .35rem .55rem;
    border: 1px solid #dce3e9;
    border-radius: 999px;
    color: #40566a;
    background: #fff;
    font-size: .82rem;
    font-weight: 560;
}
.user-avatar {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: var(--accent);
    font-size: .75rem;
}

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.metric-grid article, .content-card {
    border: 1px solid #e0e6ec;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 5px 18px #23384d08;
}
.metric-grid article { display: grid; gap: .45rem; padding: 1.15rem; }
.metric-grid span { color: #73808d; font-size: .84rem; }
.metric-grid strong { color: #263746; font-size: 1.9rem; font-weight: 600; }
.content-card { width: 100%; padding: 1.35rem; margin-bottom: 1rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card-heading { display: flex; justify-content: space-between; align-items: center; }

.stat-list { display: grid; gap: .6rem; }
.stat-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .75rem; border: 1px solid #edf1f4; border-radius: 9px; background: #fbfcfe; }
.stat-list span { color: #596879; }
.stat-list strong { color: #263746; }
.import-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: .8rem 0 1rem; }
.import-summary-grid article { padding: .85rem; border: 1px solid #edf1f4; border-radius: 9px; background: #fbfcfe; }
.import-summary-grid span { display: block; margin-bottom: .35rem; color: #73808d; font-size: .8rem; }
.import-summary-grid strong { color: #263746; font-size: 1.45rem; font-weight: 620; }
.flow-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.flow-strip span { padding: .42rem .65rem; border-radius: 999px; color: #1c5c7e; background: var(--accent-soft); font-size: .82rem; font-weight: 560; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .95rem 1.1rem; }
.field { display: grid; gap: .35rem; align-content: start; min-width: 0; }
.field-label-row { min-height: 20px; display: flex; align-items: center; gap: .38rem; }
.field-label { display: flex; align-items: center; gap: .35rem; color: #47576a; font-size: .8rem; font-weight: 560; }
.req { color: var(--danger); font-weight: 650; }
.opt { color: #9aa7b4; font-size: .72rem; font-weight: 400; }
.help, .control-form .helptext { color: #82909d; font-size: .74rem; line-height: 1.4; }
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.help-tip {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #c9d4de;
    border-radius: 999px;
    color: #51718d;
    background: #f7fafc;
    font-size: .72rem;
    font-weight: 700;
    cursor: help;
}
.help-tip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.err { color: #c0392b; font-size: .75rem; }
.has-error .control-input { border-color: #dda29b; }

.control-input, .table-search input {
    width: 100%;
    min-height: 42px;
    padding: .62rem .72rem;
    border: 1px solid var(--field-line);
    border-radius: 9px;
    color: #263445;
    background: #fff;
    font-weight: 400;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.control-input { min-height: 108px; resize: vertical; }
.control-input::placeholder { color: #9aa7b4; }
.control-input:hover, .table-search input:hover { border-color: #b7c2ce; }
.control-input:focus, .table-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
select.control-input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b7a89' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .78rem center; padding-right: 2rem; }
input[data-date-picker].control-input {
    padding-right: 2.35rem;
    background-image: linear-gradient(transparent, transparent), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 24 24' fill='none' stroke='%236b7a89' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4M16 2v4M3 10h18M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
}
.field > .select2-container,
.line-items-table .select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
    min-height: 42px;
    border: 1px solid var(--field-line);
    border-radius: 9px;
    background: #fff;
    display: flex;
    align-items: center;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.select2-container--default .select2-selection--single:hover { border-color: #b7c2ce; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    width: 100%;
    padding-left: .72rem;
    padding-right: 2rem;
    color: #263445;
    line-height: 40px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #9aa7b4; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: .35rem;
}
.select2-dropdown {
    z-index: 80;
    border: 1px solid #d9e1e8;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(31, 51, 71, .16);
}
.select2-search--dropdown { padding: .65rem; background: #f7f9fb; }
.select2-container--default .select2-search--dropdown .select2-search__field {
    min-height: 38px;
    padding: .5rem .65rem;
    border: 1px solid var(--field-line);
    border-radius: 8px;
    outline: none;
}
.select2-results__option { padding: .58rem .72rem; color: #334557; font-size: .86rem; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    color: #135d87;
    background: var(--accent-soft);
}
.select2-container--default .select2-results__option--selected {
    color: #1f4058;
    background: #eef4f8;
}

.control-form input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    border: 1.5px solid #c3ccd6;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: border-color .15s ease, background .15s ease;
}
.control-form input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.control-form input[type=checkbox]:checked::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.field-bool { align-self: start; justify-items: stretch; }
.check-inline { width: 100%; min-height: 42px; display: inline-flex; align-items: center; gap: .55rem; padding: .55rem .8rem; border: 1px solid var(--field-line); border-radius: 9px; color: #3c4b5b; font-size: .85rem; font-weight: 560; cursor: pointer; }
.check-inline:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.primary-link, .control-form button, .secondary-button, .ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 9px;
    padding: .58rem .9rem;
    font-weight: 560;
    text-decoration: none;
    cursor: pointer;
}
.primary-link, .control-form button { border: 0; color: #fff; background: var(--accent); }
.primary-link:hover, .control-form button:hover { background: var(--accent-strong); }
.secondary-button, .ghost-button { border: 1px solid #d4dce4; color: #40566a; background: #fff; }
.secondary-button:hover, .ghost-button:hover { border-color: #9fb2c4; background: #f4f8fb; }
.danger-button { color: #9b2f29; border-color: rgba(184, 63, 55, .34); background: rgba(184, 63, 55, .09); }
.danger-button:hover { color: #872923; background: rgba(184, 63, 55, .16); border-color: rgba(184, 63, 55, .48); }
.icon-button-text { gap: .45rem; }
.button-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: #5d7184;
    color: #fff;
    font-size: .74rem;
    font-weight: 800;
    line-height: 1;
}
.row-action-danger .button-icon { background: #9b2f29; }
.row-action-success .button-icon { background: #216c46; }
.form-errors { margin-bottom: 1rem; padding: .7rem .85rem; border: 1px solid #e6c4c0; border-radius: 9px; color: #9b2f29; background: #fdf1f0; font-size: .82rem; }
.form-footer { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid #eef1f5; }
.req-legend { color: #8a97a4; font-size: .76rem; }

.records-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.form-toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.detail-toolbar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: 1.15rem; flex-wrap: wrap; }
.detail-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #eef1f5; }
.detail-heading h2 { margin-bottom: 0; color: #1f2e3c; font-size: 1.28rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.detail-panel { padding: 1rem; border: 1px solid #edf1f4; border-radius: 10px; background: #fbfcfe; }
.detail-panel-wide { margin-top: 1rem; }
.detail-panel h3 { margin: 0 0 .75rem; color: #34475a; font-size: .86rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.detail-list { display: grid; gap: .55rem; margin: 0; }
.detail-list div { display: grid; grid-template-columns: minmax(120px, .55fr) minmax(0, 1fr); gap: .8rem; align-items: start; }
.detail-list dt { color: #73808d; font-size: .78rem; font-weight: 650; }
.detail-list dd { min-width: 0; margin: 0; color: #2f4050; overflow-wrap: anywhere; }
.detail-text { margin-bottom: 0; color: #4d5d6c; line-height: 1.6; white-space: pre-line; }
.detail-items-table { min-width: 980px; }
.detail-totals { display: flex; justify-content: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef1f5; }
.detail-totals dl { width: min(340px, 100%); margin: 0; }
.detail-totals div { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; border-bottom: 1px solid #edf1f4; }
.detail-totals dt { color: #657382; }
.detail-totals dd { margin: 0; color: #243443; font-weight: 600; }
.detail-grand-total dt, .detail-grand-total dd { color: #135d87; font-size: 1rem; }
.table-search { display: flex; gap: .5rem; align-items: center; }
.table-search input { width: 260px; font-size: .86rem; }
.table-responsive { width: 100%; overflow-x: auto; border: 1px solid #edf0f4; border-radius: 10px; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th, .data-table td { padding: .8rem .9rem; border-bottom: 1px solid #eceff3; text-align: left; vertical-align: middle; }
.data-table thead th { color: #64748a; background: #f7f9fb; font-size: .73rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.data-table td { color: #3a4a58; font-size: .86rem; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcfe; }
.sl-col, .sl-cell { width: 3.2rem; color: #93a1af; font-variant-numeric: tabular-nums; }
.actions-col { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: .4rem; align-items: center; }
.row-action { display: inline-flex; align-items: center; gap: .32rem; padding: .34rem .6rem; border: 1px solid #d4dce4; border-radius: 7px; color: #40566a; background: #fff; text-decoration: none; font-size: .76rem; line-height: 1.2; cursor: pointer; }
.row-action:hover { border-color: #9fb2c4; background: #f4f8fb; }
.row-action-success { color: #216c46; border-color: #b9dfc8; }
.row-action-success:hover { background: #edf9f2; border-color: #86caa0; }
.row-action-danger { color: #9b2f29; border-color: rgba(184, 63, 55, .34); background: rgba(184, 63, 55, .08); }
.row-action-danger:hover { color: #872923; background: rgba(184, 63, 55, .15); border-color: rgba(184, 63, 55, .48); }
.control-form .delete-icon-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(184, 63, 55, .35);
    border-radius: 8px;
    color: #9b2f29;
    background: rgba(184, 63, 55, .12);
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}
.control-form .delete-icon-button:hover {
    color: #fff;
    border-color: rgba(184, 63, 55, .58);
    background: rgba(184, 63, 55, .78);
    box-shadow: 0 8px 18px rgba(184, 63, 55, .18);
}
.control-form .delete-icon-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(184, 63, 55, .18);
}
.inline-action { display: inline; margin: 0; }
.pill { display: inline-block; padding: .18rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 560; }
.pill-on { color: var(--success); background: #e7f6ee; }
.pill-off { color: #7a6a2f; background: #f6efda; }
.pill-danger { color: #9b2f29; background: #fdf1f0; }
.pill-soft { color: #47576a; background: #edf2f6; }
.empty-state { margin: 0; padding: 1.1rem; border: 1px dashed #cfd8e1; border-radius: 9px; color: #6a7886; background: #fafcfd; line-height: 1.5; }

.line-items-panel { margin-top: 1.35rem; padding-top: 1.2rem; border-top: 1px solid #eef1f5; }
.purchase-payment-panel { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef1f5; }
.section-note { margin: .15rem 0 0; color: #7c8a98; font-size: .82rem; line-height: 1.45; }
.line-items-scroll { width: 100%; overflow-x: auto; border: 1px solid #edf0f4; border-radius: 10px; }
.line-items-table { width: 100%; min-width: 1180px; border-collapse: collapse; }
.line-items-table th, .line-items-table td { padding: .62rem .55rem; border-bottom: 1px solid #eceff3; vertical-align: top; }
.line-items-table thead th { color: #64748a; background: #f7f9fb; font-size: .72rem; font-weight: 650; text-align: left; text-transform: uppercase; letter-spacing: .03em; }
.line-items-table thead .req,
.line-items-table thead .opt { display: block; margin-top: .15rem; text-transform: none; letter-spacing: 0; }
.line-items-table tbody tr:last-child td { border-bottom: 0; }
.line-items-table tbody tr.is-revised { background: #f2f9fc; }
.line-items-table tbody tr.is-revised [data-amendment-revised-quantity] { color: var(--accent); }
.amendment-rule-note { display: flex; align-items: flex-start; gap: .7rem; margin-bottom: 1rem; padding: .8rem .9rem; border-left: 3px solid var(--accent); background: #f2f8fb; color: #536676; }
.amendment-rule-note strong { flex: 0 0 auto; color: #1f4053; }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.section-heading-row h2 { margin: .12rem 0 0; }
.amendment-comparison-table tbody tr.is-revised { background: #edf7fb; }
.amendment-comparison-table tbody tr.is-revised strong,
.amendment-comparison-table .quantity-delta { color: #126f98; }
.amendment-amount-table { width: min(620px, 100%); margin-left: auto; }
.amendment-amount-table th:not(:first-child),
.amendment-amount-table td:not(:first-child) { text-align: right; }
.amendment-amount-table .amendment-total-row td { background: #173f54; color: #fff; font-weight: 700; }
.amendment-decision-panel { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(320px, 1.2fr); align-items: end; gap: 1rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid #d8e4eb; background: #f7fafc; }
.amendment-decision-panel h3 { margin: .15rem 0 .3rem; color: #203443; }
.amendment-decision-panel p { margin: 0; color: #677888; }
.approval-button { color: #216c46; border-color: #b9dfc8; background: #edf9f2; }
.approval-button:hover { color: #185537; border-color: #86caa0; background: #e0f4e8; }
.amendment-reject-form { min-width: 0; }
.amendment-reject-controls { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: .65rem; }
.amendment-reject-controls textarea { min-height: 58px; resize: vertical; }
.new-chain-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: .5rem 0 1rem; }
.new-chain-heading h2 { margin: .2rem 0 .35rem; color: #203443; }
.new-chain-heading p { margin: 0; color: #677888; }
.new-chain-flow { display: flex; align-items: center; gap: .55rem; padding: .85rem; overflow-x: auto; border: 1px solid #d8e4eb; border-radius: 8px; background: #f7fafc; color: #738291; white-space: nowrap; }
.new-chain-flow span:not([aria-hidden]) { padding: .42rem .65rem; border: 1px solid #d5e0e8; border-radius: 7px; background: #fff; color: #40566a; font-size: .78rem; font-weight: 650; }
.new-chain-flow .is-source { color: #7a4f21; border-color: #e8d1ad; background: #fff8eb; }
.new-chain-flow .is-new { color: #176081; border-color: #b9d9e8; background: #eef8fc; }
.new-chain-rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: .85rem 0 1rem; }
.new-chain-rule-grid article { padding: .85rem .95rem; border-left: 3px solid #89adbd; background: #f7fafc; }
.new-chain-rule-grid article:last-child { border-left-color: var(--accent); }
.new-chain-rule-grid h3 { margin: 0 0 .3rem; color: #294353; font-size: .9rem; }
.new-chain-rule-grid p { margin: 0; color: #687987; font-size: .8rem; line-height: 1.5; }
.new-chain-source-total { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .8rem .2rem 0; color: #687987; }
.new-chain-source-total strong { color: #173f54; font-size: 1.05rem; }
.new-chain-form { margin-top: 1.2rem; padding-top: 1.15rem; border-top: 1px solid #e8eef2; }
.new-chain-form .field { max-width: 820px; }
.new-chain-submit-note { color: #687987; font-size: .8rem; }
.line-items-table .control-input { min-width: 105px; padding: .5rem .55rem; font-size: .82rem; }
.line-items-table select.control-input { min-width: 190px; }
.document-items-table { min-width: 1360px; }
.document-items-table textarea.control-input { min-height: 42px; min-width: 190px; }
.pi-items-table { min-width: 1480px; }
.pi-items-table textarea.control-input { min-height: 42px; min-width: 190px; }
.lc-documents-table { min-width: 980px; }
.control-form .help-popover-trigger {
    width: 19px;
    height: 19px;
    min-height: 19px;
    flex: 0 0 19px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid #b9cad8;
    border-radius: 50%;
    color: #35647f;
    background: #f4f9fc;
    box-shadow: none;
    font-size: .7rem;
    font-weight: 750;
    line-height: 1;
    cursor: help;
    transition: color .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.control-form .help-popover-trigger:hover,
.control-form .help-popover-trigger:focus-visible,
.control-form .help-popover-trigger[aria-expanded="true"] {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    transform: translateY(-1px);
}
.control-form .help-popover-trigger:focus { outline: none; }
.field-help-popover[hidden] { display: none; }
.field-help-popover {
    --popover-arrow-left: 28px;
    position: fixed;
    z-index: 140;
    width: min(340px, calc(100vw - 24px));
    padding: .82rem .9rem .88rem;
    border: 1px solid #d4e0e9;
    border-radius: 10px;
    color: #536474;
    background: #fff;
    box-shadow: 0 18px 44px rgba(31, 51, 71, .2), 0 3px 10px rgba(31, 51, 71, .08);
    font-size: .79rem;
    line-height: 1.55;
    pointer-events: none;
}
.field-help-popover::before,
.field-help-popover::after {
    content: "";
    position: absolute;
    left: var(--popover-arrow-left);
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border: 7px solid transparent;
}
.field-help-popover.is-below::before {
    top: -15px;
    border-bottom-color: #d4e0e9;
}
.field-help-popover.is-below::after {
    top: -13px;
    border-bottom-color: #fff;
}
.field-help-popover.is-above::before {
    bottom: -15px;
    border-top-color: #d4e0e9;
}
.field-help-popover.is-above::after {
    bottom: -13px;
    border-top-color: #fff;
}
.field-help-popover__eyebrow {
    margin-bottom: .18rem;
    color: var(--accent);
    font-size: .66rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.field-help-popover__title {
    display: block;
    margin-bottom: .3rem;
    color: #263c4d;
    font-size: .84rem;
    font-weight: 700;
}
.field-help-popover__content { margin: 0; }
.file-current-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    min-width: 220px;
    margin-bottom: .45rem;
    padding: .42rem .45rem .42rem .62rem;
    border: 1px solid #dbe5ed;
    border-radius: 9px;
    background: #f8fbfd;
}
.file-download-link {
    min-width: 0;
    overflow: hidden;
    color: #245b7a;
    font-size: .78rem;
    font-weight: 600;
    text-overflow: ellipsis;
    text-decoration: none;
    white-space: nowrap;
}
.file-download-link:hover { color: var(--accent); text-decoration: underline; }
.file-clear-button {
    position: relative;
    flex: 0 0 auto;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: .34rem .5rem;
    border: 1px solid rgba(184, 63, 55, .32);
    border-radius: 8px;
    color: #9b2f29;
    background: rgba(184, 63, 55, .09);
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
}
.file-clear-button:hover,
.file-clear-button.is-active {
    border-color: rgba(184, 63, 55, .52);
    background: rgba(184, 63, 55, .16);
}
.file-clear-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.file-upload-control {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: .48rem .65rem;
    border: 1px dashed #c8d4df;
    border-radius: 9px;
    color: #536577;
    background: #fff;
    font-size: .8rem;
    font-weight: 650;
    cursor: pointer;
}
.file-upload-control:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.file-upload-control input[type=file] {
    width: 1px;
    height: 1px;
    position: absolute;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}
.line-total-preview { color: #34475a; background: #f8fafc; font-weight: 650; }
.delete-control { display: none; }
.erp-line-item-row.is-deleted { display: none; }
.muted-text { color: #9aa7b4; }
.purchase-summary-panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: .75rem;
    margin-top: 1rem;
    padding: .9rem;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    background: #f8fafc;
}
.purchase-summary-panel div {
    display: grid;
    gap: .25rem;
    min-width: 0;
    padding: .7rem .75rem;
    border: 1px solid #e9eef3;
    border-radius: 9px;
    background: #fff;
}
.purchase-summary-panel span {
    color: #71808e;
    font-size: .72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.purchase-summary-panel strong {
    color: #243443;
    font-size: 1.02rem;
    font-weight: 650;
}
.purchase-summary-panel .summary-due strong { color: #9b2f29; }
.document-summary-panel { grid-template-columns: repeat(4, minmax(130px, 1fr)); }

.date-picker-popover[hidden] { display: none; }
.date-picker-popover {
    position: absolute;
    z-index: 70;
    width: 292px;
    padding: .8rem;
    border: 1px solid #dce4ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 45px rgba(26, 43, 61, .18);
}
.date-picker-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .65rem; }
.date-picker-head strong { color: #223443; font-size: .92rem; font-weight: 650; }
.date-picker-nav {
    width: 32px;
    height: 32px;
    border: 1px solid #d8e0e8;
    border-radius: 8px;
    color: #40566a;
    background: #f8fafc;
    cursor: pointer;
}
.date-picker-nav:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.date-picker-weekdays, .date-picker-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .22rem; }
.date-picker-weekdays { margin-bottom: .3rem; }
.date-picker-weekdays span { color: #7d8b99; font-size: .68rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.date-picker-empty { min-height: 34px; }
.date-picker-day {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #314456;
    background: transparent;
    font-size: .8rem;
    font-weight: 560;
    cursor: pointer;
}
.date-picker-day:hover { border-color: #c7d9e7; background: #f1f7fb; }
.date-picker-day.is-today { border-color: #9fc3d8; color: #135d87; }
.date-picker-day.is-selected { color: #fff; background: var(--accent); border-color: var(--accent); }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .9rem; flex-wrap: wrap; }
.page-summary { color: #7c8a98; font-size: .8rem; }
.page-controls { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.page-link { display: inline-block; min-width: 2rem; padding: .38rem .55rem; border: 1px solid #dde3ea; border-radius: 7px; color: #47576a; background: #fff; text-decoration: none; font-size: .8rem; text-align: center; }
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }
.page-link.is-disabled { color: #b7c1cc; background: #f6f8fa; cursor: default; }

.notice { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid #cfe9da; border-radius: 9px; color: #286044; background: #eef9f3; }
.notice.error { border-color: #e6c4c0; color: #9b2f29; background: #fdf1f0; }
.notice.warning { border-color: #ead69e; color: #5e4a19; background: #fff9e9; }
.confirm-modal[hidden] { display: none; }
.confirm-modal { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 1rem; }
.confirm-modal__backdrop { position: absolute; inset: 0; background: rgba(18, 34, 52, .44); backdrop-filter: blur(2px); }
.confirm-modal__dialog {
    position: relative;
    width: min(420px, 100%);
    overflow: hidden;
    border: 1px solid #dfe6ed;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(20, 37, 55, .24);
}
.confirm-modal__body { padding: 1.15rem 1.2rem .7rem; }
.confirm-modal__eyebrow { display: block; margin-bottom: .35rem; color: #7b8996; font-size: .72rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.confirm-modal__body h2 { margin-bottom: .45rem; color: #1f2e3c; font-size: 1.05rem; }
.confirm-modal__body p { margin-bottom: 0; color: #5e6d7c; line-height: 1.55; }
.confirm-modal__actions { display: flex; justify-content: flex-end; gap: .55rem; padding: .9rem 1.2rem 1.15rem; }
.confirm-modal__accept {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: .58rem .9rem;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: var(--accent);
    font-weight: 560;
    cursor: pointer;
}
.confirm-modal__accept:hover { background: var(--accent-strong); }
.confirm-modal__accept.is-danger { background: var(--danger); }
.confirm-modal__accept.is-danger:hover { background: #9f332d; }
.print-toolbar { display: flex; justify-content: flex-end; gap: .55rem; margin-bottom: 1rem; }
.print-document {
    width: min(980px, 100%);
    margin: 0 auto 1rem;
    padding: 2rem;
    border: 1px solid #dfe6ed;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 18px #23384d08;
}
.print-letterhead { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; padding-bottom: .85rem; border-bottom: 1px solid #dce5ec; }
.print-company-mark { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: #fff; background: var(--accent); font-weight: 750; }
.print-company-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.print-company-copy { min-width: 0; display: grid; gap: .12rem; }
.print-company-copy strong { color: #203443; font-size: 1.05rem; }
.print-company-copy small { color: #748290; line-height: 1.35; }
.print-document__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1.1rem;
    border-bottom: 2px solid #1f6e9d;
}
.print-brand { display: block; margin-bottom: .25rem; color: #6c7b89; font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.print-document h2 { margin-bottom: .2rem; color: #1d2d3b; font-size: 1.55rem; }
.print-document h3 { margin: 0 0 .65rem; color: #253545; font-size: .9rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.print-document p { margin-bottom: .25rem; color: #4d5d6c; line-height: 1.5; }
.print-status { display: grid; justify-items: end; gap: .2rem; color: #526170; text-align: right; }
.print-status span { padding: .25rem .55rem; border-radius: 999px; color: #1c5c7e; background: var(--accent-soft); font-size: .76rem; font-weight: 650; }
.print-status small { color: #788694; }
.print-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; padding: 1.2rem 0; }
.print-strong { color: #1f2e3c; font-weight: 650; }
.print-meta { display: grid; gap: .45rem; margin: 0; }
.print-meta div { display: grid; grid-template-columns: minmax(130px, .7fr) 1fr; gap: .75rem; }
.print-meta--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.print-meta--grid div { grid-template-columns: 1fr; gap: .12rem; }
.print-meta dt { color: #768391; font-size: .76rem; font-weight: 650; }
.print-meta dd { margin: 0; color: #2f4050; }
.print-section { padding: 1rem 0; border-top: 1px solid #e7ecf1; }
.print-table-wrap { width: 100%; overflow-x: auto; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th, .print-table td { padding: .62rem .55rem; border: 1px solid #e3e8ee; color: #354655; font-size: .8rem; text-align: left; vertical-align: top; }
.print-table th { color: #526170; background: #f5f8fa; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.print-totals { display: flex; justify-content: flex-end; padding: .9rem 0 1.1rem; border-top: 1px solid #e7ecf1; }
.print-totals dl { width: min(340px, 100%); margin: 0; overflow: hidden; border: 1px solid #dce5ec; border-radius: 8px; background: #f8fafc; }
.print-totals div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .75rem; border-bottom: 1px solid #e7edf2; }
.print-totals dt { color: #657382; }
.print-totals dd { margin: 0; color: #243443; font-weight: 600; }
.print-totals div:last-child { border-bottom: 0; }
.print-grand-total { background: #163e54; }
.print-grand-total dt, .print-grand-total dd { color: #fff; font-size: 1rem; font-weight: 700; }
.print-signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding-top: 3rem; }
.print-signatures span { display: block; border-top: 1px solid #98a6b3; }
.print-legal-footer { margin-top: 1.5rem; padding-top: .65rem; border-top: 1px solid #e2e8ed; color: #7b8996 !important; font-size: .72rem; text-align: center; }
.print-signatures p { margin-top: .45rem; color: #667584; font-size: .78rem; text-align: center; }
.panel-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: auto;
    padding: 1rem 0 0;
    border-top: 1px solid #e4e9ef;
    color: #8a97a4;
    font-size: .78rem;
    flex-shrink: 0;
}

/* Inventory operations */
.inventory-metric-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.inventory-metric { position: relative; overflow: hidden; }
.inventory-metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #4f809d; }
.inventory-metric--success::before { background: #2f8a61; }
.inventory-metric--warning::before { background: #c28a2b; }
.inventory-metric--danger::before { background: #b83f37; }
.inventory-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.inventory-section-heading h2 { margin: .12rem 0 0; color: #243443; font-size: 1.02rem; font-weight: 650; }
.inventory-section-heading p { margin: .3rem 0 0; color: #7b8996; font-size: .78rem; }
.inventory-filter-card { padding: 1rem 1.1rem; }
.inventory-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: .8rem; }
.inventory-filter-grid--ledger { grid-template-columns: repeat(4, minmax(165px, 1fr)); }
.inventory-filter-actions { display: flex; justify-content: flex-end; align-items: center; gap: .55rem; margin-top: .9rem; padding-top: .85rem; border-top: 1px solid #edf1f4; }
.inventory-table { min-width: 980px; }
.inventory-ledger-table { min-width: 1260px; }
.inventory-balance-table { min-width: 1160px; }
.inventory-table td > small { display: block; margin-top: .2rem; color: #8795a3; font-size: .72rem; }
.inventory-record-link, .inventory-source-link { color: #1b678f; font-weight: 620; text-decoration: none; }
.inventory-record-link:hover, .inventory-source-link:hover { color: #124e70; text-decoration: underline; }
.inventory-quantity { display: block; margin-top: .28rem; color: #2f4050; font-size: .8rem; white-space: nowrap; }
.inventory-badge { display: inline-flex; align-items: center; width: fit-content; padding: .26rem .5rem; border: 1px solid transparent; border-radius: 999px; font-size: .7rem; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.inventory-badge--success { color: #216c46; border-color: #c7e7d3; background: #edf9f2; }
.inventory-badge--warning { color: #795817; border-color: #ead69e; background: #fff8e5; }
.inventory-badge--danger { color: #9b2f29; border-color: #e7c2be; background: #fdf0ef; }
.inventory-badge--primary { color: #1b6085; border-color: #c8ddea; background: #eef6fa; }
.inventory-badge--neutral { color: #637281; border-color: #dce3e9; background: #f5f7f9; }
.inventory-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.inventory-compact-list { display: grid; }
.inventory-compact-list > a { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .72rem 0; border-bottom: 1px solid #edf1f4; color: inherit; text-decoration: none; }
.inventory-compact-list > a:first-child { padding-top: .15rem; }
.inventory-compact-list > a:last-child { padding-bottom: 0; border-bottom: 0; }
.inventory-compact-list > a:hover strong:first-child { color: #1b678f; }
.inventory-compact-list a > span:first-child { min-width: 0; }
.inventory-compact-list strong, .inventory-compact-list small { display: block; }
.inventory-compact-list strong { color: #304252; font-size: .84rem; }
.inventory-compact-list small { margin-top: .22rem; color: #7e8c99; font-size: .72rem; line-height: 1.4; }
.inventory-list-end { display: grid; justify-items: end; gap: .28rem; flex: 0 0 auto; text-align: right; }
.inventory-list-end > strong { color: #526272; font-size: .76rem; }
.inventory-empty-state { display: grid; justify-items: center; gap: .25rem; padding: 2.25rem 1rem; border: 1px dashed #d9e2e9; border-radius: 10px; color: #7b8996; background: #fafcfd; text-align: center; }
.inventory-empty-state.compact { padding: 1.4rem 1rem; }
.inventory-empty-state strong { color: #405364; font-size: .9rem; }
.inventory-empty-state p { max-width: 520px; margin: 0; font-size: .78rem; line-height: 1.5; }
.inventory-detail-wide { grid-column: 1 / -1; }
.inventory-heading-meta { margin: .3rem 0 0; color: #748290; font-size: .82rem; }
.inventory-product-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 1rem; }
.inventory-product-metrics article { border-color: #e7ebef; box-shadow: none; background: #fafcfd; }
.inventory-product-metrics strong { font-size: 1.35rem; }
.inventory-product-metrics strong small { color: #6f7e8d; font-size: .75rem; font-weight: 560; }
.inventory-product-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin: 0; }
.inventory-product-meta div { min-width: 0; padding: .7rem .75rem; border: 1px solid #edf1f4; border-radius: 8px; background: #fff; }
.inventory-product-meta dt { color: #7a8895; font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.inventory-product-meta dd { margin: .25rem 0 0; color: #334556; font-size: .84rem; overflow-wrap: anywhere; }
.inventory-product-filter { margin: .2rem 0 1rem; padding: .9rem; border: 1px solid #e7ecf1; border-radius: 9px; background: #fafcfd; }
.inventory-product-ledger { margin-top: .3rem; }
.inventory-opening-search { display: grid; grid-template-columns: minmax(220px, 1fr) 180px auto; gap: .55rem; align-items: center; flex: 1 1 620px; max-width: 760px; }
.inventory-opening-search .secondary-button { min-height: 42px; }
.inventory-opening-table { min-width: 1080px; }
.inventory-opening-items-table { min-width: 1280px; }
.inventory-opening-detail-table { min-width: 1040px; }
.opening-unit-display { min-height: 42px; min-width: 72px; display: inline-flex; align-items: center; padding: .58rem .7rem; border: 1px solid #e1e7ec; border-radius: 8px; color: #435667; background: #f7f9fb; font-size: .82rem; font-weight: 620; }
.opening-summary-panel { display: grid; grid-template-columns: repeat(2, minmax(160px, 240px)); justify-content: end; gap: .75rem; margin-top: 1rem; padding: .9rem; border: 1px solid #e2e8ef; border-radius: 10px; background: #f8fafc; }
.opening-summary-panel > div { display: grid; gap: .25rem; padding: .72rem .8rem; border: 1px solid #e7edf2; border-radius: 8px; background: #fff; }
.opening-summary-panel span { color: #71808e; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.opening-summary-panel strong { color: #243443; font-size: 1.12rem; }
.inventory-opening-actions { flex-wrap: wrap; }
.inventory-opening-actions .secondary-button { border: 1px solid #d4dce4; color: #40566a; background: #fff; }
.inventory-opening-actions .secondary-button:hover { border-color: #9fb2c4; color: #30485c; background: #f4f8fb; }
.inventory-adjustment-filter-card { padding: 1.1rem 1.2rem; }
.inventory-adjustment-filter-grid { grid-template-columns: minmax(260px, 1.6fr) minmax(180px, .7fr) minmax(180px, .7fr); gap: .9rem; }
.inventory-adjustment-heading { margin-bottom: 1rem; padding-bottom: .9rem; border-bottom: 1px solid #edf1f4; }
.inventory-adjustment-table { min-width: 1180px; }
.inventory-adjustment-items-table { min-width: 1780px; }
.inventory-adjustment-detail-table { min-width: 1080px; }
.adjustment-available-display { min-height: 42px; min-width: 112px; display: inline-flex; align-items: center; padding: .58rem .7rem; border: 1px solid #dfe7ed; border-radius: 8px; color: #40596c; background: #f4f8fa; font-size: .78rem; font-weight: 680; white-space: nowrap; }
.adjustment-bucket-picker { min-width: 230px; }
.inventory-adjustment-form [data-adjustment-unit-cost][readonly] { color: #4a6072; background: #eef3f6; cursor: not-allowed; }
.opening-action-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; margin-top: 1rem; padding: 1rem; border: 1px solid #cbdfea; border-radius: 9px; background: #f1f7fa; }
.opening-action-panel--danger { border-color: #e5c8c4; background: #fdf5f4; }
.opening-action-panel h3 { margin: .12rem 0 .35rem; color: #2c4051; font-size: .96rem; }
.opening-action-panel p { max-width: 720px; margin: 0; color: #687887; font-size: .8rem; line-height: 1.5; }
.opening-reversal-form { width: min(440px, 100%); display: grid; gap: .5rem; }
.control-form .danger-button { border: 1px solid rgba(184, 63, 55, .38); color: #9b2f29; background: rgba(184, 63, 55, .1); }
.control-form .danger-button:hover { color: #fff; border-color: #a8352f; background: #a8352f; }
.delivery-filter { display: grid; grid-template-columns: minmax(260px, 560px) auto; gap: .75rem; align-items: end; padding: 1rem; border: 1px solid #e4eaf0; border-radius: 9px; background: #f8fafc; }
.delivery-filter .secondary-button { min-height: 42px; }
.delivery-order-strip { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 1px; margin-top: 1rem; overflow: hidden; border: 1px solid #e2e8ee; border-radius: 9px; background: #e2e8ee; }
.delivery-order-strip > div { display: grid; gap: .28rem; padding: .85rem; background: #fff; }
.delivery-order-strip span, .delivery-summary span { color: #71808e; font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.delivery-order-strip strong { color: #293c4d; font-size: .86rem; overflow-wrap: anywhere; }
.delivery-summary { display: grid; grid-template-columns: repeat(3, minmax(140px, 210px)); justify-content: end; gap: .65rem; margin: 1rem 0; }
.delivery-summary > div { display: grid; gap: .2rem; padding: .72rem .8rem; border: 1px solid #e2e8ee; border-radius: 8px; background: #fff; }
.delivery-summary strong { color: #263a4b; font-size: 1.08rem; }
.delivery-table { min-width: 920px; }
.delivery-product-name, .delivery-item-note { display: block; }
.delivery-product-name { color: #2c4051; font-size: .84rem; }
.delivery-item-note { margin-top: .2rem; color: #7b8996; font-size: .74rem; }
.delivery-complete-button { min-height: 34px !important; padding: .42rem .64rem !important; border: 1px solid #bdd8cc !important; color: #267151 !important; background: #edf8f3 !important; font-size: .74rem !important; white-space: nowrap; box-shadow: none !important; }
.delivery-complete-button:hover { border-color: #7fb89f !important; color: #185c40 !important; background: #dff2e9 !important; }
.delivery-empty { margin-top: 1rem; }
.menu-toggle, .menu-close, .sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .inventory-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .inventory-filter-grid--ledger { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
    .amendment-decision-panel { grid-template-columns: 1fr; align-items: stretch; }
    .new-chain-rule-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    body { overflow-x: hidden; }
    .sidebar { transform: translateX(-105%); box-shadow: none; }
    .sidebar-open .sidebar { transform: translateX(0); box-shadow: 12px 0 35px #192d4240; }
    .sidebar-backdrop { position: fixed; z-index: 20; inset: 0; display: block; border: 0; pointer-events: none; opacity: 0; background: #12223466; transition: opacity .28s ease; }
    .sidebar-open .sidebar-backdrop { pointer-events: auto; opacity: 1; }
    .menu-toggle { position: fixed; z-index: 15; top: .8rem; left: .8rem; width: 42px; height: 42px; display: grid; place-content: center; gap: 4px; border: 1px solid #d9e1e8; border-radius: 9px; background: #fff; box-shadow: 0 4px 14px #253b5014; cursor: pointer; }
    .menu-toggle span { width: 20px; height: 2px; border-radius: 2px; background: #405363; transition: transform .22s ease, opacity .22s ease; }
    .sidebar-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .sidebar-open .menu-toggle span:nth-child(2) { opacity: 0; }
    .sidebar-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
    .menu-close { position: absolute; top: .8rem; right: .75rem; display: block; border: 0; color: #687886; background: transparent; font-size: 1.7rem; cursor: pointer; }
    .main { width: 100%; margin-left: 0; padding: 4.5rem 1rem 1.5rem; }
    .content-shell { min-height: calc(100vh - 6rem); }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .inventory-overview-grid { grid-template-columns: 1fr; }
    .inventory-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inventory-product-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .opening-action-panel { grid-template-columns: 1fr; align-items: stretch; }
    .delivery-order-strip { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

@media (max-width: 640px) {
    .login-page { padding: 0; place-items: stretch; }
    .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
    .login-brand-panel { min-height: 220px; padding: 2rem; }
    .login-brand-panel h1 { font-size: 1.5rem; }
    .login-form-panel { padding: 2rem; }
    .topbar { align-items: stretch; flex-direction: column; }
    .topbar-main, .topbar-tools { align-items: stretch; flex-direction: column; }
    .topbar-search { width: 100%; min-width: 0; }
    .user-chip, .topbar-link { width: 100%; justify-content: center; }
    .field-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-toolbar, .detail-heading { align-items: stretch; flex-direction: column; }
    .detail-list div { grid-template-columns: 1fr; gap: .15rem; }
    .detail-totals { justify-content: stretch; }
    .import-summary-grid { grid-template-columns: 1fr; }
    .form-footer { flex-direction: column; align-items: flex-start; gap: .6rem; }
    .metric-grid { grid-template-columns: 1fr; }
    .inventory-metric-grid, .inventory-product-metrics, .inventory-filter-grid, .inventory-filter-grid--ledger, .inventory-product-meta { grid-template-columns: 1fr; }
    .inventory-filter-actions, .inventory-section-heading { align-items: stretch; flex-direction: column; }
    .inventory-filter-actions .ghost-button, .inventory-filter-actions button { width: 100%; }
    .inventory-compact-list > a { align-items: flex-start; flex-direction: column; }
    .inventory-list-end { width: 100%; justify-items: start; text-align: left; }
    .inventory-opening-search, .opening-summary-panel { grid-template-columns: 1fr; width: 100%; max-width: none; }
    .inventory-opening-search .secondary-button, .opening-summary-panel > div { width: 100%; }
    .inventory-opening-actions { align-items: stretch; flex-direction: column; }
    .inventory-opening-actions button { width: 100%; }
    .delivery-filter, .delivery-order-strip, .delivery-summary { grid-template-columns: 1fr; }
    .delivery-filter .secondary-button, .delivery-summary > div { width: 100%; }
    .purchase-summary-panel { grid-template-columns: 1fr; }
    .toolbar-actions, .table-search, .table-search input, .table-search button, .primary-link, .ghost-button { width: 100%; }
    .toolbar-actions { justify-content: stretch; }
    .confirm-modal__actions { flex-direction: column-reverse; }
    .confirm-modal__actions .ghost-button, .confirm-modal__accept { width: 100%; }
    .print-toolbar { flex-direction: column; }
    .print-two-col, .print-meta--grid, .print-signatures { grid-template-columns: 1fr; }
    .print-document { padding: 1.15rem; }
    .panel-footer { flex-direction: column; }
    .amendment-reject-controls { grid-template-columns: 1fr; }
    .amendment-reject-controls .danger-button { width: 100%; }
}

@media print {
    :root, body { background: #fff; }
    .sidebar, .topbar, .panel-footer, .menu-toggle, .sidebar-backdrop, .no-print, .confirm-modal { display: none !important; }
    .main { margin-left: 0; padding: 0; }
    .content-shell { max-width: none; min-height: 0; }
    .page-content { flex: none; }
    .print-document { width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
    .print-table th, .print-table td { padding: .42rem; }
    .print-section, .print-totals { break-inside: avoid; }
}
