/* ============================================================
   WorkSpace — Main Stylesheet
   Inspired by monday.com aesthetics
   ============================================================ */

:root {
  --bg:          #1c1f2e;
  --bg2:         #252838;
  --bg3:         #2d3147;
  --sidebar-bg:  #1a1d2e;
  --panel:       #20233a;
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.13);
  --text:        #e8e9f0;
  --text2:       #9ea0b5;
  --text3:       #6b6e85;
  --accent:      #6c63ff;
  --accent2:     #8b83ff;
  --accent-hover:#5a51ee;
  --red:         #e2445c;
  --green:       #00c875;
  --orange:      #fdab3d;
  --blue:        #579bfc;
  --teal:        #2bcbba;
  --pink:        #ff6584;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 20px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.25);
  --trans:       all 0.18s ease;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-w:   240px;
  --topbar-h:    54px;
}

/* ---- Light mode ---- */
body.light-mode {
  --bg:          #f4f5f9;
  --bg2:         #ffffff;
  --bg3:         #eef0f6;
  --sidebar-bg:  #f0f1f8;
  --panel:       #ffffff;
  --border:      rgba(0,0,0,0.08);
  --border2:     rgba(0,0,0,0.14);
  --text:        #1c1f2e;
  --text2:       #545779;
  --text3:       #9194ae;
  --accent:      #6c63ff;
  --accent2:     #5a51ee;
  --accent-hover:#4a42d8;
  --shadow:      0 4px 20px rgba(0,0,0,0.1);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.08);
}
#trash-icon { color: #E2E8F0; filter: drop-shadow(0 0 3px rgba(226,232,240,0.5)); }
body.light-mode #trash-icon { color: #64748B; filter: none; }
body.light-mode .sidebar { border-right: 1px solid var(--border2); }
body.light-mode .sidebar-logo .logo-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
body.light-mode .sidebar-section-title { color: var(--text3); }
body.light-mode .sidebar-item { color: var(--text2); }
body.light-mode .sidebar-item:hover { background: rgba(108,99,255,0.08); color: var(--accent); }
body.light-mode .sidebar-item.active { color: var(--accent); background: rgba(108,99,255,0.1); }
body.light-mode .board-table thead th,
body.light-mode .board-table tfoot tr { background: #eef0f6; }
body.light-mode .board-table tbody td:first-child { background: #ffffff; }
body.light-mode .board-table tbody tr:hover td:first-child { background: #f8f9fd; }
body.light-mode .board-table tbody tr:hover { background: #f8f9fd; }
body.light-mode input, body.light-mode select, body.light-mode textarea { color: var(--text); }
body.light-mode .status-dropdown { background: var(--bg2); }
body.light-mode ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); }
body.light-mode #sticky-hscroll { background: var(--bg2); border-top-color: var(--border2); }
body.light-mode #sticky-hscroll::-webkit-scrollbar-track { background: var(--bg2); }
body.light-mode #sticky-hscroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.25); border-color: var(--bg2); }
body.light-mode #sticky-hscroll::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.4); }

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

.board-content::-webkit-scrollbar { width: 8px; height: 12px; }
.board-content::-webkit-scrollbar-track { background: var(--bg3); border-radius: 6px; }
.board-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 6px; border: 2px solid var(--bg3); }
.board-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s;
  z-index: 50;
}
.sidebar-logo {
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  flex-shrink: 0;
}
.sidebar-logo .logo-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-scroll {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.sidebar-section { margin-bottom: 4px; }
.sidebar-section-title {
  padding: 6px 18px 4px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3);
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 18px;
  color: var(--text2);
  border-radius: 0;
  transition: var(--trans);
  cursor: pointer;
  font-size: 13.5px;
  position: relative;
  user-select: none;
}
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sidebar-item.active {
  background: rgba(108,99,255,0.18);
  color: var(--accent2);
}
.sidebar-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.sidebar-item .item-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.sidebar-item .item-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-item .item-badge {
  margin-left: auto; background: var(--bg3);
  padding: 1px 7px; border-radius: 10px; font-size: 11px;
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer; transition: var(--trans);
}
.sidebar-user:hover { background: rgba(255,255,255,0.05); }
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.sidebar-user .user-role { font-size: 11px; color: var(--text3); }

