/* ===========================================================
   Tablero — design tokens
   Family: Guacamaya Lab (mono nav, mint accent, dark/light)
   Signature: the "stamped" paid mark on settled cards
   =========================================================== */

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --sidebar-w: 220px;
  --topbar-h: 60px;
  --panel-w: 420px;

  --accent-mint: #6FE3B4;
  --accent-mint-dim: #3E7D63;
  --accent-coral: #EA8B6C;
  --accent-coral-dim: #7A4B3A;
  --accent-gold: #D9B25C;

  --person-yatan: #6FE3B4;
  --person-manuel: #6FA8E3;
  --person-dani: #EA8B6C;
  --person-adri: #B79CE8;
  --person-unassigned: #6B7280;

  --shadow-md: 0 8px 24px rgba(0,0,0,0.28);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.4);
}

:root[data-theme="dark"] {
  --bg: #12151A;
  --bg-elevated: #191D24;
  --surface: #1F242C;
  --surface-hover: #272E37;
  --border: #2E3540;
  --border-strong: #3A424E;
  --text: #E7EAEE;
  --text-dim: #8B94A3;
  --text-faint: #5C6473;
  --overlay: rgba(8,10,13,0.6);
}

:root[data-theme="light"] {
  --bg: #F4F2ED;
  --bg-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-hover: #EEEBE3;
  --border: #DDD8CC;
  --border-strong: #C9C2B2;
  --text: #1B1D1F;
  --text-dim: #63665F;
  --text-faint: #9A9689;
  --overlay: rgba(30,28,22,0.35);
  --accent-mint-dim: #B6EBD4;
  --accent-coral-dim: #F6D2C2;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input { font-family: inherit; color: inherit; }
input:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-mint);
  outline-offset: 2px;
}
::selection { background: var(--accent-mint-dim); }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 12px;
  z-index: 30;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand-mark { color: var(--accent-mint); }
.brand-name { font-family: var(--font-mono); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.sidebar-close { display: none; }

.board-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.board-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-dim); cursor: pointer;
  border: 1px solid transparent; background: none; text-align: left; width: 100%;
  font-family: var(--font-mono);
}
.board-item:hover { background: var(--surface-hover); color: var(--text); }
.board-item.active { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.board-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-mint); margin-right: 8px; flex-shrink: 0; opacity: 0; }
.board-item.active .dot { opacity: 1; }
.board-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item-count { font-size: 11px; color: var(--text-faint); }
.board-item-del {
  opacity: 0; background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 13px; padding: 2px 4px; border-radius: 4px;
}
.board-item:hover .board-item-del { opacity: 1; }
.board-item-del:hover { color: var(--accent-coral); background: var(--surface-hover); }

.add-board-btn {
  border: 1px dashed var(--border-strong); background: none; color: var(--text-dim);
  padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  font-family: var(--font-mono); text-align: left;
}
.add-board-btn:hover { color: var(--accent-mint); border-color: var(--accent-mint-dim); }

.sidebar-foot { display: flex; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--text-dim);
  width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
  position: relative;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn:disabled:hover { background: none; border-color: transparent; }
.icon-btn.danger:hover { color: var(--accent-coral); }
.sidebar-foot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sidebar-scrim { display: none; }

/* ===== Main / Topbar ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.menu-btn { display: none; }
.board-title {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700;
  margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; overflow-x: auto; }
.search-wrap { position: relative; }
.search-input {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 13px; width: 160px; color: var(--text);
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { width: 200px; transition: width .15s ease; }

.chip-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px; cursor: pointer;
  font-family: var(--font-mono); white-space: nowrap; flex-shrink: 0;
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.chip-btn[data-active="true"] { background: var(--accent-mint-dim); color: var(--accent-mint); border-color: var(--accent-mint-dim); }
:root[data-theme="light"] .chip-btn[data-active="true"] { color: #1B6B4A; }

.person-menu {
  position: absolute; top: 66px; right: 20px; z-index: 40;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 6px; min-width: 160px;
}
.person-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; background: none; border: none; width: 100%; text-align: left; color: var(--text);
}
.person-menu-item:hover { background: var(--surface-hover); }
.person-menu-item .swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.person-menu-item .check { margin-left: auto; opacity: 0; color: var(--accent-mint); }
.person-menu-item[data-checked="true"] .check { opacity: 1; }

/* ===== Board / Columns ===== */
.board-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; }
.columns { display: flex; gap: 16px; padding: 18px 20px; height: 100%; min-width: min-content; }

.column { width: 272px; flex: 0 0 272px; display: flex; flex-direction: column; max-height: 100%; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.column-name { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.column-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); background: var(--surface); border-radius: 999px; padding: 1px 7px; }
.column-cards {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 2px 2px 8px; border-radius: var(--radius-md); min-height: 40px;
}
.column-cards.drag-over { background: var(--surface-hover); outline: 1.5px dashed var(--border-strong); outline-offset: -4px; }
.column-add {
  margin-top: 6px; padding: 8px 9px; border-radius: var(--radius-sm); border: 1px dashed var(--border);
  background: none; color: var(--text-faint); font-size: 12.5px; text-align: left; cursor: pointer;
}
.column-add:hover { color: var(--accent-mint); border-color: var(--accent-mint-dim); }
.column-quick-input {
  width: 100%; background: var(--surface); border: 1px solid var(--accent-mint-dim); border-radius: var(--radius-sm);
  padding: 8px 9px; font-size: 13px; color: var(--text); margin-top: 6px; resize: none;
}

