:root {
    --ifsi-navy: #002f45;
    --ifsi-navy-dark: #00283b;
    --ifsi-navy-mid: #163f59;
    --ifsi-bg: #f7f3ed;
    --ifsi-panel: #fffefa;
    --ifsi-border: #dfd7cb;
    --ifsi-text: #0b2e43;
    --ifsi-muted: #71808a;
    --ifsi-green: #0d8d5b;
    --ifsi-amber: #d98a00;
    --ifsi-red: #bd3d33;
    --sidebar-width: 208px;
    --topbar-height: 56px;
}

html { font-size: 15px; }

body {
    margin: 0;
    background: var(--ifsi-bg);
    color: var(--ifsi-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--ifsi-navy-dark);
    color: #e9f0f4;
    z-index: 1030;
}

.sidebar-brand { padding: 24px 20px 18px; }

.brand-wordmark {
    color: #e5e5df;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 3.3rem;
    line-height: .86;
    letter-spacing: -.08em;
    font-weight: 700;
}

.brand-tagline {
    color: #d28b16;
    margin-top: 8px;
    font-size: .58rem;
    text-transform: uppercase;
    letter-spacing: .09em;
}

.sidebar-section-label {
    padding: 27px 8px 9px;
    color: #678395;
    font-size: .66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 8px 12px;
    margin: 0 6px;
    color: #a9bbc5;
    text-decoration: none;
    border-radius: 8px;
    font-size: .81rem;
    font-weight: 650;
}

.sidebar-link:hover { color: white; background: rgba(255,255,255,.05); }

.sidebar-link.active {
    color: white;
    background: #164258;
    box-shadow: inset 3px 0 #d38a15;
}

.sidebar-link i { width: 17px; }

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 14px;
}

.sidebar-user { display: flex; align-items: center; gap: 9px; }
.sidebar-user-name { font-weight: 700; font-size: .76rem; }
.sidebar-user-role { color: #7f9aa9; font-size: .66rem; }

.avatar-placeholder {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e7eee9;
    color: var(--ifsi-navy);
    font-weight: 800;
    font-size: .72rem;
}

.avatar-small { width: 30px; height: 30px; }

.app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.app-topbar {
    min-height: var(--topbar-height);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
    border-bottom: 1px solid var(--ifsi-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-page-name {
    font-size: .78rem;
    font-weight: 800;
}

.topbar-actions { display: flex; align-items: center; gap: 9px; }

.topbar-search {
    min-width: 270px;
    height: 34px;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid #ddd4c6;
    border-radius: 8px;
    background: #fbf8f2;
    color: #8a8b87;
    font-size: .72rem;
}

.topbar-search span { flex: 1; }
.topbar-search kbd {
    padding: 1px 5px;
    background: #fff;
    color: #8f8f8a;
    border: 1px solid #dfd7cb;
    box-shadow: none;
    font-size: .62rem;
}

.topbar-button,
.topbar-icon-button {
    height: 34px;
    border-color: #ddd4c6;
    background: #fff;
    color: var(--ifsi-text);
    font-weight: 700;
}

.topbar-icon-button { width: 38px; }

.app-content {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px 28px 42px;
}

.sidebar-toggle {
    color: var(--ifsi-text);
    padding: 0;
    font-size: 1.45rem;
}

.phase-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    max-width: 360px;
    padding: 11px 14px;
    border-radius: 9px;
    background: #173f59;
    color: white;
    font-size: .76rem;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(7,40,58,.18);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
}

.phase-toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-content { padding: 14px; }
    .app-topbar { padding: 10px 14px; }
}
.dashboard-filter-toolbar {
    display: flex;
    align-items: center;
    width: 100%;
    gap: .75rem;
    flex-wrap: wrap;
}

.dashboard-filter-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
}
.btn-dashboard-apply {
    min-width: 86px;
    height: 36px;
    padding: 0 1.2rem;

    background: #00354d;
    color: #fff;

    border: 1px solid #00354d;
    border-bottom: 3px solid #f3a000;
    border-radius: 5px;

    font-weight: 700;
    line-height: 1;
    box-shadow: none;
}

.btn-dashboard-apply:hover,
.btn-dashboard-apply:focus {
    background: #002b3f;
    color: #fff;
    border-color: #002b3f;
    border-bottom-color: #f3a000;
}

/* Maintenance - management-friendly synchronization workspace */
.maintenance-page { width: 100%; }

.maintenance-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}
.maintenance-page-header h1 {
    margin: 0 0 4px;
    color: var(--ifsi-navy);
    font-size: 1.6rem;
    font-weight: 850;
}
.maintenance-page-header p {
    margin: 0;
    color: #6f7d86;
    font-size: .78rem;
}

