:root {
    --mp-orange: #f89000;
    --mp-orange-dark: #d97900;
    --mp-charcoal: #252630;
    --mp-charcoal-deep: #1d1e25;
    --mp-sidebar-width: 264px;
    --mp-topbar-height: 68px;
}

html, body { min-height: 100%; }
body { font-family: "Segoe UI", Arial, sans-serif; background: #f4f5f8; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--mp-orange); --bs-btn-border-color: var(--mp-orange); --bs-btn-hover-bg: var(--mp-orange-dark); --bs-btn-hover-border-color: var(--mp-orange-dark); --bs-btn-active-bg: var(--mp-orange-dark); --bs-btn-active-border-color: var(--mp-orange-dark); }
.text-primary { color: var(--mp-orange) !important; }
.bg-primary { background-color: var(--mp-orange) !important; }
.form-control:focus, .form-select:focus { border-color: rgba(248,144,0,.55); box-shadow: 0 0 0 .2rem rgba(248,144,0,.14); }

.mp-shell { min-height: 100vh; }
.mp-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--mp-sidebar-width); background: var(--mp-charcoal); color: #aeb8c5; z-index: 1035; display: flex; flex-direction: column; transition: transform .22s ease; }
.mp-brand { min-height: var(--mp-topbar-height); padding: 12px 20px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(255,255,255,.07); }
.mp-brand img { width: 38px; height: 38px; object-fit: contain; }
.mp-brand-word { font-weight: 800; letter-spacing: .06em; font-size: 19px; color: #fff; line-height: 1; }
.mp-brand-word span { color: var(--mp-orange); }
.mp-brand-sub { display: block; color: #7f8c9e; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; margin-top: 5px; }
.mp-nav-wrap { overflow-y: auto; padding: 14px 12px 22px; }
.mp-nav-label { color: #687587; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; padding: 12px 11px 6px; font-weight: 700; }
.mp-nav { list-style: none; padding: 0; margin: 0; }
.mp-nav li { margin: 2px 0; }
.mp-nav a, .mp-nav .mp-disabled { color: #aeb8c5; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 9px 11px; border-radius: 8px; font-size: 14px; }
.mp-nav a:hover { color: #fff; background: rgba(255,255,255,.055); }
.mp-nav a.active { color: #fff; background: rgba(248,144,0,.16); box-shadow: inset 3px 0 0 var(--mp-orange); }
.mp-nav .mp-disabled { opacity: .72; }
.mp-nav .menu-icon { width: 21px; text-align: center; font-size: 19px; color: #8290a3; }
.mp-nav a.active .menu-icon, .mp-nav a:hover .menu-icon { color: var(--mp-orange); }
.mp-nav .badge { margin-left: auto; font-size: 9px; font-weight: 600; }

.mp-main { min-height: 100vh; margin-left: var(--mp-sidebar-width); }
.mp-topbar { height: var(--mp-topbar-height); background: #fff; border-bottom: 1px solid #e8eaf0; position: sticky; top: 0; z-index: 1025; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; }
.mp-topbar-left, .mp-topbar-right { display: flex; align-items: center; gap: 10px; }
.mp-context-pill { display: inline-flex; align-items: center; gap: 7px; background: #fff3df; color: #a96100; border: 1px solid #ffe1ad; border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 700; }
.mp-user { display: flex; align-items: center; gap: 9px; }
.mp-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mp-charcoal); color: #fff; display: grid; place-items: center; font-weight: 700; }
.mp-content { padding: 26px; }
.mp-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.mp-page-head h1 { font-size: 23px; margin: 0 0 4px; }
.mp-page-head p { margin: 0; color: #788492; }
.mp-sidebar-toggle { display: none; border: 0; background: transparent; font-size: 24px; padding: 5px; }
.mp-overlay { display: none; }

.mp-stat-card { position: relative; overflow: hidden; border: 0; }
.mp-stat-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(248,144,0,.13); color: var(--mp-orange); font-size: 23px; }
.mp-stat-value { font-size: 26px; font-weight: 750; color: #2d3440; }
.mp-foundation-banner { border-left: 4px solid var(--mp-orange); background: linear-gradient(90deg, rgba(248,144,0,.08), rgba(248,144,0,.015)); }
.mp-status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.mp-status-ok { background: #2fb344; }
.mp-status-warn { background: #f59f00; }
.mp-module-card { transition: transform .15s ease, box-shadow .15s ease; border: 1px solid #e8eaf0; }
.mp-module-card:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(31,37,50,.08); }
.mp-module-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: rgba(248,144,0,.12); color: var(--mp-orange); font-size: 24px; }

.mp-auth { min-height: 100vh; background: radial-gradient(circle at 20% 15%, rgba(248,144,0,.14), transparent 30%), #eef0f4; display: grid; place-items: center; padding: 25px; }
.mp-auth-card { width: min(460px, 100%); border: 0; box-shadow: 0 18px 55px rgba(25,30,40,.12); }
.mp-auth-logo { max-width: 320px; width: 84%; height: auto; }
.mp-auth-rule { height: 3px; width: 54px; background: var(--mp-orange); border-radius: 10px; margin: 14px auto 22px; }

[data-bs-theme="dark"] body { background: #1f2028; }
[data-bs-theme="dark"] .mp-topbar { background: #252630; border-color: #343642; }
[data-bs-theme="dark"] .mp-page-head p { color: #949daa; }
[data-bs-theme="dark"] .mp-stat-value { color: #f1f1f1; }
[data-bs-theme="dark"] .mp-module-card { border-color: #353743; }
[data-bs-theme="dark"] .mp-context-pill { background: rgba(248,144,0,.13); color: #ffb343; border-color: rgba(248,144,0,.25); }

@media (max-width: 991.98px) {
    .mp-sidebar { transform: translateX(-100%); }
    body.mp-sidebar-open .mp-sidebar { transform: translateX(0); }
    .mp-main { margin-left: 0; }
    .mp-sidebar-toggle { display: inline-flex; }
    body.mp-sidebar-open .mp-overlay { display: block; position: fixed; inset: 0; background: rgba(20,22,28,.5); z-index: 1030; }
    .mp-content { padding: 20px 16px; }
    .mp-topbar { padding: 0 16px; }
    .mp-page-head { flex-direction: column; }
}


/* MaximPromo Next 0.2.0 Multi-Tenant Core */
.mp-context-tenant { background: color-mix(in srgb, var(--mp-tenant-accent, var(--mp-orange)) 12%, white); color: color-mix(in srgb, var(--mp-tenant-accent, var(--mp-orange)) 75%, #222); border-color: color-mix(in srgb, var(--mp-tenant-accent, var(--mp-orange)) 28%, white); }
.mp-check-card { display:flex; align-items:flex-start; gap:10px; padding:14px; border:1px solid #e5e8ee; border-radius:10px; min-height:88px; cursor:pointer; transition:border-color .15s ease, box-shadow .15s ease; }
.mp-check-card:hover { border-color:rgba(248,144,0,.45); box-shadow:0 4px 16px rgba(31,37,50,.05); }
.mp-check-card input { margin-top:3px; }
.mp-check-card span { display:block; }
.mp-check-card strong { display:block; }
.mp-check-card small { display:block; color:#7b8490; margin-top:4px; line-height:1.35; }
.mp-flow-step { display:flex; align-items:flex-start; gap:12px; margin-bottom:18px; }
.mp-flow-step > span { width:30px; height:30px; border-radius:50%; background:rgba(248,144,0,.14); color:var(--mp-orange); display:grid; place-items:center; font-weight:800; flex:0 0 auto; }
.mp-flow-step strong,.mp-flow-step small { display:block; }
.mp-flow-step small { color:#7b8490; margin-top:2px; line-height:1.35; }
.mp-provision-summary { top:88px; }
[data-bs-theme="dark"] .mp-check-card { border-color:#3a3d49; }
[data-bs-theme="dark"] .mp-context-tenant { background:rgba(248,144,0,.12); color:#ffb343; border-color:rgba(248,144,0,.25); }


/* MaximPromo Next 0.2.0 R4 acceptance refinements */
.mp-feature-grid > [class*="col-"] { display: flex; }
.mp-feature-option {
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: 100%;
    min-height: 108px;
    padding: 17px 18px;
    margin: 0;
    border: 1px solid #e3e7ed;
    border-radius: 12px;
    background: var(--bs-body-bg, #fff);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.mp-feature-option:hover {
    border-color: rgba(248,144,0,.50);
    box-shadow: 0 8px 22px rgba(31,37,50,.06);
    transform: translateY(-1px);
}
.mp-feature-option:has(input:checked) {
    border-color: rgba(248,144,0,.65);
    background: linear-gradient(135deg, rgba(248,144,0,.08), rgba(248,144,0,.015));
    box-shadow: inset 3px 0 0 var(--mp-orange);
}
.mp-feature-option .form-check-input {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    flex: 0 0 auto;
}
.mp-feature-option-copy { display: block; min-width: 0; }
.mp-feature-option-copy strong {
    display: block;
    color: var(--bs-body-color, #2d3440);
    font-size: 14px;
    line-height: 1.3;
}
.mp-feature-option-copy small {
    display: block;
    margin-top: 6px;
    color: #788492;
    font-size: 12px;
    line-height: 1.45;
}

.mp-tenant-accent-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 1085;
    overflow: hidden;
    background: var(--mp-tenant-accent, var(--mp-orange));
    box-shadow: 0 1px 5px color-mix(in srgb, var(--mp-tenant-accent, var(--mp-orange)) 30%, transparent);
}
.mp-tenant-accent-bar span {
    position: absolute;
    inset: 0 auto 0 -25%;
    width: 25%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.70), transparent);
    transform: skewX(-20deg);
    animation: mp-tenant-accent-sweep 1.25s ease-out .15s 1 both;
}
@keyframes mp-tenant-accent-sweep {
    from { left: -30%; opacity: 0; }
    15% { opacity: .9; }
    to { left: 110%; opacity: 0; }
}
body.mp-tenant-context .mp-topbar { border-top-color: transparent; }
[data-bs-theme="dark"] .mp-feature-option {
    border-color: #3a3d49;
    background: #252630;
}
[data-bs-theme="dark"] .mp-feature-option-copy strong { color: #f1f3f5; }
[data-bs-theme="dark"] .mp-feature-option-copy small { color: #9aa4b1; }
[data-bs-theme="dark"] .mp-feature-option:has(input:checked) {
    background: linear-gradient(135deg, rgba(248,144,0,.13), rgba(248,144,0,.025));
}
@media (prefers-reduced-motion: reduce) {
    .mp-tenant-accent-bar span { animation: none; display: none; }
    .mp-feature-option { transition: none; }
}


/* 0.2.0 R5 explicit admin-context identity */
.mp-platform-accent-bar,
.mp-tenant-accent-bar {
    position: fixed;
    z-index: 1105;
    inset: 0 0 auto 0;
    height: 4px;
    overflow: hidden;
    pointer-events: none;
}
.mp-platform-accent-bar {
    background: linear-gradient(90deg, #F89000 0%, #F89000 74%, #24262f 74%, #24262f 100%);
    box-shadow: 0 1px 5px rgba(248,144,0,.28);
}
.mp-platform-accent-bar span,
.mp-tenant-accent-bar span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 18%;
    left: -22%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
    animation: mp-admin-context-sweep 1.15s ease-out .12s 1 both;
}
@keyframes mp-admin-context-sweep {
    from { left: -22%; opacity: 0; }
    18% { opacity: .9; }
    to { left: 106%; opacity: 0; }
}
body.mp-platform-context .mp-topbar,
body.mp-tenant-context .mp-topbar { border-top-color: transparent; }
.mp-context-platform {
    background: rgba(248,144,0,.10);
    color: #a85d00;
    border-color: rgba(248,144,0,.28);
}
[data-bs-theme="dark"] .mp-context-platform {
    background: rgba(248,144,0,.13);
    color: #ffb343;
    border-color: rgba(248,144,0,.25);
}
@media (prefers-reduced-motion: reduce) {
    .mp-platform-accent-bar span,
    .mp-tenant-accent-bar span { animation: none; display: none; }
}

/* User/action controls */
.mp-action-stack { display:flex; gap:.4rem; flex-wrap:wrap; justify-content:flex-end; }
.mp-secret-state { font-size:.78rem; }


/* 0.2.0 R10 unsaved-change / floating-save UX */
.mp-floating-save {
    position: fixed;
    right: 24px;
    bottom: 22px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px 9px 14px;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 12px;
    background: var(--bs-body-bg);
    box-shadow: 0 10px 32px rgba(20,25,35,.18);
    transition: transform .18s ease, opacity .18s ease;
}
.mp-floating-save .mp-save-state {
    min-width: 110px;
    font-size: 12px;
    line-height: 16px;
}
.mp-floating-save .mp-save-state strong {
    display: block;
    font-size: 12px;
}
.mp-floating-save.is-clean .mp-save-state strong { color: var(--bs-secondary-color); }
.mp-floating-save.is-dirty .mp-save-state strong { color: var(--bs-warning-text-emphasis); }
.mp-floating-save .btn[disabled] { opacity: .58; }
body.mp-has-floating-save .mp-content { padding-bottom: 96px; }

[data-mp-idle-countdown] {
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}
#mp-idle-warning-modal .modal-content,
#mp-unsaved-modal .modal-content {
    border: 0;
    box-shadow: 0 18px 60px rgba(20,25,35,.28);
}

@media (max-width: 767.98px) {
    .mp-floating-save {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: space-between;
    }
    .mp-floating-save .btn { flex: 0 0 auto; }
    body.mp-has-floating-save .mp-content { padding-bottom: 108px; }
}


.mp-live-debug-console {
    min-height: 220px;
    max-height: 360px;
    overflow: auto;
    padding: 12px 14px;
    background: #111820;
    color: #d9e2ec;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.55;
}

.mp-live-debug-line {
    display: grid;
    grid-template-columns: 82px 92px minmax(0, 1fr);
    gap: 10px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,.045);
}

.mp-live-debug-line:last-child {
    border-bottom: 0;
}

.mp-live-debug-time,
.mp-live-debug-stage {
    opacity: .72;
    white-space: nowrap;
}

.mp-live-debug-stage {
    font-weight: 700;
}

.mp-live-debug-message {
    overflow-wrap: anywhere;
}

.mp-live-debug-line.is-error .mp-live-debug-message {
    font-weight: 700;
}

.mp-live-debug-status {
    background: var(--bs-tertiary-bg);
}

@media (max-width: 767.98px) {
    .mp-live-debug-line {
        grid-template-columns: 70px minmax(0,1fr);
    }

    .mp-live-debug-stage {
        display: none;
    }
}


/* MaximPromo Next 0.4.7 Taxonomy Unified Interpretation UX */
.mp-taxonomy-tree-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.mp-taxonomy-tree-tools { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.mp-taxonomy-tree-tools .form-control { min-width:220px; max-width:330px; }
.mp-root-toggle { color:var(--bs-secondary-color); line-height:1; width:18px; }
.mp-root-toggle:hover { color:var(--mp-orange); }
.mp-interpretation-form { padding:12px; border:1px solid var(--bs-border-color); border-radius:10px; background:var(--bs-tertiary-bg); }
.mp-tag-chip-list { display:flex; flex-wrap:wrap; gap:6px; min-height:28px; }
.mp-tag-chip { display:inline-flex; align-items:center; gap:5px; padding:4px 5px 4px 9px; border-radius:999px; background:var(--bs-info-bg-subtle); color:var(--bs-info-text-emphasis); font-size:12px; font-weight:600; }
.mp-tag-chip button { border:0; background:transparent; color:inherit; padding:0; width:20px; height:20px; display:grid; place-items:center; border-radius:50%; }
.mp-tag-chip button:hover { background:rgba(0,0,0,.08); }
.mp-taxonomy-review-table .form-text { font-size:11px; }
[data-mp-category-picker]:invalid { border-color:var(--bs-danger); }
[data-bs-theme="dark"] .mp-interpretation-form { background:#242630; border-color:#3a3d49; }
[data-bs-theme="dark"] .mp-tag-chip button:hover { background:rgba(255,255,255,.09); }
@media (max-width: 767.98px) {
    .mp-taxonomy-tree-tools { width:100%; justify-content:flex-start; }
    .mp-taxonomy-tree-tools .form-control { min-width:100%; max-width:none; width:100%; }
}
