/* Yo'riqnoma (Medportal) */
.mpg {
    --mpg-accent: var(--mp-accent, var(--wp--preset--color--accent, #0e7490));
    --mpg-text: var(--mp-text, #1d2731);
    --mpg-muted: #5b6875;
    --mpg-line: #dfe5ea;
    --mpg-soft: #f3f7f9;
    --mpg-card: #fff;
    --mpg-warn: #b45309;
    --mpg-warn-bg: #fff7ea;
    color: var(--mpg-text);
    max-width: 1180px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.6;
}
.mpg--admin { margin: 0; font-size: 14px; }
.mpg *, .mpg *::before, .mpg *::after { box-sizing: border-box; }

.mpg-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin: 8px 0 18px; }
.mpg-h1 { margin: 0 0 10px !important; padding: 0 !important; }
.mpg-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.mpg-roles a, .mpg-langs a, .mpg-chip {
    display: inline-block; padding: 5px 12px; border: 1px solid var(--mpg-line); border-radius: 999px;
    text-decoration: none; color: var(--mpg-text); background: var(--mpg-card); font-size: 13px; line-height: 1.4;
}
.mpg-roles a:hover, .mpg-langs a:hover, .mpg-chip:hover { border-color: var(--mpg-accent); color: var(--mpg-accent); }
.mpg-roles a.is-on, .mpg-langs a.is-on, .mpg-chip.is-on { background: var(--mpg-accent); border-color: var(--mpg-accent); color: #fff; }
.mpg-roles a:focus-visible, .mpg-langs a:focus-visible, .mpg-btn:focus-visible, .mpg-toc a:focus-visible { outline: 2px solid var(--mpg-accent); outline-offset: 2px; }

.mpg-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mpg-langs { display: flex; flex-wrap: wrap; gap: 4px; }
.mpg-search input {
    width: 260px; max-width: 100%; padding: 7px 12px; border: 1px solid var(--mpg-line); border-radius: 8px;
    font: inherit; font-size: 14px; background: var(--mpg-card); color: var(--mpg-text);
}
.mpg-search input:focus { outline: none; border-color: var(--mpg-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mpg-accent) 25%, transparent); }
.mpg-btn {
    display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--mpg-accent);
    background: var(--mpg-accent); color: #fff !important; text-decoration: none; font: inherit; font-size: 14px; cursor: pointer; line-height: 1.3;
}
.mpg-btn--ghost { background: transparent; color: var(--mpg-accent) !important; }

.mpg-sos { margin: 0 0 18px; padding: 10px 14px; border-radius: 10px; background: #fdecec; color: #8a1c1c; }
.mpg-sos strong { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 6px; background: #c62828; color: #fff; }

.mpg-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; }
.mpg-toc { position: sticky; top: 48px; max-height: calc(100vh - 70px); overflow: auto; padding: 14px 16px; border-radius: 12px; background: var(--mpg-soft); font-size: 13.5px; }
.mpg--front .mpg-toc { top: 90px; }
.mpg-toc summary { cursor: pointer; margin-bottom: 6px; list-style: none; }
.mpg-toc summary::-webkit-details-marker { display: none; }
.mpg-toc summary::after { content: ' ▾'; color: var(--mpg-muted); }
.mpg-toc details:not([open]) summary { margin-bottom: 0; }
.mpg-toc details:not([open]) summary::after { content: ' ▸'; }
.mpg-toc ol { margin: 0; padding-left: 20px; }
.mpg-toc li { margin: 3px 0; }
.mpg-toc a { color: var(--mpg-text); text-decoration: none; }
.mpg-toc a:hover, .mpg-toc a.is-on { color: var(--mpg-accent); }
.mpg-toc a.is-on { font-weight: 600; }
.mpg-toc li.is-hidden { opacity: .35; }

.mpg-body { min-width: 0; max-width: 780px; }
.mpg-title { margin: 0 0 12px; font-size: 1.75em; line-height: 1.25; }
.mpg--admin .mpg-title { font-size: 1.6em; }
.mpg-edited { margin: 0 0 12px; color: var(--mpg-muted); font-size: 13px; }
.mpg-intro { font-size: 1.05em; }
.mpg-sec { padding: 6px 0 14px; border-top: 1px solid var(--mpg-line); scroll-margin-top: 60px; }
.mpg--front .mpg-sec { scroll-margin-top: 100px; }
.mpg-sec h2 { margin: 14px 0 8px; font-size: 1.3em; line-height: 1.3; }
.mpg-body h3 { margin: 16px 0 6px; font-size: 1.08em; }
.mpg-body h4 { margin: 12px 0 4px; font-size: 1em; }
.mpg-body p { margin: 0 0 10px; }
.mpg-body ul, .mpg-body ol { margin: 0 0 12px; padding-left: 22px; }
.mpg-body ul { list-style: disc; }
.mpg-body ol { list-style: decimal; }
.mpg-body li > ul { list-style: circle; }
.mpg-toc ol { list-style: decimal; }
.mpg-body li { margin: 3px 0; }
.mpg-body li > ul { margin: 4px 0; }
.mpg-body code { padding: 1px 5px; border-radius: 4px; background: var(--mpg-soft); font-size: .92em; }
.mpg-body a { color: var(--mpg-accent); }
.mpg-body hr { border: 0; border-top: 1px dashed var(--mpg-line); margin: 16px 0; }
.mpg-note { margin: 10px 0 14px; padding: 10px 14px; border-left: 3px solid var(--mpg-accent); border-radius: 0 10px 10px 0; background: var(--mpg-soft); }
.mpg-note p:last-child { margin-bottom: 0; }
.mpg-note--warn { border-left-color: var(--mpg-warn); background: var(--mpg-warn-bg); }
.mpg-staffnote { margin-top: 18px; padding: 10px 14px; border-radius: 10px; background: var(--mpg-soft); color: var(--mpg-muted); font-size: .92em; }
.mpg-totop { margin-top: 18px; font-size: 13px; }
.mpg-nothing, .mpg-count { color: var(--mpg-muted); }
.mpg mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }

/* Pastki qism havolasi va kabinet */
.mpg-footlink { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.mpg-portal-link { margin: 0 0 12px; font-size: 14px; }
.mpg-portal-link a { text-decoration: none; }

/* Tahrirlash */
.mpg-ed-pick { display: grid; gap: 8px; margin: 12px 0; }
.mpg-ed-pick > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mpg-ed-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.mpg-ed-col textarea { width: 100%; min-height: 640px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.mpg-ed-preview { max-height: 680px; overflow: auto; padding: 4px 16px; border: 1px solid var(--mpg-line); border-radius: 10px; background: #fff; }
.mpg-ed-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mpg-ed-revert { color: #b32d2e !important; border-color: #b32d2e !important; }
.mpg-ed-syntax { font-size: 12px; }

@media (max-width: 900px) {
    .mpg-layout { grid-template-columns: 1fr; gap: 16px; }
    .mpg-toc { position: static; max-height: none; }
    .mpg-toc ol { columns: 2; column-gap: 24px; }
    .mpg-ed-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .mpg-toc ol { columns: 1; }
    .mpg-search input { width: 100%; }
    .mpg-tools, .mpg-search { width: 100%; }
    .mpg-title { font-size: 1.45em; }
}
@media print {
    .mpg-tools, .mpg-toc, .mpg-roles, .mpg-totop, .mpg-staffnote, #adminmenumain, #wpadminbar, #wpfooter, .mp-topbar, header, footer { display: none !important; }
    .mpg-layout { display: block; }
    .mpg-sec { break-inside: auto; }
    .mpg-sec h2 { break-after: avoid; }
}
@media (prefers-reduced-motion: no-preference) {
    .mpg-roles a, .mpg-langs a, .mpg-chip { transition: background-color .15s, border-color .15s, color .15s; }
}
