/* =========================================================
   CSS VARIABLES
   ========================================================= */
:root {
  --sidebar-bg:      #162235;
  --sidebar-hover:   #1e3350;
  --sidebar-active:  #2563eb;
  --sidebar-text:    #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-width:   250px;

  --primary:         #2563eb;
  --primary-hover:   #1d4ed8;
  --primary-light:   #eff6ff;

  --background:      #f1f5f9;
  --surface:         #ffffff;
  --surface-hover:   #f8fafc;

  --text:            #1e293b;
  --text-secondary:  #64748b;
  --muted:           #94a3b8;

  --border:          #e2e8f0;
  --border-focus:    #93c5fd;

  --danger:          #ef4444;
  --danger-light:    #fef2f2;
  --danger-hover:    #dc2626;

  --success:         #22c55e;
  --success-light:   #f0fdf4;
  --success-text:    #16a34a;

  --warning:         #f59e0b;
  --warning-light:   #fffbeb;
  --warning-text:    #b45309;

  --col-todo-bg:     #f0f4ff;
  --col-todo-border: #c7d7fc;
  --col-process-bg:  #fffbf0;
  --col-process-border: #fde68a;
  --col-done-bg:     #f0fdf4;
  --col-done-border: #bbf7d0;

  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       14px;
  --radius-xl:       18px;

  --shadow-sm:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:       0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:       0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-modal:    0 20px 60px rgba(0,0,0,.18);

  --transition:      0.18s ease;
  --font:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* =========================================================
   RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* =========================================================
   LAYOUT
   ========================================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { color: #fff; }

.sidebar-logo-text {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.sidebar-logo-sub {
  font-size: .7rem;
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: .68rem;
  font-weight: 600;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  user-select: none;
}

.nav-item svg { flex-shrink: 0; opacity: .8; }

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}

.nav-item.active svg { opacity: 1; }

.nav-item .badge-soon {
  margin-left: auto;
  font-size: .62rem;
  background: rgba(255,255,255,.1);
  color: var(--sidebar-text);
  padding: 2px 6px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-footer .nav-item {
  color: #f87171;
}
.sidebar-footer .nav-item:hover {
  background: rgba(239,68,68,.12);
  color: #fca5a5;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hamburger-btn {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition);
}

.hamburger-btn:hover { background: var(--background); }

.topbar-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.topbar-icon-btn:hover { background: var(--background); color: var(--text); }

.notif-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.topbar-user:hover { background: var(--background); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.user-role {
  font-size: .72rem;
  color: var(--text-secondary);
}

/* =========================================================
   PAGE CONTENT
   ========================================================= */
.page-content {
  flex: 1;
  padding: 28px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.page-header-left p {
  color: var(--text-secondary);
  font-size: .88rem;
  margin-top: 3px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: .88rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,.38);
}

.btn-primary:active { transform: translateY(0); }

/* =========================================================
   TOOLBAR (search + filters)
   ========================================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(147,197,253,.25);
}

.search-input::placeholder { color: var(--muted); }

.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: .87rem;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}

.btn-filter:hover {
  background: var(--background);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-filter.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Filter panel */
.filter-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: none;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
  box-shadow: var(--shadow-md);
}

.filter-panel.open { display: flex; }

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.filter-group label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--text);
  font-size: .87rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--border-focus); }

.btn-clear-filters {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--text-secondary);
  font-size: .83rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  transition: background var(--transition), color var(--transition);
}

.btn-clear-filters:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* =========================================================
   KANBAN BOARD
   ========================================================= */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

/* =========================================================
   COLUMN
   ========================================================= */
.kanban-col {
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 300px;
}

.col-todo    { background: var(--col-todo-bg);    border: 1.5px solid var(--col-todo-border); }
.col-process { background: var(--col-process-bg); border: 1.5px solid var(--col-process-border); }
.col-done    { background: var(--col-done-bg);    border: 1.5px solid var(--col-done-border); }

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 2px;
}

