html, body { margin: 0; padding: 0; height: 100%; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; color: #111; }
#cy { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.9); z-index: 9999; }
.overlay.hidden { display: none; }
.overlay .spinner { width: 44px; height: 44px; border: 4px solid #e5e7eb; border-top-color: #3b82f6; border-radius: 50%; animation: spin 1s linear infinite; }
.overlay .msg { margin-top: 10px; font-size: 14px; color: #374151; position: absolute; top: calc(50% + 40px); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin redesign */
.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .grid { grid-template-columns: 1fr; } }
.card { border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 6px 16px rgba(0,0,0,0.06); background: white; }
.card-header { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid #f3f4f6; background: #f9fafb; border-top-left-radius: 10px; border-top-right-radius: 10px; }
.card-body { padding: 12px 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid #f3f4f6; padding: 8px; text-align: left; vertical-align: top; }
.actions-row { display: flex; gap: 8px; }
.small-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); }
.modal.hidden { display: none; }
.modal-panel { background: white; border-radius: 10px; max-width: 720px; width: 92%; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); }
.modal.hidden { display: none; }
.modal-content { background: white; border-radius: 8px; max-width: 720px; width: 92%; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); position: relative; max-height: 90vh; overflow: auto; }
.modal-content img { max-width: 100%; height: auto; display: block; margin-bottom: 8px; border-radius: 6px; max-height: 70vh; object-fit: contain; }
.modal-content .close { position: absolute; right: 10px; top: 6px; cursor: pointer; font-size: 22px; }

/* Node-attached popover */
.popover { position: absolute; pointer-events: none; opacity: 0; transition: opacity 1s ease; }
.popover.show { opacity: 1; pointer-events: auto; }
.popover-content { background: white; border-radius: 8px; width: 260px; max-width: 80vw; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); position: relative; border: 1px solid #e5e7eb; max-height: none; overflow: visible; }
.popover.no-scroll .popover-content { max-height: none; overflow: visible; }
.popover-content img { max-width: 100%; height: auto; display: block; margin-bottom: 6px; border-radius: 6px; }
.popover-content .close { position: absolute; right: 8px; top: 4px; cursor: pointer; font-size: 18px; }

@media (max-width: 640px){
  .popover-content { width: 220px; max-width: 88vw; padding: 10px; }
  .popover-content h3 { font-size: 1rem; margin: 6px 0; }
  .popover-content p, .popover-content li { font-size: 0.9rem; }
}

#admin { padding: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 6px 0; align-items: center; }
.row.actions { display: flex; gap: 8px; }
.row.edge { border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
.full { grid-column: 1 / -1; }
.full textarea { width: 100%; }
@media (min-width: 900px){
  /* Make node description almost full width on larger screens */
  #nodeModal .form-grid #mDescription { width: 95%; }
}
.card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; margin: 10px 0; }
.thumb { max-width: 120px; max-height: 120px; display: block; margin-top: 6px; border-radius: 6px; }

button { background: #2563eb; color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
button.danger { background: #dc2626; }
input, textarea, select { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; }