.maintenance-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.maintenance-menu { min-width: 0; }
.maintenance-menu-search {
    height: 34px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    margin-bottom: 12px;
    border: 1px solid #ddd5c8;
    border-radius: 8px;
    background: #fffaf3;
    color: #9aa2a7;
    font-size: .72rem;
}
.maintenance-menu-group { margin-top: 12px; }
.maintenance-menu-heading {
    padding: 0 7px 7px;
    border-bottom: 1px solid #beb8ae;
    color: #183b50;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.maintenance-menu-group a {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    margin-top: 2px;
    padding: 6px 8px;
    border-radius: 7px;
    color: #435e70;
    font-size: .72rem;
    font-weight: 700;
    text-decoration: none;
}
.maintenance-menu-group a:hover { background: #ece9e3; color: var(--ifsi-navy); }
.maintenance-menu-group a.active { background: #dfe5e8; color: var(--ifsi-navy); font-weight: 850; }
.maintenance-menu-group a i { width: 14px; color: #5c7b8c; }

.maintenance-content { min-width: 0; }
.maintenance-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
}
.maintenance-section-header h2 {
    margin: 0 0 4px;
    color: var(--ifsi-navy);
    font-size: 1.45rem;
    font-weight: 850;
}
.maintenance-section-header p {
    margin: 0;
    color: #6d7c85;
    font-size: .78rem;
}
.sync-last-success {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--ifsi-navy);
    font-size: .74rem;
    font-weight: 600;
}
.sync-last-success i { color: #6d7c85; }
.maintenance-section-rule {
    height: 2px;
    margin: 12px 0 15px;
    background: var(--ifsi-navy-mid);
}
.maintenance-eyebrow {
    color: #8a6a37;
    font-size: .64rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.maintenance-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.maintenance-actions .btn { min-height: 38px; font-size: .75rem; font-weight: 800; }

.sync-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--ifsi-border);
    border-radius: 10px;
    background: #fff;
    color: #657782;
    font-size: .72rem;
}
.sync-banner strong { display: block; margin-bottom: 2px; color: var(--ifsi-text); font-size: .77rem; }
.sync-banner-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .88rem;
}
.sync-banner-neutral .sync-banner-icon { background: #edf3f5; color: #315d73; }
.sync-banner-working .sync-banner-icon { background: #eef4fb; color: #25639b; }
.sync-banner-success { border-color: #b9ddcd; background: #f7fcf9; }
.sync-banner-success .sync-banner-icon { background: #dff3e8; color: var(--ifsi-green); }
.sync-banner-warning { border-color: #ead39d; background: #fffaf0; }
.sync-banner-warning .sync-banner-icon { background: #faeac4; color: #9b6500; }
.sync-banner-danger { border-color: #e4bbb7; background: #fff7f6; }
.sync-banner-danger .sync-banner-icon { background: #f7dfdd; color: var(--ifsi-red); }

.sync-source-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
}
.sync-source-card {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--ifsi-border);
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(25,47,60,.03);
}
.sync-source-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.sync-source-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 9px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #edf3f5;
    color: var(--ifsi-navy-mid);
}
.sync-source-card h3 { margin: 0; color: var(--ifsi-navy); font-size: .95rem; font-weight: 850; }
.sync-source-card p { margin: 4px 0 0; color: #77868e; font-size: .67rem; line-height: 1.4; }
.sync-status-badge {
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .59rem;
    font-weight: 850;
}
.sync-status-neutral { background: #f0efeb; color: #73746f; }
.sync-status-up-to-date { background: #e0f3e9; color: #08754a; }
.sync-status-changes { background: #e5eef9; color: #225e91; }
.sync-status-needs-review { background: #fff0ce; color: #9b6500; }
.sync-status-blocked { background: #f9e2df; color: #a63c33; }
.sync-status-working { background: #e4eef8; color: #2b6190; }
.sync-source-metrics { margin-top: 15px; border-top: 1px solid #eee7dd; }
.sync-source-metrics > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #f2ede6;
    font-size: .70rem;
}
.sync-source-metrics span { color: #78868e; }
.sync-source-metrics strong { color: var(--ifsi-text); text-align: right; }
.sync-source-detail { margin-top: 11px; color: #71818a; font-size: .67rem; line-height: 1.55; }
.sync-card-actions { margin-top: auto; padding-top: 10px; }
.sync-card-actions .btn-link {
    padding: 0;
    color: #1b607f;
    font-size: .68rem;
    font-weight: 800;
    text-decoration: none;
}
.sync-card-actions .btn-link:hover { text-decoration: underline; }

.sync-result-panel {
    margin-top: 18px;
    padding: 17px;
    border: 1px solid var(--ifsi-border);
    border-radius: 11px;
    background: #fff;
}
.sync-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.sync-result-heading h3 { margin: 2px 0 0; color: var(--ifsi-navy); font-size: 1rem; font-weight: 850; }
.sync-operation-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid #eee8df; }
.sync-operation-main { display: flex; align-items: center; gap: 10px; min-width: 280px; }
.sync-operation-main strong { color: var(--ifsi-text); font-size: .77rem; }
.sync-operation-main div div { color: #77858d; font-size: .67rem; }
.sync-operation-main small { color: #87939a; font-size: .63rem; }
.sync-operation-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; }
.sync-operation-row.is-success .sync-operation-icon { background: #e0f3e9; color: var(--ifsi-green); }
.sync-operation-row.is-failed .sync-operation-icon { background: #f9e2df; color: var(--ifsi-red); }
.sync-operation-counts { display: flex; justify-content: flex-end; gap: 13px; flex-wrap: wrap; color: #73828a; font-size: .67rem; }
.sync-operation-counts b { color: var(--ifsi-text); }
.sync-confirm-flow { display: grid; gap: 7px; margin-top: 14px; }
.sync-confirm-flow div { display: flex; align-items: center; gap: 8px; color: var(--ifsi-text); font-size: .76rem; font-weight: 700; }
.sync-confirm-flow span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #eaf0f3; color: var(--ifsi-navy); font-size: .65rem; }

.preview-explainer {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid #dfd7cb;
    border-radius: 9px;
    background: #faf7f1;
}
.preview-explainer strong { color: var(--ifsi-navy); font-size: .78rem; }
.preview-explainer p { margin: 4px 0 0; color: #667780; font-size: .72rem; line-height: 1.5; }
.preview-section { margin-top: 18px; }
.preview-section-review { padding: 12px; border: 1px solid #ead39d; border-radius: 9px; background: #fffaf0; }
.preview-section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.preview-section-title h6 { margin: 0; color: var(--ifsi-navy); font-size: .82rem; font-weight: 850; }
.preview-section-title span { color: #6f7d85; font-size: .68rem; font-weight: 750; }
.preview-section-copy { margin: 0 0 10px; color: #6f7d85; font-size: .70rem; line-height: 1.5; }
.preview-table-wrap { max-height: 360px; border: 1px solid #ebe4da; border-radius: 8px; }
.preview-table { margin: 0; font-size: .69rem; }
.preview-table thead th { position: sticky; top: 0; z-index: 1; background: #f6f1e9; color: #3d5969; font-size: .64rem; text-transform: uppercase; letter-spacing: .03em; }
.preview-table td, .preview-table th { padding: 7px 8px; border-color: #eee8df; }
.preview-code { margin-top: 2px; color: #8c989e; font-size: .60rem; }
.preview-footnote { margin-top: 7px; color: #88949a; font-size: .64rem; }
.preview-empty { padding: 13px; border: 1px dashed #dcd4c8; border-radius: 8px; color: #7f8b91; font-size: .70rem; }
.held-reason-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; margin-bottom: 16px; }
.held-reason-grid > div { display: flex; align-items: baseline; gap: 8px; padding: 10px 11px; border: 1px solid #e5ddd2; border-radius: 8px; background: #fbf8f3; }
.held-reason-grid strong { color: var(--ifsi-navy); font-size: .95rem; }
.held-reason-grid span { color: #6d7b84; font-size: .66rem; }

@media (max-width: 1200px) {
    .sync-source-grid { grid-template-columns: 1fr; }
    .sync-source-card { min-height: 0; }
}
@media (max-width: 991.98px) {
    .maintenance-workspace { grid-template-columns: 1fr; }
    .maintenance-menu { display: none; }
}
@media (max-width: 767.98px) {
    .maintenance-section-header,
    .sync-result-heading,
    .sync-operation-row { flex-direction: column; align-items: stretch; }
    .maintenance-actions .btn { flex: 1; }
    .sync-operation-counts { justify-content: flex-start; }
    .held-reason-grid { grid-template-columns: 1fr; }
}


/* Inventory synchronization human-approval flow */
.sync-approval-callout {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid #d9e6ec;
    border-radius: 12px;
    background: #f6fafb;
    margin-bottom: 1rem;
}

.sync-approval-callout > i {
    font-size: 1.35rem;
    color: #0b617a;
    margin-top: .1rem;
}

.sync-approval-callout p {
    margin: .25rem 0 0;
    color: #526873;
    font-size: .9rem;
}

.sync-approval-summary {
    border: 1px solid #e1ddd5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.sync-approval-list {
    display: grid;
}

.sync-approval-row {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(0, 2fr);
    gap: 1rem;
    padding: .8rem .95rem;
    border-bottom: 1px solid #ebe7df;
}

.sync-approval-row:last-child {
    border-bottom: 0;
}

.sync-approval-row span {
    color: #51636b;
}

.sync-approval-protection {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .75rem .95rem;
    background: #fbf7ee;
    border-top: 1px solid #ebe2cd;
    color: #665631;
    font-size: .88rem;
}

.sync-approval-check {
    padding: .95rem 1rem .95rem 2.55rem;
    border: 1px solid #d9d4ca;
    border-radius: 10px;
    background: #fff;
}

.sync-approval-check .form-check-input {
    margin-left: -1.55rem;
}

@media (max-width: 767.98px) {
    .sync-approval-row {
        grid-template-columns: 1fr;
        gap: .25rem;
    }
}
