.mtbsg,
.mtbsg * {
    box-sizing: border-box;
}

.mtbsg {
    --mtbsg-navy: #0d1b2a;
    --mtbsg-blue: #175cd3;
    --mtbsg-cyan: #0ea5e9;
    --mtbsg-green: #067647;
    --mtbsg-gold: #c99730;
    --mtbsg-red: #b42318;
    --mtbsg-text: #172b3a;
    --mtbsg-muted: #667085;
    --mtbsg-border: #dfe6ee;
    --mtbsg-bg: #f5f8fb;
    width: 100%;
    max-width: 1240px;
    margin: 24px auto;
    color: var(--mtbsg-text);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.75;
}

.mtbsg-admin-wrap .mtbsg {
    margin-right: 0;
}

.mtbsg-admin-intro {
    max-width: 1000px;
    font-size: 14px;
}

.mtbsg-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 32px;
    border-radius: 24px;
    color: #fff;
    background:
        radial-gradient(circle at 10% 0%, rgba(14,165,233,.32), transparent 38%),
        linear-gradient(135deg, #091725 0%, #123557 58%, #175cd3 120%);
    box-shadow: 0 20px 60px rgba(13, 27, 42, .16);
}

.mtbsg-hero h2,
.mtbsg-output-header h3 {
    margin: 6px 0 8px;
    color: inherit;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.35;
}

.mtbsg-hero p {
    max-width: 720px;
    margin: 0;
    color: rgba(255,255,255,.82);
}

.mtbsg-kicker {
    display: inline-block;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    direction: ltr;
}

.mtbsg-security-badge {
    min-width: 215px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 18px;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(10px);
}

.mtbsg-security-badge .dashicons {
    width: 32px;
    height: 32px;
    margin-left: 8px;
    font-size: 32px;
    vertical-align: middle;
}

.mtbsg-security-badge strong,
.mtbsg-security-badge small {
    display: block;
}

.mtbsg-security-badge small {
    color: rgba(255,255,255,.7);
}

.mtbsg-notice {
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid;
    border-radius: 14px;
    font-size: 13px;
}

.mtbsg-notice-warning {
    color: #7a2e0e;
    border-color: #fed7aa;
    background: #fff7ed;
}

.mtbsg-notice-info {
    color: #1849a9;
    border-color: #b2ddff;
    background: #eff8ff;
}

.mtbsg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.mtbsg-card {
    padding: 24px;
    border: 1px solid var(--mtbsg-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(16,24,40,.055);
}

.mtbsg-card-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.mtbsg-card-title h3 {
    margin: 0;
    color: var(--mtbsg-navy);
    font-size: 18px;
}

.mtbsg-card-title p {
    margin: 2px 0 0;
    color: var(--mtbsg-muted);
    font-size: 12px;
}

.mtbsg-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--mtbsg-blue), var(--mtbsg-cyan));
    font-weight: 800;
}

.mtbsg-fields {
    display: grid;
    gap: 15px;
}

.mtbsg-field {
    display: grid;
    gap: 7px;
    margin: 0;
}

.mtbsg-field > span {
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.mtbsg-field small,
.mtbsg-field code {
    color: var(--mtbsg-muted);
    font-size: 11px;
}

.mtbsg input,
.mtbsg select {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    color: #101828;
    background: #fff;
    font: inherit;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
    outline: none;
}


/* Keep native selects clickable above page-builder overlays. */
.mtbsg select {
    position: relative;
    z-index: 3;
    pointer-events: auto !important;
    cursor: pointer;
}

/* Progressive enhancement: without JavaScript, all schedule detail fields stay
   visible and usable. Once JS starts, irrelevant fields are hidden explicitly. */
.mtbsg.mtbsg-js-ready [data-schedule-field][hidden] {
    display: none !important;
}

.mtbsg input:focus,
.mtbsg select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 4px rgba(23,92,211,.1);
}

.mtbsg input[name="smtp_server"],
.mtbsg input[name="smtp_user"],
.mtbsg input[name="smtp_from"],
.mtbsg input[name="email_to"],
.mtbsg input[name="script_name"],
.mtbsg input[name="file_prefix"],
.mtbsg input[name="custom_interval"] {
    direction: ltr;
    text-align: left;
}

