* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Sans', 'ヒラギノ角ゴシック', 'Yu Gothic', 'Meiryo', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

main {
    flex: 1;
    padding: 1rem;
}

.input-section, .file-section, .point-status-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.point-status-section {
    border-left: 4px solid #ff9800;
}

.status-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.status-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.status-group label {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #333;
}

.status-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.legend-section {
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.legend-grid {
    display: flex;
    gap: 2rem;
}

.legend-category {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #ccc;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
    font-size: 0.9rem;
}

select, input[type="number"], input[type="text"], input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

select:focus, input[type="number"]:focus, input[type="text"]:focus, input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.button-row .btn-primary,
.button-row .btn-secondary {
    width: auto !important;
    flex: 1;
    min-width: 120px;
    margin: 0 !important;
    font-size: 0.9rem !important;
    padding: 0.75rem !important;
}


.coordinate-input-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.input-field {
    flex: 1;
    min-width: 80px;
}

.input-field:first-child {
    flex: 1.2;
}

.input-field:nth-child(2),
.input-field:nth-child(3) {
    flex: 1.5;
}

.input-field:last-child {
    flex: 0.8;
}

.input-field label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.input-field input {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.top-button-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.top-button-row .form-group {
    margin-bottom: 0;
    min-width: 120px;
}

.top-button-row .btn-secondary {
    margin-top: 0;
    width: auto;
    min-width: 100px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.button-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.result-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    display: none;
}

.result-section.show {
    display: block;
}

#coordinates-display {
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

#coordinates-display h3 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

#coordinates-display p {
    margin: 0.25rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #6c757d;
}

#map-container {
    position: relative;
}

.map-table-tabs {
    margin-top: 1rem;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background-color: #f5f5f5;
    color: #333;
}

.tab-button.active {
    color: #2196f3;
    border-bottom-color: #2196f3;
    background-color: #f8f9fa;
}

.tab-content {
    position: relative;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.map-and-table-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#map-container {
    flex: 1;
}

#map {
    height: 300px;
    width: 100%;
}

#table-container {
    flex: 1;
    overflow-x: auto;
}

#points-table-wrapper {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    position: relative;
}

#points-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#points-table th {
    background: #f8f9fa;
    color: #495057;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

#points-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #dee2e6;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

#points-table tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

#points-table tr.selected {
    background: #e3f2fd;
}

#points-table td.point-name {
    font-weight: 600;
    color: #495057;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.delete-btn:hover {
    background: #c82333;
}

#points-table th:last-child,
#points-table td:last-child {
    width: 60px;
    text-align: center;
}

.marker-popup {
    min-width: 200px;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.popup-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    margin-left: 10px;
}

.popup-delete-btn:hover {
    background: #c82333;
}

.popup-body {
    font-size: 13px;
    line-height: 1.4;
}

#links-section {
    padding: 1.5rem;
}

#google-maps-link {
    margin-bottom: 1.5rem;
}

#google-maps-link a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #34a853;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

#google-maps-link a:hover {
    background: #2d8f47;
}

#qr-code-container {
    text-align: center;
}

#qr-code-container h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1rem;
}

#qr-code canvas {
    max-width: 200px;
    height: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

