:root {
    --mp-bg: #f6f8fc;
    --mp-panel: #ffffff;
    --mp-panel-soft: #f1f5fb;
    --mp-text: #172033;
    --mp-muted: #71809a;
    --mp-border: #dfe6f0;
    --mp-brand: #6842e8;
    --mp-brand-strong: #5434c9;
    --mp-brand-soft: #f0ecff;
    --mp-hero-start: #111318;
    --mp-hero-end: #6842e8;
    --mp-green: #178c57;
    --mp-red: #c2413b;
    --mp-shadow: 0 18px 44px rgba(29, 42, 67, .10);
    --mp-card-shadow: 0 1px 0 rgba(29, 42, 67, .03), 0 10px 30px rgba(29, 42, 67, .045);
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

.mp-body {
    margin: 0;
    color: var(--mp-text);
    background: var(--mp-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

.mp-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
}

.mp-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #e8edf5;
    border-right: 1px solid #d6deeb;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    overflow-y: auto;
}

.mp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 10px 20px;
    border-bottom: 1px solid rgba(113, 128, 154, .22);
}

.mp-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #111318;
    color: #fff;
    font-weight: 900;
    overflow: hidden;
}

.mp-brand-mark.has-logo {
    width: 58px;
    height: 38px;
    border-radius: 6px;
    background: transparent;
}

.mp-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #fff;
}

.mp-brand strong {
    display: block;
    font-size: 17px;
    line-height: 1.15;
}

.mp-brand small {
    display: block;
    margin-top: 2px;
    color: var(--mp-muted);
    font-size: 12px;
    font-weight: 700;
}

.mp-menu {
    display: grid;
    gap: 7px;
    padding: 18px 0;
}

.mp-menu-item {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #1f2a3d;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.2;
}

.mp-menu-item:hover,
.mp-menu-item.is-active {
    background: rgba(255, 255, 255, .78);
    color: #111827;
}

.mp-menu-item.is-active {
    box-shadow: inset 4px 0 0 var(--mp-brand), 0 10px 24px rgba(29, 42, 67, .06);
}

.mp-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mp-sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(113, 128, 154, .22);
}

.mp-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mp-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 32px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--mp-border);
    backdrop-filter: blur(18px);
}

.mp-title-block h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.15;
    font-weight: 850;
}

.mp-title-block p {
    margin: 4px 0 0;
    color: var(--mp-muted);
    font-size: 14px;
    font-weight: 650;
}

.mp-search {
    flex: 1 1 420px;
    max-width: 620px;
    min-width: 220px;
    height: 42px;
    display: flex;
    align-items: center;
    border: 1px solid var(--mp-border);
    background: #f8fafd;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.mp-search input {
    min-width: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    padding: 0 13px;
    color: var(--mp-text);
    font: inherit;
    font-size: 13px;
    outline: 0;
}

.mp-search button,
.mp-top-action {
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #526078;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mp-search .mp-icon,
.mp-top-action .mp-icon {
    width: 20px;
    height: 20px;
}

.mp-top-action {
    border-radius: 999px;
}

.mp-top-action:hover {
    background: #f0f4fa;
    color: var(--mp-brand);
}

.mp-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mp-user-meta {
    display: grid;
    text-align: right;
}

.mp-user-meta strong {
    font-size: 13px;
    line-height: 1.2;
}

.mp-user-meta small {
    color: var(--mp-muted);
    font-size: 12px;
    font-weight: 700;
}

.mp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mp-brand) 10%, #fff);
    color: var(--mp-brand-strong);
    border: 1px solid #ded6ff;
    font-weight: 900;
}

.mp-content {
    width: 100%;
    max-width: 1440px;
    padding: 32px 32px 52px;
}

.mp-grid {
    display: grid;
    gap: 18px;
}

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

.mp-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mp-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mp-card {
    background: var(--mp-panel);
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    box-shadow: var(--mp-card-shadow);
}

.mp-card.pad {
    padding: 24px;
}

.mp-card-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 850;
}

.mp-card-subtitle {
    margin: 6px 0 0;
    color: var(--mp-muted);
    font-size: 13px;
    line-height: 1.45;
    font-weight: 640;
}

.mp-kpi {
    min-height: 128px;
}

.mp-kpi-label {
    color: var(--mp-muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.mp-kpi-value {
    margin-top: 16px;
    font-size: 38px;
    line-height: 1;
    font-weight: 900;
}

.mp-kpi-note {
    margin-top: 10px;
    color: var(--mp-muted);
    font-size: 13px;
    font-weight: 680;
}

.mp-hero {
    min-height: 218px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
    gap: 20px;
    align-items: center;
    padding: 34px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(17, 19, 24, .96), rgba(17, 19, 24, .86)),
        linear-gradient(90deg, var(--mp-hero-start), var(--mp-hero-end));
    overflow: hidden;
}

.mp-hero h2 {
    margin: 0;
    max-width: 680px;
    font-size: 34px;
    line-height: 1.12;
    font-weight: 900;
}

.mp-hero p {
    max-width: 660px;
    margin: 12px 0 0;
    color: rgba(255,255,255,.72);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 650;
}

.mp-plan-card {
    justify-self: stretch;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 10px;
    padding: 18px 20px;
}

.mp-plan-card strong {
    display: block;
    font-size: 14px;
}

.mp-plan-card span {
    display: block;
    margin-top: 8px;
    color: rgba(255,255,255,.75);
    font-size: 13px;
    line-height: 1.45;
}

.mp-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 30px 0 14px;
}

