/* Markdown to HTML — professional dashboard UI */
.tool-widget:has(.mdh-app) {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.mdh-app {
    --mdh-accent: #00aeef;
    --mdh-accent-2: #38bdf8;
    --mdh-ok: #34d399;
    --mdh-err: #f87171;
    --mdh-card: rgba(15, 23, 42, 0.82);
    --mdh-border: rgba(148, 163, 184, 0.16);
    --mdh-muted: #94a3b8;
    width: 100%;
}

.mdh-app [hidden] {
    display: none !important;
}

.mdh-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.mdh-shell {
    border: 1px solid var(--mdh-border);
    border-radius: 20px;
    background:
        radial-gradient(ellipse 70% 45% at 0% 0%, rgba(0, 174, 239, .14), transparent 50%),
        radial-gradient(ellipse 50% 35% at 100% 0%, rgba(167, 139, 250, .08), transparent 45%),
        linear-gradient(180deg, #111827 0%, #0b1220 100%);
    padding: 1.15rem 1.2rem 1.35rem;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.mdh-trust {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .95rem;
}

.mdh-trust-item {
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--mdh-border);
    background: rgba(2, 8, 20, .45);
    font-size: .72rem;
    font-weight: 700;
    color: #e2e8f0;
}

.mdh-layout {
    display: grid;
    grid-template-columns: minmax(220px, 270px) 1fr;
    gap: 1.1rem;
    align-items: start;
}

.mdh-intro {
    position: sticky;
    top: 1rem;
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid var(--mdh-border);
    background:
        radial-gradient(circle at top left, rgba(0, 174, 239, .18), transparent 55%),
        linear-gradient(165deg, #111827, #0b1220 70%);
}

.mdh-kicker {
    margin: 0 0 .45rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mdh-accent-2);
}

.mdh-intro-title {
    margin: 0 0 .7rem;
    font-size: 1.4rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #e0f2fe, #7dd3fc 40%, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mdh-intro-text {
    margin: 0 0 1rem;
    color: var(--mdh-muted);
    font-size: .9rem;
    line-height: 1.55;
}

.mdh-cta {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    margin-bottom: 1rem;
}

.mdh-why {
    padding: .9rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(0, 174, 239, .22);
    background: rgba(0, 174, 239, .08);
}

.mdh-why h3 {
    margin: 0 0 .55rem;
    font-size: .88rem;
    color: #e2e8f0;
}

.mdh-why ul {
    margin: 0;
    padding: 0 0 0 1.05rem;
    color: #cbd5e1;
    font-size: .82rem;
    line-height: 1.55;
}

.mdh-why li + li {
    margin-top: .28rem;
}

.mdh-workspace {
    min-width: 0;
}

.mdh-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .85rem;
}

.mdh-tab {
    appearance: none;
    border: 1px solid var(--mdh-border);
    background: rgba(2, 8, 20, .4);
    color: #cbd5e1;
    border-radius: 999px;
    padding: .42rem .85rem;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: .15s ease;
}

.mdh-tab:hover {
    border-color: rgba(0, 174, 239, .35);
    color: #fff;
}

.mdh-tab.active {
    background: linear-gradient(135deg, rgba(0, 174, 239, .35), rgba(56, 189, 248, .18));
    border-color: rgba(0, 174, 239, .55);
    color: #fff;
}

.mdh-panel {
    display: none;
}

.mdh-panel.active {
    display: block;
}

.mdh-dual {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: .75rem;
    align-items: stretch;
    margin-bottom: .9rem;
}

.mdh-card {
    border: 1px solid var(--mdh-border);
    border-radius: 16px;
    background: var(--mdh-card);
    padding: .85rem .95rem 1rem;
    min-width: 0;
}

.mdh-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .65rem;
    flex-wrap: wrap;
}

.mdh-card-head h3 {
    margin: 0;
    font-size: .95rem;
    color: #f1f5f9;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.mdh-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(0, 174, 239, .2);
    border: 1px solid rgba(0, 174, 239, .4);
    color: var(--mdh-accent-2);
    font-size: .72rem;
    font-weight: 800;
}

.mdh-head-actions {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.mdh-link-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--mdh-accent-2);
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    padding: .2rem .35rem;
}

.mdh-link-btn:hover {
    color: #fff;
    text-decoration: underline;
}

.mdh-textarea {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid var(--mdh-border);
    background: rgba(2, 8, 20, .55);
    color: #e2e8f0;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
    line-height: 1.55;
    padding: .85rem;
    box-sizing: border-box;
}

.mdh-textarea:focus {
    outline: none;
    border-color: rgba(0, 174, 239, .55);
    box-shadow: 0 0 0 3px rgba(0, 174, 239, .15);
}

.mdh-textarea[readonly] {
    color: #cbd5e1;
}

.mdh-pane-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .55rem;
    color: var(--mdh-muted);
    font-size: .75rem;
}

.mdh-status.is-ok {
    color: var(--mdh-ok);
    font-weight: 700;
}

.mdh-status.is-err {
    color: var(--mdh-err);
    font-weight: 700;
}

.mdh-icon-btn {
    appearance: none;
    border: 1px solid var(--mdh-border);
    background: rgba(2, 8, 20, .4);
    color: #cbd5e1;
    border-radius: 8px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: .9rem;
}

.mdh-icon-btn:hover {
    border-color: rgba(0, 174, 239, .4);
    color: #fff;
}

