:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #eef2f6;
    --surface-3: #f8fafc;
    --text: #1f2933;
    --muted: #667085;
    --soft: #98a2b3;
    --line: #d9e1ea;
    --line-strong: #b9c6d4;
    --primary: #1f5fbf;
    --primary-strong: #164a96;
    --accent: #2f9e73;
    --success: #20875a;
    --warning: #b76e00;
    --danger: #b42318;
    --shadow: 0 16px 42px rgba(31, 41, 51, .08);
    --shadow-soft: 0 8px 24px rgba(31, 41, 51, .06);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

body.modal-open {
    overflow: hidden;
}

body.nav-open {
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: 24px; line-height: 1.15; font-weight: 780; }
h2 { font-size: 15px; font-weight: 760; }
h3 { font-size: 13px; font-weight: 760; }
small { color: var(--muted); }

.success { background: #e5f5eb !important; color: #28754e !important; }
.warning { background: #fff0e7 !important; color: #a75828 !important; }
.danger { background: #ffeaea !important; color: #9d3838 !important; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 276px;
    background: #fbfbfa;
    border-right: 1px solid var(--line);
    color: var(--text);
    padding: 14px 16px 18px;
    overflow-y: auto;
}

.nav-backdrop,
.sidebar-close {
    display: none;
}

.brand {
    display: flex;
    gap: 11px;
    align-items: center;
    min-height: 44px;
    margin-bottom: 24px;
}

.brand > div {
    min-width: 0;
}

.brand-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
    padding: 4px;
}

.brand strong { display: block; color: var(--text); font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav::before,
.sidebar nav::after {
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.sidebar nav::before {
    content: "Modules";
    margin: 8px 4px 4px;
}

.sidebar nav::after {
    content: "Saved views";
    border-top: 1px solid var(--line);
    margin: 16px 4px 0;
    padding-top: 16px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #f0f0ee;
    color: #5f5f5f;
    font-weight: 670;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: #e8e8e5;
    color: #1f1f1f;
}

.sidebar nav a.active::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--accent);
}

.app-shell {
    margin-left: 276px;
    min-height: 100vh;
    padding: 0 16px 20px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    min-height: 62px;
    margin: 0 -16px 16px;
    padding: 8px 16px;
    background: rgba(247, 247, 246, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-title > div {
    min-width: 0;
}

.topbar-title h1 {
    overflow-wrap: anywhere;
}

.menu-glyph {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    min-height: 32px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    background: var(--surface);
    color: #606060;
    font-size: 24px;
    font-weight: 760;
    line-height: 1;
}

.eyebrow {
    display: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.view-chip,
.icon-btn,
.role-switch,
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: #4d4d4d;
    box-shadow: none;
}

.view-chip {
    padding: 8px 12px;
    font-weight: 740;
    white-space: nowrap;
}

.icon-btn {
    justify-content: center;
    width: 38px;
    padding: 0;
    font-size: 18px;
    font-weight: 760;
}

.role-switch { padding: 9px 12px; }
.role-switch label { color: var(--muted); font-weight: 700; }

.user-chip {
    padding: 7px 10px;
    max-width: 280px;
}

.user-chip .avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1f1f1f;
    color: #fff;
    font-size: 12px;
    font-weight: 850;
}

.user-chip strong,
.user-chip small,
.user-chip span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip strong { font-size: 13px; }
.user-chip small,
.user-chip span { color: var(--muted); font-size: 11px; }
.user-chip a { color: var(--text); font-weight: 760; }

.notification-menu {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    z-index: 80;
}

.notification-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    position: relative;
    width: 38px;
    height: 38px;
    cursor: pointer;
}

.notification-menu summary::-webkit-details-marker {
    display: none;
}

.notification-menu[open] summary {
    border-color: #b7c7da;
    background: #eef5ff;
    color: var(--primary-strong);
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #c94f4f;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.notification-panel {
    position: fixed;
    top: 88px;
    right: 22px;
    z-index: 90;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(380px, calc(100vw - 32px));
    max-height: min(420px, calc(100vh - 82px));
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.notification-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.notification-head a {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font-size: 12px;
    font-weight: 760;
}

.notification-item {
    display: grid;
    gap: 5px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf1f5;
    color: var(--text);
    text-decoration: none;
    white-space: normal;
    min-width: 0;
    overflow-wrap: anywhere;
    transition: background .15s ease;
}

.notification-item:hover {
    background: #f7faff;
}

.notification-item.unread {
    background: #f3fbf6;
}

.notification-item strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
}

.notification-item span,
.notification-item small,
.notification-empty {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.notification-item small {
    font-weight: 700;
}

.notification-empty {
    padding: 18px 14px;
}

select,
input,
textarea {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 11px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    width: 100%;
    outline: none;
    min-height: 38px;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--line-strong);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(98, 180, 129, .13);
}

textarea { min-height: 88px; resize: vertical; }

button,
.btn {
    border: 0;
    border-radius: 8px;
    padding: 9px 12px;
    min-height: 38px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 760;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

button:hover,
.btn:hover { filter: brightness(.96); }
.btn.secondary, button.secondary { background: #eeeeec; color: #333; }
.btn.success, button.success { background: #e5f5eb; color: #28754e; }
.btn.warning, button.warning { background: #fff0e7; color: #a75828; }
.btn.danger, button.danger { background: #ffeaea; color: #9d3838; }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
    padding: 0;
    overflow: hidden;
}

.card + .card,
.grid + .card,
.card + .grid { margin-top: 12px !important; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 50px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    min-width: 0;
}

.card-header h2 {
    margin-right: auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.card > :not(.card-header):not(.table-wrap):not(script) {
    margin: 14px;
}

.card > form,
.card > .form-grid,
.card > .control-grid,
.card > .flow,
.card > .swimlane,
.card > .kanban {
    margin: 14px;
}

.metric {
    display: grid;
    gap: 4px;
    padding: 14px;
    min-height: 96px;
}

.metric span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 720;
}

.metric strong {
    color: var(--text);
    font-size: 25px;
    line-height: 1.1;
    font-weight: 780;
}

.metric small { color: var(--muted); }

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}

.table-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(320px, 100%);
}

.table-search span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

.table-search input {
    min-height: 34px;
    padding: 7px 10px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

th,
td {
    border-bottom: 1px solid #eeeeec;
    padding: 10px 12px;
    vertical-align: middle;
    text-align: left;
    line-height: 1.35;
}

th {
    position: static;
    color: #626262;
    font-size: 12px;
    font-weight: 760;
    text-transform: none;
    letter-spacing: 0;
    background: #f3f3f1;
    white-space: nowrap;
}

td {
    color: #575757;
    background: #fff;
    height: 58px;
}

tbody tr:hover td { background: #fbfbfa; }
tbody tr.detail-row { cursor: zoom-in; }
tbody tr:first-child td { border-top: 0; }
.table-empty-row td {
    color: var(--muted);
    text-align: center;
    height: 54px;
}
td strong { color: #3a3a3a; font-weight: 760; }
td .btn,
td button {
    min-height: 32px;
    padding: 7px 10px;
    vertical-align: middle;
}
td input,
td select { min-width: 120px; }

.material-picker {
    min-width: 240px;
}

td:last-child {
    white-space: nowrap;
}

td:last-child .btn,
td:last-child button {
    margin: 2px 3px 2px 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 4px 8px;
    max-width: 100%;
    background: #eeeeec;
    color: #555;
    font-size: 12px;
    font-weight: 760;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-draft,
.status-draft-created,
.status-not-active,
.status-pending { background: #eeeeec; color: #606060; }
.status-for-approval,
.status-for-approval-procurement-manager,
.status-for-approval-operations-manager,
.status-for-renewal { background: #fff0e7; color: #a75828; }
.status-for-canvass,
.status-open { background: #e8f6f4; color: #26716f; }
.status-for-po,
.status-approved { background: #eaf1fb; color: #315f93; }
.status-closed,
.status-active,
.status-accredited,
.status-valid { background: #e5f5eb; color: #28754e; }
.status-partially-delivered,
.status-expiring { background: #fff4df; color: #9a6817; }
.status-blacklisted,
.status-rejected,
.status-expired,
.status-missing { background: #ffeaea; color: #9d3838; }

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.form-grid .wide { grid-column: 1 / -1; }

.label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    margin-bottom: 6px;
    display: block;
}

.alert {
    border-radius: 8px;
    padding: 11px 13px;
    margin-bottom: 12px;
    border: 1px solid #cfead9;
    background: #eefaf2;
    color: #28754e;
    font-weight: 720;
}

.alert-danger {
    border-color: #f2d5d5;
    background: #fff1f1;
    color: #9d3838;
}

.flow,
.swimlane {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.step {
    position: relative;
    border: 1px solid var(--line);
    background: #fbfbfa;
    border-radius: 8px;
    padding: 11px;
    min-height: 74px;
}

.step.active { border-color: #b8dfc6; background: #f2fbf5; }
.step.done { border-color: #d8ebe0; background: #f7fcf9; }
.step strong { display: block; margin-bottom: 4px; }
.step small { color: var(--muted); }
.arrow { color: var(--muted); align-self: center; text-align: center; font-weight: 800; }

.kanban {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 10px;
}

.lane {
    background: #f4f4f2;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    min-height: 150px;
}

.lane h3 { margin-bottom: 10px; color: #4a4a4a; }

.mini-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.control-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfbfa;
}

.control-item strong { display: block; margin-bottom: 6px; }
.control-item small { color: var(--muted); line-height: 1.45; }

.chart-box { height: 300px; }
.chart-box.small { height: 235px; }

.proc-form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.proc-form .title {
    text-align: left;
    letter-spacing: 0;
    font-weight: 800;
    margin-bottom: 14px;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(220px, .7fr) minmax(0, 1.8fr);
    gap: 18px;
    align-items: start;
}

.settings-preview {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.settings-preview h3 {
    color: var(--text);
    font-size: 18px;
}

.settings-preview p {
    margin: 4px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.settings-logo-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 104px;
    height: 104px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-size: 34px;
    font-weight: 800;
}

.settings-logo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.settings-fields {
    display: grid;
    gap: 14px;
}

.system-config-form button {
    width: max-content;
    min-width: 230px;
}

.document-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.document-brand img {
    width: 58px;
    height: 58px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: contain;
    padding: 5px;
}

.document-brand strong {
    display: block;
    color: var(--text);
    font-size: 17px;
}

.document-brand small {
    display: block;
    color: var(--muted);
    font-weight: 700;
}

.signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 42px;
    margin-top: 22px;
}

.signature-line {
    border-top: 1px solid #111827;
    text-align: center;
    padding-top: 5px;
    min-height: 42px;
}

.signature-line-with-image {
    display: grid;
    place-items: center;
    gap: 3px;
    padding-top: 0;
    min-height: 92px;
}

.signature-line-with-image strong,
.signature-line-with-image small {
    display: block;
}

.signature-image {
    display: block;
    width: min(180px, 90%);
    height: 52px;
    object-fit: contain;
    margin: 0 auto -2px;
}

.signature-upload-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.signature-upload-row.compact {
    grid-template-columns: 150px minmax(0, 1fr);
}

.signature-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    border: 1px dashed #c9d5e3;
    border-radius: 8px;
    background: #fbfcfe;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.signature-preview img {
    width: 100%;
    max-width: 170px;
    height: 58px;
    object-fit: contain;
    padding: 4px;
}

.footer {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    padding: 20px 0 0;
    font-size: 12px;
}

.login-page {
    min-height: 100vh;
    background: #f7f7f6;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.login-brand { margin-bottom: 20px; color: var(--text); }
.login-brand strong { color: var(--text); }
.login-panel h1 { margin-bottom: 8px; }
.login-panel p { color: var(--muted); line-height: 1.5; margin: 0 0 18px; }
.login-form { display: grid; gap: 10px; }
.login-hint { display: block; margin-top: 16px; color: var(--muted); }

.inline-admin-form {
    min-width: 260px;
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 12px;
    background: #fbfbfa;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.workflow-details { margin-top: 8px; }
.workflow-details summary { width: max-content; list-style: none; }
.workflow-details summary::-webkit-details-marker { display: none; }
.workflow-form { width: min(860px, 88vw); }
.workflow-form table input,
.workflow-form table select { min-width: 110px; }
.admin-status-editor {
    display: inline-block;
    margin-left: 6px;
    vertical-align: top;
}
.admin-status-editor summary::-webkit-details-marker {
    display: none;
}
.admin-status-editor .inline-admin-form {
    margin-top: 8px;
    min-width: 240px;
}
.approval-confirm-form {
    display: grid;
    gap: 14px;
}
.approval-confirm-copy {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #fbfcfe;
}
.approval-confirm-copy strong {
    color: var(--text);
    font-size: 15px;
}
.approval-confirm-copy span {
    color: var(--muted);
}
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.supplier-status-form {
    display: grid;
    gap: 14px;
}
.supplier-status-form select {
    width: 100%;
}
.modal-action-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
}
.modal-action-row .primary-action,
.modal-action-row button {
    width: auto;
    min-width: 120px;
}
.choice-list {
    display: grid;
    gap: 10px;
}
.choice-option {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #fff;
    white-space: normal;
    line-height: 1.35;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.choice-option:hover {
    border-color: #aac4e6;
    background: #f8fbff;
}
.choice-option input[type="radio"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
    margin: 1px 0 0;
    padding: 0;
    justify-self: start;
}
.choice-option span {
    display: grid;
    gap: 2px;
}
.choice-option small {
    color: var(--muted);
}
.aoc-detail {
    display: grid;
    gap: 16px;
}
.aoc-detail h3 {
    margin: 0;
    color: #172033;
    font-size: 17px;
}
.aoc-modal-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 1px 2px rgba(31, 41, 51, .04);
}
.aoc-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.aoc-meta-row span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid #dbe3ec;
    border-radius: 999px;
    background: #fff;
    color: #526273;
    font-size: 12px;
    font-weight: 700;
}
.aoc-status-stack {
    display: grid;
    justify-items: end;
    gap: 8px;
    min-width: 140px;
}
.aoc-status-stack small {
    color: #526273;
    font-weight: 700;
    text-align: right;
}
.aoc-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding-top: 2px;
}
.aoc-section-heading small {
    color: #526273;
    font-weight: 700;
    text-align: right;
}
.aoc-basis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.aoc-metric {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #fff;
}
.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #eef4ff;
    color: #1f5fbf;
    font-size: 10px;
    font-weight: 800;
}
.aoc-metric small,
.aoc-metric strong {
    display: block;
}
.aoc-metric strong {
    color: #172033;
    font-size: 15px;
}
.aoc-metric small,
.supplier-quote-card small {
    color: var(--muted);
}
.supplier-card-list {
    display: grid;
    gap: 10px;
}
.supplier-quote-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(31, 41, 51, .04);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.supplier-quote-card:hover {
    border-color: #aac4e6;
    box-shadow: 0 10px 24px rgba(31, 41, 51, .08);
    transform: translateY(-1px);
}
.supplier-quote-card.selected {
    border-color: #7fc79c;
    background: #f5fbf7;
    box-shadow: inset 4px 0 0 #2f8f5a, 0 8px 22px rgba(47, 143, 90, .10);
}
.supplier-delivery-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #eef4ff;
    color: #1f5fbf;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
}
.supplier-card-content {
    min-width: 0;
}
.supplier-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.supplier-card-head strong {
    min-width: 0;
    color: #172033;
    font-size: 15px;
}
.quote-price {
    margin-top: 6px;
    font-weight: 800;
    font-size: 20px;
    color: #111827;
}
.supplier-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.supplier-card-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f2f5f8;
    color: #526273;
    font-size: 12px;
    font-weight: 700;
}
.best-choice-tag {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dff3e6;
    color: #28754e;
    font-size: 11px;
    font-weight: 800;
}
.aoc-action-title {
    margin-top: 2px !important;
}
.aoc-action-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #fbfcfe;
}
.aoc-action-panel .inline-admin-form {
    display: grid;
    gap: 12px;
}
.aoc-action-panel .label {
    margin: 0;
    color: #526273;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}
.primary-action {
    background: #2d6cdf;
    color: #fff;
    width: 100%;
    justify-content: center;
    min-height: 42px;
    font-weight: 800;
}
.outline-action {
    border: 1px solid #2d6cdf;
    background: #fff;
    color: #2d6cdf;
    width: 100%;
    justify-content: center;
    min-height: 42px;
    font-weight: 800;
}
.hidden-cost { color: var(--muted); font-style: italic; }
.print-only { display: none; }

.modal-source-card,
.modal-source-form,
.modal-source-detail {
    display: none !important;
}

.modal-launch-inline {
    margin-left: 0;
}

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.modal-root.open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 28, 28, .36);
    backdrop-filter: blur(8px);
}

.modal-panel {
    position: absolute;
    inset: 5vh max(16px, calc((100vw - 980px) / 2)) auto;
    max-height: 90vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 26px 80px rgba(0, 0, 0, .18);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: #fbfbfa;
}

.modal-header h2 {
    font-size: 16px;
}

.modal-close {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.modal-body {
    overflow: auto;
    padding: 14px;
}

.modal-body form,
.modal-body .proc-form {
    margin: 0;
}

.modal-body .inline-admin-form,
.modal-body .workflow-form {
    width: 100%;
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
}

.modal-body table {
    min-width: 720px;
}

.modal-body .table-toolbar {
    padding: 0 0 10px;
    border-bottom: 0;
}

.modal-body th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.record-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.record-detail-item {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fbfbfa;
}

.record-detail-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

.record-detail-item strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Professional interface refresh */
.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    box-shadow: 1px 0 0 rgba(31, 41, 51, .03);
}

.brand {
    margin-bottom: 18px;
    padding: 8px 4px 14px;
    border-bottom: 1px solid var(--line);
}

.brand strong {
    font-size: 16px;
    letter-spacing: 0;
}

.sidebar nav {
    gap: 4px;
}

.sidebar nav::before,
.sidebar nav::after {
    color: #7b8794;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.sidebar nav a {
    min-height: 38px;
    border: 1px solid transparent;
    background: transparent;
    color: #4a5565;
    font-size: 13px;
}

.sidebar nav a:hover {
    background: #f3f7fb;
    border-color: #e7edf5;
    color: var(--primary-strong);
}

.sidebar nav a.active {
    background: #eaf2ff;
    border-color: #c8dcff;
    color: var(--primary-strong);
    box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar nav a.active::before {
    display: none;
}

.app-shell {
    padding: 0 22px 26px;
}

.topbar {
    min-height: 68px;
    margin: 0 -22px 18px;
    padding: 10px 22px;
    background: rgba(244, 246, 248, .92);
    border-bottom: 1px solid #dce4ed;
}

.topbar-title h1 {
    font-size: 22px;
    font-weight: 780;
}

.view-chip,
.icon-btn,
.role-switch,
.user-chip {
    border-color: #d6dee8;
    background: #fff;
    color: #354052;
    box-shadow: var(--shadow-soft);
}

.icon-btn:hover,
.view-chip:hover,
.user-chip:hover {
    border-color: #b7c7da;
}

.user-chip .avatar {
    background: var(--primary);
}

select,
input,
textarea {
    border-color: #d6dee8;
    background: #fff;
    color: var(--text);
}

select:focus,
input:focus,
textarea:focus {
    border-color: #7aa7e8;
    box-shadow: 0 0 0 3px rgba(31, 95, 191, .14);
}

button,
.btn {
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font-weight: 780;
    box-shadow: none;
}

button:hover,
.btn:hover {
    filter: none;
    background: var(--primary-strong);
}

.btn.secondary,
button.secondary {
    border-color: #cdd6e0;
    background: #fff;
    color: #344054;
}

.btn.secondary:hover,
button.secondary:hover {
    background: #f3f7fb;
}

.btn.success,
button.success {
    border-color: #abd8c0;
    background: #e7f6ed;
    color: #11623f;
}

.btn.warning,
button.warning {
    border-color: #f0c78b;
    background: #fff5e8;
    color: #8a5100;
}

.btn.danger,
button.danger {
    border-color: #f1aaa5;
    background: #fff0ef;
    color: #9f1f17;
}

.card {
    border-color: #dbe3ec;
    box-shadow: var(--shadow-soft);
}

.card-header {
    min-height: 52px;
    background: #fbfcfe;
    border-bottom-color: #dde5ee;
}

.card-header h2 {
    color: #263445;
    font-size: 15px;
    font-weight: 800;
}

.metric {
    border-top: 3px solid #d8e6f8;
    background: #fff;
}

.metric span {
    color: #697586;
    font-size: 11px;
    text-transform: uppercase;
}

.metric strong {
    color: #1d2b3a;
    font-size: 27px;
}

.table-toolbar {
    background: #fbfcfe;
}

table {
    min-width: 820px;
}

th,
td {
    border-bottom-color: #e5ebf2;
    padding: 11px 12px;
}

th {
    color: #48576a;
    background: #f3f6fa;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

td {
    color: #3d4a5c;
    height: 54px;
}

tbody tr:hover td {
    background: #f8fbff;
}

.badge {
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.status-draft,
.status-draft-created,
.status-not-active,
.status-pending {
    background: #eef2f6;
    color: #475467;
}

.status-for-approval,
.status-for-approval-procurement-manager,
.status-for-approval-operations-manager,
.status-for-renewal {
    background: #fff4e5;
    color: #924f00;
}

.status-for-canvass,
.status-open {
    background: #e8f6f2;
    color: #126b57;
}

.status-for-po,
.status-approved {
    background: #e8f1ff;
    color: #1959a6;
}

.status-closed,
.status-active,
.status-accredited,
.status-valid {
    background: #e7f6ed;
    color: #11623f;
}

.status-blacklisted,
.status-rejected,
.status-expired,
.status-missing {
    background: #fff0ef;
    color: #9f1f17;
}

.filters,
.inline-admin-form,
.record-detail-item,
.aoc-metric,
.supplier-quote-card,
.mini-card {
    border-color: #dbe3ec;
    background: #fff;
    box-shadow: 0 1px 2px rgba(31, 41, 51, .04);
}

.modal-backdrop {
    background: rgba(17, 25, 40, .46);
}

.modal-panel {
    border-color: #d6dee8;
    box-shadow: 0 28px 90px rgba(17, 25, 40, .22);
}

.modal-header {
    background: #fbfcfe;
}

.notification-panel {
    border-color: #d6dee8;
}

.notification-item.unread {
    background: #edf7ff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.primary-action {
    background: #1f5fbf;
    color: #fff;
}

.primary-action:hover {
    background: #164a96;
}

.outline-action {
    border-color: #1f5fbf;
    background: #fff;
    color: #1f5fbf;
}

.outline-action:hover {
    background: #edf5ff;
}

/* Production theme refinements */
:root {
    --bg: #f3f6fa;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef3f8;
    --text: #162232;
    --muted: #5f6f84;
    --soft: #8a98aa;
    --line: #d9e2ec;
    --line-strong: #aebccd;
    --primary: #1f5fbf;
    --primary-strong: #174b97;
    --accent: #2f8f68;
    --success: #1f7a52;
    --warning: #a76500;
    --danger: #a92b22;
    --shadow: 0 22px 58px rgba(22, 34, 50, .12);
    --shadow-soft: 0 10px 28px rgba(22, 34, 50, .075);
}

body {
    background: var(--bg);
    color: var(--text);
    letter-spacing: 0;
}

h1,
h2,
h3,
button,
.btn,
input,
select,
textarea {
    letter-spacing: 0;
}

.sidebar {
    background: #ffffff;
    border-right-color: #dce5ef;
    box-shadow: 8px 0 30px rgba(22, 34, 50, .035);
}

.brand {
    padding-bottom: 12px;
    border-bottom: 1px solid #e1e8f0;
}

.brand strong {
    color: #172334;
    font-size: 15px;
    line-height: 1.25;
}

.brand small {
    color: #65758a;
    font-weight: 650;
}

.brand-logo {
    border-color: #d9e2ec;
    background: #f8fafc;
}

.sidebar nav::before,
.sidebar nav::after,
.metric span,
th,
.label,
.aoc-action-panel .label {
    letter-spacing: 0;
}

.sidebar nav a {
    min-height: 40px;
    border-radius: 8px;
    color: #45556b;
    font-weight: 720;
}

.sidebar nav a:hover {
    background: #f4f8fd;
    border-color: #dbe8f7;
    color: var(--primary-strong);
}

.sidebar nav a.active {
    background: #eef5ff;
    border-color: #cbdcf5;
    color: var(--primary-strong);
    box-shadow: inset 3px 0 0 var(--primary);
}

.app-shell {
    padding: 0 24px 28px;
}

.topbar {
    min-height: 72px;
    margin: 0 -24px 20px;
    padding: 12px 24px;
    background: rgba(248, 250, 252, .94);
    border-bottom-color: #dbe4ee;
    box-shadow: 0 1px 0 rgba(22, 34, 50, .03);
}

.topbar-title h1 {
    color: #172334;
    font-size: 23px;
    font-weight: 820;
    overflow-wrap: normal;
    word-break: normal;
}

.view-chip,
.icon-btn,
.role-switch,
.user-chip {
    border-color: #d9e2ec;
    background: #fff;
    color: #344358;
    box-shadow: 0 8px 20px rgba(22, 34, 50, .055);
}

.icon-btn:hover,
.view-chip:hover,
.user-chip:hover,
.role-switch:hover {
    border-color: #b7c7da;
    background: #f8fbff;
}

.user-chip .avatar {
    background: var(--primary);
}

select,
input,
textarea {
    border-color: #cfd9e6;
    background: #fff;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(22, 34, 50, .025);
}

select:hover,
input:hover,
textarea:hover {
    border-color: #b9c7d8;
}

select:focus,
input:focus,
textarea:focus {
    border-color: #6b9ce2;
    box-shadow: 0 0 0 3px rgba(31, 95, 191, .14);
}

button,
.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 780;
    box-shadow: 0 8px 18px rgba(31, 95, 191, .16);
}

button:hover,
.btn:hover {
    background: var(--primary-strong);
    filter: none;
}

.btn.secondary,
button.secondary {
    border-color: #cfd9e6;
    background: #fff;
    color: #344358;
    box-shadow: none;
}

.btn.secondary:hover,
button.secondary:hover {
    border-color: #b8c8da;
    background: #f5f8fc;
}

.btn.success,
button.success,
.success {
    border-color: #a9d4bd !important;
    background: #e7f6ed !important;
    color: #11623f !important;
}

.btn.danger,
button.danger,
.danger {
    border-color: #efb0ab !important;
    background: #fff0ef !important;
    color: #9f1f17 !important;
}

.btn.warning,
button.warning,
.warning {
    border-color: #edc887 !important;
    background: #fff5e8 !important;
    color: #8a5100 !important;
}

.card {
    border-color: #dbe4ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.card-header {
    min-height: 54px;
    padding: 12px 16px;
    background: #fbfcfe;
    border-bottom-color: #dfe7f0;
}

.card-header h2 {
    color: #1e2b3a;
    font-size: 15px;
    font-weight: 820;
}

.card > :not(.card-header):not(.table-wrap):not(script),
.card > form,
.card > .form-grid,
.card > .control-grid,
.card > .flow,
.card > .swimlane,
.card > .kanban {
    margin: 16px;
}

.metric {
    border-top: 0;
    box-shadow: inset 0 3px 0 #d7e6f8;
}

.metric span {
    color: #64748b;
    font-size: 11px;
    font-weight: 820;
    text-transform: uppercase;
}

.metric strong {
    color: #102033;
    font-size: 28px;
}

.table-toolbar {
    padding: 12px 14px;
    background: #fbfcfe;
    border-bottom-color: #e1e8f0;
}

table {
    min-width: 840px;
}

th {
    background: #f5f8fb;
    color: #536276;
    font-size: 12px;
    font-weight: 820;
    text-transform: uppercase;
}

td {
    color: #354358;
    border-bottom-color: #e6edf4;
}

td strong {
    color: #172334;
}

tbody tr:hover td {
    background: #f8fbff;
}

.badge {
    border-radius: 999px;
    padding: 4px 9px;
    font-weight: 800;
}

.alert {
    border-color: #bfe4cc;
    background: #effaf3;
    color: #1f6f49;
}

.alert-danger {
    border-color: #efb0ab;
    background: #fff0ef;
    color: #9f1f17;
}

.inline-admin-form,
.filters,
.record-detail-item,
.aoc-metric,
.supplier-quote-card,
.mini-card,
.control-item {
    border-color: #dbe4ee;
    background: #fff;
    box-shadow: 0 1px 2px rgba(22, 34, 50, .035);
}

.modal-backdrop {
    background: rgba(15, 23, 42, .48);
}

.modal-panel {
    border-color: #d8e1ec;
    box-shadow: 0 30px 90px rgba(15, 23, 42, .24);
}

.modal-header {
    min-height: 58px;
    background: #fbfcfe;
}

.modal-header h2 {
    color: #172334;
    font-weight: 820;
}

.notification-panel {
    border-color: #d8e1ec;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
}

.login-page {
    min-height: 100vh;
    background: #f2f5f9;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-panel {
    position: relative;
    width: min(456px, 100%);
    padding: 30px;
    border: 1px solid #d7e0eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .16);
}

.login-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    border-radius: 8px 8px 0 0;
    background: var(--primary);
}

.login-brand {
    margin-bottom: 22px;
    padding-bottom: 16px;
}

.login-panel h1 {
    color: #142033;
    font-size: 26px;
    font-weight: 840;
    margin-bottom: 8px;
}

.login-panel p {
    color: #617086;
    margin-bottom: 22px;
}

.login-form {
    display: grid;
    gap: 11px;
}

.login-form button {
    width: 100%;
    margin-top: 6px;
    min-height: 42px;
}

.dev-login-form {
    margin-top: 10px;
}

.dev-login-form button {
    width: 100%;
    min-height: 40px;
}

.login-hint {
    display: block;
    margin-top: 18px;
    color: #6b7a8d;
    text-align: center;
    font-weight: 700;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, .9fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.dashboard-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 840;
    text-transform: uppercase;
}

.dashboard-hero h2 {
    color: #142033;
    font-size: 24px;
    font-weight: 860;
}

.dashboard-hero p {
    margin: 6px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.dashboard-hero-stats {
    display: grid;
    grid-template-columns: .85fr 1.35fr .85fr;
    gap: 10px;
}

.dashboard-hero-stats div {
    display: grid;
    align-content: center;
    gap: 5px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #e2e9f2;
    border-radius: 8px;
    background: #f8fbff;
}

.dashboard-hero-stats span {
    color: #66778d;
    font-size: 11px;
    font-weight: 820;
    text-transform: uppercase;
}

.dashboard-hero-stats strong {
    color: #172334;
    font-size: 16px;
    line-height: 1.2;
    overflow-wrap: normal;
    word-break: normal;
}

.dashboard-filters {
    grid-template-columns: minmax(240px, 1fr) minmax(170px, .35fr) auto;
    margin-bottom: 16px;
    padding: 14px;
    border-color: #dbe4ee;
    background: #fbfcfe;
    box-shadow: var(--shadow-soft);
}

.dashboard-kpi-grid,
.dashboard-secondary-grid {
    display: grid;
    gap: 14px;
}

.dashboard-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-secondary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 14px;
}

.dashboard-metric {
    min-height: 132px;
    border-color: #dbe4ee;
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.dashboard-metric:hover {
    border-color: #bcd1ea;
    box-shadow: 0 16px 34px rgba(22, 34, 50, .10);
    transform: translateY(-2px);
}

.dashboard-metric::after {
    content: "";
    width: 34px;
    height: 3px;
    border-radius: 999px;
    background: var(--primary);
}

.dashboard-metric.warning-metric::after {
    background: var(--warning);
}

.dashboard-metric.danger-metric::after {
    background: var(--danger);
}

.dashboard-metric.success-metric::after {
    background: var(--success);
}

.dashboard-section {
    margin-top: 16px !important;
}

.dashboard-panel {
    min-height: 360px;
}

.dashboard-panel .chart-box {
    height: 320px;
}

.dashboard-panel .chart-box.small {
    height: 260px;
}

.dashboard-cycle-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.dashboard-cycle-grid .metric {
    min-height: 128px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    box-shadow: none;
}

/* Centralized button system */
button,
.btn,
.primary-action,
.outline-action,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    min-width: 96px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(31, 95, 191, .16);
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

button:hover,
.btn:hover,
.primary-action:hover,
.outline-action:hover,
input[type="submit"]:hover {
    background: var(--primary-strong);
    color: #fff;
    filter: none;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(31, 95, 191, .20);
}

button:active,
.btn:active,
.primary-action:active,
.outline-action:active,
input[type="submit"]:active {
    transform: translateY(0);
}

button:focus-visible,
.btn:focus-visible,
.primary-action:focus-visible,
.outline-action:focus-visible,
input[type="submit"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 95, 191, .18), 0 8px 18px rgba(31, 95, 191, .16);
}

button.secondary,
.btn.secondary,
.outline-action {
    border-color: #cfd9e6;
    background: #fff;
    color: #344358;
    box-shadow: none;
}

button.secondary:hover,
.btn.secondary:hover,
.outline-action:hover {
    border-color: #b8c8da;
    background: #f5f8fc;
    color: #172334;
    box-shadow: none;
}

button.success,
.btn.success,
.success {
    border-color: #a9d4bd !important;
    background: #e7f6ed !important;
    color: #11623f !important;
    box-shadow: none;
}

button.success:hover,
.btn.success:hover,
.success:hover {
    border-color: #89c7a6 !important;
    background: #d9f0e4 !important;
    color: #0f5133 !important;
}

button.warning,
.btn.warning,
.warning {
    border-color: #edc887 !important;
    background: #fff5e8 !important;
    color: #8a5100 !important;
    box-shadow: none;
}

button.warning:hover,
.btn.warning:hover,
.warning:hover {
    background: #ffe9c7 !important;
}

button.danger,
.btn.danger,
.danger {
    border-color: #efb0ab !important;
    background: #fff0ef !important;
    color: #9f1f17 !important;
    box-shadow: none;
}

button.danger:hover,
.btn.danger:hover,
.danger:hover {
    background: #ffe2df !important;
}

td .btn,
td button,
td input[type="submit"] {
    min-height: 34px;
    min-width: 82px;
    padding: 7px 11px;
    font-size: 13px;
}

.modal-action-row button,
.modal-action-row .btn,
.confirm-actions button,
.confirm-actions .btn {
    min-width: 128px;
}

.login-form button,
.dev-login-form button,
.system-config-form button {
    min-height: 42px;
}

/* ERP production redesign layer */
:root {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --surface-3: #edf2f7;
    --text: #182434;
    --muted: #607086;
    --soft: #91a0b2;
    --line: #d5dee9;
    --line-strong: #aab8c8;
    --primary: #205fbe;
    --primary-strong: #174b96;
    --accent: #2b8a63;
    --shadow: 0 8px 20px rgba(24, 36, 52, .06);
    --shadow-soft: 0 4px 12px rgba(24, 36, 52, .045);
}

html,
body {
    background: var(--bg);
}

body {
    color: var(--text);
    font-size: 14px;
}

.sidebar {
    width: 260px;
    padding: 14px 14px 18px;
    background: #ffffff;
    border-right: 1px solid #d8e1ec;
    box-shadow: none;
}

.brand {
    min-height: 50px;
    margin-bottom: 14px;
    padding-bottom: 14px;
}

.brand strong {
    font-size: 14px;
    font-weight: 840;
}

.brand small {
    font-size: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
}

.sidebar nav {
    gap: 3px;
}

.sidebar nav::before {
    content: "Navigation";
    margin: 8px 6px 6px;
    color: #738196;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.sidebar nav::after {
    display: none;
    content: none;
}

.sidebar nav a {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #405169;
    font-size: 13px;
    font-weight: 760;
}

.sidebar nav a.active {
    background: #e9f2ff;
    border-color: #c8daf2;
    box-shadow: inset 3px 0 0 var(--primary);
}

.app-shell {
    margin-left: 260px;
    padding: 0 18px 22px;
}

.topbar {
    min-height: 62px;
    margin: 0 -18px 16px;
    padding: 10px 18px;
    background: rgba(246, 248, 251, .96);
    border-bottom-color: #d6e0eb;
}

.topbar-title h1 {
    font-size: 21px;
    font-weight: 840;
}

.topbar-actions {
    gap: 7px;
}

.icon-btn {
    width: 36px;
    min-height: 36px;
    border-radius: 7px;
}

.user-chip {
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 8px;
}

.user-chip .avatar {
    width: 30px;
    height: 30px;
}

select,
input,
textarea {
    min-height: 36px;
    border-radius: 7px;
    padding: 8px 10px;
}

button,
.btn,
.primary-action,
.outline-action,
input[type="submit"] {
    min-height: 36px;
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 7px;
    box-shadow: none;
}

button:hover,
.btn:hover,
.primary-action:hover,
.outline-action:hover,
input[type="submit"]:hover {
    transform: none;
    box-shadow: none;
}

.card {
    border-color: #d7e0eb;
    border-radius: 8px;
    box-shadow: none;
}

.card-header {
    min-height: 48px;
    padding: 10px 14px;
    background: #fbfcfe;
}

.card-header h2 {
    font-size: 14px;
    font-weight: 850;
}

.card > :not(.card-header):not(.table-wrap):not(script),
.card > form,
.card > .form-grid,
.card > .control-grid,
.card > .flow,
.card > .swimlane,
.card > .kanban {
    margin: 14px;
}

.grid {
    gap: 12px;
}

.metric {
    min-height: 104px;
    padding: 14px;
    box-shadow: none;
}

.metric span {
    font-size: 11px;
    color: #65748a;
}

.metric strong {
    font-size: 25px;
    line-height: 1.08;
}

.table-toolbar {
    padding: 10px 12px;
    background: #f8fafc;
}

table {
    min-width: 820px;
}

th,
td {
    padding: 9px 11px;
}

th {
    background: #f4f7fa;
    color: #526176;
    font-size: 11px;
}

td {
    height: 50px;
    color: #35445a;
}

td .btn,
td button,
td input[type="submit"] {
    min-height: 32px;
    min-width: 76px;
    padding: 6px 10px;
}

.badge {
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
}

.filters {
    padding: 12px;
    border-color: #d7e0eb;
    border-radius: 8px;
    box-shadow: none;
}

.inline-admin-form {
    border-color: #d7e0eb;
    background: #fbfcfe;
    box-shadow: none;
}

.modal-panel {
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.modal-header {
    min-height: 54px;
    padding: 10px 14px;
}

.notification-panel {
    top: 74px;
}

.dashboard-hero,
.dashboard-panel,
.dashboard-metric {
    box-shadow: none;
}

.dashboard-hero {
    padding: 16px;
    margin-bottom: 14px;
}

.dashboard-hero h2 {
    font-size: 22px;
}

.dashboard-filters {
    margin-bottom: 14px;
    box-shadow: none;
}

.dashboard-metric {
    min-height: 118px;
}

.dashboard-secondary-grid,
.dashboard-section {
    margin-top: 12px !important;
}

.login-panel {
    box-shadow: 0 20px 56px rgba(15, 23, 42, .13);
}

@media (max-width: 1100px) {
    .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.two { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters { grid-template-columns: minmax(180px, 1fr) minmax(150px, .6fr) auto; }
    .dashboard-hero { grid-template-columns: 1fr; }
    .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 901px) {
    .menu-glyph,
    .sidebar-close,
    .nav-backdrop {
        display: none;
    }
}

@media (max-width: 900px) {
    .sidebar {
        z-index: 30;
        width: min(312px, calc(100vw - 44px));
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 18px 0 50px rgba(0, 0, 0, .14);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 25;
        display: block;
        border: 0;
        border-radius: 0;
        padding: 0;
        min-height: 0;
        background: rgba(28, 28, 28, .38);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    body.nav-open .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-close {
        display: inline-flex;
        margin-left: auto;
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }

    .sidebar nav::before,
    .sidebar nav::after {
        grid-column: 1 / -1;
    }

    .app-shell { margin-left: 0; padding: 0 12px 18px; }
    .topbar {
        position: sticky;
        margin: 0 -12px 12px;
        align-items: stretch;
        flex-direction: row;
    }

    .topbar-title {
        flex: 1 1 auto;
    }

    .topbar-title h1 {
        max-width: 150px;
        font-size: 18px;
        line-height: 1.15;
    }

    .topbar-actions {
        flex: 0 0 auto;
    }

    .notification-panel {
        position: fixed;
        top: 72px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 84px);
    }

    .view-chip { display: none; }
    .user-chip { max-width: 100%; }
    .user-chip > div:last-child { display: none; }
    .grid.three,
    .grid.four,
    .settings-layout,
    .dashboard-secondary-grid,
    .dashboard-cycle-grid,
    .form-grid,
    .filters { grid-template-columns: 1fr; }
    .card-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .footer { flex-direction: column; gap: 6px; }
    .table-toolbar { justify-content: stretch; }
    .table-search { width: 100%; }
    .modal-panel { inset: 12px; max-height: calc(100vh - 24px); }
    .record-detail-grid { grid-template-columns: 1fr; }
    .aoc-modal-hero,
    .aoc-section-heading {
        align-items: stretch;
        flex-direction: column;
    }
    .aoc-status-stack {
        justify-items: start;
        min-width: 0;
    }
    .aoc-section-heading small,
    .aoc-status-stack small {
        text-align: left;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 13px;
    }

    h1 {
        font-size: 20px;
    }

    .app-shell {
        padding-inline: 10px;
    }
    .aoc-modal-hero,
    .aoc-action-panel {
        padding: 12px;
    }
    .dashboard-hero {
        padding: 14px;
    }
    .dashboard-hero-stats,
    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-panel .chart-box,
    .dashboard-panel .chart-box.small {
        height: 250px;
    }
    .aoc-basis,
    .supplier-quote-card {
        grid-template-columns: 1fr;
    }
    .signature-upload-row,
    .signature-upload-row.compact {
        grid-template-columns: 1fr;
    }
    .supplier-delivery-icon {
        width: 38px;
        height: 38px;
    }
    .quote-price {
        font-size: 18px;
    }

    .topbar {
        margin-inline: -10px;
        min-height: 56px;
        padding-inline: 10px;
        gap: 8px;
    }

    .topbar-actions {
        gap: 6px;
    }

    .topbar-title > div {
        display: none;
    }

    .icon-btn {
        width: 36px;
        min-height: 36px;
    }

    .card > :not(.card-header):not(.table-wrap):not(script),
    .card > form,
    .card > .form-grid,
    .card > .control-grid,
    .card > .flow,
    .card > .swimlane,
    .card > .kanban {
        margin: 10px;
    }

    .metric {
        min-height: 84px;
        padding: 12px;
    }

    .metric strong {
        font-size: 22px;
    }

    .table-wrap {
        overflow: visible;
    }

    table.responsive-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    table.responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    table.responsive-table,
    table.responsive-table tbody,
    table.responsive-table tr,
    table.responsive-table td {
        display: block;
        width: 100%;
    }

    table.responsive-table tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        overflow: hidden;
        background: #fff;
    }

    table.responsive-table td {
        display: grid;
        grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
        gap: 10px;
        min-height: 0;
        height: auto;
        padding: 9px 10px;
        border-bottom: 1px solid #eeeeec;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    table.responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 760;
    }

    table.responsive-table td:last-child {
        border-bottom: 0;
        white-space: normal;
    }

    table.responsive-table td input,
    table.responsive-table td select {
        min-width: 0;
    }

    .table-empty-row td {
        display: block;
        text-align: center;
    }

    .signature-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .modal-body {
        padding: 10px;
    }
}

@media print {
    .sidebar, .topbar, .footer, .no-print, .alert { display: none !important; }
    .app-shell { margin: 0; padding: 0; }
    .card { box-shadow: none; border: 0; padding: 0; }
    .print-only { display: block; }
}