.mp-section-head h2 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
}

.mp-section-head p {
    margin: 5px 0 0;
    color: var(--mp-muted);
    font-size: 13px;
    font-weight: 650;
}

.mp-module-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 20px;
}

.mp-module-link:hover {
    border-color: color-mix(in srgb, var(--mp-brand) 28%, #dbe3ee);
    box-shadow: var(--mp-shadow);
    transform: translateY(-1px);
}

.mp-module-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mp-brand-soft);
    color: var(--mp-brand-strong);
}

.mp-module-copy {
    min-width: 0;
}

.mp-module-copy strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}

.mp-module-copy span {
    display: block;
    margin-top: 4px;
    color: var(--mp-muted);
    font-size: 12px;
    line-height: 1.35;
    font-weight: 650;
}

.mp-alert {
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #d9ccff;
    background: #f5f1ff;
    color: #45308c;
    font-weight: 750;
    font-size: 14px;
}

.mp-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: end;
    margin-top: 18px;
}

.mp-form-grid label {
    display: grid;
    gap: 8px;
    color: var(--mp-text);
    font-size: 13px;
    font-weight: 850;
}

.mp-form-grid input,
.mp-form-grid select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--mp-border);
    border-radius: 7px;
    padding: 9px 11px;
    font: inherit;
}

.mp-form-grid input[type="color"] {
    padding: 4px;
}

.mp-form-grid input[type="file"] {
    padding: 8px;
    background: #fff;
}

.mp-branding-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mp-inline-check {
    min-height: 42px;
    display: flex !important;
    align-items: center;
    gap: 10px !important;
    padding: 9px 11px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    background: #fff;
}

.mp-inline-check input {
    width: auto;
    min-height: 0;
}

.mp-branding-preview {
    margin-top: 18px;
    min-height: 118px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border-radius: 8px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(17, 19, 24, .9), rgba(17, 19, 24, .76)),
        linear-gradient(90deg, var(--preview-secondary), var(--preview-primary));
}

.mp-branding-logo {
    width: 66px;
    height: 66px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255,255,255,.94);
    color: var(--preview-primary);
    font-size: 24px;
    font-weight: 900;
}

.mp-branding-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mp-branding-preview strong,
.mp-branding-preview span {
    display: block;
}

.mp-branding-preview strong {
    font-size: 22px;
    line-height: 1.1;
}

.mp-branding-preview span {
    margin-top: 6px;
    color: rgba(255,255,255,.72);
    font-size: 13px;
    font-weight: 700;
}

.mp-btn {
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    padding: 10px 14px;
    background: var(--mp-brand);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--mp-brand) 20%, transparent);
}

.mp-table-wrap {
    margin-top: 16px;
    overflow-x: auto;
}

.mp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mp-table th,
.mp-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--mp-border);
    text-align: left;
    white-space: nowrap;
}

.mp-table th {
    color: var(--mp-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.mp-permission-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    max-height: 560px;
    overflow: auto;
    padding-right: 4px;
}

.mp-check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    background: #fff;
}

.mp-check-row input {
    margin-top: 3px;
}

.mp-check-row strong,
.mp-check-row small {
    display: block;
}

.mp-check-row small {
    margin-top: 3px;
    color: var(--mp-muted);
    font-weight: 650;
}

.mp-mobile-menu {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.mp-mobile-menu span {
    display: block;
    height: 2px;
    background: var(--mp-text);
    margin: 5px 0;
}

@media (max-width: 1180px) {
    .mp-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mp-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .mp-shell { grid-template-columns: 1fr; }
    .mp-sidebar {
        position: fixed;
        z-index: 40;
        inset: 0 auto 0 0;
        width: min(320px, 88vw);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: var(--mp-shadow);
    }
    .mp-shell.is-menu-open .mp-sidebar { transform: translateX(0); }
    .mp-mobile-menu { display: inline-block; }
    .mp-topbar {
        padding: 14px 16px;
        min-height: 72px;
    }
    .mp-search,
    .mp-top-action {
        display: none;
    }
    .mp-title-block h1 { font-size: 19px; }
    .mp-title-block p { display: none; }
    .mp-user-meta { display: none; }
    .mp-content { padding: 22px 16px 42px; }
    .mp-grid.cols-4,
    .mp-grid.cols-3,
    .mp-grid.cols-2 { grid-template-columns: 1fr; }
    .mp-form-grid { grid-template-columns: 1fr; }
    .mp-branding-form { grid-template-columns: 1fr; }
    .mp-hero {
        grid-template-columns: 1fr;
        padding: 22px;
    }
    .mp-hero h2 { font-size: 26px; }
}
