/* The Mt* component styles ("2026-11-14 Magic Scales - UI polish and themes" R18, AC-19, part G). The UiComponents
   components MtPage, MtFormCard, MtField, MtFormActions, MtCard, MtStat, MtBadge, MtProgress, MtEmptyState and MtTable
   render plain mt-* elements; these rules style them. Moved unchanged from the Magic Scales host's magicscales.css.
   A host opts in with a <link> right after components.css (Magic Scales does, Wayware does not). Every colour comes
   from a --scheme-* / --mastech-* variable (the --mastech-tone-* set is UiKit's css/themes/roles.css), so the
   components follow the colour scheme. Placement inside host markup stays in the host's own sheet. */

/* ---- Page shell and form card (2026-11-13 Magic Scales - Styling alignment, D1, AC-4b) ---------------------------- */

.mt-page {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    gap: 1rem;
}

.mt-page > h1 {
    margin: 0;
}

.mt-page > h2 {
    margin-block-start: 2rem;
}

.mt-form-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--mastech-border);
    border-radius: 0.75rem;
    background: var(--mastech-surface-raised);
    color: var(--mastech-text);
}

.mt-form-card--auth {
    width: 100%;
    max-width: 360px;
    margin-inline: auto;
    box-sizing: border-box;
}

.mt-form-card > form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}

.mt-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mt-field > input:not([type="checkbox"]):not([type="radio"]),
.mt-field > select,
.mt-field > textarea {
    width: 100%;
    box-sizing: border-box;
}

.mt-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Part H R19: the first button of a form is the primary action, every later one is secondary. The host's R22
   plain-button rule excludes these buttons (Q-G3), so these win whatever the sheet order. */
.mt-form-actions > button {
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    font: inherit;
    cursor: pointer;
}

.mt-form-actions > button:first-of-type {
    background: var(--scheme-primary);
    color: var(--scheme-on-primary);
    border: 1px solid var(--scheme-primary);
}

.mt-form-actions > button + button {
    background: transparent;
    border: 1px solid var(--scheme-primary);
    color: var(--scheme-text);
}

.mt-form-actions > button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.mt-form-actions > button:focus-visible {
    outline: 2px solid var(--scheme-primary);
    outline-offset: 2px;
}

.mt-form-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0;
}

/* ---- Display components (2026-11-14 UI polish and themes, R1, R2) ------------------------------------------------ */

.mt-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    border: 1px solid var(--mastech-border);
    border-radius: 0.75rem;
    background: var(--mastech-surface-raised);
    color: var(--mastech-text);
}

.mt-card--highlight {
    border-color: var(--mastech-tone-info-solid);
    background: var(--mastech-tone-info-background);
}

/* 2026-11-17 Polish round 2 (R0.6, D8): a responsive grid for a list of cards or stats. Layout only, no colour. */
.mt-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
    gap: 1rem;
}

.mt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.mt-card-title {
    margin: 0;
    font-size: 1.1rem;
}

.mt-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mt-card-body > p {
    margin: 0;
}

.mt-stat {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.75rem;
    align-items: center;
}

/* Polish round 2 R26: MtStat and MtEmptyState render Radzen's <i class="rzi">; these sizes win over .rzi's 1.5rem
   because this sheet loads after Radzen's. */
.mt-stat-icon {
    grid-row: span 3;
    font-size: 2rem;
    color: var(--mastech-accent);
}

.mt-stat-label {
    font-size: 0.85rem;
    color: var(--mastech-text-muted);
}

.mt-stat-value {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--mastech-text);
}

.mt-stat-hint {
    font-size: 0.85rem;
    color: var(--mastech-text-muted);
}

.mt-badge {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border: 1px solid var(--mastech-border);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
}

.mt-badge--neutral {
    background: var(--mastech-tone-neutral-background);
    color: var(--mastech-tone-neutral-color);
}

.mt-badge--success {
    border-color: var(--mastech-tone-success-solid);
    background: var(--mastech-tone-success-background);
    color: var(--mastech-tone-success-color);
}

.mt-badge--warning {
    border-color: var(--mastech-tone-warning-solid);
    background: var(--mastech-tone-warning-background);
    color: var(--mastech-tone-warning-color);
}

.mt-badge--danger {
    border-color: var(--mastech-tone-danger-solid);
    background: var(--mastech-tone-danger-background);
    color: var(--mastech-tone-danger-color);
}

.mt-badge--info {
    border-color: var(--mastech-tone-info-solid);
    background: var(--mastech-tone-info-background);
    color: var(--mastech-tone-info-color);
}

.mt-progress {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mt-progress-label {
    font-size: 0.85rem;
    color: var(--mastech-text-muted);
}

.mt-progress-track {
    height: 0.5rem;
    border-radius: 999px;
    background: var(--mastech-surface-sunken);
    overflow: hidden;
}

.mt-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--mastech-tone-success-solid);
}

.mt-progress--warning .mt-progress-fill {
    background: var(--mastech-tone-warning-solid);
}

.mt-progress--danger .mt-progress-fill {
    background: var(--mastech-tone-danger-solid);
}

.mt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--mastech-text-muted);
}

.mt-empty-icon {
    font-size: 2.5rem;
    color: var(--mastech-accent);
}

.mt-empty-title {
    margin: 0;
    font-weight: 600;
    color: var(--mastech-text);
}

.mt-empty-text {
    margin: 0;
}

.mt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.mt-table th,
.mt-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--mastech-border);
    text-align: left;
}

.mt-table th {
    color: var(--mastech-text-muted);
    font-weight: 600;
}

.mt-table tbody tr:nth-child(even) {
    background: var(--mastech-table-row-alternate);
}

.mt-table tbody tr:hover {
    background: var(--mastech-table-row-hover);
}
