/* Magnet Calculator — scoped to left panel only */

.sam-magnet-tool .magnet-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0.36rem;
    border-bottom: 1px solid rgba(183, 183, 183, 0.3);
}

.sam-magnet-tool .magnet-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: #666;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.18rem, 14px);
    font-weight: 700;
    line-height: 1.2;
    padding: 0.12rem 0.2rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.sam-magnet-tool .magnet-tab:hover {
    color: #2F67B3;
}

.sam-magnet-tool .magnet-tab.is-active {
    color: #2F67B3;
    border-bottom-color: #2F67B3;
}

.sam-magnet-tool .magnet-tab:focus {
    outline: none;
}

.sam-magnet-tool .magnet-tab:focus-visible {
    outline: none;
    color: #2F67B3;
}

.sam-magnet-tool .magnet-panel {
    display: none;
}

.sam-magnet-tool .magnet-panel.is-active {
    display: block;
    padding-top: 0.12rem;
}

.sam-magnet-tool .magnet-layout {
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.sam-magnet-tool .magnet-inputs,
.sam-magnet-tool .magnet-results {
    flex: 1 1 4.2rem;
    min-width: 3.6rem;
}

.sam-magnet-tool .magnet-results {
    padding-top: 0.04rem;
}

.sam-magnet-tool .magnet-field {
    display: flex;
    align-items: center;
    margin-bottom: 0.14rem;
    gap: 0.12rem;
}

.sam-magnet-tool .magnet-field label {
    flex: 0 0 2.4rem;
    color: #333;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.16rem, 13px);
    font-weight: 400;
    line-height: 1.3;
}

.sam-magnet-tool .magnet-field .field-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.08rem;
    min-width: 0;
}

.sam-magnet-tool .magnet-field input,
.sam-magnet-tool .magnet-field select {
    width: 100%;
    height: 0.4rem;
    min-height: 36px;
    padding: 0.05rem 0.12rem;
    border-radius: 0.06rem;
    border: 1px solid #A9A9A9;
    background: #FFF;
    color: #333;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.16rem, 14px);
    box-sizing: border-box;
}

.sam-magnet-tool .magnet-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 0.4rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.16rem center;
    background-size: 12px 8px;
}

.sam-magnet-tool .magnet-field select::-ms-expand {
    display: none;
}

.sam-magnet-tool .magnet-field input:focus,
.sam-magnet-tool .magnet-field select:focus {
    outline: none;
    border-color: #2F67B3;
}

.sam-magnet-tool .magnet-field .unit-suffix {
    color: #666;
    font-size: max(0.14rem, 12px);
    white-space: nowrap;
}

.sam-magnet-tool .magnet-actions {
    margin: 0.12rem 0 0.16rem;
}

.sam-magnet-tool .magnet-btn {
    appearance: none;
    border: 1px solid #2F67B3;
    background: #2F67B3;
    color: #fff;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.16rem, 14px);
    font-weight: 700;
    line-height: 1.2;
    padding: 0.1rem 0.18rem;
    border-radius: 0.06rem;
    cursor: pointer;
    min-height: 40px;
}

.sam-magnet-tool .magnet-btn:hover {
    background: #255691;
    border-color: #255691;
}

.sam-magnet-tool .magnet-btn:focus,
.sam-magnet-tool .magnet-btn:focus-visible {
    outline: none;
}

.sam-magnet-tool .magnet-btn--ghost {
    background: #fff;
    color: #2F67B3;
}

.sam-magnet-tool .magnet-btn--ghost:hover {
    background: #F1F1F1;
    color: #255691;
}

.sam-magnet-tool .result-card {
    border: 1px solid rgba(183, 183, 183, 0.45);
    border-radius: 4px;
    padding: 0.14rem 0.16rem;
    margin-bottom: 0.12rem;
    background: #fff;
}

.sam-magnet-tool .result-card h4 {
    margin: 0 0 0.08rem;
    color: #333;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.18rem, 14px);
    font-weight: 800;
    line-height: 1.2;
}

.sam-magnet-tool .result-values {
    color: #2F67B3;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.2rem, 16px);
    font-weight: 800;
    line-height: 1.3;
}

.sam-magnet-tool .result-values span {
    color: #666;
    font-size: max(0.16rem, 13px);
    font-weight: 400;
    margin: 0 0.06rem;
}

.sam-magnet-tool .magnet-note,
.sam-magnet-tool .magnet-warn {
    color: #666;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.14rem, 12px);
    line-height: 1.4;
    margin-top: 0.1rem;
}

.sam-magnet-tool .magnet-warn {
    color: #b35a00;
}

.sam-magnet-tool .convert-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.12rem;
}

.sam-magnet-tool .convert-table th,
.sam-magnet-tool .convert-table td {
    border-bottom: 1px solid rgba(183, 183, 183, 0.3);
    padding: 0.16rem 0.1rem;
    text-align: left;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.16rem, 13px);
    color: #333;
    vertical-align: middle;
    line-height: 1.5;
}

.sam-magnet-tool .convert-table th {
    font-weight: 700;
    color: #666;
    padding-top: 0.1rem;
    padding-bottom: 0.14rem;
}

.sam-magnet-tool .convert-table .note {
    color: #999;
    font-size: max(0.14rem, 12px);
}

.sam-magnet-tool .convert-title {
    margin: 0 0 0.14rem;
    color: #333;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.18rem, 15px);
    font-weight: 800;
}

.sam-magnet-tool .tool-detail-content {
    margin-top: 0.28rem;
}

.sam-magnet-tool .shape-block,
.sam-magnet-tool .draw-shape-block {
    display: none;
}

.sam-magnet-tool .shape-block.is-visible,
.sam-magnet-tool .draw-shape-block.is-visible {
    display: block;
}

.sam-magnet-tool .draw-spec h4 {
    margin: 0 0 0.12rem;
    color: #333;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.2rem, 16px);
    font-weight: 800;
    line-height: 1.3;
}

.sam-magnet-tool .draw-spec-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sam-magnet-tool .draw-spec-list li {
    margin: 0 0 0.08rem;
    color: #333;
    font-family: NunitoSans, sans-serif;
    font-size: max(0.16rem, 13px);
    line-height: 1.45;
}

.sam-magnet-tool .draw-spec-list strong {
    color: #666;
    font-weight: 700;
    margin-right: 0.06rem;
}

.sam-magnet-tool .draw-preview {
    margin-top: 0.16rem;
    border: 1px solid rgba(183, 183, 183, 0.45);
    border-radius: 4px;
    background: #f5f5f5;
    padding: 0;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1;
    min-height: 280px;
    max-height: 420px;
}

.sam-magnet-tool .draw-preview canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
}

@media (max-width: 768px) {
    .sam-magnet-tool .magnet-field {
        flex-direction: column;
        align-items: stretch;
    }

    .sam-magnet-tool .magnet-field label {
        flex-basis: auto;
    }

    .sam-magnet-tool .draw-sketch {
        min-height: 240px;
    }
}
