:root {

    --msa-primary: #2563eb;
    --msa-border: #dbe3ed;

    --msa-success: #15803d;
    --msa-success-bg: #f0fdf4;

    --msa-danger: #b91c1c;
    --msa-danger-bg: #fef2f2;

    --msa-text: #1f2937;
    --msa-card: #ffffff;

    --msa-pruefung-bg: #93c5fd;
    --msa-abschluss-bg: #fde68a;
}

* {
    box-sizing: border-box;
}

.msa-input-table th .dashicons{
    font-size:20px;
    width:20px;
    height:20px;
    vertical-align:middle;
    color:#2563eb;
}

.msa-pn-label {
    display: inline-block;
    margin-right: 4px;
    font-weight: 700;
    vertical-align: middle;
}

/* Abkürzungs-Tooltips: Hover am Desktop, Antippen/Fokus auf Mobilgeräten. */
.msa-input-table th.msa-abbr {
    position: relative;
    cursor: help;
}

.msa-input-table th.msa-abbr::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
    width: max-content;
    max-width: 260px;
    padding: 7px 9px;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 100;
    transition: opacity .12s ease, transform .12s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}

.msa-input-table th.msa-abbr:hover::after,
.msa-input-table th.msa-abbr:focus::after,
.msa-input-table th.msa-abbr.msa-tooltip-open::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .msa-input-table th.msa-abbr::after {
        max-width: 190px;
        font-size: 11px;
        padding: 6px 8px;
        top: calc(100% + 5px);
    }
}

.msa-input-table th:nth-child(5) {
    background: #f3f4f6;
}

.msa-input-table th:nth-child(5) .dashicons {
    color: #7c3aed;
}

.msa-input-table th:nth-child(4) .dashicons {
    color: #2563eb;
}

.msa-container {

    max-width: 950px;
    margin: 20px auto;
    padding: 12px;

    color: var(--msa-text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

.msa-card,
.msa-card-result {

    background: var(--msa-card);

    border: 1px solid var(--msa-border);

    border-radius: 10px;

    padding: 15px;

    margin-bottom: 16px;
}

.msa-disclaimer {

    background: #f8fafc;

    border-left: 4px solid var(--msa-primary);

    padding: 10px 12px;

    margin-bottom: 14px;

    border-radius: 6px;

    font-size: .9rem;
}

/* ==========================
   EINGABETABELLE
   ========================== */

.msa-input-table {

    width: 100%;

    border-collapse: collapse;

    table-layout: fixed;
}

.msa-input-table thead {

    background: #f8fafc;
}

.msa-input-table th {

    padding: 8px;

    border-bottom: 2px solid var(--msa-border);

    text-align: center;

    font-size: .95rem;
}

.msa-input-table td {

    padding: 6px;

    border-bottom: 1px solid #edf2f7;

    text-align: center;
}

.msa-input-table td:first-child,
.msa-input-table th:first-child {

    text-align: left;
}

/* Breiten */

.msa-input-table th:nth-child(1) {
    width: 30%;
}

.msa-input-table th:nth-child(6) {
    width: 12%;
}

/* ==========================
   FACHFARBEN
   ========================== */

.msa-input-table tbody tr.msa-pruefungsfach td {
    background: var(--msa-pruefung-bg);
}

.msa-input-table tbody tr.msa-abschlussfach td {
    background: var(--msa-abschluss-bg);
}


/* ==========================
   DROPDOWNS
   ========================== */

.msa-select {

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    width: 58px;

    padding: 4px;

    border: 1px solid var(--msa-border);

    border-radius: 6px;

    text-align: center;

    background: #ffffff;

    cursor: pointer;

    font-size: .95rem;
}

.msa-select:disabled {

    opacity: .55;
    cursor: not-allowed;
    background: transparent;
    border-color: transparent;
}

.msa-select:focus {

    outline: none;

    border-color: var(--msa-primary);

    box-shadow:
        0 0 0 2px rgba(37,99,235,.15);
}

/* ==========================
   GESAMTNOTEN
   ========================== */

.note-good {

    color: var(--msa-success);

    font-weight: 700;
}

.note-critical {

    color: var(--msa-danger);

    font-weight: 700;
}

/* ==========================
   STATUSBOX
   ========================== */

.msa-status-alert {

    padding: 15px;

    border-radius: 8px;

    margin-bottom: 12px;

    font-size: 1rem;
}

.alert-success {

    background: var(--msa-success-bg);

    color: var(--msa-success);

    border-left: 5px solid var(--msa-success);
}

.alert-danger {

    background: var(--msa-danger-bg);

    color: var(--msa-danger);

    border-left: 5px solid var(--msa-danger);
}

/* ==========================
   FOS
   ========================== */

.msa-fos-box {

    text-align: center;
}

#msa-fos-val {

    font-size: 1.8rem;

    font-weight: 700;

    color: var(--msa-primary);
}

.fos-success {

    background: #dcfce7;

    color: #166534;

    border-radius: 6px;

    padding: 10px;

    font-weight: 700;

    margin: 10px 0;
}

.fos-fail {

    background: #fee2e2;

    color: #991b1b;

    border-radius: 6px;

    padding: 10px;

    font-weight: 700;

    margin: 10px 0;
}

.msa-hints-wrapper{

    margin-top:20px;

    padding-top:15px;

    border-top:1px solid #e5e7eb;
}

.msa-hints-wrapper h4{

    margin-bottom:10px;
}

.msa-hints-wrapper ul{

    margin:0;
    padding-left:20px;
}

.msa-hints-wrapper li{

    margin-bottom:5px;
}

/* ==========================
   SMARTPHONE
   ========================== */

@media (max-width: 768px) {

    .msa-container {

        padding: 6px;
    }

    .msa-input-table {

        font-size: .82rem;
    }

    .msa-input-table th,
    .msa-input-table td {

        padding: 4px 2px;
    }

    .msa-input-table th:first-child {
        width: 28%;
    }

    .msa-input-table th {
        font-size: .72rem;
        line-height: 1.1;
    }

    .msa-input-table .msa-pn-label {
        margin-right: 1px;
    }

    .msa-input-table th .dashicons {
        font-size: 17px;
        width: 17px;
        height: 17px;
    }

    .msa-select {

        width: 100%;

        min-width: 42px;

        font-size: .85rem;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: none;
    }

    #msa-fos-val {

        font-size: 1.4rem;
    }
}
/* ==========================
   KOMPAKTE SPRECHBLASE
   ========================== */