.mtbsg-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(100px, .75fr);
    gap: 12px;
}

.mtbsg-input-action {
    display: flex;
    gap: 7px;
}

.mtbsg-input-action input {
    flex: 1 1 auto;
    direction: ltr;
    text-align: left;
}

.mtbsg-mini-button,
.mtbsg-eye {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    color: #344054;
    background: #f9fafb;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
}

.mtbsg-eye {
    width: 44px;
    padding: 0;
    font-size: 17px;
}

.mtbsg-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #344054;
    font-size: 13px;
    cursor: pointer;
}

.mtbsg-check input {
    flex: 0 0 18px;
    width: 18px;
    min-height: 18px;
    margin-top: 4px;
    accent-color: var(--mtbsg-blue);
}

.mtbsg-instructions {
    margin: 0;
    padding-right: 22px;
    color: #344054;
    font-size: 13px;
}

.mtbsg-instructions li {
    margin-bottom: 10px;
}

.mtbsg-actions-primary {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 24px 0;
}

.mtbsg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.mtbsg-button:hover {
    transform: translateY(-1px);
}

.mtbsg-button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--mtbsg-blue), #0e72df);
    box-shadow: 0 10px 24px rgba(23,92,211,.22);
}

.mtbsg-button-secondary {
    color: #344054;
    border-color: #d0d5dd;
    background: #fff;
}

.mtbsg-errors {
    margin: 18px 0;
    padding: 16px 18px;
    border: 1px solid #fecdca;
    border-radius: 14px;
    color: var(--mtbsg-red);
    background: #fef3f2;
    font-size: 13px;
}

.mtbsg-errors ul {
    margin: 8px 0 0;
    padding-right: 20px;
}

.mtbsg-output {
    overflow: hidden;
    border: 1px solid #203957;
    border-radius: 20px;
    background: #07111e;
    box-shadow: 0 24px 60px rgba(7,17,30,.22);
}

.mtbsg-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    color: #fff;
    background: #0d1b2a;
}

.mtbsg-output-header h3 {
    margin: 2px 0;
    font-size: 22px;
}

.mtbsg-output-header p {
    margin: 0;
    color: #98a2b3;
    font-size: 12px;
}

.mtbsg-output-actions {
    display: flex;
    gap: 8px;
}

.mtbsg-button-copy {
    color: #fff;
    background: var(--mtbsg-green);
}

.mtbsg-button-download {
    color: #0d1b2a;
    background: #fdb022;
}

.mtbsg-code-wrap {
    max-height: 620px;
    overflow: auto;
    direction: ltr;
    text-align: left;
}

.mtbsg-code-wrap pre {
    min-width: 820px;
    margin: 0;
    padding: 24px;
    color: #d1e9ff;
    background: #07111e;
    white-space: pre;
    tab-size: 4;
}

.mtbsg-code-wrap code {
    color: inherit;
    background: transparent;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.75;
}

.mtbsg-copy-status {
    min-height: 38px;
    padding: 8px 20px;
    color: #d0d5dd;
    background: #0b1624;
    font-size: 12px;
}

.mtbsg-copy-status.is-success { color: #6ce9a6; }
.mtbsg-copy-status.is-error { color: #fda29b; }

.mtbsg [hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .mtbsg-grid {
        grid-template-columns: 1fr;
    }

    .mtbsg-hero,
    .mtbsg-output-header {
        align-items: stretch;
        flex-direction: column;
    }

    .mtbsg-security-badge {
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .mtbsg {
        margin: 14px auto;
    }

    .mtbsg-hero,
    .mtbsg-card {
        padding: 18px;
        border-radius: 16px;
    }

    .mtbsg-two-columns {
        grid-template-columns: 1fr;
    }

    .mtbsg-actions-primary,
    .mtbsg-output-actions,
    .mtbsg-input-action {
        flex-direction: column;
    }

    .mtbsg-button,
    .mtbsg-mini-button,
    .mtbsg-eye {
        width: 100%;
    }
}

/* Keep conditional fields hidden even when a theme overrides the HTML hidden attribute. */
.mtbsg [hidden] {
    display: none !important;
}