/* ---- MAIN ---- */
.main-wrap {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  position: relative; background: var(--bg2);
}
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  flex-shrink: 0;
}
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.page-content {
  flex: 1; overflow: auto; padding: 24px;
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  user-select: none;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 16px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  border: none; transition: var(--trans);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--bg2); border-color: var(--border2); }
.btn-danger { background: var(--red); color: #fff; }

/* Menú de fila */
.row-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 5px;
  font-size: 13.5px; cursor: pointer; color: var(--text);
}
.row-menu-item:hover { background: rgba(255,255,255,0.07); }

/* Subelementos — animación slide */
.subitem-section {
  background: var(--bg3);
}
.subitem-section > td {
  padding: 0;
  border-top: none !important;
  border-bottom: none !important;
}
/* Cuando está cerrado, ocultar el tr completamente */
.subitem-section:not(.is-open) {
  display: none;
}
.subitem-section.is-open {
  display: table-row;
}
.subitem-section-anim {
  transition: opacity 0.22s ease, visibility 0.22s ease;
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  overflow: visible;
}
.subitem-section-anim.open {
  opacity: 1;
  visibility: visible;
  max-height: none;
  border-top: 2px solid var(--border);
}
.btn-add-subitem {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 5px; border: none;
  background: none; color: var(--accent2); font-size: 12.5px;
  font-weight: 600; cursor: pointer; margin-top: 6px;
  margin-left: 44px;
}
.btn-add-subitem:hover { background: rgba(108,99,255,0.1); }
[data-subcol-id]:hover .subcol-menu-btn { opacity: 1 !important; }
/* Placeholder nombre subelemento */
tr[data-subitem-row] .row-name-input::placeholder { color: var(--text3); font-style: italic; }
tr[data-subitem-row] input,
tr[data-subitem-row] textarea,
tr[data-subitem-row] .row-name-input,
.subitem-section input { text-transform: none !important; }
.board-table td input, .board-table td textarea { text-transform: none; }
/* Fila completada (deadline) — flash verde suave sin tachado */
tr.row-completed td {
  transition: opacity 0.35s ease;
}
tr.row-completed {
  animation: rowCompletedFlash 0.6s ease forwards;
}
@keyframes rowCompletedFlash {
  0%   { background: transparent; }
  30%  { background: rgba(0,200,117,0.12); }
  100% { background: transparent; }
}
.btn-danger:hover { background: #c73450; }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn-icon {
  width: 30px; height: 30px; padding: 0;
  background: transparent; border: none; color: var(--text3);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.btn-icon:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.btn-sm { padding: 4px 12px; font-size: 12.5px; }
.btn-xs { padding: 2px 9px; font-size: 11.5px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--text2); }
.form-control {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  padding: 8px 12px; font-size: 13.5px;
  transition: var(--trans); outline: none; width: 100%;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
.form-control::placeholder { color: var(--text3); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239ea0b5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; padding-right: 32px; }
.form-hint { font-size: 11.5px; color: var(--text3); }
.form-error { font-size: 12px; color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-body { padding: 20px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  box-shadow: var(--shadow); transform: translateY(-16px); transition: transform 0.2s;
  position: relative; overflow: hidden;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}
.modal-lg { max-width: 640px; }

/* ---- Page loader ---- */
#page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.35s ease;
}
#page-loader.hide { opacity: 0; pointer-events: none; }

/* ---- Modal loader (5 dots bouncing) ---- */
.modal-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border-radius: inherit; z-index: 10;
}
.dots-loader { display: flex; gap: 10px; align-items: center; }
.dots-loader span {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent);
  animation: dot-bounce 0.9s ease-in-out infinite;
  opacity: 0.35;
}
.dots-loader span:nth-child(1) { animation-delay: 0s; }
.dots-loader span:nth-child(2) { animation-delay: 0.15s; }
.dots-loader span:nth-child(3) { animation-delay: 0.30s; }
.dots-loader span:nth-child(4) { animation-delay: 0.45s; }
.dots-loader span:nth-child(5) { animation-delay: 0.60s; }
@keyframes dot-bounce {
  0%, 55%, 100% { transform: translateY(0); opacity: 0.35; }
  27% { transform: translateY(-18px); opacity: 1; }
}

