.code-management {
    padding: 2rem 1rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.code-click {
    cursor: pointer;
}

.code-click .code-input {
    cursor: pointer;
}

.code-management-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.code-management-header p {
    color: #64748b;
    font-size: 0.9rem;
}

.code-management-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.code-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1.5rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.code-section-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.code-form {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: 1fr 2fr auto;
    align-items: center;
}

.code-form-inline {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto auto;
    align-items: center;
    gap: 0.4rem;
}

.code-form-inline .code-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.code-form-inline .code-inline .code-input {
    min-width: 0;
    width: 100%;
    padding: 0.5rem 0.6rem;
}

.code-form-inline .code-button {
    white-space: nowrap;
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
}

.code-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1.5rem;
}

.code-modal-card {
    background: #ffffff;
    border-radius: 1.5rem;
    width: min(420px, 100%);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #e5e7eb;
}

.code-modal-body {
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
}

.code-modal-close {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1rem;
}

.code-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 0.8rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.code-button {
    border: none;
    background: #111827;
    color: #ffffff;
    padding: 0.6rem 1rem;
    border-radius: 0.8rem;
    font-weight: 700;
}

.code-button.secondary {
    background: #e2e8f0;
    color: #475569;
}

.code-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 420px;
    overflow-y: auto;
}

.code-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-radius: 0.8rem;
    background: #f8fafc;
}

.code-id {
    font-weight: 700;
    color: #1f2937;
    margin-right: 0.6rem;
}

.code-name {
    color: #64748b;
}

.code-actions {
    display: flex;
    gap: 0.4rem;
}

.code-action {
    border: none;
    background: #e2e8f0;
    color: #475569;
    width: 32px;
    height: 32px;
    border-radius: 0.7rem;
}

.code-action.danger {
    background: #fee2e2;
    color: #ef4444;
}

@media (max-width: 640px) {
    .code-form {
        grid-template-columns: 1fr;
    }

    .code-form-inline {
        grid-template-columns: 1fr;
    }
}
