:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e5;
  --text: #171717;
  --text-muted: #737373;
  --text-faint: #a3a3a3;
  --accent: #171717;
  --accent-fg: #ffffff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; }

h1, h2, h3, p { margin: 0; }

.h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); font-size: 12px; }
.text-sm { font-size: 13px; }
.text-danger { color: var(--danger); }

/* Layout */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 32px; font-weight: 600; font-size: 20px; }

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-logo { font-weight: 600; font-size: 17px; }
.app-nav { display: flex; align-items: center; gap: 24px; }
.app-nav a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.app-nav a:hover, .app-nav a.active { color: var(--text); }
.app-main { max-width: 960px; margin: 0 auto; padding: 40px 24px; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header { padding: 20px 20px 0; }
.card-header.row { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0; }
.card-title { font-size: 16px; font-weight: 600; }
.card-desc { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.card-body { padding: 20px; }

/* Form */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--text);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-fg);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #f5f5f5;
  color: var(--text-muted);
}
.badge-dark { background: var(--accent); color: var(--accent-fg); }

/* Alert */
.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.mt-4 { margin-top: 16px; }
.hashtag { font-size: 12px; color: var(--text-faint); margin-right: 6px; }

/* Calendario */
.board-fila { margin-bottom: 20px; }
.board-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
@media (max-width: 900px) { .board-week { grid-template-columns: repeat(2, 1fr); } }
.day-col {
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface);
}
.day-col.drag-over { border-color: var(--text); background: #fafafa; }
.day-col-title { font-size: 12px; font-weight: 600; }
.day-col-sub { font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.piece-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: var(--surface);
  margin-bottom: 8px;
  cursor: grab;
  font-size: 12px;
}
.piece-card:active { cursor: grabbing; }
.piece-card .tema { font-weight: 500; margin: 4px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Biblioteca */
.lib-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.lib-item-header { padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.lib-item-header .tema { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-item-body { padding: 16px; border-top: 1px solid var(--border); display: none; }
.lib-item-body.open { display: block; }
.lib-filters { display: flex; gap: 10px; margin-bottom: 16px; }
.lib-filters select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