/* ============================================================
   BADGE / CHIPS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-superadmin { background: rgba(168,85,247,0.2); color: #c084fc; }
.badge-admin { background: rgba(108,99,255,0.2); color: var(--accent2); }
.badge-member { background: rgba(158,160,181,0.15); color: var(--text2); }
.badge-active { background: rgba(0,200,117,0.15); color: var(--green); }
.badge-inactive { background: rgba(226,68,92,0.15); color: var(--red); }

/* ============================================================
   TABLE
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 14px; text-align: left;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.data-table tr:hover td { background: rgba(255,255,255,0.025); }
.data-table tr:last-child td { border-bottom: none; }

/* ============================================================
   WORKSPACE / BOARD CARDS
   ============================================================ */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
.ws-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer;
  transition: var(--trans); overflow: hidden;
}
.ws-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.ws-card-stripe { height: 5px; }
.ws-card-body { padding: 14px 16px; }
.ws-card-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.ws-card-desc { font-size: 12.5px; color: var(--text3); margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-card-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text3); }
/* Desktop: hide "Nuevo tablero" menu item from 3-dots (button already visible) and hide 3-dots for non-owners */
.ws-new-board-menu-item { display: none; }
.ws-dots-nonowner { display: none; }

/* ============================================================
   BOARD TABLE (the main board view)
   ============================================================ */
/* Board actions: desktop visible, mobile hidden by default */
.board-actions-mobile { display: none; }

.board-wrap { height: 100%; display: flex; flex-direction: column; }
.board-topbar {
  padding: 12px 20px; display: flex; align-items: center;
  gap: 10px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.board-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0; background: var(--bg2); }
/* Ocultar el scrollbar nativo — reemplazado por #sticky-hscroll fijo abajo */
.board-scroll-x { overflow-x: auto; overflow-y: visible; padding: 16px 20px; min-height: 100%; }
.board-scroll-x::-webkit-scrollbar { height: 0; }

/* Scrollbar horizontal fijo al fondo del viewport */
#sticky-hscroll {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 100;
  display: none;
}
#sticky-hscroll-inner { height: 1px; }
#sticky-hscroll::-webkit-scrollbar        { height: 14px; }
#sticky-hscroll::-webkit-scrollbar-track  { background: var(--bg3); }
#sticky-hscroll::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.28); border-radius: 7px; border: 3px solid var(--bg3); }
#sticky-hscroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }

/* Lazy-loaded rows — hidden until revealed by IntersectionObserver */
.row-lazy-hidden { display: none !important; }

.board-group { margin-bottom: 24px; width: max-content; min-width: max-content; }
.board-group-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 0; padding: 6px 8px;
  border-radius: var(--radius) var(--radius) 0 0;
  user-select: none;
}
.board-group-name {
  font-size: 13.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  cursor: pointer;
}
.board-group-count { font-size: 12px; color: var(--text3); }
.board-group-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: var(--trans); }
.board-group:hover .board-group-actions { opacity: 1; }

/* Board table */
.board-table-wrap { overflow-x: visible; min-width: 100%; }
.board-table {
  border-collapse: collapse; width: max-content;
  table-layout: fixed;
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
}
.board-table thead th {
  background: var(--bg3);
  padding: 7px 10px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
  position: relative;
  user-select: none;
}
.board-table thead th:first-child { position: sticky; left: 0; z-index: 3; background: var(--bg3); }
.board-table tbody td:first-child { position: sticky; left: 0; z-index: 2; background: var(--bg2); }
.board-table tbody tr:hover td:first-child { background: var(--bg3); }
.board-table tfoot td:first-child { position: sticky; left: 0; z-index: 2; background: var(--bg3); }
.board-table thead th .col-resize {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 8px; cursor: col-resize;
  background: transparent; transition: background 0.15s;
  z-index: 5;
}
.board-table thead th .col-resize::after {
  content: ''; position: absolute;
  right: 2px; top: 20%; bottom: 20%; width: 2px;
  background: transparent; border-radius: 2px; transition: background 0.15s;
}
.board-table thead th .col-resize:hover::after,
.board-table thead th .col-resize:active::after { background: var(--accent); }
.board-table thead th .col-title {
  display: flex; align-items: center; gap: 6px; overflow: hidden;
}
.board-table thead th .col-icon {
  font-size: 12px; color: var(--text3); flex-shrink: 0;
}
.board-table thead th .col-name { overflow: hidden; text-overflow: ellipsis; }
.board-table td {
  padding: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: 36px;
  overflow: hidden;
  /* contain eliminado: layout y paint atrapan position:fixed (person-drop, timeline-picker) */
}
/* max-width:0 es el truco estándar para que overflow:hidden funcione correctamente
   en celdas de tabla con table-layout:fixed — sin él el navegador no recorta el contenido */
