* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; background: #f5f7fa; }

/* Header */
.header { background: linear-gradient(135deg, #0066cc, #00a8cc); color: white; padding: 16px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.header h1 { font-size: 20px; font-weight: 600; }
.header p { font-size: 13px; opacity: 0.9; margin-top: 2px; }
.auth-btn { margin-left: auto; background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.4); border-radius: 6px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.auth-btn:hover { background: rgba(255,255,255,0.3); }
.auth-btn.active { background: #059669; border-color: #059669; }

/* Toolbar */
.toolbar { display: flex; gap: 16px; padding: 10px 24px; background: white; border-bottom: 1px solid #e2e8f0; font-size: 13px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.toolbar-group { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 4px; }
.stat b { color: #0066cc; }
.search-input { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; width: 200px; }
.month-filter { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.export-btn { background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.export-btn:hover { background: #e5e7eb; }

/* Map container with scroll gutter */
.map-container { display: flex; position: relative; }
.map-gutter { width: 60px; min-height: calc(100vh - 240px); background: #f5f7fa; flex-shrink: 0; border-right: 1px solid #e2e8f0; }
#map { flex: 1; height: calc(100vh - 240px); min-height: 400px; }

/* Filter panel */
.filters { background: white; padding: 12px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); font-size: 12px; }
.filters label { display: block; margin: 3px 0; cursor: pointer; }
.filters input { margin-right: 5px; }

/* Legend */
.legend { background: white; padding: 10px 14px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); font-size: 12px; line-height: 1.8; max-width: 220px; }
.legend h4 { margin-bottom: 4px; font-size: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.legend hr { border: none; border-top: 1px solid #e2e8f0; margin: 6px 0; }
.legend .infra-item { display: flex; align-items: center; gap: 6px; }
.legend .infra-line { width: 18px; height: 3px; border-radius: 2px; flex-shrink: 0; }

/* Popups */
.popup { max-width: 360px; max-height: 400px; overflow-y: auto; font-size: 13px; }
.popup h3 { font-size: 15px; margin-bottom: 6px; color: #1a202c; }
.popup .cnt { font-weight: normal; color: #718096; font-size: 13px; }
.popup .types { font-size: 11px; color: #718096; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; }
.popup .iss { margin-bottom: 8px; line-height: 1.4; }
.popup .tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.popup .tag.cb { background: #dbeafe; color: #1e40af; }
.popup .tag.co { background: #fef3c7; color: #92400e; }
.popup .tag.cs { background: #d1fae5; color: #065f46; }
.popup .tag.cg { background: #ede9fe; color: #5b21b6; }
.popup .tag.ss { background: #e0e7ff; color: #3730a3; }
.popup .tag.ov { background: #f3f4f6; color: #374151; }
.popup .date { font-size: 11px; color: #a0aec0; }
.popup .more { font-style: italic; color: #a0aec0; font-size: 12px; }

/* Issue ID links */
a.eid { color: #0066cc; font-family: monospace; font-size: 11px; text-decoration: none; white-space: nowrap; }
a.eid:hover { text-decoration: underline; }

/* Table */
.table-section { padding: 24px; max-width: 1400px; margin: 0 auto; }
.table-section h2 { font-size: 18px; margin-bottom: 8px; color: #1a202c; }
.table-section p { font-size: 13px; color: #718096; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { background: #f7fafc; text-align: left; padding: 8px 12px; font-weight: 600; border-bottom: 2px solid #e2e8f0; }
table td { padding: 6px 12px; border-bottom: 1px solid #edf2f7; vertical-align: top; }
table .type-header td { background: #edf2f7; font-weight: 600; font-size: 14px; padding: 10px 12px; }
.col-actions { width: 120px; }
.col-id { width: 140px; }
.col-date { width: 100px; }
.col-cat { width: 100px; }
.col-area { width: 120px; }

/* Edit-only elements hidden by default */
.edit-only { display: none; }
body.edit-mode .edit-only { display: table-cell; }

/* Action buttons in table */
.btn-place { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer; margin-right: 4px; }
.btn-place:hover { background: #bfdbfe; }
.btn-hide { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer; }
.btn-hide:hover { background: #fecaca; }
tr.hidden-row { display: none; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 10000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: white; border-radius: 12px; max-width: 700px; width: 90%; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
.modal-header h3 { font-size: 15px; color: #1a202c; font-family: monospace; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #718096; padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: #f7fafc; color: #1a202c; }
.modal-body { padding: 20px; overflow-y: auto; font-size: 14px; line-height: 1.6; color: #2d3748; white-space: pre-wrap; word-wrap: break-word; }
.modal-body .no-text { color: #a0aec0; font-style: italic; }

/* Auth dialog */
.auth-box { max-width: 400px; }
.auth-box .modal-body { display: flex; flex-direction: column; gap: 12px; white-space: normal; }
.pw-input { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.login-btn { background: #0066cc; color: white; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; cursor: pointer; align-self: flex-start; }
.login-btn:hover { background: #0052a3; }
.auth-error { color: #dc2626; font-size: 13px; min-height: 20px; }

/* Place-on-map banner */
.place-banner { display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1e40af; color: white; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 9999; box-shadow: 0 4px 16px rgba(0,0,0,0.3); gap: 16px; align-items: center; }
.place-banner.active { display: flex; }
.place-banner button { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.4); border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 13px; }

/* Footer */
.footer { text-align: center; padding: 16px; font-size: 12px; color: #a0aec0; }

/* Map placing mode cursor */
body.placing-mode #map { cursor: crosshair; }

/* Responsive */
@media (max-width: 768px) {
  .map-gutter { display: none; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
}
