/* Liteword shared stylesheet: design tokens + primitive classes.
   One file, two consumers — the React SPA (web/src) and Django-rendered
   pages (server/repeat/templates). The vite build copies it verbatim into
   webapp/dist under this stable, unhashed name, so Django templates load
   the exact same file via {% static 'shared.css' %}.

   The Claude Design pass restyles both surfaces here: change tokens and
   primitive classes, not components or templates. No hardcoded visual
   values below the tokens block. */

:root {
  /* Color */
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1f24;
  --muted: #6b7683;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --border: #d9dee5;
  --overlay: rgb(16 20 24 / 0.5);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-sm: 0.85rem;
  --text-lg: 1.05rem;
  --text-xl: 1.4rem;
  --text-2xl: 2rem;

  /* Spacing + shape */
  --space-0: 2px;
  --space-1: 4px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
  --radius: 10px;
  --radius-lg: 14px;
  --content-width: 560px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --card: #1a2028;
    --text: #e8ecf1;
    --muted: #8b95a1;
    --accent: #3b82f6;
    --border: #2a323d;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

h1 {
  font-size: var(--text-xl);
  margin: 0;
}

a {
  color: var(--accent);
}

/* ---- Layout ---- */

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.site-header .topbar {
  min-height: 56px;
}

.brand {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text);
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---- Buttons ---- */

.btn {
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.btn-big {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-lg);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--accent-text);
}

.btn-link {
  border: none;
  background: none;
  color: var(--accent);
  padding: var(--space-1);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---- Forms ---- */

input,
textarea,
select {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  width: 100%;
}

input[type='checkbox'] {
  width: auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-size: var(--text-sm);
  color: var(--muted);
}

.field-error {
  color: var(--danger);
  font-size: var(--text-sm);
  margin: 0;
}

.field-check {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  align-items: center;
}

/* ---- Surfaces ---- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.list-row {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  color: inherit;
  text-decoration: none;
}

.list-row-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-0);
  min-width: 0;
}

a.list-row:hover {
  border-color: var(--accent);
}

.badge {
  font-size: var(--text-sm);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-2);
}

.hint {
  color: var(--muted);
  font-size: var(--text-sm);
}

.error {
  color: var(--danger);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: var(--space-5);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.terms-table {
  width: 100%;
  border-collapse: collapse;
}

.terms-table th,
.terms-table td {
  text-align: left;
  padding: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.terms-table th {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.terms-table tr:last-child td {
  border-bottom: none;
}

/* ---- Dialog ---- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 10;
}

.dialog {
  max-width: 400px;
  width: 100%;
}

.dialog-title {
  font-size: var(--text-lg);
  margin: 0;
}

.dialog-actions {
  justify-content: flex-end;
}

/* ---- Auth pages ---- */

.auth-card {
  max-width: 400px;
  width: 100%;
  margin: var(--space-5) auto;
  padding: var(--space-5);
  gap: var(--space-3);
}

.auth-title {
  text-align: center;
  font-size: var(--text-xl);
}

.or-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
  text-transform: uppercase;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
