.chmod-calc {
    max-width: 720px;
    margin: 0 auto;
    font-family: inherit;
    color: inherit;
}

/* Numeric row */
.chmod-numeric-row {
    margin-bottom: 1em;
}

.chmod-numeric-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3em;
}

.chmod-numeric-inputs {
    display: flex;
    gap: 0.3em;
    max-width: 180px;
}

.chmod-numeric-inputs input {
    width: 50px;
    text-align: center;
    padding: 0.5em;
    font-size: 1.3em;
    font-family: monospace;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 4px;
    background: transparent;
    color: inherit;
}

.chmod-numeric-inputs input:focus {
    outline: 2px solid rgba(255, 255, 255, .4);
    outline-offset: -1px;
}

/* Symbolic */
.chmod-symbolic-row {
    margin-bottom: 1.2em;
}

.chmod-symbolic-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3em;
}

.chmod-symbolic {
    font-family: monospace;
    font-size: 1.3em;
    letter-spacing: 0.1em;
    padding: 0.4em 0;
}

/* Matrix */
.chmod-matrix {
    margin-bottom: 1.2em;
}

.chmod-matrix table {
    width: 100%;
    max-width: 400px;
    border-collapse: collapse;
}

.chmod-matrix th,
.chmod-matrix td {
    padding: 0.5em 0.7em;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    text-align: center;
}

.chmod-matrix th:first-child,
.chmod-matrix td:first-child {
    text-align: left;
}

.chmod-matrix thead th {
    font-weight: 600;
    font-size: 0.85em;
    opacity: 0.8;
}

.chmod-matrix tbody th {
    font-weight: 600;
}

.chmod-matrix input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Special bits */
.chmod-special {
    margin-bottom: 1.5em;
}

.chmod-special > label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4em;
}

.chmod-special-row {
    display: flex;
    gap: 1.5em;
    flex-wrap: wrap;
}

.chmod-special-row label {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.9em;
    cursor: pointer;
}

.chmod-special-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Output */
.chmod-output-section {
    margin-top: 1.5em;
}

.chmod-output-section h3 {
    margin: 0 0 0.5em;
}

.chmod-output-wrap {
    position: relative;
}

.chmod-output {
    padding: 1em;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 4px;
    font-family: monospace;
    font-size: 1em;
    margin: 0;
}

.chmod-copy-btn {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    padding: 0.3em 0.5em;
    font-size: 0.85em;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 3px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.chmod-copy-btn:hover {
    opacity: 1;
}

/* Presets */
.chmod-presets {
    margin-top: 2em;
}

.chmod-presets h3 {
    margin: 0 0 0.6em;
}

.chmod-preset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
}

.chmod-preset {
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    font-family: inherit;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.chmod-preset:hover {
    opacity: 1;
}

/* Reference table */
.chmod-reference {
    margin-top: 2em;
}

.chmod-reference h3 {
    margin: 0 0 0.5em;
}

.chmod-ref-table {
    width: 100%;
    max-width: 450px;
    border-collapse: collapse;
    font-size: 0.9em;
}

.chmod-ref-table th,
.chmod-ref-table td {
    padding: 0.4em 0.7em;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    text-align: left;
}

.chmod-ref-table thead th {
    font-weight: 600;
}

.chmod-ref-table td {
    font-family: monospace;
}

/* Responsive */
@media (max-width: 480px) {
    .chmod-special-row {
        flex-direction: column;
        gap: 0.5em;
    }

    .chmod-preset-grid {
        flex-direction: column;
    }

    .chmod-preset {
        width: 100%;
        text-align: left;
    }
}