/* ===== Cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 11px; cursor: grab; box-shadow: 0 1px 0 rgba(0,0,0,0.06);
  border-left: 3px solid var(--card-person-color, var(--text-faint));
  display: flex; flex-direction: column; gap: 6px;
  overflow: hidden;
}
.card-cover {
  width: calc(100% + 22px); margin: -10px -11px 0; display: block;
  height: 120px; object-fit: cover; background: var(--bg-elevated);
}
.card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.card.dragging { opacity: 0.4; }
.card-title { font-size: 13.5px; line-height: 1.4; font-weight: 500; }
.card-title.done { text-decoration: line-through; color: var(--text-faint); }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge {
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px; border-radius: 5px;
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent;
}
.badge-due { color: var(--text-dim); background: var(--bg-elevated); }
.badge-due.overdue { color: var(--accent-coral); background: var(--accent-coral-dim); }
.badge-priority-high { color: var(--accent-coral); border-color: var(--accent-coral-dim); }
.badge-priority-med { color: var(--accent-gold); border-color: var(--accent-gold); opacity: 0.85; }
.badge-checklist { color: var(--text-faint); }
.badge-comments { color: var(--text-faint); }

.person-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }
.person-chip .swatch { width: 7px; height: 7px; border-radius: 50%; }

/* Signature: the stamp — settled cards get a rubber-stamp style mark */
.stamp {
  align-self: flex-start; font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-mint);
  border: 1.5px solid var(--accent-mint); border-radius: 4px; padding: 1px 6px;
  transform: rotate(-3deg); opacity: 0.9;
}
.chip-amount {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--accent-coral);
  border: 1px dashed var(--accent-coral-dim); border-radius: 5px; padding: 2px 6px;
}

/* ===== Card panel ===== */
.panel-scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 45; }
.card-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: 92vw;
  background: var(--bg-elevated); border-left: 1px solid var(--border); z-index: 46;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slideIn .16s ease;
}
.card-panel[hidden] { display: none; }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0.6; } to { transform: translateX(0); opacity: 1; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.panel-head-actions { display: flex; gap: 6px; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .field-label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.field input[type=text], .field input[type=date], .field input[type=datetime-local], .field input[type=number], .field select, .field textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 14px; color: var(--text); width: 100%;
}
.field textarea { resize: vertical; min-height: 64px; font-family: var(--font-sans); }
.title-input { font-size: 17px; font-weight: 600; border: none; background: none; padding: 2px 0; width: 100%; }
.title-input:focus { outline: none; border-bottom: 1.5px solid var(--accent-mint-dim); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.paid-toggle-row { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .15s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: var(--bg-elevated); border-radius: 50%; transition: .15s; }
.switch input:checked + .track { background: var(--accent-mint-dim); }
.switch input:checked + .track::before { transform: translateX(17px); background: var(--accent-mint); }

.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist-item { display: flex; align-items: center; gap: 8px; }
.checklist-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent-mint); }
.checklist-item input[type=text] { flex: 1; background: none; border: none; font-size: 13.5px; padding: 4px 0; color: var(--text); }
.checklist-item.done input[type=text] { color: var(--text-faint); text-decoration: line-through; }
.checklist-item-del { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.checklist-item-del:hover { color: var(--accent-coral); }
.checklist-add { background: none; border: none; color: var(--text-faint); font-size: 12.5px; text-align: left; cursor: pointer; padding: 4px 0; }
.checklist-add:hover { color: var(--accent-mint); }

.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.image-thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.image-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.image-thumb-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(8,10,13,0.65); color: #fff; border: none; cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.image-thumb-del:hover { background: var(--accent-coral); }

.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--surface); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.comment-time { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-top: 4px; }
.comment-add-row { display: flex; gap: 6px; }
.comment-add-row input { flex: 1; }

.btn {
  font-family: var(--font-mono); font-size: 12.5px; padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--accent-mint); border-color: var(--accent-mint); color: #0B1710; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-dim); }

.panel-footer-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 12px; }

.empty-state { color: var(--text-faint); font-size: 12.5px; text-align: center; padding: 24px 8px; font-family: var(--font-mono); }

/* ===== Dialog ===== */
.dialog { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0; background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: var(--overlay); }
.dialog form { padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 280px; }
.dialog h2 { margin: 0; font-family: var(--font-mono); font-size: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 12.5px; font-family: var(--font-mono);
  box-shadow: var(--shadow-md); z-index: 60; animation: toastIn .15s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .card-panel, .toast { animation: none; }
}

/* ===== Mobile ===== */
@media (max-width: 760px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 29; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; gap: 8px; }
  .board-title { font-size: 14px; }
  .search-input { width: 100px; }
  .search-input:focus { width: 130px; }
  .topbar-tools { gap: 6px; }
  .chip-btn { padding: 6px 9px; font-size: 11.5px; }
  .columns { padding: 12px; gap: 12px; scroll-snap-type: x mandatory; }
  .column { width: 84vw; flex: 0 0 84vw; scroll-snap-align: start; }
  .card-panel { width: 100vw; max-width: 100vw; }
}