.board-table tbody td { max-width: 0; }
/* La celda envolvente de subelementos NO debe recortarse: overflow:hidden en un ancestro
   rompe position:sticky de los descendientes (la primera columna sticky del subelemento) */
.board-table tbody tr.subitem-section > td { overflow: visible; max-width: none; }
.board-table tr:hover td { background: rgba(255,255,255,0.025); }
.board-table tr:last-child td { border-bottom: none; }

/* Row name cell */
.row-name-cell {
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px; height: 36px;
  position: relative;
}
.row-color-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
}
.row-name-input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13.5px; width: 100%; min-width: 0;
  padding-left: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-name-input:focus { color: var(--text); }
.row-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: var(--trans); }
.board-table tr:hover .row-actions { opacity: 1; }

/* Cell types */
.cell-wrap { height: 36px; display: flex; align-items: center; justify-content: center; padding: 0 8px; overflow: hidden; white-space: nowrap; min-width: 0; }
.cell-text-input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13.5px; width: 100%; min-width: 0; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell-text-input:focus { background: var(--bg3); }

.status-chip {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 12px; border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--trans); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.status-chip:hover { filter: brightness(1.15); }

.status-dropdown {
  position: fixed; z-index: 9999;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 200px; max-width: 260px;
  padding: 0; overflow: hidden;
}
.status-option {
  padding: 6px 10px; border-radius: 4px;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
}
.status-option:hover { background: rgba(255,255,255,0.07); }

.checkbox-cell {
  width: 18px; height: 18px; cursor: pointer;
  accent-color: var(--accent);
}
.date-cell { font-size: 12.5px; color: var(--text); background: transparent; border: none; outline: none; text-align: center; width: 100%; min-width: 0; cursor: pointer; }
.date-cell:focus { background: var(--bg3); }
.number-cell { text-align: right; }
.formula-cell { width: 100%; text-align: right; }

.person-chip {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; cursor: pointer;
}

/* Add row button */
.add-row-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; color: var(--text3);
  font-size: 13px; cursor: pointer;
  border: 1px dashed var(--border2);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: var(--trans);
  background: transparent;
  width: 100%;
}
.add-row-btn:hover { background: rgba(255,255,255,0.03); color: var(--text); }

/* Add column button */
.add-col-btn {
  background: transparent; border: none; color: var(--text3);
  padding: 7px 14px; cursor: pointer; font-size: 20px;
  transition: var(--trans);
}
.add-col-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* Add group button */
.add-group-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; color: var(--text3);
  font-size: 13px; cursor: pointer;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  transition: var(--trans); background: transparent; width: auto;
}
.add-group-btn:hover { border-color: var(--accent); color: var(--accent2); }

/* ============================================================
   COLOR PICKER (palette)
   ============================================================ */
.color-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent; transition: var(--trans);
}
.color-swatch:hover, .color-swatch.selected {
  border-color: #fff; transform: scale(1.15);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 12px 18px;
  font-size: 13.5px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.25s ease;
  max-width: 320px;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--blue); }
