#section-master.master-frame {
    --accent: #6525ef;
    --accent-line: #6525ef;
    --text: #111111;
    --text-dim: #494949;
    --text-faint: #585858;
    --border: #adadad;
    padding: clamp(20px, 3vw, 40px);
    border: 1px solid #323232;
    background: #fff;
    color: var(--text);
}

.master-frame .master-section-head {
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
}

.master-frame .lab-section-title h2 {
    font-family: var(--font-sans);
    font-size: clamp(1.4rem, 2.5vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.15;
    text-wrap: pretty;
}

.master-frame .master-edition-field select {
    min-width: 160px;
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid #323232;
    border-radius: 0;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.master-frame .master-dashboard {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.master-view-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #323232;
}

.master-view-tabs [role="tab"] {
    min-height: 52px;
    margin-bottom: -1px;
    padding: 12px 20px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #111;
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 120ms ease-out, border-color 120ms ease-out;
}

.master-view-tabs [aria-selected="true"] {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.master-frame :is(button, a, summary, select, input, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.master-frame-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    padding: 26px 16px;
    border-bottom: 1px solid #323232;
}

.master-frame-hero-copy {
    padding: 16px 0;
}

.master-frame-hero h3 {
    margin: 0 0 14px;
    color: #111;
    font-family: var(--font-sans);
    font-size: clamp(1.75rem, 2.75vw, 2.65rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.12;
    text-wrap: pretty;
}

.master-frame-hero p {
    margin: 8px 0;
    color: #111;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.5;
}

.master-frame-hero-action {
    margin-top: 22px;
}

.master-frame .btn-accent,
.master-frame .master-file-label {
    min-height: 44px;
    padding: 10px 22px;
    border: 1px solid var(--accent);
    border-radius: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    box-shadow: none;
}

.master-frame .btn-accent:hover,
.master-frame .master-file-label:hover {
    border-color: #4e18c4;
    background: #4e18c4;
}

.master-frame-art {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    mix-blend-mode: multiply;
}

.master-frame-program {
    padding: 18px 16px 0;
}

.master-frame .master-progress-heading {
    align-items: center;
    margin-bottom: 10px;
}

.master-frame .master-progress-heading h3 {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 650;
}

.master-frame .master-progress-heading .master-cert-count {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 400;
    white-space: nowrap;
}

.master-frame .master-missing-list {
    display: block;
    margin-top: 0;
}

.master-program-group {
    border-bottom: 1px solid #787878;
}

.master-frame summary.master-program-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px;
    color: #111;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    list-style: none;
    cursor: pointer;
}

.master-program-group > .master-program-block::-webkit-details-marker {
    display: none;
}

.master-program-group > .master-program-block::after {
    content: '';
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    border-bottom: 1px solid currentColor;
    border-right: 1px solid currentColor;
    transform: rotate(45deg);
}

.master-program-group[open] > .master-program-block::after {
    color: var(--accent);
    transform: rotate(225deg);
}

.master-program-rows {
    border: 1px solid var(--border);
    border-bottom: 0;
}

.master-frame .master-missing-item {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 42px;
    margin: 0;
    padding: 8px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.master-frame .master-missing-title {
    color: #111;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.master-workshop-code,
.master-workshop-status {
    color: #494949;
    font-size: 0.82rem;
    line-height: 1.4;
}

.master-frame .master-missing-btn {
    min-height: 36px;
    border: 1px solid var(--accent);
    border-radius: 0;
    color: var(--accent);
    background: transparent;
    font-size: 0.82rem;
}

.master-frame [data-master-view="company"],
.master-frame [data-master-view="certificate"] {
    padding: 32px 16px;
}

.master-frame .master-passport h3,
.master-frame .master-achievement-heading h3 {
    margin: 0 0 14px;
    font-family: var(--font-sans);
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.master-frame .master-passport p,
.master-frame .master-achievement-heading p,
.master-frame-install p {
    margin: 12px 0;
    color: #494949;
    font-size: 1rem;
    line-height: 1.6;
}

.master-company-help {
    margin: 18px 0;
}

.master-frame .master-passport > summary {
    min-height: 44px;
    padding: 12px 0;
    cursor: pointer;
    font-weight: 500;
    color: #111;
}

.master-company-help ol {
    margin: 10px 0;
    padding-left: 22px;
    line-height: 1.7;
}

.master-frame .master-file-label {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    cursor: pointer;
}

.master-sr-only,
.master-frame .master-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.master-file-label:has(+ input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.master-frame #masterPassportPrivacy,
.master-frame #masterPassportMessage {
    font-size: 0.88rem;
}

.master-frame-install {
    margin: 0;
}

.master-install-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: center;
    gap: 20px;
}

.master-install-heading h3 {
    margin: 0 0 12px;
    color: #111;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.master-install-art {
    display: block;
    width: 100%;
    height: auto;
}

.master-install-steps {
    width: min(100%, 860px);
    box-sizing: border-box;
    margin: 24px 0;
    padding-left: 26px;
}

.master-install-steps > li {
    margin: 0 0 26px;
    padding-left: 4px;
    color: #111;
}

.master-install-steps > li::marker {
    font-size: 1.2rem;
    font-weight: 650;
}

.master-install-steps h4,
.master-cert-actions h4 {
    margin: 0 0 12px;
    color: #111;
    font-size: 1.2rem;
    font-weight: 650;
}

.master-app-choices {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.master-app-choices button {
    min-width: 0;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #585858;
    border-radius: 0;
    background: #fff;
    color: #111;
    font: inherit;
    line-height: 1.35;
    cursor: pointer;
}

.master-app-choices button:hover {
    border-color: var(--accent);
}

.master-app-choices [aria-pressed="true"] {
    border-color: var(--accent);
    background: #f4efff;
    color: #4e18c4;
}

.master-install-copy {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.master-install-copy textarea {
    flex: 1;
    min-width: 0;
    min-height: 64px;
    padding: 14px;
    border: 1px solid var(--border, #787878);
    border-radius: 0;
    background: transparent;
    color: var(--text, #111);
    font: 0.9rem/1.6 var(--font-mono);
    overflow-wrap: anywhere;
    resize: none;
}

.master-frame .master-install-copy .btn {
    flex: 0 0 auto;
    min-height: 48px;
    align-self: stretch;
    white-space: nowrap;
}

.master-frame-install .master-copy-status {
    min-height: 1.5em;
    margin: 0;
    color: #4e18c4;
    font-size: 0.88rem;
}

#masterStartCommand {
    display: inline-block;
    max-width: 100%;
    padding: 5px 12px;
    border: 1px solid #787878;
    background: #fafafa;
    color: #111;
    overflow-wrap: anywhere;
}

.master-frame .master-passport {
    padding: 16px 0 0;
    border: 0;
    border-top: 1px solid #787878;
    background: #fff;
}

.master-frame .master-achievement-panel {
    padding: 0;
    border: 0;
    background: transparent;
}

.master-certificate-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    align-items: start;
    gap: 36px;
}

.master-certificate-preview {
    min-width: 0;
}

.master-frame .master-achievement-panel .master-cert {
    display: block;
    margin: 22px 0 14px;
}

.master-frame .master-cert-frame {
    width: 100%;
    max-width: none;
    min-height: 370px;
    box-sizing: border-box;
    padding: 30px 24px;
    aspect-ratio: 3 / 2;
    border: 1px solid #111;
    border-radius: 0;
    outline: 1px solid #111;
    outline-offset: -9px;
    background: #fff;
    box-shadow: none;
}

.master-frame .master-cert.is-locked .master-cert-frame {
    filter: none;
    opacity: 1;
}

.master-frame .master-cert-overlay {
    position: static;
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    color: #111;
}

.master-frame .master-cert-overlay > * {
    position: static;
    width: auto;
    max-width: 100%;
    margin: 0;
    text-align: center;
}

.master-frame .master-cert-eyebrow,
.master-frame .master-cert-for {
    color: #111;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
}

.master-frame .master-cert-title,
.master-frame .master-cert-title em {
    color: #111;
    font-family: Georgia, serif !important;
    font-size: 1.65rem;
    font-weight: 400;
}

.master-frame .master-cert-name,
.master-frame .master-cert-name.is-empty {
    padding: 0;
    color: #111;
    font-family: Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.master-frame .master-cert-name::after {
    width: 45%;
    height: 1px;
    margin: 12px auto 4px;
    background: var(--accent);
}

.master-frame .master-cert-edition,
.master-frame .master-cert-desc,
.master-frame .master-cert-id,
.master-frame .master-cert-sig-date {
    color: #494949;
    font-size: 0.75rem;
    line-height: 1.5;
    text-wrap: pretty;
}

.master-frame .master-cert-sig {
    position: static;
    gap: 8px;
    margin-top: 6px;
}

.master-frame .master-cert-sig::before {
    content: none;
}

.master-frame .master-cert-sig-brand {
    margin: 0;
    color: #111;
    font-family: Georgia, serif;
    font-size: 1.15rem;
    font-weight: 400;
}

.master-cert-preview-note {
    display: inline-block;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid var(--accent);
    color: #4e18c4;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.master-frame .master-achievement-panel .master-cert-actions {
    display: flex;
    min-width: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    gap: 16px;
    align-items: stretch;
}

.master-frame .master-cert-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.master-frame .master-cert-controls :is(label, input, select) {
    width: 100%;
    min-width: 0;
    color: #111;
    font-size: 1rem;
}

.master-frame .master-cert-controls :is(input, select, .btn) {
    border-radius: 0;
    box-shadow: none;
}

.master-frame .master-cert-controls :is(input, select) {
    min-height: 48px;
    border-color: #787878;
    background: #fff;
}

.master-frame .master-cert-controls input::placeholder {
    color: #585858;
}

.master-frame .master-cert-actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    border-radius: 0;
    box-shadow: none;
}

.master-frame .master-cert-actions .btn:disabled {
    border-color: #b0b0b0;
    background: #ededed;
    color: #494949;
    cursor: not-allowed;
    opacity: 1;
}

.master-certificate-progress {
    margin-top: 8px;
    padding-top: 22px;
    border-top: 1px solid #adadad;
}

.master-frame .master-cert-actions p {
    margin: 0 0 12px;
    color: #494949;
    font-size: 0.95rem;
    line-height: 1.5;
}

.master-frame .master-certificate-progress .master-cert-lead {
    color: #111;
    font-size: 1.15rem;
    font-weight: 650;
}

.master-text-action {
    min-height: 44px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: #4e18c4;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.master-cert-more-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.master-frame .master-edition-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 20px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.master-frame-edition {
    margin: 0;
    border-top: 1px solid #787878;
    border-bottom: 1px solid #787878;
}

.master-edition-info > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.master-edition-info > div + div {
    padding-left: 24px;
    border-left: 1px solid #adadad;
}

.master-frame .master-edition-label,
.master-frame .master-edition-detail {
    color: #494949;
    font-size: 0.85rem;
    line-height: 1.4;
}

.master-edition-info strong,
.master-edition-info a {
    color: #111;
    font-size: 1rem;
    line-height: 1.4;
}

.master-edition-info a {
    color: #4e18c4;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.master-frame-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 16px 10px;
    font-size: 0.88rem;
}

.master-frame-footer a {
    color: #222;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 4px;
}

@media (max-width: 760px) {
    #section-master.master-frame {
        padding: 20px 14px;
    }

    .master-frame .master-section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .master-view-tabs {
        gap: 0;
    }

    .master-view-tabs [role="tab"] {
        flex: 1;
        padding: 12px 7px;
        font-size: 0.95rem;
    }

    .master-frame-hero {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 18px 0;
    }

    .master-frame-art {
        width: min(100%, 440px);
        justify-self: center;
    }

    .master-frame-program {
        padding: 20px 0 0;
    }

    .master-frame .master-progress-heading {
        gap: 10px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .master-frame summary.master-program-block {
        padding: 12px 6px;
        font-size: 0.92rem;
    }

    .master-frame .master-missing-item {
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 6px 10px;
        padding: 12px 8px;
    }

    .master-workshop-status,
    .master-frame .master-missing-item .master-missing-btn {
        grid-column: 2;
        justify-self: start;
    }

    .master-frame .master-missing-btn {
        min-height: 44px;
    }

    .master-frame [data-master-view="company"],
    .master-frame [data-master-view="certificate"] {
        padding: 28px 0;
    }

    .master-install-heading {
        grid-template-columns: 1fr;
    }

    .master-install-heading h3 {
        font-size: 1.8rem;
    }

    .master-install-art {
        display: none;
    }

    .master-install-steps {
        margin-top: 12px;
        padding-left: 22px;
    }

    .master-app-choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .master-install-copy {
        flex-direction: column;
    }

    .master-install-copy textarea {
        width: 100%;
        min-height: 132px;
        box-sizing: border-box;
    }

    .master-certificate-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .master-frame .master-cert-frame {
        min-height: 350px;
        aspect-ratio: auto;
        padding: 26px 20px;
    }

    .master-frame .master-cert-name {
        font-size: 1.65rem;
    }

    .master-frame .master-cert-title,
    .master-frame .master-cert-title em {
        font-size: 1.4rem;
    }

    .master-frame .master-edition-info {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        padding: 18px 0;
    }

    .master-edition-info > div + div {
        padding-left: 0;
        border-left: 0;
    }

    .master-edition-info > div:last-child {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: baseline;
        gap: 7px 12px;
    }

    .master-edition-info > div:last-child .master-edition-detail {
        grid-column: 1 / -1;
    }

    .master-frame-footer {
        flex-wrap: wrap;
        padding: 24px 0 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .master-view-tabs [role="tab"] {
        transition: none;
    }
}
