:root {
  --primary: #4f46e5;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--primary);
  color: white;
}

.topbar h1 { font-size: 1.1rem; margin: 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.google-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 { margin-top: 0; font-size: 1rem; color: var(--muted); }

.status-card {
  border-left: 5px solid var(--primary);
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.status-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

form input {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary.small { padding: 6px 12px; font-size: 0.85rem; text-decoration: none; }

.btn-secondary {
  background: #e5e7eb;
  color: var(--text);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-link {
  background: none;
  border: none;
  color: white;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.8rem;
}

.badge.ok {
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-right: 8px;
}

.badge.muted {
  background: #e5e7eb;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.sync-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.sync-ok {
  background: rgba(34, 197, 94, 0.22);
  color: #d1fae5;
}

.sync-pending {
  background: rgba(245, 158, 11, 0.22);
  color: #fef3c7;
}

.sync-offline {
  background: rgba(239, 68, 68, 0.22);
  color: #fee2e2;
}

.item-list { list-style: none; padding: 0; margin: 0; }

.item-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.item-list li:last-child { border-bottom: none; }

.item-title { font-weight: 600; }
.item-when { font-size: 0.8rem; color: var(--muted); }
.item-notes { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

.item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
}

.edit-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 1rem;
}

.pending-chip {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  animation: pop 0.2s ease-out;
}

@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-box h3 { margin-top: 0; }

.empty-hint { color: var(--muted); font-size: 0.85rem; }
.hidden { display: none !important; }

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .status-row {
    flex-direction: column;
  }

  .item-list li {
    align-items: flex-start;
    gap: 12px;
  }
}