@keyframes toast-in { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* ============================================================
   DROPDOWN MENU
   ============================================================ */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 5px; z-index: 300; min-width: 160px;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 5px;
  font-size: 13px; color: var(--text);
  cursor: pointer; transition: var(--trans);
}
.dropdown-item:hover { background: rgba(255,255,255,0.07); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: rgba(226,68,92,0.12); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 14px;
  color: var(--text3); text-align: center;
}
.empty-state .empty-icon { font-size: 48px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; color: var(--text2); }
.empty-state p { font-size: 13.5px; max-width: 280px; line-height: 1.6; }

/* ============================================================
   LOADING
   ============================================================ */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 16px; padding: 40px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow);
}
.auth-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px; justify-content: center;
}
.auth-logo .logo-mark {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #fff;
}
.auth-logo .logo-name { font-size: 22px; font-weight: 700; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { font-size: 13.5px; color: var(--text3); margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text3); }
.auth-alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 12px;
}
.auth-alert-error { background: rgba(226,68,92,0.15); color: var(--red); border: 1px solid rgba(226,68,92,0.3); }
.auth-alert-success { background: rgba(0,200,117,0.15); color: var(--green); border: 1px solid rgba(0,200,117,0.3); }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-wrap { position: relative; }
.search-wrap .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 14px; }
.search-input { padding-left: 32px !important; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 0; margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px; background: transparent; border: none;
  color: var(--text3); font-size: 13.5px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: var(--trans); border-radius: var(--radius) var(--radius) 0 0;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg3); color: var(--text);
  padding: 4px 10px; border-radius: 5px; font-size: 12px;
  white-space: nowrap; pointer-events: none; z-index: 400;
  border: 1px solid var(--border2);
}

/* ============================================================
   RESPONSIVE (MOBILE)
   ============================================================ */

/* Sidebar close button — hidden on desktop, shown on mobile */
#sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: transparent; border: none; cursor: pointer;
  color: var(--text2); font-size: 18px;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
#sidebar-close-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
body.light-mode #sidebar-close-btn:hover { background: rgba(0,0,0,0.06); }

/* Hamburger button — hidden on desktop, shown on mobile */
#mob-menu-btn {
  display: none;
  position: fixed; top: 9px; left: 10px; z-index: 190;
  width: 36px; height: 36px;
  background: transparent; border: none; cursor: pointer;
  border-radius: var(--radius); color: var(--text2);
  align-items: center; justify-content: center;
  font-size: 20px; transition: var(--trans);
  -webkit-tap-highlight-color: transparent;
}
#mob-menu-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
body.light-mode #mob-menu-btn:hover { background: rgba(0,0,0,0.06); }

