.mar-panel {
    box-sizing: border-box;
    width: 100%;
    margin: 14px 0;
    padding: 22px;
    border: 1px solid #dce6ed;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .055);
    color: #172033;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.mar-panel *,
.mar-panel *::before,
.mar-panel *::after {
    box-sizing: border-box;
}

.mar-panel > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px;
    padding: 0 0 17px;
    border-bottom: 1px solid #e8eef3;
}

.mar-panel > header > div {
    min-width: 0;
}

.mar-panel > header small {
    display: block;
    margin-bottom: 6px;
    color: #0f766e;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .12em;
}

.mar-panel h2 {
    margin: 0;
    color: #172033;
    font-size: clamp(21px, 2.1vw, 27px);
    font-weight: 760;
    letter-spacing: -.035em;
    line-height: 1.2;
}

.mar-panel > header p {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.mar-panel > header > span {
    flex: 0 0 auto;
    margin-top: 3px;
    padding: 7px 11px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .06em;
}

.mar-panel > header > .mar-on {
    border-color: #b7ead8;
    background: #edfcf6;
    color: #08735e;
}

.mar-panel > header > .mar-off {
    border-color: #e2e8f0;
    background: #f3f6f9;
    color: #64748b;
}

.mar-alert {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
}

.mar-alert.good {
    border-color: #b7ead8;
    background: #edfcf6;
    color: #08735e;
}

.mar-alert.bad {
    border-color: #fecdd3;
    background: #fff5f6;
    color: #b4233e;
}

.mar-muted {
    margin: 12px 0;
    color: #64748b;
    font-size: 13px;
}

.mar-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
    gap: 14px;
    align-items: stretch;
}

.mar-grid > label:not(.mar-toggle) {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    color: #334155;
    font-size: 12px;
    font-weight: 750;
}

.mar-toggle {
    display: flex;
    min-height: 86px;
    align-items: center;
    gap: 13px;
    padding: 16px 18px;
    border: 1px solid #dce7ed;
    border-radius: 13px;
    background: #fbfdff;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.mar-toggle:has(input:checked) {
    border-color: #a9ddd4;
    background: #f0fdfa;
    box-shadow: inset 3px 0 #0f9386;
}

.mar-toggle input,
.mar-confirm input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 0;
    accent-color: #0f766e;
}

.mar-toggle span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.mar-toggle b {
    color: #1e293b;
    font-size: 13px;
    font-weight: 800;
}

.mar-toggle small,
.mar-psids > small {
    color: #718096;
    font-size: 11px;
    font-weight: 450;
    line-height: 1.45;
}

.mar-grid select,
.mar-grid textarea {
    display: block;
    width: 100%;
    min-width: 0;
    border: 1px solid #d7e1e9;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #26364a;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.mar-grid select {
    height: 46px;
    padding: 0 12px;
}

.mar-grid textarea {
    min-height: 96px;
    padding: 11px 12px;
    resize: vertical;
    line-height: 1.5;
}

.mar-grid textarea::placeholder {
    color: #9aa8b5;
    font-weight: 400;
}

.mar-grid select:focus,
.mar-grid textarea:focus {
    border-color: #4eafa4;
    box-shadow: 0 0 0 3px rgba(15, 148, 136, .11);
}

.mar-grid select:disabled,
.mar-grid textarea:disabled,
.mar-toggle input:disabled,
.mar-confirm input:disabled {
    cursor: not-allowed;
    opacity: .7;
}

.mar-psids {
    grid-column: 1 / -1;
}

.mar-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px solid #f2d59a;
    border-radius: 11px;
    background: #fffbeb;
    color: #854d0e;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
}

.mar-note {
    margin: 15px 0 0;
    padding: 11px 13px;
    border-left: 3px solid #7bc9bd;
    border-radius: 0 9px 9px 0;
    background: #f0fdfa;
    color: #526779;
    font-size: 11px;
    line-height: 1.55;
}

.mar-health {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 15px 0 0;
}

.mar-health-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    min-height: 130px;
    padding: 14px;
    border: 1px solid #dce6ed;
    border-radius: 13px;
    background: linear-gradient(180deg, #fff, #f8fbfd);
}

.mar-health-item > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mar-health-item b {
    color: #223247;
    font-size: 12px;
    font-weight: 800;
}

.mar-health-item > div small {
    color: #8290a1;
    font-size: 10px;
    line-height: 1.4;
}

.mar-health-item > span {
    align-self: flex-start;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .06em;
}

.mar-health-good {
    border: 1px solid #b7ead8;
    background: #edfcf6;
    color: #08735e;
}

.mar-health-bad {
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #b45309;
}

