:root {
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --bg: #ffffff;
  --card: #ffffff;
}

* { box-sizing: border-box; }

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

.header {
  position: relative;
  padding: 24px 20px 8px;
  border-bottom: 1px solid var(--border);
}

.auth-account-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* Auth panel overlay and modal */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.auth-panel {
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.auth-tabs {
  display: flex;
  gap: 8px;
}

.auth-tab {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.auth-tab.active {
  background: var(--text);
  color: var(--card);
  border-color: var(--text);
}

.auth-status {
  font-size: 13px;
  padding: 8px;
  border-radius: 8px;
}

.auth-status.auth-status-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #dc2626;
}

.auth-status.auth-status-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

.auth-unavailable code {
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

.auth-link {
  color: var(--text);
  font-size: 13px;
  text-decoration: underline;
}

.auth-link:hover {
  color: var(--muted);
}

.auth-oauth-btns {
  gap: 8px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.sub {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Save/sync status pill (header, right side) */
.sync-status-wrap {
  flex-shrink: 0;
}

.sync-status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.sync-status-pill.sync-status-saving {
  background: #fef3c7;
  color: #92400e;
}

.sync-status-pill.sync-status-saved {
  background: #d1fae5;
  color: #065f46;
}

.sync-status-pill.sync-status-saved_locally {
  background: #fef3c7;
  color: #92400e;
}

.sync-status-pill.sync-status-error {
  background: #fee2e2;
  color: #991b1b;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}

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

.btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button {
  appearance: none;
  border: 1px solid var(--border);
  background: #f9fafb;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

button.primary {
  background: #111827;
  color: white;
  border-color: #111827;
}

button.danger {
  background: #fff1f2;
  border-color: #fecdd3;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.help {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.35;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Quizlet-style list */
.deckTop {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.deckStats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.deckStats strong {
  color: var(--text);
  font-weight: 600;
}

.cardRow {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  background: #ffffff;
}

.cardRowHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.cardRowHeader .idx {
  color: var(--muted);
  font-size: 12px;
}

.cardRowGrid {
  display: grid;
  gap: 12px;
}

@media (min-width: 780px) {
  .cardRowGrid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}