/* Sidebar overlay */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  -webkit-tap-highlight-color: transparent;
}
#sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  /* Sidebar — slide-over drawer */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: -282px;
    width: 280px; min-width: 280px; height: 100%;
    transition: left 0.26s ease; z-index: 200;
    border-right: none;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.4); }

  /* Hamburger — visible on mobile */
  #mob-menu-btn { display: flex !important; }

  /* Sidebar close button — visible on mobile */
  #sidebar-close-btn { display: flex !important; }

  /* Main wrap — full width (sidebar is off-screen) */
  .main-wrap { width: 100%; }

  /* Topbar — left padding for hamburger, reduced gap */
  .topbar { padding: 0 12px 0 54px; gap: 8px; }

  /* Topbar — hide non-essential icons on mobile to prevent right-side overflow */
  #email-inbox-btn { display: none !important; }

  /* Board filter bar — swap desktop buttons for 3-dot menu */
  .board-actions-desktop { display: none !important; }
  .board-actions-mobile  { display: block !important; }

  /* Side panels (automations, trash, history, activity) — full width on mobile */
  #auto-panel,
  #trash-panel,
  #history-panel,
  #activity-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    border-left: none !important;
  }

  /* Board table — compact view: 3 columns visible (name + 2 data) */
  .board-table thead th[data-col-id="__name__"] { width: 156px !important; min-width: 156px !important; }
  .board-table thead th[data-col-type]           { width: 110px !important; min-width: 110px !important; }
  .board-table thead th:last-child               { width: 36px  !important; min-width: 36px  !important; }
  .board-table td,
  .board-table th                                { height: 30px !important; }
  .cell-wrap                                     { height: 30px !important; padding: 0 5px !important; font-size: 12px !important; }
  .row-name-cell                                 { height: 30px !important; padding: 0 6px  !important; gap: 4px !important; }
  .row-name-input                                { font-size: 12.5px !important; }
  .board-table thead th .col-title               { font-size: 12px !important; }
  .board-table thead th .col-name                { font-size: 12px !important; }

  /* Notes cell — prevent overflow of 30px cell-wrap (iOS Safari blocks taps on overflowing children) */
  .notes-cell { min-height: 0 !important; height: 100% !important; touch-action: manipulation; }

  /* Hide row drag handles on mobile (no drag-and-drop on touch) */
  .row-drag-handle { display: none !important; }

  /* Hide activity/comments button on mobile (moved to 3-dot menu) */
  .row-activity-btn { display: none !important; }

  /* Hide column resize handle on mobile */
  .col-resize { display: none !important; }

  /* Subitem table — match parent compact sizing on mobile */
  .subitem-wrapper { padding-left: 16px !important; }
  .subitem-table { min-width: unset !important; }
  .subitem-table col:first-child { width: 156px !important; min-width: 120px !important; }
  .subitem-table col { width: 100px !important; min-width: 80px !important; }
  .subitem-table th, .subitem-table td { height: 30px !important; font-size: 12px !important; }
  .subitem-table .cell-wrap { height: 30px !important; padding: 0 5px !important; font-size: 12px !important; }
  tr[data-subitem-row] .row-name-input { font-size: 12.5px !important; }
  tr[data-subitem-row] td:first-child { padding: 0 4px !important; }

  /* User pill — only avatar circle, no pill styling */
  .user-pill-name { display: none !important; }
  .user-pill-caret { display: none !important; }
  .user-pill {
    background: transparent !important;
    border: none !important;
    padding: 2px !important;
    gap: 0 !important;
  }

  /* Settings header — left padding for hamburger + wrapping */
  .settings-hdr { padding: 8px 12px 8px 54px; flex-wrap: wrap; height: auto; min-height: var(--topbar-h); }
  .settings-tabs-nav { flex-wrap: wrap; }
  .stab-btn { padding: 5px 10px; font-size: 12px; }

  /* Sticky hscroll — no sidebar offset on mobile */
  #sticky-hscroll { left: 0; }

  /* Page content — tighter padding */
  .page-content { padding: 12px; }
  .board-scroll-x { padding: 10px 12px; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }

  /* Auth card */
  .auth-card { padding: 28px 20px; }

  /* Workspace grid — single column */
  .ws-grid { grid-template-columns: 1fr; }

  /* Workspace topbar — mobile adjustments */
  .ws-new-board-btn { display: none !important; }
  .ws-topbar-desc { display: none !important; }
  .ws-members-label { display: none !important; }
  .ws-dots-nonowner { display: block !important; }
  .ws-new-board-menu-item { display: block !important; }

  /* Modals — bottom sheet style */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: 100%;
    border-radius: 16px 16px 0 0;
    transform: translateY(30px);
    max-height: 92vh;
    overflow-y: auto;
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  .modal-lg { max-width: 100%; }

  /* Toast — full width */
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: 100%; }

  /* Notification panel — constrained to viewport */
  #notif-panel {
    width: calc(100vw - 24px) !important;
    right: 12px !important;
    left: auto !important;
    max-height: 70vh;
  }

}

