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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  line-height: 1.5;
}

.hidden { display: none !important; }

.view {
  min-height: 100vh;
}

.btn {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  background: white;
  color: #374151;
}

.btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-primary {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-secondary {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-danger {
  color: #dc2626;
  background: white;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 4px;
}

.btn-icon:hover {
  background: #f3f4f6;
}

input, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

#landing {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.landing-container {
  text-align: center;
  max-width: 700px;
  width: 100%;
}

.landing-container h1 {
  font-size: 36px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111827;
}

.subtitle {
  color: #6b7280;
  margin-bottom: 40px;
  font-size: 16px;
}

.landing-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-card {
  background: white;
  padding: 28px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  text-align: left;
}

.form-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #111827;
}

.form-card input {
  margin-bottom: 12px;
}

.form-card .btn {
  width: 100%;
  padding: 10px;
  font-weight: 500;
}

.header {
  height: 56px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.board-code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 4px;
  color: #1f2937;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.presence {
  display: flex;
  gap: -8px;
}

.presence-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e5e7eb;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  margin-left: -8px;
  position: relative;
}

.presence-avatar:first-child {
  margin-left: 0;
}

.presence-avatar.online {
  background: #dbeafe;
  color: #1d4ed8;
}

.presence-avatar.editing {
  background: #fef3c7;
  color: #d97706;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 6px;
}

.update-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: #92400e;
}

.canvas {
  position: relative;
  min-height: calc(100vh - 56px);
  background: white;
  background-image: radial-gradient(circle, #e5e7eb 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: hidden;
}

.board-item {
  position: absolute;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 14px;
  min-width: 220px;
  min-height: 100px;
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.board-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.board-item.dragging {
  cursor: grabbing;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.board-item.editing {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.board-item.editing-remote {
  border-color: #f59e0b;
}

.item-menu {
  position: absolute;
  top: -10px;
  right: -10px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.board-item:hover .item-menu {
  opacity: 1;
}

.item-menu-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: white;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.item-menu-btn:hover {
  background: #f3f4f6;
}

.item-menu-del:hover {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626;
}

.fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  z-index: 150;
}

.fab-menu {
  display: none;
  position: fixed;
  bottom: 88px;
  right: 24px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 150;
  overflow: hidden;
}

.fab-menu button {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.fab-menu button:hover {
  background: #f3f4f6;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.item-title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}

.item-type-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 500;
}

.item-content {
  font-size: 13px;
  color: #4b5563;
  word-break: break-word;
  white-space: pre-wrap;
}

.item-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 13px;
}

.item-link:hover {
  text-decoration: underline;
}

.item-photo {
  width: 100%;
  border-radius: 4px;
  margin-top: 6px;
  max-height: 150px;
  object-fit: cover;
}

.editing-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  border: 1px solid #fde68a;
}

.sidebar {
  position: fixed;
  right: 0;
  top: 56px;
  width: 280px;
  height: calc(100vh - 56px);
  background: white;
  border-left: 1px solid #e5e7eb;
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.users-list {
  padding: 12px;
  overflow-y: auto;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.user-item:hover {
  background: #f9fafb;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.user-role {
  font-size: 11px;
  color: #6b7280;
}

.user-actions {
  display: flex;
  gap: 4px;
}

.user-actions button {
  font-size: 12px;
  padding: 3px 8px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: white;
  border-radius: 10px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-body label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #374151;
}

.modal-body input,
.modal-body textarea {
  margin-bottom: 16px;
}

.edit-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 4px;
  margin-top: 8px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 768px) {
  .landing-forms {
    grid-template-columns: 1fr;
  }
  .header-center {
    display: none;
  }
  .sidebar {
    width: 100%;
  }
  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .fab-menu:not(.hidden) {
    display: block;
  }
}

@media (min-width: 769px) {
  .fab { display: none !important; }
  .fab-menu { display: none !important; }
}
