body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

.layout {
  padding: 16px;
  box-sizing: border-box;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  padding-bottom: 10px;
}

.topbar h1 {
  margin: 0 0 8px;
}

.home-link {
  display: inline-block;
  margin-bottom: 8px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 700;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  color: #334155;
}

.filter-label {
  font-weight: 700;
}

.filter-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.92rem;
}

.color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #94a3b8;
  display: inline-block;
}

.swatch-red {
  background: rgb(255, 182, 193);
}

.swatch-yellow {
  background: rgb(253, 245, 124);
}

.swatch-green {
  background: rgb(152, 251, 152);
}

button {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: #f1f5f9;
}

.meta {
  margin: 4px 0;
  color: #334155;
}

.sync-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.84rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.sync-badge[data-state="disabled"],
.sync-badge[data-state="idle"] {
  background: #e2e8f0;
  color: #334155;
}

.sync-badge[data-state="fetching"],
.sync-badge[data-state="syncing"] {
  background: #dbeafe;
  color: #1d4ed8;
}

.sync-badge[data-state="queued"] {
  background: #fef3c7;
  color: #92400e;
}

.sync-badge[data-state="synced"] {
  background: #dcfce7;
  color: #166534;
}

.sync-badge[data-state="error"] {
  background: #fee2e2;
  color: #b91c1c;
}

.grid-root {
  display: grid;
  gap: 14px;
  padding-bottom: 64px;
}

.table-block {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.vocab-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

.vocab-table th,
.vocab-table td {
  border: 1px solid #d5deea;
  min-width: 96px;
  height: 34px;
  text-align: center;
  padding: 4px;
  box-sizing: border-box;
}

.vocab-table th {
  background: #eef2ff;
  font-weight: 700;
}

.cell-selected {
  outline: 3px solid #dc2626;
  outline-offset: -2px;
}

.definition-tab {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(820px, calc(100% - 32px));
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  display: none;
}

.definition-tab p {
  margin: 4px 0;
}

/* Dark theme support */
html[data-theme="dark"] body {
  background: #0f172a;
  color: #f1f5f9;
}

html[data-theme="dark"] .topbar {
  background: #0f172a;
}

html[data-theme="dark"] .home-link {
  color: #60a5fa;
}

html[data-theme="dark"] .filter-row {
  color: #cbd5e1;
}

html[data-theme="dark"] button {
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
}

html[data-theme="dark"] button:hover {
  background: #334155;
}

html[data-theme="dark"] .meta {
  color: #94a3b8;
}

html[data-theme="dark"] .sync-badge[data-state="disabled"],
html[data-theme="dark"] .sync-badge[data-state="idle"] {
  background: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] .sync-badge[data-state="fetching"],
html[data-theme="dark"] .sync-badge[data-state="syncing"] {
  background: #1e3a8a;
  color: #bfdbfe;
}

html[data-theme="dark"] .sync-badge[data-state="queued"] {
  background: #78350f;
  color: #fde68a;
}

html[data-theme="dark"] .sync-badge[data-state="synced"] {
  background: #14532d;
  color: #bbf7d0;
}

html[data-theme="dark"] .sync-badge[data-state="error"] {
  background: #7f1d1d;
  color: #fecaca;
}

html[data-theme="dark"] .table-block {
  border: 1px solid #334155;
  background: #1e293b;
}

html[data-theme="dark"] .vocab-table th,
html[data-theme="dark"] .vocab-table td {
  border: 1px solid #334155;
}

html[data-theme="dark"] .vocab-table th {
  background: #0f172a;
  color: #cbd5e1;
}

html[data-theme="dark"] .vocab-table td {
  background: #d1d5db;
  color: #111827;
}

html[data-theme="dark"] .definition-tab {
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}



