:root {
  --bg: #f2f3f5;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --border: #d8dbe0;
  --text: #1f2328;
  --text-muted: #667085;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #b45309;
  --purple: #7c3aed;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 10px;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 1.05rem;
}

.container { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.25rem; font-weight: 650; margin-bottom: 0.75rem; }
h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: background 0.15s;
}
button:hover { background: var(--accent-hover); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled { opacity: 0.55; cursor: default; }
button.secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
button.secondary:hover { background: var(--bg); }
button.danger { background: var(--red); }
button.danger:hover { background: #b91c1c; }
button.small { padding: 0.3rem 0.7rem; font-size: 0.9rem; }

input, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font);
  width: 100%;
}
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

.row { display: flex; gap: 0.9rem; align-items: center; margin: 0.5rem 0; flex-wrap: wrap; }
.row-right { justify-content: flex-end; }
.flex-1 { flex: 1; }

.muted { color: var(--text-muted); font-size: 0.9rem; }
.ok { color: var(--green); }
.bad { color: var(--red); }
.warn { color: var(--orange); }
.info { color: var(--accent); }

.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  margin-right: 0.5rem; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tag {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 500;
}
.tag-synced { background: #e7f5ec; color: #15803d; }
.tag-pending { background: #fdf2e3; color: #b45309; }
.tag-conflict { background: #fdeaea; color: #b91c1c; }

.item-row {
  display: flex; align-items: flex-start; gap: 0.9rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-content { flex: 1; min-width: 0; }
.item-meta { font-size: 0.85rem; color: var(--text-muted); display: flex; gap: 0.9rem; flex-wrap: wrap; }
.item-actions { display: flex; gap: 0.3rem; }

.hidden { display: none !important; }

.nav {
  display: flex; gap: 0.75rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border); margin-bottom: 1.25rem;
  align-items: center;
}
.nav a { color: var(--text-muted); text-decoration: none; font-size: 1rem; padding: 0.3rem 0; }
.nav a.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* --- modal --- */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(16, 24, 40, 0.5);
  cursor: pointer;
}
.modal-content {
  position: relative; z-index: 1;
  max-width: 520px; width: 90%;
}
.modal-content textarea {
  resize: vertical;
  min-height: 100px;
}
