/* ── Maintenance Overlay ──────────────────────────────────────────────────── */

.maint-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, .97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 24px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.maint-card {
    text-align: center;
    max-width: 500px;
    width: 100%;
    padding: 48px 36px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, .12);
    border-top: 5px solid #f39c12;
}

.maint-icon {
    font-size: 3.2rem;
    line-height: 1;
    margin-bottom: 20px;
    display: block;
}

.maint-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin: 0 0 14px;
}

.maint-message {
    font-size: .95rem;
    color: #495057;
    line-height: 1.65;
    margin: 0 0 14px;
}

.maint-until {
    font-size: .85rem;
    color: #6c757d;
    margin: 0;
}

/* ── Maintenance Inline (page-scope only) ────────────────────────────────── */

.maint-inline {
    margin: 24px 0;
}

.maint-inline .maint-card {
    text-align: left;
    max-width: 100%;
    width: fit-content;
    padding: 28px 28px 24px;
    border-radius: 10px;
    border-top: 4px solid #f39c12;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
    box-sizing: border-box;
}

.maint-inline .maint-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.maint-inline .maint-title {
    font-size: 1.15rem;
}

/* ── Maintenance Manager Admin UI ────────────────────────────────────────── */

#maintenance-manager {
    font-family: inherit;
    color: var(--fm-text, #212529);
}

.mm-shell {
    background: #fff;
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 8px;
    overflow: hidden;
}

.mm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
    gap: 12px;
    flex-wrap: wrap;
}

