.note-freq {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.nf-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* A4 reference */
.nf-ref {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.nf-ref-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--text);
}

.nf-ref-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nf-ref-input .field {
    width: 7rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Three linked fields in a row, wrapping on small screens */
.nf-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.nf-field {
    flex: 1 1 12rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nf-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.nf-field .field {
    width: 100%;
}

.nf-with-unit {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nf-with-unit .field {
    flex: 1 1 auto;
}

.nf-unit {
    color: var(--muted);
    font-size: 0.9rem;
}

#nf-freq,
#nf-midi {
    font-variant-numeric: tabular-nums;
}

/* Validation message */
.nf-message {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: var(--accent-weak);
    color: var(--text);
    font-size: 0.9rem;
}

.nf-message[hidden] {
    display: none;
}

/* Reference table: scrollable with a sticky header */
.nf-table-wrap {
    max-height: 28rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.nf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.nf-table th,
.nf-table td {
    padding: 0.5rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.nf-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nf-table tbody tr:last-child td {
    border-bottom: none;
}

.nf-cell-note {
    font-weight: 600;
    color: var(--text);
}

.nf-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