.col-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.col-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.col-todo    .col-dot { background: #6366f1; }
.col-process .col-dot { background: #f59e0b; }
.col-done    .col-dot { background: #22c55e; }

.col-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.col-count {
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 24px;
  text-align: center;
}

.col-todo    .col-count { background: #e0e7ff; color: #4338ca; }
.col-process .col-count { background: #fef3c7; color: #b45309; }
.col-done    .col-count { background: #dcfce7; color: #166534; }

/* cards container */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
  flex: 1;
}

/* drag-over highlight */
.cards-list.drag-over {
  background: rgba(37,99,235,.05);
  border-radius: var(--radius-lg);
  outline: 2px dashed rgba(37,99,235,.3);
  outline-offset: -2px;
}

/* placeholder while dragging */
.drag-placeholder {
  height: 82px;
  border-radius: var(--radius-md);
  background: rgba(37,99,235,.07);
  border: 2px dashed rgba(37,99,235,.3);
}

/* empty state */
.empty-state {
  text-align: center;
  padding: 30px 10px 20px;
  color: var(--muted);
}

.empty-state svg {
  margin-bottom: 8px;
  opacity: .45;
}

.empty-state p {
  font-size: .82rem;
  font-weight: 500;
}

.empty-state .btn-empty-add {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.empty-state .btn-empty-add:hover { background: var(--primary-light); }

/* add-task button at bottom of column */
.btn-add-task {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 500;
  margin-top: 10px;
  transition: background var(--transition), color var(--transition);
}

.btn-add-task:hover { background: rgba(0,0,0,.05); color: var(--text); }

/* =========================================================
   CARD
   ========================================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 14px 14px 12px;
  cursor: grab;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  user-select: none;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #c7d2fe;
  transform: translateY(-1px);
}

.card.dragging {
  opacity: .55;
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
  transform: scale(1.02) rotate(.5deg);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.card-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
  word-break: break-word;
}

.card-top-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.card-menu-wrapper {
  position: relative;
  flex-shrink: 0;
}

.card-menu-btn {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.card-menu-btn:hover { background: var(--background); color: var(--text); }

/* Context menu */
.card-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 300;
  overflow: hidden;
  display: none;
  animation: menuIn .12s ease;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.card-menu.open { display: block; }

.card-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  font-size: .84rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
  text-align: left;
}

.card-menu-item:hover { background: var(--background); }

.card-menu-item.danger { color: var(--danger); }
.card-menu-item.danger:hover { background: var(--danger-light); }

.card-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Priority badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-alta    { background: #fee2e2; color: #b91c1c; }
.badge-media   { background: #fef3c7; color: #92400e; }
.badge-baja    { background: #dcfce7; color: #166534; }

/* done check */
.card-done-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--success);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.card-done-check svg { color: #fff; }

/* Card meta row */
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
}

.card-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: var(--text-secondary);
}

.card-date svg { flex-shrink: 0; }
.card-date.overdue { color: var(--danger); }
.card-date.today   { color: var(--warning-text); font-weight: 600; }
.card-date.tomorrow { color: var(--primary); font-weight: 600; }

.card-assignee {
  display: flex;
  align-items: center;
  gap: 5px;
}

.assignee-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.assignee-name {
  font-size: .78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* =========================================================
   MODAL OVERLAY
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlayIn .15s ease;
}

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

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--background); color: var(--text); }

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* Form */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input, .form-textarea, .form-select {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--text);
  font-size: .87rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(147,197,253,.25);
  background: var(--surface);
}

.form-input.error, .form-textarea.error { border-color: var(--danger); }

.form-textarea { resize: vertical; min-height: 88px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-hint {
  font-size: .76rem;
  color: var(--muted);
}

.form-error {
  font-size: .76rem;
  color: var(--danger);
  display: none;
}

.form-error.visible { display: block; }

/* Buttons */
.btn-ghost {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: .87rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.btn-ghost:hover { background: var(--background); color: var(--text); }

.btn-danger {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  background: var(--danger);
  color: #fff;
  font-size: .87rem;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(239,68,68,.28);
}

.btn-danger:hover { background: var(--danger-hover); }

.btn-save {
  padding: 9px 20px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: .87rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.btn-save:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-save:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* =========================================================
   DETAIL DRAWER / MODAL
   ========================================================= */
.detail-modal .modal {
  max-width: 580px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.detail-value {
  font-size: .9rem;
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.detail-description {
  background: var(--background);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: .87rem;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================
   CONFIRM MODAL
   ========================================================= */
.confirm-modal .modal {
  max-width: 380px;
}

.confirm-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--danger-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}

.confirm-icon svg { color: var(--danger); }

/* =========================================================
   TOAST
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: .86rem;
  font-weight: 500;
  color: var(--text);
  min-width: 260px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn .22s ease;
  border-left: 4px solid var(--border);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: none; }
}

.toast.out {
  animation: toastOut .2s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}

.toast.success { border-left-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }

.toast.error { border-left-color: var(--danger); }
.toast.error .toast-icon { color: var(--danger); }

.toast.warning { border-left-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }

.toast.info { border-left-color: var(--primary); }
.toast.info .toast-icon { color: var(--primary); }

/* =========================================================
   SKELETON LOADER
   ========================================================= */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeletonShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.skeleton-card {
  height: 90px;
  margin-bottom: 10px;
}

/* =========================================================
   COMING SOON PAGE
   ========================================================= */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.coming-soon-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}

.coming-soon-icon svg { color: var(--primary); }

.coming-soon h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.coming-soon p {
  color: var(--text-secondary);
  font-size: .9rem;
  max-width: 320px;
}

/* =========================================================
   SIDEBAR OVERLAY (mobile)
   ========================================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 190;
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   USER DROPDOWN
   ========================================================= */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
  animation: menuIn .12s ease;
}

.user-dropdown.open { display: block; }

.user-dropdown-header {
  padding: 14px 16px 12px;
}

.user-dropdown-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  font-size: .76rem;
  color: var(--muted);
  margin-top: 2px;
  word-break: break-all;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text);
  font-size: .87rem;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.user-dropdown-item:hover { background: var(--background); }

.user-dropdown-item[disabled] {
  color: var(--muted);
  cursor: default;
}

.user-dropdown-item[disabled]:hover { background: none; }

.user-dropdown-item.logout { color: var(--danger); }
.user-dropdown-item.logout:hover { background: var(--danger-light); }

.user-dropdown form { margin: 0; }

/* =========================================================
   FOCUS VISIBLE
   ========================================================= */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    overflow-x: auto;
    padding-bottom: 12px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay { display: block; }

  .main-content { margin-left: 0; }

  .hamburger-btn { display: flex; }

  .page-content { padding: 18px 14px 30px; }

  .kanban-board {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
  }

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

  .page-header { flex-direction: column; align-items: flex-start; }

  .user-name, .user-role { display: none; }

  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .kanban-board {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }

  .topbar { padding: 0 14px; }

  .modal { border-radius: var(--radius-lg); }
}

/* =========================================================
   CARD TIMER
   ========================================================= */
.card-timer {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 20px;
  margin: 6px 0 2px;
  width: fit-content;
}

.card-timer svg { flex-shrink: 0; }

.timer-ok       { background: #dcfce7; color: #166534; }
.timer-warn     { background: #fef3c7; color: #92400e; }
.timer-danger   { background: #ffedd5; color: #c2410c; }
.timer-critical { background: #fee2e2; color: #991b1b; animation: timerPulse 1s infinite; }
.timer-expired  { background: #fee2e2; color: #991b1b; }

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}

/* =========================================================
   TASKS TABLE
   ========================================================= */
.tasks-table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}

.tasks-table thead {
  background: var(--background);
  border-bottom: 1.5px solid var(--border);
}

.tasks-table th {
  padding: 11px 14px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  white-space: nowrap;
}

.tasks-table th.sortable:hover { color: var(--primary); cursor: pointer; }

.sort-icon { opacity: .5; font-style: normal; }

.tasks-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tasks-table tr:last-child td { border-bottom: none; }
.tasks-table tbody tr:hover { background: var(--surface-hover); }

.task-cell-title { max-width: 260px; }

.task-table-title {
  display: block;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.task-table-title:hover { color: var(--primary); }

.task-table-desc {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.task-cell-assignee { color: var(--text-secondary); }

.task-cell-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-action-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.task-action-btn:hover { background: var(--background); color: var(--text); }
.task-action-btn.danger:hover { background: var(--danger-light); color: var(--danger); }

.tasks-empty-row {
  text-align: center;
  color: var(--muted);
  padding: 40px !important;
  font-size: .9rem;
}

/* =========================================================
   CALENDAR
   ========================================================= */
.calendar-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.calendar-month-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
  flex: 1;
  text-align: center;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.calendar-weekdays div {
  padding: 8px 4px;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  min-height: 80px;
  padding: 6px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: default;
  position: relative;
  transition: background var(--transition);
}

.cal-cell:nth-child(7n) { border-right: none; }

.cal-cell.cal-has-tasks { cursor: pointer; }
.cal-cell.cal-has-tasks:hover { background: var(--primary-light); }

.cal-cell.cal-today { background: rgba(37,99,235,.06); }
.cal-cell.cal-today .cal-day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}

.cal-cell-empty { background: var(--background); opacity: .4; }

.cal-day-num {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  margin-bottom: 4px;
}

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.cal-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-more {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  display: block;
}

.calendar-day-detail {
  border-top: 1.5px solid var(--border);
  padding: 18px 20px;
  background: var(--background);
}

.calendar-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-detail-header h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.cal-no-tasks {
  color: var(--muted);
  font-size: .87rem;
  text-align: center;
  padding: 16px 0;
}

.cal-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.cal-task-item:last-child { border-bottom: none; }

.cal-task-title {
  flex: 1;
  font-size: .87rem;
  font-weight: 500;
  color: var(--text);
}

.cal-task-status {
  font-size: .76rem;
  color: var(--muted);
  white-space: nowrap;
}

/* =========================================================
   REPORTS
   ========================================================= */
.reports-loading {
  text-align: center;
  color: var(--muted);
  padding: 60px;
  font-size: .9rem;
}

.reports-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1;
}

.stat-pendiente { border-left: 4px solid #6366f1; }
.stat-proceso   { border-left: 4px solid #f59e0b; }
.stat-terminado { border-left: 4px solid #22c55e; }
.stat-vencidas  { border-left: 4px solid var(--danger); }

.stat-pendiente .stat-card-value { color: #4f46e5; }
.stat-proceso   .stat-card-value { color: #b45309; }
.stat-terminado .stat-card-value { color: #166534; }
.stat-vencidas  .stat-card-value { color: var(--danger); }

.reports-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.reports-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.reports-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-bar-track {
  flex: 1;
  height: 10px;
  background: var(--background);
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 20px;
  transition: width .5s ease;
}

.progress-bar-label {
  font-size: .88rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 42px;
  text-align: right;
}

.reports-hint {
  font-size: .8rem;
  color: var(--muted);
}

.reports-prio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reports-prio-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prio-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--background);
  border-radius: 20px;
  overflow: hidden;
}

.prio-bar {
  height: 100%;
  border-radius: 20px;
  transition: width .5s ease;
  min-width: 4px;
}

.prio-count {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  min-width: 20px;
  text-align: right;
}

/* =========================================================
   SETTINGS
   ========================================================= */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.settings-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.settings-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-loading {
  color: var(--muted);
  font-size: .87rem;
  padding: 12px 0;
}

.settings-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.settings-user-item:last-child { border-bottom: none; }

.settings-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.settings-user-name {
  font-size: .87rem;
  font-weight: 500;
  color: var(--text);
}

.settings-user-email {
  font-size: .77rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-user-status {
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

.settings-user-active   { background: #dcfce7; color: #166534; }
.settings-user-inactive { background: #fee2e2; color: #991b1b; }

/* Detail modal timer grid */
.detail-timer-wrap { background: var(--sidebar-bg); border-radius: 8px; padding: 10px 12px; }
.detail-timer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: .85rem; color: var(--text); }
.detail-timer-label { font-weight: 600; color: var(--text-secondary); font-size: .78rem; }

/* =========================================================
   COMMENTS
   ========================================================= */
.comments-section-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.comment-count-badge {
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 7px;
  margin-left: 6px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}

.comments-loading,
.comments-empty {
  font-size: .83rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 14px 0;
}

.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }

.comment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.comment-author { font-size: .8rem; font-weight: 600; color: var(--text); }
.comment-date   { font-size: .72rem; color: var(--text-secondary); }

.comment-text {
  font-size: .83rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Reopen comments */
.comment-reopen {
  border-left: 3px solid #8b5cf6;
  background: rgba(139, 92, 246, .06);
  border-radius: 0 8px 8px 0;
  padding: 8px 10px;
  flex-direction: column;
  gap: 4px;
}

.comment-reopen-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 700;
  color: #8b5cf6;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.comment-reopen-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.comment-reopen-reason {
  color: var(--text-secondary);
  font-size: .82rem;
  margin-top: 4px;
}

/* Comment form */
.comment-form { margin-top: 4px; }

.comment-textarea {
  min-height: 70px;
  resize: vertical;
}

.comment-form-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.comment-hint { font-size: .75rem; flex: 1; }

.comment-submit-btn { padding: 6px 16px; font-size: .83rem; }

/* Card comment badge */
.card-comments-count {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: .7rem;
  color: var(--text-secondary);
}

.card-comments-count svg { flex-shrink: 0; }

/* Tasks table comment badge */
.task-comments-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .7rem;
  color: var(--text-secondary);
  margin-left: 6px;
  vertical-align: middle;
}

/* =========================================================
   RESPONSIVE (new sections)
   ========================================================= */
@media (max-width: 768px) {
  .reports-row      { grid-template-columns: 1fr; }
  .settings-layout  { grid-template-columns: 1fr; }
  .reports-stats-grid { grid-template-columns: repeat(2, 1fr); }

  .calendar-grid .cal-cell { min-height: 56px; padding: 4px; }
  .cal-day-num { font-size: .72rem; }
  .cal-dot { width: 5px; height: 5px; }

  .tasks-table-wrap { overflow-x: auto; }
  .tasks-table th, .tasks-table td { white-space: nowrap; }
}

/* =========================================================
   PRIORITY VISUALS — alta gets a red left border on cards
   ========================================================= */
.card-prioridad-alta {
  border-left: 3px solid #ef4444;
}

.badge-alta  { background: #fee2e2; color: #991b1b; }
.badge-media { background: #fef3c7; color: #92400e; }
.badge-baja  { background: #dcfce7; color: #166534; }

/* =========================================================
   SIDEBAR — PROJECT SELECTOR
   ========================================================= */
.sidebar-project-selector {
  padding: 8px 12px 0;
  position: relative;
}

.project-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--sidebar-text-active);
  text-align: left;
  transition: background .15s;
}
.project-selector-btn:hover { background: rgba(255,255,255,.1); }

.project-selector-icon {
  flex-shrink: 0;
  color: var(--sidebar-text);
}

.project-selector-text { flex: 1; min-width: 0; }

.project-selector-empresa {
  font-size: .68rem;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-selector-proyecto {
  font-size: .8rem;
  font-weight: 600;
  color: var(--sidebar-text-active);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-selector-dropdown {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(100% + 4px);
  background: #1a2c45;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  overflow: hidden;
}

.psd-header {
  font-size: .7rem;
  font-weight: 700;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px 6px;
}

.psd-list {
  max-height: 220px;
  overflow-y: auto;
}

.psd-loading {
  padding: 10px 14px;
  font-size: .8rem;
  color: var(--sidebar-text);
}

.psd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--sidebar-text-active);
  text-align: left;
  transition: background .12s;
}
.psd-item:hover    { background: rgba(255,255,255,.07); }
.psd-item-active   { background: rgba(37,99,235,.2); color: #93c5fd; }

.psd-item-names    { min-width: 0; }
.psd-empresa       { font-size: .67rem; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psd-proyecto      { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.psd-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 8px 10px;
}

.psd-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: 1px dashed rgba(255,255,255,.2);
  border-radius: 6px;
  cursor: pointer;
  font-size: .78rem;
  color: var(--sidebar-text);
  transition: background .12s, color .12s;
}
.psd-new-btn:hover { background: rgba(255,255,255,.08); color: var(--sidebar-text-active); }

/* =========================================================
   DASHBOARD — PROJECT GRID
   ========================================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.dashboard-loading,
.dashboard-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: .9rem;
}

.project-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow .18s, border-color .18s;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-focus); }
.project-card-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.project-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.project-card-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.project-card-meta {
  min-width: 0;
  flex: 1;
}

.project-card-empresa {
  font-size: .72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.project-rol-badge {
  font-size: .67rem;
  font-weight: 700;
  background: var(--background);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.project-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.project-card-desc {
  font-size: .83rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.project-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.project-stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.project-stat-label {
  font-size: .68rem;
  color: var(--text-secondary);
  text-align: center;
}

.project-stat-alert .project-stat-num { color: #ef4444; }

.project-card-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

/* =========================================================
   MEMBERS MODAL
   ========================================================= */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.members-invite-form {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .project-card-stats { gap: 12px; }
}

/* =========================================================
   EMPRESA SETTINGS
   ========================================================= */

.settings-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.settings-card-header .settings-card-title {
  margin-bottom: 0;
}

.btn-sm {
  padding: 5px 12px;
  font-size: .8rem;
}

.btn-danger {
  color: #dc2626;
}
.btn-danger:hover {
  background: #fee2e2;
}

/* Empresa members / invitations table */
.empresa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.empresa-table th {
  text-align: left;
  padding: 6px 10px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.empresa-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.empresa-table tr:last-child td {
  border-bottom: none;
}
.empresa-table tr:hover td {
  background: var(--hover);
}

/* Rol badges for empresa roles */
.empresa-rol-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.empresa-rol-badge.rol-propietario {
  background: #ede9fe;
  color: #5b21b6;
}
.empresa-rol-badge.rol-administrador {
  background: #dbeafe;
  color: #1d4ed8;
}
.empresa-rol-badge.rol-miembro {
  background: #f1f5f9;
  color: var(--text-2);
}

@media (max-width: 640px) {
  .empresa-table th:nth-child(3),
  .empresa-table td:nth-child(3) { display: none; }
}