@media (min-width: 768px) {
    #app {
        max-width: 1200px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 2rem;
    }
    
    .map-and-table-container {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .tab-button {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    #map-container {
        flex: 2;
        min-width: 400px;
    }
    
    #table-container {
        flex: 1;
        min-width: 300px;
    }
    
    #points-table-wrapper {
        max-height: 400px;
    }
    
    #map {
        height: 400px;
    }
    
    .btn-primary, .btn-secondary {
        width: auto;
        min-width: 200px;
        display: inline-block;
        margin-right: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    main {
        padding: 0.75rem;
    }
    
    .input-section {
        padding: 1rem;
    }
    
    #map {
        height: 250px;
    }
    
    #points-table-wrapper {
        max-height: 200px;
    }
    
    #points-table th {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    #points-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .top-button-row {
        flex-wrap: wrap;
        gap: 0.3rem;
        align-items: end;
    }
    
    .top-button-row .form-group {
        flex: 1;
        min-width: 80px;
    }
    
    .top-button-row .form-group select {
        font-size: 0.8rem;
        padding: 0.5rem 0.3rem;
    }
    
    .top-button-row .form-group label {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .top-button-row .btn-secondary {
        flex: 1;
        min-width: 70px;
        margin-bottom: 0;
        font-size: 0.8rem;
        padding: 0.5rem 0.3rem;
    }
    
    .button-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .button-row .btn-primary,
    .button-row .btn-secondary {
        width: 100% !important;
        min-width: auto !important;
        margin-bottom: 0.5rem !important;
    }
    
    .coordinate-input-row {
        gap: 0.25rem;
    }
    
    .input-field {
        min-width: 60px;
    }
    
    .input-field label {
        font-size: 0.7rem;
        margin-bottom: 0.15rem;
    }
    
    .input-field input {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
}

.calculation-section {
    margin-top: 1rem;
    text-align: center;
}

.calculation-section button {
    margin: 0 0.5rem;
}

.intersection-form-section,
.dimension-form-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

.intersection-form-section {
    border-left: 4px solid #667eea;
}

.dimension-form-section {
    border-left: 4px solid #28a745;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.form-header h3 {
    margin: 0;
    color: #495057;
}

.form-header button {
    min-width: 80px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.calculation-type {
    margin-bottom: 1.5rem;
}

.calculation-type label {
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.calculation-type input[type="radio"] {
    margin-right: 0.5rem;
}

.form-buttons {
    text-align: center;
    margin: 1.5rem 0;
}

.form-buttons button {
    min-width: 150px;
}

.area-controls {
    text-align: center;
    margin: 1rem 0;
}

.area-controls button {
    margin: 0 0.5rem;
    min-width: 100px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    margin: 0;
    color: #495057;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s ease;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1.5rem;
}

.calculation-type {
    margin-bottom: 1.5rem;
}

.calculation-type label {
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.calculation-type input[type="radio"] {
    margin-right: 0.5rem;
}

.point-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.point-field {
    flex: 1;
}

.point-field label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #555;
}

.point-field input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.modal-buttons button {
    min-width: 120px;
}

.map-select-btn {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 1.2rem !important;
    margin: 0 !important;
    background: #007bff !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.map-select-btn:hover {
    background: #0056b3 !important;
    transform: scale(1.05) !important;
}

.point-field {
    display: flex;
    flex-direction: column;
}

.point-row {
    display: grid;
    grid-template-columns: 60px 1.5fr 1fr 1fr;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 1rem;
}

#calculation-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.result-actions {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.result-actions input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
}

@media (max-width: 480px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .point-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* テーブル行の選択状態 */
#points-table tbody tr.selected {
    background-color: #e3f2fd !important;
    border-left: 4px solid #2196f3;
}

#points-table tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* マーカーポップアップのスタイル */
.marker-popup {
    font-family: inherit;
    max-width: 280px;
    cursor: pointer;
}

.popup-header {
    padding: 0.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    margin: -10px -10px 10px -10px;
}

.popup-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}

.popup-icon-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.popup-icon-btn:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.popup-googlemap-btn {
    background: #34a853;
}

.popup-googlemap-btn:hover {
    background: #2d8f47;
}

.popup-qr-btn {
    background: #ff9800;
}

.popup-qr-btn:hover {
    background: #e68900;
}

.popup-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.popup-delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.marker-popup:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.popup-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.popup-coordinates,
.popup-status {
    font-size: 0.9rem;
    line-height: 1.4;
}

.popup-coordinates strong,
.popup-status strong {
    color: #495057;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 地図上の現在位置取得ボタン */
.leaflet-control-location {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.65);
}

.leaflet-control-location button {
    width: 30px;
    height: 30px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.leaflet-control-location button:hover {
    background: #f4f4f4;
}

/* 地図上の計算ツールボタン */
.leaflet-control-calculation {
    margin-bottom: 10px;
    margin-left: 10px;
}

.leaflet-control-calculation button {
    width: 34px;
    height: 34px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 1px 5px rgba(0,0,0,0.65);
    margin-bottom: 5px;
}

.leaflet-control-calculation button:hover {
    background: #f4f4f4;
    transform: scale(1.1);
}

.leaflet-control-calculation button.active {
    background: #007bff;
    color: white;
}

/* 地図上のメッセージバー */
.map-message-bar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: none;
    max-width: 80%;
    text-align: center;
}

.map-message-bar.show {
    display: block;
}

/* 計算タイプ選択モーダル */
.calculation-type-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.calculation-type-modal.show {
    display: flex;
}

.calculation-type-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.calculation-type-content h3 {
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

.calculation-type-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calculation-type-buttons button {
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.calculation-type-buttons button:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

/* SIMA読み込み時の測点状態設定モーダル */
.sima-status-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sima-status-form .status-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sima-status-form .status-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.sima-status-form .status-group select {
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.sima-status-form .status-group select:focus {
    outline: none;
    border-color: #667eea;
}

.sima-status-form .modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.sima-status-form .modal-buttons button {
    min-width: 120px;
    padding: 0.75rem 1.5rem;
}

@media (max-width: 480px) {
    .sima-status-form .modal-buttons {
        flex-direction: column;
    }
    
    .sima-status-form .modal-buttons button {
        width: 100%;
    }
}

/* QRコード表示モーダル */
.qr-modal-content {
    text-align: center;
}

#qr-code-display {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

#qr-code-display canvas,
#qr-code-display img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

/* 新点座標登録セクション */
.coordinate-input-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    border-left: 4px solid #2196f3;
}

.coordinate-input-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.input-fields {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.input-fields .input-field {
    flex: 1;
}

.input-fields .input-field input {
    width: 100%;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.register-button-container {
    margin-left: 1rem;
}

.register-button-container button {
    white-space: nowrap;
    padding: 0.6rem 1.5rem;
}

@media (max-width: 768px) {
    .coordinate-input-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .input-fields {
        /* 横並びを維持 */
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .input-fields .input-field {
        /* スマホでは点名を広めに、座標は狭めに */
        flex: none;
    }
    
    .input-fields .input-field:first-child {
        /* 点名フィールド */
        flex: 1.5;
        min-width: 80px;
        max-width: 120px;
    }
    
    .input-fields .input-field:nth-child(2),
    .input-fields .input-field:nth-child(3) {
        /* X,Y座標フィールド */
        flex: 1.2;
        min-width: 70px;
    }
    
    .input-fields .input-field:nth-child(4) {
        /* Z座標フィールド（狭め） */
        flex: 0.8;
        min-width: 60px;
        max-width: 80px;
    }
    
    .register-button-container {
        margin-left: 0;
        margin-top: 0;
    }
    
    .register-button-container button {
        width: 100%;
        padding: 0.75rem;
    }
}

/* 非常に狭い画面用 */
@media (max-width: 480px) {
    .input-fields {
        gap: 0.25rem;
    }
    
    .input-fields .input-field:first-child {
        /* 点名フィールド（狭い画面では少し小さく） */
        flex: 1.3;
        min-width: 70px;
        max-width: 100px;
    }
    
    .input-fields .input-field:nth-child(2),
    .input-fields .input-field:nth-child(3) {
        /* X,Y座標フィールド（狭い画面） */
        flex: 1;
        min-width: 60px;
    }
    
    .input-fields .input-field:nth-child(4) {
        /* Z座標フィールド（最も狭く） */
        flex: 0.6;
        min-width: 45px;
        max-width: 60px;
    }
    
    .input-fields .input-field input {
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
    }
    
    .coordinate-input-section h3 {
        font-size: 1.1rem;
    }
}

/* 計算結果ポップアップのスタイル */
.calculation-result-popup {
    padding: 0.5rem;
    min-width: 200px;
}

.calculation-result-popup h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1rem;
}

.calculation-result-popup p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #555;
}

.calculation-result-popup button {
    margin-top: 0.75rem;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* 新しいレイアウト用スタイル */
.map-table-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.map-table-tabs {
    flex: 2;
}

.point-status-section {
    flex: 1;
    min-width: 300px;
    margin-bottom: 0;
}

/* タブ内の新点座標登録セクション */
#tab-map .coordinate-input-section {
    margin-top: 1rem;
    margin-bottom: 0;
}

/* 凡例を横並びで表示 */
.legend-grid {
    display: flex;
    gap: 2rem;
}

.legend-category {
    flex: 1;
}

/* 表示項目選択のスタイル */
.table-display-options {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.table-display-options h4 {
    margin: 0 0 0.75rem 0;
    color: #495057;
    font-size: 1rem;
    font-weight: 600;
}

.display-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

.checkbox-item input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: #2196f3;
}

.checkbox-item:hover {
    color: #2196f3;
}

/* テーブル列の表示/非表示制御 */
.col-x.hidden,
.col-y.hidden,
.col-z.hidden,
.col-point-type.hidden,
.col-stake-type.hidden,
.col-installation.hidden {
    display: none;
}

@media (max-width: 768px) {
    .display-checkboxes {
        gap: 0.5rem;
    }
    
    .checkbox-item {
        font-size: 0.85rem;
    }
}

@media (max-width: 1024px) {
    .map-table-container {
        flex-direction: column;
    }
    
    .point-status-section {
        min-width: auto;
        margin-bottom: 1.5rem;
    }
    
    .legend-grid {
        flex-direction: column;
        gap: 1rem;
    }
}