.msa-speech-icon {
    display: inline-block;
    position: relative;
    width: 13px;
    height: 10px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    vertical-align: -1px;
}

.msa-speech-icon::after {
    content: "";
    position: absolute;
    left: 2px;
    bottom: -4px;
    width: 4px;
    height: 4px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    background: transparent;
    transform: skew(-18deg) rotate(-8deg);
}

.msa-input-table th:nth-child(4) .msa-speech-icon,
.msa-input-table th:nth-child(4) .msa-speech-icon::after {
    color: #2563eb;
}

.msa-input-table th:nth-child(5) .msa-speech-icon,
.msa-input-table th:nth-child(5) .msa-speech-icon::after {
    color: #7c3aed;
}

/* ==========================
   BERECHNUNGSAUFSCHLÜSSELUNG
   ========================== */

.msa-calculation-wrapper {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--msa-border);
}

.msa-calculation-wrapper h4 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.msa-calculation-details {
    display: grid;
    gap: 8px;
}

.msa-calculation-item {
    padding: 9px 11px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #f8fafc;
    line-height: 1.45;
    font-size: .9rem;
}

.msa-calculation-item strong {
    display: block;
    margin-bottom: 2px;
}

.msa-calculation-formula {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .86rem;
}

.msa-calculation-note {
    color: #64748b;
    font-size: .82rem;
}

@media (max-width: 768px) {
    .msa-calculation-item {
        padding: 8px 9px;
        font-size: .84rem;
    }

    .msa-calculation-formula {
        font-size: .78rem;
        overflow-wrap: anywhere;
    }
}

/* ==========================
   BEISPIELNOTEN
   ========================== */

.msa-example-controls {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 12px;
    flex-wrap: wrap;
}

.msa-example-button {
    border: 0;
    border-radius: 6px;
    padding: 7px 11px;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    background: #334155;
    color: #fff;
    transition: opacity .15s ease, transform .05s ease;
}

.msa-example-button:hover {
    opacity: .9;
}

.msa-example-button:active {
    transform: translateY(1px);
}

.msa-example-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.msa-example-button.is-used {
    background: #475569;
}

.msa-example-hint {
    color: #64748b;
    font-size: .78rem;
}

@media (max-width: 768px) {
    .msa-example-controls {
        align-items: flex-start;
        gap: 5px;
        margin-bottom: 9px;
    }

    .msa-example-button {
        width: auto;
        padding: 7px 9px;
        font-size: .82rem;
    }

    .msa-example-hint {
        width: 100%;
        font-size: .74rem;
    }
}
