/* Kanban personal — monocromo cálido, editorial, sin adornos. */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --line: #eaeaea;
  --ink: #2f3437;
  --muted: #6b6a67; /* 4.95:1 sobre el fondo hueso — el #787774 de la guía se queda en 4.1 */
  --black: #111111;

  --blue-bg: #e1f3fe;   --blue-ink: #1f6c9f;
  --green-bg: #edf3ec;  --green-ink: #346538;
  --yellow-bg: #fbf3db; --yellow-ink: #956400;
  --red-bg: #fdebec;    --red-ink: #9f2f2d;

  --radius: 8px;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --serif: ui-serif, 'New York', Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

[data-accent='blue']   { --accent-bg: var(--blue-bg);   --accent-ink: var(--blue-ink); }
[data-accent='green']  { --accent-bg: var(--green-bg);  --accent-ink: var(--green-ink); }
[data-accent='yellow'] { --accent-bg: var(--yellow-bg); --accent-ink: var(--yellow-ink); }
[data-accent='red']    { --accent-bg: var(--red-bg);    --accent-ink: var(--red-ink); }

* { box-sizing: border-box; }

/* Las reglas de abajo declaran `display`, que gana a la hoja del navegador
   para [hidden]. Sin esto, ocultar algo desde JS no surte efecto. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input, textarea { font: inherit; color: inherit; }
textarea { resize: vertical; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ————————————————————————————————— botones */

.btn-primary {
  background: var(--black);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 12px 18px;
  min-height: 44px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, transform 100ms;
}
.btn-primary:hover { background: #333; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-quiet {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  min-height: 44px;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}
.btn-quiet:hover { color: var(--ink); border-color: #d8d8d8; }
.btn-quiet.danger:hover { color: var(--red-ink); border-color: var(--red-ink); }

.btn-icon {
  background: transparent; border: 0; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
  min-width: 44px; min-height: 44px; border-radius: 6px;
}
.btn-icon:hover { color: var(--ink); background: rgba(0, 0, 0, 0.04); }

:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

/* ————————————————————————————————— acceso */

.login {
  max-width: 380px;
  margin: 0 auto;
  padding: 18vh 24px 24px;
}
.login-mark {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 0 0 32px;
}
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form label { font-size: 13px; color: var(--muted); }
.login-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 12px 14px;
  min-height: 44px;
}
#code { font-family: var(--mono); letter-spacing: 0.3em; text-align: center; font-size: 20px; }
.login-msg { color: var(--muted); font-size: 14px; margin-top: 18px; min-height: 3em; }

/* ————————————————————————————————— barra superior */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  padding-top: calc(6px + env(safe-area-inset-top));
  background: rgba(247, 246, 243, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-back {
  text-decoration: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.topbar-back:hover { color: var(--ink); background: rgba(0, 0, 0, 0.04); }

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 15px;
  transition: background 150ms, color 150ms;
}
.tab:hover { color: var(--ink); background: rgba(0, 0, 0, 0.04); }
.tab[aria-current='page'] {
  background: var(--accent-bg);
  color: var(--accent-ink);
  font-weight: 500;
}

.menu {
  position: absolute;
  right: 12px;
  top: calc(56px + env(safe-area-inset-top));
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.menu button {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
  min-height: 44px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.menu button:last-child { border-bottom: 0; }
.menu button:hover { background: var(--bg); }

/* ————————————————————————————————— portada de móvil */

.home { padding: 24px 16px 40px; max-width: 640px; margin: 0 auto; }
.home-title {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.home-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.home-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-ink);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 72px;
  transition: box-shadow 200ms;
}
.home-item:active { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
.home-item-name { font-size: 20px; letter-spacing: -0.01em; }
.home-item-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.home-new { width: 100%; }

/* ————————————————————————————————— tablero */

.board { padding: 16px 16px 48px; }

.board-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 4px 0 16px;
}

.capture {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.capture textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  min-height: 88px;
}
.capture textarea::placeholder { color: var(--muted); }

.columns { display: flex; flex-direction: column; gap: 28px; }

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.column-count { font-family: var(--mono); font-weight: 400; }
.column-cards { display: flex; flex-direction: column; gap: 8px; }
.column-empty { color: #c4c3bf; margin: 4px 0 0; }

/* ————————————————————————————————— tarjeta */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow 200ms;
}
.card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }

.card-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 14px 10px;
  cursor: pointer;
  list-style: none;
  word-break: break-word;
}
.card-title::-webkit-details-marker { display: none; }

.card-dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent-ink);
}

.card-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 14px 14px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 14px;
}
.card-edit label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.card-edit textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font-size: 15px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
}
.card-edit-actions { display: flex; gap: 8px; }

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 2px 6px;
}
.btn-move {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-move:hover:not(:disabled) { color: var(--ink); background: rgba(0, 0, 0, 0.04); }
.btn-move:disabled { opacity: 0.25; cursor: default; }
.card-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ————————————————————————————————— aviso */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  margin: 0;
  max-width: calc(100vw - 32px);
  background: var(--black);
  color: #fff;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 14px;
}

/* ————————————————————————————————— escritorio */

@media (min-width: 900px) {
  .topbar-back, .board-title { display: none; }

  .board { padding: 20px 24px 60px; max-width: 1180px; margin: 0 auto; }

  .capture { flex-direction: row; align-items: flex-start; margin-bottom: 24px; }
  .capture textarea { min-height: 44px; padding: 10px 14px; }
  .capture .btn-primary { flex: none; }

  .columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
  }
}

@media (max-width: 899px) {
  .tabs { display: none; }
  #menu-btn { margin-left: auto; } /* sin las pestañas, nada empuja el menú a la derecha */
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
