/* Modern, clean and professional UI inspired by reference design */
:root{
  --bg: #f9fafb;
  --panel: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --accent: #2563eb;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --card: #ffffff;
  --border: #e5e7eb;
  --hover: #f3f4f6;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
*{box-sizing:border-box}
html,body{height:100%;overflow-x:hidden;}
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

/* Mejoras táctiles para móviles */
@media (max-width: 640px) {
  button, .btn, .icon-btn, select, input[type="color"] {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  .emoji-item {
    min-width: 40px;
    min-height: 40px;
  }
}

/* Login Screen */
.login-screen{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

@media (max-width: 640px) {
  .login-screen{
    padding: 16px;
  }
  .login-container{
    padding: 24px;
    border-radius: 12px;
  }
}

.login-header{text-align: center; margin-bottom: 32px;}
.login-header h1{margin: 0 0 8px 0; font-size: 28px; color: var(--text); font-weight: 700;}
.login-header p{margin: 0; color: var(--muted); font-size: 14px;}

@media (max-width: 640px) {
  .login-header{margin-bottom: 24px;}
  .login-header h1{font-size: 24px;}
  .login-header p{font-size: 13px;}
}
.login-form{display: flex; flex-direction: column; gap: 20px;}
.login-field{display: flex; flex-direction: column; gap: 8px;}
.login-field label{font-size: 14px; font-weight: 500; color: var(--text);}
.login-field input{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-size: 14px;
}
.login-field input:focus{
  outline: none;
  border-color: var(--accent);
}
.btn-login{
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
}
.btn-login:hover{
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.login-error{
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--err);
  border-radius: 8px;
  padding: 12px;
  color: var(--err);
  font-size: 14px;
  text-align: center;
}

/* App Header */
.app-header{
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: opacity 0.2s ease;
  opacity: 1;
}
.app-header.navbar-hidden{
  pointer-events: none;
}
.app-header h1{margin:0;font-size: 20px; font-weight: 600; color: var(--text);}
.header-right{display: flex; align-items: center; flex-wrap: wrap;}
.user-info{display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; flex-wrap: wrap;}
.db-status-bar{
  padding: 8px 24px; 
  border-bottom: 1px solid var(--border); 
  background: var(--panel); 
  color:var(--muted); 
  font-size:13px; 
  overflow-x: auto; 
  white-space: nowrap;
  transition: opacity 0.2s ease;
  opacity: 1;
}
.db-status-bar strong{color: var(--text);}
.db-status-bar.navbar-hidden{
  pointer-events: none;
}

/* Botón Hamburguesa */
.btn-hamburger{
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
  transition: all 0.3s;
}
.btn-hamburger span{
  width: 100%;
  height: 2px;
  background: var(--text);
  transition: all 0.3s;
  border-radius: 2px;
}
.btn-hamburger:hover{
  background: var(--panel);
  border-color: var(--accent);
}

/* Menu Overlay */
.menu-overlay{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  display: none;
  backdrop-filter: blur(4px);
}
.menu-overlay.active{
  display: block;
}

/* Sidebar Menu */
.sidebar-menu{
  position: fixed;
  top: 0;
  left: -100%;
  width: min(400px, 85vw);
  height: 100%;
  background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 1000;
  transition: left 0.3s ease;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}
.sidebar-menu.active{
  left: 0;
}
.sidebar-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
}
.sidebar-header h3{
  margin: 0;
  font-size: 18px;
}
.btn-close-sidebar{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-close-sidebar:hover{
  background: var(--err);
  border-color: var(--err);
}
.sidebar-content{
  padding: 20px;
}
.sidebar-section{
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child{
  border-bottom: none;
  margin-bottom: 0;
}
.sidebar-section h4{
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-filters{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.sidebar-filters .f-group{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-filters label{
  font-size: 12px;
  color: var(--muted);
}
.sidebar-filters select,
.sidebar-filters input{
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}
.sidebar-actions{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-actions .btn{
  width: 100%;
  justify-content: center;
}

@media (max-width: 1024px) {
  .btn-hamburger{
    display: flex;
  }
  .toolbar{
    display: none !important;
  }
  .db-status-bar{
    display: none !important;
  }
  .app-header{
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
  }
  .header-left{
    grid-column: 2;
  }
  .header-right{
    grid-column: 3;
  }
  .btn-hamburger{
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .app-header{
    padding: 12px 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
  }
  .app-header h1{font-size: 16px; margin: 0;}
  .header-left{
    grid-column: 2;
    text-align: center;
  }
  .header-right{
    grid-column: 3;
    flex-shrink: 0;
  }
  .btn-hamburger{
    grid-column: 1;
  }
  .user-info{font-size: 11px; gap: 4px;}
  .user-info span{display: none;}
  .user-info .btn{padding: 6px 8px; font-size: 11px;}
  
  .sidebar-menu{
    width: 90vw;
  }
  .sidebar-filters{
    grid-template-columns: 1fr;
  }
}

/* Emoji Picker */
.emoji-picker-btn{
  background: #0a1222;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  height: 42px;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.emoji-picker-btn:hover{
  background: var(--panel);
  border-color: var(--accent);
}
.emoji-picker{
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  width: 320px;
  max-height: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  z-index: 100;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .emoji-picker{
    width: 280px;
    max-height: 350px;
    padding: 10px;
  }
  .emoji-grid{
    grid-template-columns: repeat(6, 1fr);
    max-height: 240px;
  }
  .emoji-categories{
    gap: 2px;
  }
  .emoji-cat-btn, .emoji-cat-btn-edit{
    padding: 6px;
    font-size: 18px;
  }
}
.emoji-picker-header{
  margin-bottom: 12px;
}
.emoji-search{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  color: var(--text);
  font-size: 14px;
}
.emoji-search:focus{
  outline: none;
  border-color: var(--accent);
}
.emoji-categories{
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.emoji-cat-btn, .emoji-cat-btn-edit{
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 20px;
  border-radius: 6px;
  transition: background 0.2s;
}
.emoji-cat-btn:hover, .emoji-cat-btn-edit:hover{
  background: var(--panel);
}
.emoji-cat-btn.active, .emoji-cat-btn-edit.active{
  background: var(--accent);
}
.emoji-grid{
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.emoji-item{
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 24px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-item:hover{
  background: var(--panel);
  transform: scale(1.2);
}

.toolbar{
  display:flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  align-items: end;
  border-bottom:2px solid var(--border);
  position: sticky; 
  top:0;
  background: var(--panel);
  z-index: 10;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: opacity 0.2s ease;
  opacity: 1;
}
.toolbar.navbar-hidden{
  pointer-events: none;
}
.toolbar label{font-size:13px;color:var(--muted);display:block;margin-bottom:8px;font-weight:600;}
.filters{display:flex;gap:12px;align-items:end;flex-wrap:wrap; width: 100%;}
.filters .f-group{min-width: 180px; flex: 1;}
.filters select, .filters input{
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 160px;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  font-weight: 500;
}
.filters select:focus, .filters input:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.filters select:hover, .filters input:hover{
  border-color: var(--accent);
}
.actions{display: flex; gap: 12px; flex-wrap: wrap; width: 100%; align-items: center;}
.data-actions{display: flex; gap: 10px; flex-wrap: wrap; width: 100%; align-items: center;}

@media (max-width: 768px) {
  .toolbar{padding: 12px 16px;}
  .filters{gap: 8px;}
  .filters .f-group{min-width: 140px;}
  .actions{justify-content: stretch;}
  .btn{font-size: 13px; padding: 8px 12px;}
}

@media (max-width: 640px) {
  .toolbar{flex-direction: column; align-items: stretch;}
  .filters{flex-direction: column; width: 100%;}
  .filters .f-group{min-width: auto; width: 100%;}
  .actions{flex-direction: column;}
  .data-actions{flex-direction: column;}
  .btn{width: 100%; justify-content: center;}
}
.btn{
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn:hover{
  background: var(--hover);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn:active{
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn.primary{ 
  background: var(--accent); 
  color: #fff; 
  border-color: var(--accent);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.btn.primary:hover{ 
  background: #1d4ed8; 
  border-color: #1d4ed8;
  transform: translateY(-2px); 
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4); 
}
.btn.secondary{
  background: #10b981;
  color: #fff;
  border-color: #10b981;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}
.btn.secondary:hover{
  background: #059669;
  border-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}
.btn.ghost{ 
  background: transparent; 
  border-color: var(--border);
  box-shadow: none;
}
.btn.ghost:hover{ 
  background: var(--hover);
  border-color: var(--accent);
}
.btn.xs{ padding: 6px 12px; font-size: 13px; margin: 0; min-width: 44px; }
#btn-add{ 
  background: var(--accent); 
  color: #fff; 
  border-color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
#btn-add:hover{ 
  background: #1d4ed8; 
  border-color: #1d4ed8;
  transform: translateY(-2px); 
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4); 
}

.summary{
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg);
}

@media (max-width: 1024px) {
  .summary{
    display: none !important;
  }
}
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s;
}
.card:hover{
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.card h3{margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: var(--text);}
.card-collapsible .card-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-collapsible .card-header h3{margin: 0;}
.btn-expand{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.25s ease;
  min-width: 32px;
  height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
}
.btn-expand[style*="display: block"]{
  display: flex !important;
}
.btn-expand:hover{
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}
.card-collapsible .card-content{
  max-height: 120px;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.card-collapsible.expanded .card-content{
  max-height: 1000px;
  overflow-y: auto;
}
.card-collapsible.expanded .btn-expand{
  transform: rotate(180deg);
}
.card-collapsible.expanded .btn-expand:hover{
  transform: rotate(180deg) scale(1.05);
}
.kpi{display:flex;justify-content:space-between;align-items:center}
.kpi-number{font-size:28px;font-weight:700}
.kpi-label{color:var(--muted)}
.kpi-split{display:flex;gap:16px;margin-top:12px}
.kpi-split div{background:#0f172a;border:1px solid var(--border);padding:8px 10px;border-radius:8px;flex:1;text-align:center;}
.kpi-split div:nth-child(1){background:rgba(59, 130, 246, 0.15);border-color:rgba(59, 130, 246, 0.3)}
.kpi-split div:nth-child(2){background:rgba(245, 158, 11, 0.15);border-color:rgba(245, 158, 11, 0.3)}
.kpi-split div:nth-child(3){background:rgba(34, 197, 94, 0.15);border-color:rgba(34, 197, 94, 0.3)}
.kpi-split small{display:block;color:var(--muted);font-size:12px}

@media (max-width: 640px) {
  .kpi{flex-direction: column; align-items: flex-start; gap: 8px;}
  .kpi-number{font-size: 24px;}
  .kpi-label{font-size: 13px;}
  .kpi-split{gap: 10px; width: 100%;}
  .kpi-split div{padding: 6px 8px;}
  .kpi-split small{font-size: 11px;}
}

.chips{display:flex;gap:8px;flex-wrap:wrap;margin:0;padding:0;list-style:none}
.chips li{background:var(--hover);border:1px solid var(--border);padding:6px 12px;border-radius:999px;color:var(--text);display:flex;align-items:center;gap:6px;font-size:13px;}
.blocker-count{
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  line-height: 1;
}

.kanban{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:20px;
  padding: 20px 24px 24px;
  background: var(--bg);
}

@media (max-width: 1024px) {
  .kanban{
    grid-template-columns: 1fr;
    padding: 0 16px 24px;
    gap: 12px;
  }
  .column{
    min-height: 180px;
  }
}

@media (max-width: 640px) {
  .kanban{
    padding: 0 12px 20px;
    gap: 10px;
  }
  .column h2{
    font-size: 15px;
    margin: 10px 10px 6px;
  }
}
.column{
  background: var(--panel); 
  border: 2px solid var(--border); 
  border-radius: 12px; 
  min-height: 240px; 
  transition: all 0.2s; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.column:hover{
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  border-color: var(--accent);
}
.column h2{
  margin:16px 16px 12px; 
  font-size:17px; 
  font-weight: 700; 
  color: var(--text);
  letter-spacing: -0.02em;
}
.column[data-col="To Do"] h2{color: #2563eb;}
.column[data-col="In Progress"] h2{color: #f59e0b;}
.column[data-col="Done"] h2{color: #10b981;}
.col-body{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding: 14px; 
  min-height: 200px; 
  transition: background 0.2s;
}
.col-body.drag-over{
  background: rgba(37, 99, 235, 0.08); 
  border-radius: 8px;
}

.card-task{
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: grab;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.card-task:hover{
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transform: translateY(-3px);
  border-color: var(--accent);
}
.card-task:active{cursor: grabbing}
.card-task.dragging{opacity: 0.5; transform: scale(0.95)}

/* Sección del título */
.card-task .task-title-section{
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.card-task .task-title{
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Meta badges */
.card-task .meta{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

/* Líneas de información */
.card-task .line{
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  word-wrap: break-word;
}

/* Footer con estado y acciones */
.card-task .task-footer{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}
.card-task .row{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

/* Botones de acción */
.card-task .actions{
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-btn{
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.icon-btn:hover{
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}
.icon-btn:active{
  transform: translateY(0);
}
.icon-btn[data-action="delete"]{
  color: var(--text);
}
.icon-btn[data-action="delete"]:hover{
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--err);
  color: var(--err);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}
.icon{
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
}

/* Badges */
.badge{
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge.prio-1{
  border-color:#ef4444;
  color:#ef4444;
  background: rgba(239, 68, 68, 0.15);
}
.badge.prio-2{
  border-color:#f59e0b;
  color:#f59e0b;
  background: rgba(245, 158, 11, 0.15);
}
.badge.prio-3{
  border-color:#64748b;
  color:#64748b;
  background: rgba(100, 116, 139, 0.15);
}
.badge.badge-bu{
  font-weight:700;
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* Responsive móvil */
@media (max-width: 640px) {
  .card-task{
    padding: 12px;
    gap: 8px;
  }
  .card-task .task-title{
    font-size: 14px;
  }
  .card-task .task-footer{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .card-task .actions{
    justify-content: flex-end;
    width: 100%;
  }
  .card-task .row{
    width: 100%;
  }
  .card-task .meta{
    gap: 6px;
    font-size: 11px;
  }
  .card-task .line{
    font-size: 11px;
  }
  .badge{
    font-size: 11px;
    padding: 2px 8px;
  }
  .icon-btn{
    padding: 6px;
  }
}

select.state-changer{
  background: var(--panel); 
  color: var(--text); 
  border: 2px solid var(--border); 
  border-radius: 8px; 
  padding: 8px 10px; 
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
select.state-changer:hover{
  border-color: var(--accent);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
select.state-changer:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

dialog{
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(820px, 96vw);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
dialog::backdrop{background: rgba(0,0,0,0.6)}

@media (max-width: 640px) {
  dialog{
    width: 96vw;
    max-height: 95vh;
    border-radius: 8px;
  }
}
.task-form header{
  padding: 20px 24px; 
  border-bottom: 2px solid var(--border);
  background: var(--hover);
}
.task-form header h2{
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.task-form .grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 24px;
}

@media (max-width: 640px) {
  .task-form .grid{
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 12px;
  }
  .field-wide{
    grid-column: span 1;
  }
}

.field{display:flex;flex-direction:column;gap:8px;}
.field label{
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.field-wide{grid-column: span 2}
.field input, .field select, .field textarea{
  background: var(--panel); 
  color: var(--text); 
  border: 2px solid var(--border); 
  border-radius: 8px; 
  padding: 12px;
  font-size: 14px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.field input:focus, .field select:focus, .field textarea:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.field input:hover, .field select:hover, .field textarea:hover{
  border-color: var(--accent);
}
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  padding:20px 24px;
  border-top:2px solid var(--border);
  flex-wrap:wrap;
  background: var(--hover);
}

@media (max-width: 640px) {
  .modal-actions{
    gap: 6px;
    padding: 10px 12px;
  }
  .modal-actions .btn{
    flex: 1;
    min-width: 100px;
  }
}

.json-output{
  margin: 0; padding: 16px; max-height: 70vh; overflow: auto; background: #0a1222; border-top:1px solid var(--border); border-bottom:1px solid var(--border)
}

.toast{
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 16px 28px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all .3s ease;
  max-width: 90vw;
  text-align: center;
  z-index: 10001;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  font-weight: 600;
  font-size: 15px;
}
.toast.show{
  opacity:1;
  transform: translateX(-50%) translateY(-8px);
}

@media (max-width: 640px) {
  .toast{
    bottom: 12px;
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 6px;
  }
}

/* Media queries heredadas - mantener compatibilidad */
@media (max-width: 980px){
  .summary{ grid-template-columns: 1fr }
  .kanban{ grid-template-columns: 1fr }
}

/* Responsive para selector de estado en tarjetas */
@media (max-width: 640px) {
  select.state-changer{
    font-size: 12px;
    padding: 5px 6px;
  }
}

/* Touch-friendly scroll */
@media (hover: none) and (pointer: coarse) {
  .emoji-grid, .col-body, dialog {
    -webkit-overflow-scrolling: touch;
  }
}

/* Timeline Analysis Styles */
.timeline-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-timeline-view {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-timeline-view:hover {
  background: var(--card);
  border-color: var(--accent);
}

.btn-timeline-view.active {
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

#timeline-chart {
  max-height: 400px;
  overflow-y: auto;
}

.timeline-period {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.timeline-period:hover {
  border-color: var(--accent);
  background: var(--card);
}

.timeline-period.timeline-overdue {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.3);
  border-left: 4px solid #ef4444;
}

.timeline-period.timeline-current {
  background: rgba(37, 99, 235, 0.05);
  border-color: rgba(37, 99, 235, 0.3);
  border-left: 4px solid #2563eb;
}

.timeline-period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.timeline-period-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.timeline-period-count {
  font-size: 12px;
  color: var(--muted);
}

.timeline-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.timeline-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.timeline-stat-label {
  color: var(--muted);
}

.timeline-stat-value {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.timeline-stat-value.todo {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.timeline-stat-value.inprogress {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.timeline-stat-value.done {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.timeline-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .timeline-controls {
    gap: 6px;
  }
  
  .btn-timeline-view {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .timeline-period {
    padding: 10px;
  }
  
  .timeline-period-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .timeline-stats {
    gap: 8px;
  }
}

/* Task Steps Styles */
.task-steps {
  margin-top: 10px;
  padding: 8px;
  background: rgba(96, 165, 250, 0.05);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

.task-steps strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 12px;
}

.steps-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}

.steps-list li {
  margin-bottom: 4px;
}

.steps-list li:last-child {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .task-steps {
    padding: 6px;
    margin-top: 8px;
  }
  
  .task-steps strong {
    font-size: 11px;
  }
  
  .steps-list {
    font-size: 11px;
    padding-left: 18px;
  }
}

/* ==================== MODAL DE INFORME DE TAREAS ==================== */
.report-modal {
  max-width: 95vw;
  max-height: 95vh;
  width: 1200px;
  height: auto;
  border: none;
  border-radius: 16px;
  padding: 0;
  background: var(--panel);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: reportFadeIn 0.3s ease-out;
}

.report-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: backdropFadeIn 0.3s ease-out;
}

@keyframes reportFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Header del informe */
.report-header {
  padding: 24px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.report-title-section h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.report-subtitle {
  margin: 8px 0 0 0;
  font-size: 15px;
  opacity: 0.95;
  font-weight: 400;
}

.btn-close-report {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
}

.btn-close-report:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Contenido del informe */
.report-content {
  padding: 32px;
  max-height: calc(95vh - 220px);
  overflow-y: auto;
  background: var(--bg);
}

/* Grid de resumen */
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.report-stat-card {
  background: var(--panel);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.report-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.report-stat-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.report-stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.report-stat-value.todo { color: #f59e0b; }
.report-stat-value.inprogress { color: #3b82f6; }
.report-stat-value.done { color: #10b981; }
.report-stat-value.overdue { color: #ef4444; }

.report-stat-sublabel {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Sección de tareas */
.report-tasks-section {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.report-section-title {
  padding: 20px 24px;
  background: var(--hover);
  border-bottom: 2px solid var(--border);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-task-group {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.report-task-group:last-child {
  border-bottom: none;
}

.report-task-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.report-task-group-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-task-group-count {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.report-task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-task-item {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.report-task-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.report-task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.report-task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}

.report-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.report-task-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.report-task-badge.priority-alta {
  background: #fee2e2;
  color: #991b1b;
}

.report-task-badge.priority-media {
  background: #fed7aa;
  color: #92400e;
}

.report-task-badge.priority-baja {
  background: #e0e7ff;
  color: #3730a3;
}

.report-task-badge.status-todo {
  background: #fef3c7;
  color: #92400e;
}

.report-task-badge.status-inprogress {
  background: #dbeafe;
  color: #1e40af;
}

.report-task-badge.business-unit {
  background: var(--hover);
  color: var(--muted);
  border: 1px solid var(--border);
}

.report-task-info {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.report-task-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-task-info-item strong {
  color: var(--text);
  font-weight: 500;
}

/* Footer del informe */
.report-footer {
  padding: 20px 32px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .report-modal {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .report-header {
    padding: 16px 20px;
  }
  
  .report-title-section h2 {
    font-size: 22px;
  }
  
  .report-content {
    padding: 20px;
  }
  
  .report-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .report-stat-card {
    padding: 16px;
  }
  
  .report-stat-value {
    font-size: 28px;
  }
  
  .report-task-item {
    padding: 12px;
  }
  
  .report-task-meta {
    gap: 6px;
  }
}

/* Estado de carga */
.report-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
}

.report-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.report-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.report-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.report-empty-text {
  font-size: 16px;
  font-weight: 500;
}

/* Hacer los periodos de la timeline clickeables */
.timeline-period {
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-period:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