.mar-health-item p {
    margin: 0;
    color: #5d6d80;
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.mar-event-log {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid #dce6ed;
    border-radius: 13px;
    background: #f8fafc;
}

.mar-event-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.mar-event-head > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mar-event-head b {
    color: #223247;
    font-size: 12px;
    font-weight: 850;
}

.mar-event-head small {
    color: #718096;
    font-size: 10px;
    line-height: 1.45;
}

.mar-event-head > span {
    flex: 0 0 auto;
    color: #718096;
    font-size: 10px;
    font-weight: 750;
}

.mar-empty {
    padding: 18px 15px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.55;
}

.mar-event {
    position: relative;
    margin: 10px;
    padding: 11px 13px 11px 15px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #94a3b8;
    border-radius: 10px;
    background: #fff;
}

.mar-event-ok { border-left-color: #0f9f78; }
.mar-event-warn { border-left-color: #e4a11b; }
.mar-event-error { border-left-color: #dc5365; }

.mar-event-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.mar-event-title b {
    color: #26364a;
    font-size: 11px;
    font-weight: 850;
}

.mar-event-title time {
    flex: 0 0 auto;
    color: #8290a1;
    font-size: 9px;
}

.mar-event p {
    margin: 6px 0;
    color: #536579;
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.mar-event > small {
    display: block;
    color: #64748b;
    font-size: 9px;
    line-height: 1.45;
}

.mar-event > small b { color: #0f766e; }

.mar-runtime { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 15px 0 0; padding: 14px; border: 1px solid #dce6ed; border-radius: 12px; background: #f8fafc; color: #334155; font-size: 11px; }
.mar-runtime > div { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.mar-runtime b {
    color: #0f766e;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .025em;
}

.mar-runtime span {
    color: #536579;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.mar-runtime-last {
    grid-column: 1 / -1;
    padding-top: 11px;
    border-top: 1px solid #e0e7ee;
}

.mar-runtime-last strong {
    color: #0f766e;
}

.mar-runtime small {
    color: #718096;
}

.mar-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 15px;
}

.mar-actions button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border: 1px solid #dce5ec;
    border-radius: 9px;
    background: #fff;
    color: #42566a;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.mar-actions button:hover:not(:disabled) {
    background: #f8fafc;
    box-shadow: 0 3px 9px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.mar-actions .mar-save {
    border-color: #0f766e;
    background: linear-gradient(135deg, #0f766e, #0b8e83);
    color: #fff;
    box-shadow: 0 4px 10px rgba(15, 118, 110, .15);
}

.mar-actions .mar-save:hover:not(:disabled) {
    background: linear-gradient(135deg, #0b655f, #087d73);
}

.mar-actions button:disabled {
    cursor: not-allowed;
    opacity: .55;
    box-shadow: none;
}

.mar-updated {
    display: block;
    margin-top: 11px;
    color: #8492a2;
    font-size: 10px;
}

@media (max-width: 720px) {
    .mar-panel {
        margin: 9px 0;
        padding: 16px;
        border-radius: 14px;
    }

    .mar-panel > header {
        gap: 10px;
        margin-bottom: 14px;
        padding-bottom: 13px;
    }

    .mar-panel > header small {
        font-size: 9px;
    }

    .mar-panel > header p {
        max-width: 42ch;
        font-size: 12px;
    }

    .mar-panel > header > span {
        padding: 6px 8px;
        font-size: 9px;
    }

    .mar-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .mar-psids {
        grid-column: auto;
    }

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

    .mar-runtime { grid-template-columns: minmax(0, 1fr); gap: 10px; }

    .mar-runtime-last {
        grid-column: auto;
    }
}

@media (max-width: 460px) {
    .mar-health { grid-template-columns: minmax(0, 1fr); }
    .mar-event-head { align-items: flex-start; }
    .mar-event-title { flex-direction: column; gap: 4px; }
}

@media (max-width: 420px) {
    .mar-panel {
        padding: 13px;
    }

    .mar-panel > header {
        align-items: flex-start;
    }

    .mar-panel h2 {
        font-size: 20px;
    }

    .mar-toggle {
        min-height: 76px;
        padding: 13px;
    }

    .mar-actions button {
        flex: 1 1 0;
        padding-inline: 9px;
    }
}

/* AH465: explicit publish-time stylesheet fallback for the Messenger admin panel. */
.mar-panel { overflow: hidden; }
.mar-panel > header { align-items: center; }
.mar-actions { align-items: center; flex-wrap: wrap; }
.mar-actions button { min-width: 116px; }
.mar-actions .mar-save { min-width: 142px; }
.mar-health-item { min-width: 0; }
.mar-event-log { max-height: 520px; overflow-y: auto; scrollbar-color: #cbd5e1 transparent; scrollbar-width: thin; }
.mar-event { overflow-wrap: anywhere; }
.mar-event-title time { white-space: nowrap; }
.mar-panel input[type="checkbox"] { accent-color: #0f766e; }

@media (max-width: 940px) {
    .mar-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .mar-health { grid-template-columns: minmax(0, 1fr); }
    .mar-event-head { align-items: flex-start; }
    .mar-event-title { flex-direction: column; gap: 4px; }
    .mar-actions { justify-content: stretch; }
    .mar-actions button { flex: 1 1 140px; }
}