@media (max-width: 480px) {
  .auth-card { padding: 20px 16px; }
  .page-content { padding: 8px; }
  .board-scroll-x { padding: 8px; }
  .topbar { padding-left: 50px; }
  .settings-hdr { padding-left: 50px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.text-muted { color: var(--text3); } .text-secondary { color: var(--text2); }
.text-accent { color: var(--accent2); }
.font-600 { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; } .h-full { height: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }

/* ---- Sidebar workspace groups ---- */
.sidebar-ws-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 8px; border-radius: var(--radius);
  cursor: pointer; transition: var(--trans); margin: 1px 4px;
  user-select: none;
}
.sidebar-ws-header:hover { background: rgba(255,255,255,0.06); }
.sidebar-ws-header.active { background: rgba(255,255,255,0.08); }
.sidebar-ws-dot {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.sidebar-board-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px 5px 8px; border-radius: 4px;
  font-size: 14px; color: var(--text2); text-decoration: none;
  transition: background 0.15s; margin: 1px 4px;
  white-space: nowrap; overflow: hidden;
}
.sb-drag-handle {
  flex-shrink: 0; font-size: 13px; color: var(--text3);
  opacity: 0; transition: opacity 0.15s; cursor: grab;
  padding: 0 2px;
}
.sidebar-board-item:hover .sb-drag-handle { opacity: 1; }
/* Drop indicator line */
.sb-drop-line {
  height: 2px; background: var(--accent); border-radius: 2px;
  margin: 0 8px; pointer-events: none;
}
.sidebar-board-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.sidebar-board-item.active { background: rgba(255,255,255,0.1); color: var(--text); font-weight: 600; }
.sidebar-board-dot {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
/* Sub-item Dashboard */
.sb-dash-item {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 4px 4px 36px; border-radius: 4px;
  font-size: 12px; color: var(--text3); text-decoration: none;
  transition: background 0.15s; margin: 1px 4px;
}
.sb-dash-item:hover { background: rgba(108,99,255,0.1); color: var(--accent2); }
.sb-dash-item.active { background: rgba(108,99,255,0.15); color: var(--accent2); font-weight:600; }
/* Botón 3 puntos — dentro del anchor, visible solo en hover */
.sidebar-board-item:hover .sb-dots-btn,
.sb-dash-item:hover .sb-dots-btn { opacity: 1; }
.sb-dots-btn {
  opacity: 0; flex-shrink: 0; margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 14px; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  pointer-events: auto;
}
.sb-dots-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
/* Menú popup del sidebar */
#sb-popup-menu {
  position: fixed; z-index: 99999;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  padding: 4px; min-width: 160px;
}
#sb-popup-menu .sb-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 5px;
  font-size: 13px; color: var(--text); cursor: pointer;
  transition: background 0.12s;
}
#sb-popup-menu .sb-menu-item:hover { background: rgba(255,255,255,0.07); }
#sb-popup-menu .sb-menu-item.danger { color: var(--red); }
#sb-popup-menu .sb-menu-item.danger:hover { background: rgba(226,68,92,0.1); }

/* Bell button — no browser focus style */
#notif-btn { -webkit-appearance: none; appearance: none; }
#notif-btn:focus { outline: none; background: transparent !important; }
#notif-btn:active { background: rgba(255,255,255,0.06) !important; }

/* Activity panel */
#ap-input:empty:before { content: attr(data-placeholder); color: var(--text3); pointer-events: none; }
.mention-opt { transition: background 0.12s; }
.mention-opt.selected { background: rgba(255,255,255,0.07); }

/* Filter bar */
#filter-bar { min-height: 44px; }
#filter-bar button:focus { outline: none; }

/* Lastupdate column — force left alignment at all levels */
td .lastupdate-cell {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  text-align: left !important;
  width: 100%;
  padding: 0 8px 0 14px;
  box-sizing: border-box;
}

/* Cell wrap for lastupdate — full width, left aligned */
td:has(.lastupdate-cell) .cell-wrap {
  justify-content: flex-start !important;
  padding: 0 !important;
  width: 100%;
}

/* ---- Deadline strike animation ---- */
@keyframes strikeSlide {
  from { width: 0; opacity: 1; }
  to   { width: 100%; opacity: 1; }
}
@keyframes sparkPop {
  0%   { transform: translate(-50%,-50%) scale(0); opacity: 1; }
  60%  { transform: translate(-50%,-50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
}
@keyframes sparkFly {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0); }
}
.deadline-strike-line {
  position: absolute;
  top: 50%; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent2), #00C875);
  border-radius: 2px;
  transform: translateY(-50%);
  animation: strikeSlide 0.35s cubic-bezier(0.4,0,0.2,1) forwards;
  pointer-events: none;
  z-index: 10;
}
.deadline-spark {
  position: fixed;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  animation: sparkFly 0.5s ease-out forwards;
}