.mdh-mid {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mdh-go-btn {
    appearance: none;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 174, 239, .45);
    background: linear-gradient(145deg, #0ea5e9, #0284c7);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 28px rgba(14, 165, 233, .35);
    transition: transform .15s ease;
}

.mdh-go-btn:hover {
    transform: scale(1.06);
}

.mdh-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, .75fr);
    gap: .85rem;
    margin-bottom: .9rem;
}

.mdh-device-toggle {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}

.mdh-device {
    appearance: none;
    border: 1px solid var(--mdh-border);
    background: rgba(2, 8, 20, .4);
    color: #94a3b8;
    border-radius: 8px;
    padding: .3rem .55rem;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
}

.mdh-device.active {
    color: #fff;
    border-color: rgba(0, 174, 239, .5);
    background: rgba(0, 174, 239, .2);
}

.mdh-preview-frame {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    transition: max-width .2s ease;
    border-radius: 12px;
    border: 1px solid var(--mdh-border);
    background: #f8fafc;
    overflow: auto;
    min-height: 220px;
}

.mdh-preview-frame[data-device="tablet"] {
    max-width: 720px;
}

.mdh-preview-frame[data-device="mobile"] {
    max-width: 390px;
}

.mdh-preview-frame--wide {
    min-height: 420px;
}

.mdh-preview {
    padding: 1.1rem 1.25rem;
    color: #0f172a;
    font-size: .95rem;
    line-height: 1.65;
}

.mdh-preview :is(h1, h2, h3, h4) {
    margin: 1em 0 .45em;
    line-height: 1.25;
    color: #0f172a;
}

.mdh-preview h1 { font-size: 1.65rem; }
.mdh-preview h2 { font-size: 1.35rem; }
.mdh-preview h3 { font-size: 1.15rem; }

.mdh-preview p,
.mdh-preview ul,
.mdh-preview ol,
.mdh-preview blockquote,
.mdh-preview pre {
    margin: 0 0 .85rem;
}

.mdh-preview a {
    color: #0284c7;
}

.mdh-preview code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: .85em;
    background: #e2e8f0;
    padding: .1em .35em;
    border-radius: 4px;
}

.mdh-preview pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: .85rem 1rem;
    border-radius: 10px;
    overflow: auto;
}

.mdh-preview pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.mdh-preview blockquote {
    border-left: 3px solid #94a3b8;
    padding-left: .85rem;
    color: #475569;
}

.mdh-preview table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: .85rem;
}

.mdh-preview th,
.mdh-preview td {
    border: 1px solid #cbd5e1;
    padding: .4rem .55rem;
    text-align: left;
}

.mdh-guide-wrap {
    overflow: auto;
    max-height: 320px;
}

.mdh-guide {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.mdh-guide th,
.mdh-guide td {
    border-bottom: 1px solid var(--mdh-border);
    padding: .45rem .35rem;
    text-align: left;
    vertical-align: top;
}

.mdh-guide th {
    color: #94a3b8;
    font-weight: 700;
}

.mdh-guide code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    color: #7dd3fc;
    font-size: .74rem;
}

.mdh-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
}

.mdh-template {
    border: 1px solid var(--mdh-border);
    border-radius: 14px;
    background: rgba(2, 8, 20, .4);
    padding: .9rem 1rem;
    text-align: left;
    cursor: pointer;
    color: #e2e8f0;
    transition: .15s ease;
}

.mdh-template:hover {
    border-color: rgba(0, 174, 239, .45);
    transform: translateY(-1px);
}

.mdh-template strong {
    display: block;
    margin-bottom: .35rem;
    font-size: .9rem;
}

.mdh-template span {
    color: var(--mdh-muted);
    font-size: .78rem;
    line-height: 1.45;
}

.mdh-history {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.mdh-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .8rem;
    border-radius: 12px;
    border: 1px solid var(--mdh-border);
    background: rgba(2, 8, 20, .4);
}

.mdh-history-item p {
    margin: 0 0 .2rem;
    color: #e2e8f0;
    font-size: .85rem;
    font-weight: 600;
}

.mdh-history-item small {
    color: var(--mdh-muted);
    font-size: .72rem;
}

.mdh-empty {
    margin: 0;
    color: var(--mdh-muted);
    font-size: .85rem;
}

.mdh-steps {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: #cbd5e1;
    font-size: .9rem;
    line-height: 1.65;
}

.mdh-note {
    margin: .5rem 0 0;
    color: var(--mdh-muted);
    font-size: .82rem;
    line-height: 1.5;
}

.mdh-features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.mdh-feature {
    border: 1px solid var(--mdh-border);
    border-radius: 14px;
    background: rgba(2, 8, 20, .35);
    padding: .85rem .9rem;
}

.mdh-feature strong {
    display: block;
    margin-bottom: .3rem;
    color: #e2e8f0;
    font-size: .85rem;
}

.mdh-feature span {
    color: var(--mdh-muted);
    font-size: .75rem;
    line-height: 1.45;
}

.mdh-app.is-expanded .mdh-textarea {
    min-height: 70vh;
}

@media (max-width: 1100px) {
    .mdh-layout {
        grid-template-columns: 1fr;
    }

    .mdh-intro {
        position: static;
    }

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

@media (max-width: 860px) {
    .mdh-dual {
        grid-template-columns: 1fr;
    }

    .mdh-mid {
        order: 0;
    }

    .mdh-go-btn {
        transform: rotate(90deg);
    }

    .mdh-bottom-grid {
        grid-template-columns: 1fr;
    }

    .mdh-features {
        grid-template-columns: 1fr;
    }
}
