/* PWTERP Masters — namespaced. Do not override Bootstrap globally. */
.mst-page {
    --mst-text: #1e293b;
    --mst-muted: #64748b;
    --mst-border: #e2e8f0;
    --mst-primary: #2563eb;
    color: var(--mst-text);
    max-width: 1200px;
}
.mst-page--wide { max-width: 1400px; }
.mst-page--narrow { max-width: 760px; }
.mst-page--medium { max-width: 860px; }
.mst-page--view .form-control,
.mst-page--view .form-select { background: #f8fafc; }
.mst-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.mst-kicker { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #2563eb; margin-bottom: 4px; }
.mst-title { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.mst-subtitle { margin: 4px 0 0; color: var(--mst-muted); font-size: 13px; }
.mst-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mst-mode {
    font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px; border: 1px solid var(--mst-border); color: var(--mst-muted); background: #f8fafc;
}
.mst-page--view .mst-mode { color: #475569; }
.mst-page--edit .mst-mode { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.mst-card, .mst-form-card, .mst-section {
    background: #fff; border: 1px solid var(--mst-border); border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04); margin-bottom: 14px;
}
.mst-form-card, .mst-section { padding: 16px 18px; }
.mst-section-title {
    margin: 0 0 12px; font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: #475569;
}
.mst-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 14px; }
.mst-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.mst-grid--1 { grid-template-columns: 1fr; }
.mst-field--full { grid-column: 1 / -1; }
.mst-page .form-label { font-size: 12.5px; font-weight: 650; color: #334155; }
.mst-page .form-control, .mst-page .form-select {
    min-height: 40px; font-size: 13.5px; border-radius: 10px; border-color: #cbd5e1;
}
.mst-page .form-control:focus, .mst-page .form-select:focus, .mst-page .btn:focus-visible {
    outline: 2px solid #2563eb; outline-offset: 2px; box-shadow: none;
}
.mst-toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--mst-border); }
.mst-table-wrap { overflow-x: auto; }
.mst-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13px; }
.mst-table thead th {
    background: #f8fafc; color: #475569; font-size: 11.5px; font-weight: 750; letter-spacing: .04em;
    text-transform: uppercase; border-bottom: 1px solid var(--mst-border); padding: 9px 12px; text-align: left; white-space: nowrap;
}
.mst-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.mst-table tbody tr:hover { background: #f8fafc; }
.mst-table .mst-num { text-align: right; font-variant-numeric: tabular-nums; }
.mst-table .mst-actions { text-align: right; white-space: nowrap; }
.mst-status {
    display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 9px;
    font-size: 11.5px; font-weight: 750; border: 1px solid transparent;
}
.mst-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mst-status-active { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.mst-status-inactive { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.mst-empty { padding: 36px 20px; text-align: center; color: var(--mst-muted); }
.mst-empty-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: #334155; }
.mst-alert { border-radius: 10px; border: 1px solid var(--mst-border); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.mst-alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.mst-alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.mst-alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.mst-page .btn { border-radius: 10px; font-weight: 650; font-size: 13px; min-height: 38px; }
.mst-page .btn-sm { min-height: 32px; font-size: 12.5px; }
.mst-page .btn-primary { background: #2563eb; border-color: #2563eb; }
.mst-page .validation-summary-errors { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; color: #991b1b; }
.mst-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--mst-border); margin-bottom: 14px; overflow-x: auto; }
.mst-tab {
    appearance: none; border: 0; background: transparent; color: #475569; font-size: 13px; font-weight: 650;
    padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer;
}
.mst-tab.is-active, .mst-tab[aria-current="page"] { color: #2563eb; border-bottom-color: #2563eb; }
.mst-tab:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.mst-dashboard { display: flex; flex-direction: column; gap: 22px; }
.mst-group-title { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: #475569; }
.mst-group { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.mst-dash-card {
    background: #fff; border: 1px solid var(--mst-border); border-radius: 12px; padding: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04); display: flex; gap: 12px; min-width: 0;
}
.mst-card-icon {
    width: 40px; height: 40px; border-radius: 10px; background: #eff6ff; color: #1d4ed8;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.mst-card-icon svg { width: 18px; height: 18px; }
.mst-search { max-width: 360px; margin-bottom: 16px; }

.mst-bom-wrap { overflow-x: auto; }
.mst-bom { width: 100%; border-collapse: collapse; font-size: 13px; }
.mst-bom thead th {
    position: sticky; top: 0; z-index: 1;
    background: #f8fafc; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    padding: 8px 10px; border-bottom: 1px solid var(--mst-border); text-align: left;
}
.mst-bom-parent td { background: #fff; font-weight: 650; border-bottom: 1px solid #e8eef5; padding: 8px 10px; }
.mst-bom-child td { background: #f8fafc; padding: 7px 10px 7px 28px; color: #334155; border-bottom: 1px solid #f1f5f9; }
.mst-bom .mst-num { text-align: right; font-variant-numeric: tabular-nums; }
.mst-bom-foot td { background: #eff6ff; font-weight: 750; padding: 10px; }

@media (max-width: 1024px) {
    .mst-group { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 768px) {
    .mst-grid, .mst-grid--3, .mst-group { grid-template-columns: 1fr; }
    .mst-field--full { grid-column: auto; }
}