/* ---- Column submenu ---- */
.cmenu-item-sub {
  position: relative;
}
.cmenu-item-sub:hover > .cmenu-submenu,
.cmenu-item-sub.open > .cmenu-submenu {
  display: block;
}
.cmenu-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: -4px;
  min-width: 190px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 4px 6px 20px rgba(0,0,0,0.45);
  padding: 4px;
  z-index: 99999;
}
/* Flip left if too close to right edge */
.cmenu-submenu.flip-left {
  left: auto;
  right: 100%;
}

/* ---- Row drag & drop ---- */
.row-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  flex-shrink: 0;
  color: var(--text3);
  cursor: grab;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s;
  user-select: none;
}
.board-table tr:hover .row-drag-handle { opacity: 1; }
.board-row-draggable.row-dragging { opacity: 0.4; }
.board-row-draggable.row-drag-over-top    td { box-shadow: inset 0 2px 0 var(--accent); }
.board-row-draggable.row-drag-over-bottom td { box-shadow: inset 0 -2px 0 var(--accent); }
.tbody-empty-drag-over tr td { box-shadow: inset 0 0 0 2px var(--accent) !important; background: rgba(108,99,255,0.08); }

/* ── Phosphor Icons ─────────────────────────────────────────────── */
i[class^="ph"] {
  font-size: inherit;
  line-height: 1;
  vertical-align: middle;
}
.btn-icon i[class^="ph"],
.btn-xs i[class^="ph"]    { font-size: 15px; }
.item-icon i[class^="ph"] { font-size: 16px; }
.col-drag-handle i[class^="ph"],
.row-drag-handle i[class^="ph"] { font-size: 14px; cursor: grab; }
.col-menu-btn i[class^="ph"],
.subcol-menu-btn i[class^="ph"],
.sb-dots-btn i[class^="ph"] { font-size: 14px; }
.dropdown-item i[class^="ph"],
.row-menu-item i[class^="ph"],
.sb-menu-item i[class^="ph"] { font-size: 14px; margin-right: 4px; }
/* Phosphor en botones del modal */
.modal-header .btn-icon i[class^="ph"] { font-size: 16px; }

/* Subelementos — scroll sincronizado con el tablero padre */
.subitem-inner-scroll {
  scrollbar-width: none; /* Firefox */
}
.subitem-inner-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* ============================================================
   SWITCHES (toggle)
   ============================================================ */
.sw { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.sw input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-track {
  display: inline-block; width: 36px; height: 20px;
  background: var(--border2); border-radius: 20px;
  transition: background 0.2s; cursor: pointer; position: relative;
}
.sw-track::after {
  content: ''; position: absolute;
  width: 14px; height: 14px; background: #fff;
  border-radius: 50%; top: 3px; left: 3px;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.sw input:checked + .sw-track { background: var(--accent); }
.sw input:checked + .sw-track::after { left: 19px; }
.sw-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 13.5px; color: var(--text2);
  user-select: none;
}
body.light-mode .sw-track::after { box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-page { display: flex; flex-direction: column; height: 100%; }
.settings-hdr {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg2);
}
.settings-hdr-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; margin-right: 8px;
}
.settings-hdr-title i { font-size: 18px; color: var(--accent2); }
.settings-tabs-nav {
  display: flex; align-items: center; gap: 2px; flex: 1;
}
.stab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 6px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text3);
  transition: all 0.15s;
}
.stab-btn:hover { color: var(--text2); background: rgba(255,255,255,0.05); }
body.light-mode .stab-btn:hover { background: rgba(0,0,0,0.04); }
.stab-btn.active { color: var(--accent2); background: rgba(108,99,255,0.12); }
.stab-content { flex: 1; overflow-y: auto; display: none; }
.stab-content.active { display: block; }

/* ============================================================
   TIMELINE COLUMN
   ============================================================ */
.timeline-bar {
  background: var(--accent);
  border-radius: 4px;
  padding: 3px 8px;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  box-sizing: border-box;
}
.timeline-bar-text {
  font-size: 11.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.timeline-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  cursor: pointer;
  padding: 4px 8px;
  width: 100%;
  box-sizing: border-box;
}