.mm-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.mm-list {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mm-empty {
    padding: 40px;
    text-align: center;
    color: var(--fm-muted, #6c757d);
    font-size: .9rem;
    font-style: italic;
}

/* ── Rule cards ───────────────────────────────────────────────────────────── */

.mm-card {
    border: 1px solid var(--fm-border, #e2e6ea);
    border-left: 4px solid #f39c12;
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.mm-card--inactive {
    border-left-color: var(--fm-border, #e2e6ea);
    opacity: .7;
}

.mm-card-body { flex: 1; min-width: 0; }

.mm-card-scope {
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: .78rem;
    color: var(--fm-muted, #6c757d);
    margin-top: 4px;
}

.mm-badge {
    background: var(--fm-bg, #f8f9fa);
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 4px;
    padding: 1px 7px;
    font-size: .72rem;
    white-space: nowrap;
}

.mm-badge--active {
    background: #fef9e7;
    border-color: #f9d175;
    color: #7d5c00;
    font-weight: 600;
}

.mm-badge--inactive {
    background: var(--fm-bg, #f8f9fa);
    color: var(--fm-muted, #6c757d);
}

.mm-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.mm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.mm-modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
}

.mm-modal-title { font-weight: 600; font-size: 1rem; }

.mm-modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: var(--fm-muted, #6c757d); padding: 2px 8px;
    border-radius: 4px;
}
.mm-modal-close:hover { background: var(--fm-bg, #f8f9fa); }

.mm-modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mm-modal-foot {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--fm-border, #e2e6ea);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Form elements ────────────────────────────────────────────────────────── */

.mm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .mm-row { grid-template-columns: 1fr; } }

.mm-field { display: flex; flex-direction: column; gap: 5px; }

.mm-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--fm-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mm-input, .mm-select, .mm-textarea {
    padding: 8px 10px;
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 6px;
    font-size: .9rem;
    font-family: inherit;
    color: var(--fm-text, #212529);
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}

.mm-input:focus, .mm-select:focus, .mm-textarea:focus {
    outline: none;
    border-color: var(--fm-accent, #1a6bb5);
    box-shadow: 0 0 0 3px rgba(26, 107, 181, .12);
}

.mm-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* ── Toggle ───────────────────────────────────────────────────────────────── */

.mm-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: .9rem;
}

.mm-toggle-wrap input { cursor: pointer; }

/* ── Hidden helper ────────────────────────────────────────────────────────── */

.mm-hidden { display: none !important; }

/* ── Build-Log card (%BUILD_LOG_*% placeholder) ──────────────────────────── */

.bl-card {
    display: inline-block;
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 8px;
    overflow: hidden;
    font-size: .875rem;
    min-width: 260px;
}

.bl-head {
    padding: 10px 14px;
    background: var(--fm-bg, #f8f9fa);
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
    font-size: .8rem;
    color: var(--fm-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.bl-table {
    width: 100%;
    border-collapse: collapse;
}

.bl-table tr + tr td {
    border-top: 1px solid var(--fm-border, #e2e6ea);
}

.bl-label {
    padding: 7px 14px;
    color: var(--fm-muted, #6c757d);
    white-space: nowrap;
    font-size: .8rem;
    width: 1%;
}

.bl-value {
    padding: 7px 14px 7px 0;
    color: var(--fm-text, #212529);
    font-weight: 500;
}

.bl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.bl-badge--done    { background: #d4edda; border-color: #b8dfc4; color: #155724; }
.bl-badge--building{ background: #fff3cd; border-color: #f9d175; color: #7d5c00; }
.bl-badge--failed  { background: #f8d7da; border-color: #f0b8b8; color: #721c24; }
.bl-badge--unknown { background: var(--fm-bg, #f8f9fa); border-color: var(--fm-border, #e2e6ea); color: var(--fm-muted, #6c757d); }

/* ── Toolbar Settings (%TOOLBAR_SETTINGS% placeholder) ───────────────────── */

#toolbar-settings {
    font-family: inherit;
    color: var(--fm-text, #212529);
}

.ts-wrap { overflow-x: auto; }

.ts-table {
    width: 100%;
    border-collapse: collapse;
}

.ts-th-wiki,
.ts-th-item {
    padding: 9px 16px;
    background: var(--fm-bg, #f8f9fa);
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--fm-muted, #6c757d);
    white-space: nowrap;
    text-align: center;
}

.ts-th-wiki { text-align: left; }

.ts-row + .ts-row td { border-top: 1px solid var(--fm-border, #e2e6ea); }
.ts-row:hover td { background: var(--fm-bg, #f8f9fa); }

.ts-td-wiki {
    padding: 10px 16px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--fm-text, #212529);
    white-space: nowrap;
}

.ts-td-item {
    padding: 8px 16px;
    text-align: center;
    vertical-align: middle;
}

.ts-loading {
    padding: 32px;
    text-align: center;
    color: var(--fm-muted, #6c757d);
    font-size: .875rem;
    font-style: italic;
}

/* Toggle switch */
.ts-toggle {
    display: inline-block;
    cursor: pointer;
    position: relative;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}

.ts-toggle input { display: none; }

.ts-knob {
    position: absolute;
    inset: 0;
    background: var(--fm-border, #ced4da);
    border-radius: 18px;
    transition: background .18s;
}

.ts-knob::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: left .18s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.ts-toggle input:checked + .ts-knob { background: var(--fm-accent, #1a6bb5); }
.ts-toggle input:checked + .ts-knob::after { left: 18px; }

/* ── PHP Settings card (%PHP_SETTINGS% placeholder) ──────────────────────── */

.ps-card {
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 8px;
    overflow: hidden;
    font-size: .8rem;
    max-width: 780px;
}

.ps-head {
    padding: 8px 12px;
    background: var(--fm-bg, #f8f9fa);
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
    font-size: .78rem;
    color: var(--fm-muted, #6c757d);
    letter-spacing: .02em;
}

.ps-section-head {
    padding: 5px 12px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--fm-muted, #6c757d);
    background: var(--fm-bg, #f8f9fa);
    border-top: 1px solid var(--fm-border, #e2e6ea);
    border-bottom: 1px solid var(--fm-border, #e2e6ea);
}

/* Extensions — 3-column pill grid */

.ps-ext-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 6px 8px;
}

@media (max-width: 600px) {
    .ps-ext-grid { grid-template-columns: repeat(2, 1fr); }
}

.ps-ext {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px 4px;
    border-radius: 4px;
    min-width: 0;
}

.ps-ext:hover { background: var(--fm-bg, #f8f9fa); }

.ps-ext-name {
    font-size: .78rem;
    color: var(--fm-text, #212529);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.ps-ver {
    font-size: .68rem;
    color: var(--fm-muted, #6c757d);
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--fm-bg, #f8f9fa);
    border: 1px solid var(--fm-border, #e2e6ea);
    border-radius: 3px;
    padding: 0 4px;
    line-height: 1.6;
}

/* Composer packages */

.ps-pkg-list {
    padding: 4px 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ps-pkg {
    padding: 4px 4px;
    border-radius: 4px;
}

.ps-pkg:hover { background: var(--fm-bg, #f8f9fa); }

.ps-pkg-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ps-pkg-name {
    font-size: .78rem;
    color: var(--fm-text, #212529);
    font-weight: 500;
    min-width: 0;
}

.ps-pkg-author {
    font-size: .7rem;
    color: var(--fm-muted, #6c757d);
    margin-top: 1px;
    padding-left: 2px;
}
