:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --col: #e7e9ef;
  --text: #1d2130;
  --muted: #687086;
  --line: #d5d9e2;
  --accent: #3f62e8;
  --accent-text: #ffffff;
  --danger: #c93a3a;
  --st-pendiente: #d98b14;
  --st-en_curso: #3f62e8;
  --st-aplicado: #2f9a5c;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161d;
    --panel: #1f2330;
    --col: #191c26;
    --text: #e6e8ef;
    --muted: #9198ab;
    --line: #2f3445;
    --accent: #6d88ff;
    --accent-text: #0d1020;
    --danger: #ef6b6b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, select, input, textarea, .button { font: inherit; color: inherit; }
button, .button, select {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.icon { padding: 4px 7px; background: transparent; border-color: transparent; }
.icon:hover { background: var(--panel); }
.danger:hover { color: var(--danger); border-color: var(--danger); }
.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 12px; background: var(--panel); }

/* ---- Acceso ---- */
.auth { max-width: 360px; margin: 12vh auto; padding: 24px; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); }
.auth h1 { margin-top: 0; font-size: 22px; }
.auth form { display: grid; gap: 14px; }
.auth label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.auth input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }
.auth-error { color: var(--danger); }
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; background: transparent; color: var(--muted);
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle.on .slash { display: none; }

/* ---- Barra superior ---- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 18px; }
.project, .actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.project select { font-weight: 600; max-width: 260px; }
.actions { margin-left: auto; }
.target, .check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.logout { margin: 0; }

.hint { margin: 10px 16px 0; color: var(--muted); font-size: 13px; }
.clip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 10px 16px 0; padding: 8px 12px;
  background: var(--panel); border: 2px solid var(--accent); border-radius: var(--radius);
}
.clip[hidden] { display: none; }
.clip img { height: 48px; max-width: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.clip span { flex: 1; min-width: 180px; }

/* ---- Tablero ---- */
.board {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px 40px;
  overflow-x: auto;
}
.col {
  flex: 0 0 320px;
  background: var(--col); border-radius: var(--radius);
  padding: 10px; min-height: 160px;
  border: 2px dashed transparent;
}
.col.inbox { border-style: solid; border-color: var(--line); }
.col.over { border-color: var(--accent); border-style: dashed; }
.col-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.col-head h2 { margin: 0; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--muted); font-size: 12px; }
.cards { display: grid; gap: 10px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 8px; margin: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  border-left: 4px solid var(--st-pendiente);
  overflow: hidden;
}
.card.st-en_curso { border-left-color: var(--st-en_curso); }
.card.st-aplicado { border-left-color: var(--st-aplicado); opacity: .7; }
.card.dragging { opacity: .4; }
.thumb { position: relative; background: var(--bg); }
.thumb img { display: block; width: 100%; max-height: 240px; object-fit: cover; object-position: top; cursor: zoom-in; }
.cid { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.card textarea {
  display: block; width: 100%; resize: none; min-height: 60px;
  border: 0; border-top: 1px solid var(--line); padding: 8px 10px;
  background: transparent; outline: none;
}
.card textarea:focus { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.note { margin: 0; padding: 6px 10px; font-size: 13px; background: color-mix(in srgb, var(--st-aplicado) 12%, transparent); white-space: pre-wrap; }
.card footer { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.card footer select { padding: 3px 6px; font-size: 13px; max-width: 140px; }
.move { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; }
.saved { margin-left: auto; color: var(--muted); font-size: 12px; }

.lightbox {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 16px; cursor: zoom-out;
  overflow: auto;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 32px); object-fit: contain; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); z-index: 30;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---- Celular ---- */
@media (max-width: 700px) {
  .hide-sm, .target, .hint { display: none; }
  .top { padding: 8px 12px; }
  .actions { margin-left: 0; width: 100%; }
  .actions .primary { flex: 1; text-align: center; }
  .project { flex: 1; }
  .project select { flex: 1; max-width: none; }
  .board { flex-direction: column; align-items: stretch; padding: 12px; }
  .col { flex-basis: auto; }
}
