/* ============================================================
   SISTEMA DE PLANIFICACIÓN — UNIVERSIDAD CENTRAL
   Design System & Component Library
   Paleta: #183c5a | #6abdbc | #d7de4f | #da4357
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS VARIABLES ────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --navy:       #183c5a;
  --navy-dark:  #102940;
  --navy-light: #1e4a6e;
  --teal:       #6abdbc;
  --teal-light: #8ecfce;
  --teal-dark:  #4da3a2;
  --yellow:     #d7de4f;
  --yellow-dark:#b8c330;
  --red:        #da4357;
  --red-dark:   #c0334a;

  /* Neutral Colors */
  --bg:         #f0f4f8;
  --bg-card:    #ffffff;
  --border:     #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary:   #0f2033;
  --text-secondary: #4a6080;
  --text-muted:     #8fa3b8;
  --white:      #ffffff;

  /* Status Colors */
  --status-pending:     #f59e0b;
  --status-progress:    #6abdbc;
  --status-completed:   #22c55e;
  --status-reopened:    #da4357;
  --status-overdue:     #dc2626;

  /* Priority Colors */
  --prio-low:    #94a3b8;
  --prio-medium: #f59e0b;
  --prio-high:   #f97316;
  --prio-urgent: #da4357;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(24,60,90,.08);
  --shadow-sm:  0 2px 8px rgba(24,60,90,.10);
  --shadow-md:  0 4px 20px rgba(24,60,90,.12);
  --shadow-lg:  0 10px 40px rgba(24,60,90,.15);
  --shadow-xl:  0 20px 60px rgba(24,60,90,.20);

  /* Layout */
  --sidebar-w:  260px;
  --header-h:   64px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Transitions */
  --transition: all .2s cubic-bezier(.4,0,.2,1);
  --transition-slow: all .35s cubic-bezier(.4,0,.2,1);

  /* Theming aliases (overridden in dark mode) */
  --input-focus-bg: var(--white);
  --sidebar-w-collapsed: 76px;
  --focus-ring: 0 0 0 3px rgba(106,189,188,.45);
  --surface: var(--bg-card);
  --accent:  var(--teal);
}

/* ── DARK THEME ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0d1726;
  --bg-card:      #15233a;
  --border:       #28384f;
  --border-light: #1d2c42;
  --text-primary:   #e8eef6;
  --text-secondary: #a7bcd4;
  --text-muted:     #6f87a3;
  --input-focus-bg: #1b2c45;
  --surface: var(--bg-card);
  --accent:  var(--teal);

  --shadow-xs:  0 1px 3px rgba(0,0,0,.30);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.35);
  --shadow-md:  0 4px 20px rgba(0,0,0,.45);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.55);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.65);
}

/* Dark-mode component touch-ups */
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.7); }
[data-theme="dark"] .column-count { background: var(--border); color: var(--text-secondary); }
[data-theme="dark"] .progress-bar,
[data-theme="dark"] .duration-bar { background: var(--border); }
[data-theme="dark"] img.logo-img { filter: brightness(0) invert(1); }


/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  display: flex;
  transition: background .35s ease, color .35s ease;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--teal-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-light); }

/* ══════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════ */

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: var(--transition-slow);
  position: relative;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(106,189,188,.15) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(106,189,188,.2);
}

.logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-system {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--teal-light);
  letter-spacing: .3px;
}

/* Sidebar navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 16px 8px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: rgba(106,189,188,.15);
  color: var(--white);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(106,189,188,.4);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(106,189,188,.15);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.06);
  cursor: pointer;
  transition: var(--transition);
}

.user-card:hover { background: rgba(255,255,255,.1); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}

.user-info-text { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: rgba(255,255,255,.5);
}

/* ── MAIN WRAPPER ─────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ── APP HEADER ───────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  gap: 16px;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hamburger-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  display: none;
}

.hamburger-btn:hover { background: var(--border); }

/* Search bar */
.header-search {
  position: relative;
}

.header-search input {
  width: 220px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px 0 36px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg);
  transition: var(--transition);
}

.header-search input:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--input-focus-bg);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(106,189,188,.15);
}

.header-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  min-height: 0;
}

/* ══════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════ */

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(106,189,188,.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(106,189,188,.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal-dark); }

.btn-danger {
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(218,67,87,.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(218,67,87,.4); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  position: relative;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--border); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ── STAT CARDS ───────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.teal    { background: rgba(106,189,188,.15); color: var(--teal-dark); }
.stat-icon.yellow  { background: rgba(215,222,79,.15); color: var(--yellow-dark); }
.stat-icon.red     { background: rgba(218,67,87,.12); color: var(--red); }
.stat-icon.navy    { background: rgba(24,60,90,.1); color: var(--navy); }
.stat-icon.green   { background: rgba(34,197,94,.12); color: #16a34a; }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}
.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.stat-change.up { color: #16a34a; }
.stat-change.down { color: var(--red); }

/* ── BADGES & TAGS ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Status badges */
.badge-pending    { background: rgba(245,158,11,.12); color: #b45309; }
.badge-progress   { background: rgba(106,189,188,.15); color: var(--teal-dark); }
.badge-completed  { background: rgba(34,197,94,.12); color: #15803d; }
.badge-reopened   { background: rgba(218,67,87,.12); color: var(--red-dark); }
.badge-overdue    { background: rgba(220,38,38,.12); color: #b91c1c; }

/* Priority badges */
.badge-low      { background: rgba(148,163,184,.15); color: #64748b; }
.badge-medium   { background: rgba(245,158,11,.12); color: #b45309; }
.badge-high     { background: rgba(249,115,22,.12); color: #c2410c; }
.badge-urgent   { background: rgba(218,67,87,.12); color: var(--red-dark); }

/* ── PROGRESS BAR ─────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}

.progress-fill.teal    { background: linear-gradient(90deg, var(--teal-dark), var(--teal)); }
.progress-fill.yellow  { background: linear-gradient(90deg, var(--yellow-dark), var(--yellow)); }
.progress-fill.red     { background: linear-gradient(90deg, var(--red-dark), var(--red)); }
.progress-fill.green   { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-fill.navy    { background: linear-gradient(90deg, var(--navy-dark), var(--navy)); }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  transition: var(--transition);
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--input-focus-bg);
  box-shadow: 0 0 0 3px rgba(106,189,188,.15);
}

.form-control.error { border-color: var(--red); }

textarea.form-control {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 80px;
}

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238fa3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; display: none; }
.form-error.visible { display: block; }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,32,51,.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(30px) scale(.97);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 460px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.modal-header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 4px;
}

.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: var(--transition);
  position: relative;
  bottom: -2px;
}

.tab-btn:hover { color: var(--teal-dark); }

.tab-btn.active {
  color: var(--teal-dark);
  border-bottom: 2px solid var(--teal);
}

/* ── NOTIFICATIONS ────────────────────────────────────────── */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  pointer-events: none;
}

.notif-panel {
  position: fixed;
  top: var(--header-h);
  right: 0;
  width: 360px;
  height: calc(100vh - var(--header-h));
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.notif-panel.open { transform: translateX(0); }

.notif-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-panel-title { font-size: 15px; font-weight: 700; }

.notif-list { flex: 1; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(106,189,188,.05); }

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-item.unread .notif-dot { background: var(--teal); }
.notif-item:not(.unread) .notif-dot { background: transparent; border: 1.5px solid var(--border); }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-msg { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.notif-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ── TOASTS ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--text-primary);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1) forwards;
}

.toast.success { background: #15803d; }
.toast.error   { background: var(--red-dark); }
.toast.warning { background: #b45309; }
.toast.info    { background: var(--navy); }

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}

.toast.out { animation: toastOut .3s ease forwards; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD VIEW
   ══════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.reminder-banner {
  background: linear-gradient(135deg, rgba(218,67,87,.08) 0%, rgba(218,67,87,.04) 100%);
  border: 1.5px solid rgba(218,67,87,.2);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.reminder-banner-icon { font-size: 24px; flex-shrink: 0; }
.reminder-banner h3 { font-size: 14px; font-weight: 700; color: var(--red-dark); margin-bottom: 8px; }
.reminder-banner ul { padding-left: 0; }
.reminder-banner li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Task list items */
.task-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  margin-bottom: 8px;
  transition: var(--transition);
  cursor: pointer;
}

.task-list-item:hover { border-color: var(--teal); box-shadow: var(--shadow-sm); }

.task-list-item .task-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  cursor: pointer;
}

.task-list-item.completed .task-check {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
  font-size: 10px;
}

.task-list-item .task-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-list-item.completed .task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-list-item .task-due {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.task-list-item.overdue .task-due { color: var(--red); font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   KANBAN BOARD VIEW
   ══════════════════════════════════════════════════════════ */
.board-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  height: calc(100vh - var(--header-h) - 48px - 70px);
  align-items: flex-start;
}

.board-column {
  width: 280px;
  min-width: 280px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  border: 1px solid var(--border);
}

.board-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-shrink: 0;
}

.column-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.column-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.column-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.board-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 100px;
}

.board-cards.drag-over {
  background: rgba(106,189,188,.08);
  border-radius: var(--radius-md);
}

.add-card-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: var(--transition);
  flex-shrink: 0;
}
.add-card-btn:hover { color: var(--teal-dark); background: rgba(106,189,188,.08); }

/* ── KANBAN CARD ──────────────────────────────────────────── */
.kanban-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  padding: 14px;
  margin-bottom: 8px;
  cursor: grab;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-xs);
}

.kanban-card:hover { box-shadow: var(--shadow-sm); border-color: var(--teal-light); }
.kanban-card.dragging { opacity: .5; cursor: grabbing; box-shadow: var(--shadow-lg); }

.card-priority-bar {
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.prio-bar-low    { background: var(--prio-low); }
.prio-bar-medium { background: var(--prio-medium); }
.prio-bar-high   { background: var(--prio-high); }
.prio-bar-urgent { background: var(--prio-urgent); }

.kanban-card { padding-left: 18px; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

.card-menu-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.card-menu-btn:hover { background: var(--bg); color: var(--text-primary); }

.card-project {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-project-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.card-duration {
  margin-top: 8px;
}

.card-duration-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.card-assignee {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-light), var(--navy));
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-attachments {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.card-due-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.card-due-date.overdue { color: var(--red); }
.card-due-date.due-today { color: var(--yellow-dark); }
.card-due-date.due-soon { color: var(--prio-high); }

/* Context menu */
.ctx-menu {
  position: absolute;
  right: 8px;
  top: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  min-width: 160px;
  overflow: hidden;
}

.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}
.ctx-menu-item:hover { background: var(--bg); color: var(--text-primary); }
.ctx-menu-item.danger { color: var(--red); }
.ctx-menu-item.danger:hover { background: rgba(218,67,87,.08); }

.ctx-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ══════════════════════════════════════════════════════════
   LIST VIEW
   ══════════════════════════════════════════════════════════ */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.list-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.filter-select {
  height: 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 28px 0 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238fa3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  -webkit-appearance: none;
  transition: var(--transition);
}

.filter-select:focus { outline: none; border-color: var(--teal); }

.tasks-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.tasks-table th {
  background: var(--bg);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.tasks-table th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.tasks-table th:last-child { border-radius: 0 var(--radius-lg) 0 0; }

.tasks-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.tasks-table tr:last-child td { border-bottom: none; }

.tasks-table tbody tr {
  transition: var(--transition);
  cursor: pointer;
}

.tasks-table tbody tr:hover { background: rgba(106,189,188,.04); }

.task-title-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
}

.task-title-cell .priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-title-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Gantt style duration bar */
.duration-bar {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  min-width: 80px;
  overflow: hidden;
}

.duration-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
}

/* ══════════════════════════════════════════════════════════
   REPORTS VIEW
   ══════════════════════════════════════════════════════════ */
.reports-period-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.period-btn {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: var(--transition);
}

.period-btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.period-btn.active {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  border-color: var(--teal);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(106,189,188,.3);
}

.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: 20px;
}

.chart-card-full {
  grid-column: 1 / -1;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-wrapper {
  position: relative;
  height: 220px;
}

/* Reopened tasks table in reports */
.reopened-table {
  width: 100%;
  border-collapse: collapse;
}

.reopened-table th, .reopened-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.reopened-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg);
}

.justification-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════
   CALENDAR VIEW
   ══════════════════════════════════════════════════════════ */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-nav h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: capitalize;
}

.calendar-grid {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
}

.calendar-weekday {
  padding: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  min-height: 90px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 8px;
  transition: var(--transition);
  cursor: pointer;
}

.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day:hover { background: rgba(106,189,188,.06); }

.calendar-day.today { background: rgba(106,189,188,.08); }
.calendar-day.today .day-number {
  background: var(--teal);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day.other-month { opacity: .4; }

.day-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.day-tasks { display: flex; flex-direction: column; gap: 2px; }

.day-task-dot {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.day-task-dot.pending   { background: rgba(245,158,11,.15); color: #b45309; }
.day-task-dot.progress  { background: rgba(106,189,188,.15); color: var(--teal-dark); }
.day-task-dot.completed { background: rgba(34,197,94,.12); color: #15803d; }
.day-task-dot.reopened  { background: rgba(218,67,87,.12); color: var(--red-dark); }
.day-task-dot.overdue   { background: rgba(220,38,38,.12); color: #b91c1c; }

.day-more { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════
   TASK DETAIL MODAL
   ══════════════════════════════════════════════════════════ */
.task-detail-header {
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.task-detail-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.3;
}

.task-detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.task-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.task-info-item label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.task-info-item span {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Timeline history */
.history-timeline { padding: 4px 0; }

.history-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}

.history-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: -16px;
  width: 2px;
  background: var(--border);
}

.history-item:last-child::before { display: none; }

.history-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 2px solid var(--bg-card);
  box-shadow: var(--shadow-xs);
}

.history-icon.created  { background: rgba(106,189,188,.15); }
.history-icon.updated  { background: rgba(24,60,90,.1); }
.history-icon.completed{ background: rgba(34,197,94,.12); }
.history-icon.reopened { background: rgba(218,67,87,.12); }
.history-icon.attached { background: rgba(215,222,79,.15); }

.history-content { flex: 1; }
.history-action { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.history-time   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-justification {
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(218,67,87,.06);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Attachments */
.attachments-list { display: flex; flex-direction: column; gap: 8px; }

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg);
  transition: var(--transition);
}

.attachment-item:hover { border-color: var(--teal); }

.attachment-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--navy-light), var(--navy));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.attachment-info { flex: 1; min-width: 0; }
.attachment-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-size { font-size: 11px; color: var(--text-muted); }

.attachment-actions { display: flex; gap: 4px; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--teal);
  background: rgba(106,189,188,.05);
}

.upload-area .upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-area p { font-size: 13px; color: var(--text-muted); }
.upload-area strong { color: var(--teal-dark); }

/* ══════════════════════════════════════════════════════════
   PROJECTS PANEL (Settings/Projects page)
   ══════════════════════════════════════════════════════════ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1.5px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.project-card-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.project-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 10px 0 6px;
}

.project-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  height: 36px;
  overflow: hidden;
}

.project-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.project-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════
   SETTINGS VIEW
   ══════════════════════════════════════════════════════════ */
.settings-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: .6;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ══════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.w-full { width: 100%; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--border-light); margin: 16px 0; }

/* ── LOADING SPINNER ──────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── SECTION HEADER ───────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.animate-fadein { animation: fadeIn .3s ease forwards; }
.animate-slidein { animation: slideIn .3s ease forwards; }

/* ══════════════════════════════════════════════════════════
   COLOR PICKER SWATCHES
   ══════════════════════════════════════════════════════════ */
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .dashboard-content { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .settings-sections { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }
  .task-info-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; z-index: 300; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .hamburger-btn { display: flex; }
  .sidebar-collapse-btn { display: none; }
  .sidebar.collapsed { width: var(--sidebar-w); }
  .main-wrapper { width: 100%; }
  .main-content { padding: 16px; }
  .board-container { height: auto; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .header-search { display: none; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .reports-period-selector { flex-wrap: wrap; }
  .modal { max-height: 100vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ══════════════════════════════════════════════════════════
   ACCESSIBILITY & POLISH (added)
   ══════════════════════════════════════════════════════════ */

/* Visible keyboard-focus ring (only for keyboard users) */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
.nav-item:focus-visible { box-shadow: inset 0 0 0 2px var(--teal-light); }

/* Screen-reader only helper */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Clickable stat cards */
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card.clickable:active { transform: translateY(-1px); }

/* Keyboard shortcut hint chips */
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: 'Inter', monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
}

/* ── Theme toggle button ──────────────────────────────────── */
.theme-toggle .icon-moon { display: inline; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: inline; }

/* ── Collapsible sidebar (desktop) ────────────────────────── */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info-text,
.sidebar.collapsed .user-card > span:last-child,
.sidebar.collapsed .nav-item > span:not(.nav-icon) { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 24px 12px 20px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item:hover { transform: none; }
.sidebar.collapsed .user-card { justify-content: center; }

.sidebar-collapse-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}
.sidebar-collapse-btn:hover { background: var(--border); color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════
   KPI COMPONENTS
   ══════════════════════════════════════════════════════════ */

/* KPI row on dashboard */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.kpi-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin: 4px 0;
}
.kpi-unit { font-size: 18px; font-weight: 500; margin-left: 2px; }

.kpi-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.kpi-bar-fill { height: 100%; border-radius: 2px; transition: width .6s ease; }

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Status summary row */
.status-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}
.status-chip:hover { opacity: .8; }

/* Health badge on project cards */
.health-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Reports KPI grid */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.report-kpi-item {
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-md);
  text-align: center;
}

.report-kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.report-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.report-kpi-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Responsive KPI */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .report-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .report-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .status-summary-row { gap: 6px; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .report-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Nav count badges ─────────────────────────────────────── */
.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: 9px;
  background: rgba(215,222,79,.85);
  color: #0f2033;
  margin-left: auto;
}
.nav-count-badge.nav-count-overdue {
  background: var(--red);
  color: #fff;
}
.sidebar.collapsed .nav-count-badge { display: none; }

/* ── Keyboard shortcuts modal ─────────────────────────────── */
.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.shortcut-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
}
.shortcut-row span { margin-left: 4px; }

/* ── Storage meter ────────────────────────────────────────── */
.storage-meter { padding: 12px; background: var(--bg); border-radius: var(--radius-md); }

/* ── LOGIN SCREEN ─────────────────────────────────────────── */
/* ── LOGIN SCREEN ─────────────────────────────────────────── */
.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #060f18;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}
.login-overlay.active { display: flex; }

/* Subtle dot-grid texture */
.login-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(106,189,188,.12) 1px, transparent 1px);
  background-size: 36px 36px;
  z-index: 0;
  pointer-events: none;
}

/* Ambient color blobs */
.login-bg-shapes { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.login-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  animation: blobDrift ease-in-out infinite alternate;
}
.login-shape.s1 {
  width: 500px; height: 500px; top: -160px; left: -100px;
  background: rgba(106,189,188,.13);
  animation-duration: 9s;
}
.login-shape.s2 {
  width: 420px; height: 420px; bottom: -130px; right: -100px;
  background: rgba(24,60,90,.75);
  animation-duration: 12s; animation-delay: -4s;
}
.login-shape.s3 {
  width: 260px; height: 260px; top: 50%; left: 58%;
  background: rgba(215,222,79,.07);
  animation-duration: 15s; animation-delay: -7s;
}
@keyframes blobDrift {
  from { transform: scale(1)    translate(0,0);      opacity: .65; }
  to   { transform: scale(1.14) translate(12px,-14px); opacity: 1; }
}

/* Floating bubbles */
.login-bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.bubble {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  opacity: 0;
  animation: bubbleRise linear infinite;
}
.bubble:nth-child(1)  { width:7px;  height:7px;  left:8%;  background:rgba(106,189,188,.45); animation-duration:9s;  animation-delay:0s;   }
.bubble:nth-child(2)  { width:11px; height:11px; left:18%; background:rgba(215,222,79,.3);  animation-duration:12s; animation-delay:2.5s; }
.bubble:nth-child(3)  { width:5px;  height:5px;  left:32%; background:rgba(142,207,206,.5); animation-duration:8s;  animation-delay:5s;   }
.bubble:nth-child(4)  { width:9px;  height:9px;  left:48%; background:rgba(106,189,188,.35); animation-duration:14s; animation-delay:1s;   }
.bubble:nth-child(5)  { width:6px;  height:6px;  left:62%; background:rgba(215,222,79,.25); animation-duration:10s; animation-delay:7s;   }
.bubble:nth-child(6)  { width:13px; height:13px; left:74%; background:rgba(106,189,188,.3); animation-duration:11s; animation-delay:3.5s; }
.bubble:nth-child(7)  { width:5px;  height:5px;  left:84%; background:rgba(77,163,162,.5);  animation-duration:7s;  animation-delay:6s;   }
.bubble:nth-child(8)  { width:8px;  height:8px;  left:92%; background:rgba(215,222,79,.2);  animation-duration:13s; animation-delay:0.5s; }
@keyframes bubbleRise {
  0%   { transform: translateY(0)     scale(1);   opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: .5; }
  100% { transform: translateY(-105vh) scale(1.3); opacity: 0; }
}

/* Card wrapper — animated gradient border */
.login-card-wrap {
  position: relative;
  z-index: 2;
  border-radius: 22px;
  padding: 2px;
  background: linear-gradient(135deg, var(--teal-dark), rgba(215,222,79,.6), var(--teal), rgba(24,60,90,.8));
  background-size: 300% 300%;
  animation: borderShift 6s ease infinite, loginCardIn .55s cubic-bezier(.16,1,.3,1);
  box-shadow: 0 32px 80px rgba(0,0,0,.7), 0 0 40px rgba(106,189,188,.1);
  width: 100%;
  max-width: 410px;
}
@keyframes borderShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(32px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Card */
.login-card {
  position: relative;
  background: #0c1b2a;
  border-radius: 20px;
  padding: 2.75rem 2.5rem 2.25rem;
  width: 100%;
}

/* Logo area */
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo-wrap {
  width: 82px; height: 82px;
  background: #ffffff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 6px 28px rgba(106,189,188,.28), 0 0 0 1px rgba(106,189,188,.15);
  animation: logoPop .6s cubic-bezier(.34,1.56,.64,1) .2s both;
}
@keyframes logoPop {
  from { transform: scale(.6) rotate(-8deg); opacity: 0; }
  to   { transform: scale(1)  rotate(0deg);  opacity: 1; }
}
.login-logo-title {
  font-size: .95rem;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  letter-spacing: .01em;
}
.login-logo-sub {
  font-size: .7rem;
  color: var(--teal-light);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: .25rem;
  font-weight: 500;
}
.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(106,189,188,.28), transparent);
  margin-bottom: 1.5rem;
}
.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: rgba(255,255,255,.95);
  margin-bottom: .25rem;
  text-align: center;
}
.login-subtitle {
  font-size: .8rem;
  color: rgba(255,255,255,.35);
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-form .form-group { margin-bottom: 1.1rem; }
.login-form label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--teal-light);
  margin-bottom: .45rem;
}
.login-form input {
  width: 100%;
  padding: .72rem 1rem;
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 12px;
  font-size: .94rem;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.login-form input::placeholder { color: rgba(255,255,255,.25); }
.login-form input:focus {
  outline: none;
  border-color: var(--teal);
  background: rgba(106,189,188,.09);
  box-shadow: 0 0 0 3px rgba(106,189,188,.18);
}
.login-btn {
  width: 100%;
  padding: .82rem;
  font-size: .95rem;
  font-weight: 600;
  margin-top: .75rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  color: var(--navy-dark);
  cursor: pointer;
  letter-spacing: .025em;
  transition: transform .15s, box-shadow .2s, filter .15s;
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(106,189,188,.4);
  filter: brightness(1.07);
}
.login-btn:active { transform: translateY(0); }
.login-error {
  background: rgba(218,67,87,.14);
  color: #f87c8c;
  border: 1px solid rgba(218,67,87,.28);
  border-radius: 10px;
  padding: .6rem .9rem;
  font-size: .85rem;
  margin-bottom: .75rem;
}
.login-error.hidden { display: none; }
.login-demo {
  margin-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 1rem;
}
.login-demo summary {
  font-size: .78rem;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.login-demo-table { margin-top: .75rem; display: flex; flex-direction: column; gap: .4rem; }
.demo-row {
  display: grid;
  grid-template-columns: 1.4fr 1.8fr 1fr;
  gap: .5rem;
  padding: .45rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  background: var(--bg);
  transition: background .15s;
}
.demo-row:hover { background: var(--hover); }
.demo-role {
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .72rem;
  white-space: nowrap;
}
.demo-role.super  { background: #fde8e8; color: var(--red); }
.demo-role.coord  { background: #e8f6f6; color: var(--teal-dark); }
.demo-role.member { background: #eef0f8; color: #5566a0; }

/* ── SIDEBAR LOGOUT BUTTON ─────────────────────────────────── */
.logout-btn {
  display: block;
  width: 100%;
  margin-top: .5rem;
  padding: .4rem .8rem;
  background: rgba(218,67,87,.12);
  color: #f87c8c;
  border: 1px solid rgba(218,67,87,.2);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  text-align: center;
}
.logout-btn:hover { background: rgba(218,67,87,.22); }

/* ── DEPARTMENTS GRID ─────────────────────────────────────── */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 1rem 0;
}
.dept-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.dept-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .4rem;
}
.dept-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: .5rem;
}
.dept-card-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--navy);
}
.dept-card-actions { display: flex; gap: .3rem; }
.dept-card-desc {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}
.dept-stats-row {
  display: flex;
  gap: 1rem;
  padding: .6rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.dept-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.dept-stat-val { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.dept-stat-lbl { font-size: .7rem; color: var(--text-muted); }
.dept-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dept-progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.dept-progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.dept-coordinator { font-size: .78rem; color: var(--text-muted); }

/* ── USERS TABLE ──────────────────────────────────────────── */
.users-filter-bar {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
}
.users-filter-bar select {
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: .85rem;
  background: var(--surface);
  color: var(--text-primary);
}
.users-table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.users-table th {
  background: var(--bg);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.users-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--hover); }
.current-user-row td { background: rgba(106,189,188,.06); }
.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.dept-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}


/* ══════════════════════════════════════════════════════════
   SKIP LINK — visible solo con foco de teclado (WCAG 2.1)
   ══════════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
  text-decoration: none;
}
.skip-link:focus {
  position: fixed;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: auto; height: auto;
  clip: auto; margin: 0;
  padding: 10px 20px;
  background: var(--navy);
  color: #fff;
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius-md);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  outline: 3px solid var(--teal);
}

/* ══════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:           #0e1420;
  --bg-card:      #1a2232;
  --border:       #2a3a52;
  --border-light: #1e2d40;
  --text-primary:   #e2eaf4;
  --text-secondary: #8fa3b8;
  --text-muted:     #506070;
  --white:          #1a2232;
  --shadow-xs:  0 1px 3px rgba(0,0,0,.4);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,.45);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.5);
  --navy:       #122a40;
  --navy-dark:  #0a1e30;
  --navy-light: #1a3a58;
  color-scheme: dark;
}
[data-theme="dark"] .sidebar { background: linear-gradient(160deg,#0a1e30,#102940 60%,#1a3a58 100%); }
[data-theme="dark"] .top-bar { background: var(--bg-card); border-bottom-color: var(--border); }
[data-theme="dark"] .modal { background: var(--bg-card); }
[data-theme="dark"] .form-control { background: var(--bg); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .form-control:focus { background: #1e2d40; }
[data-theme="dark"] .card { background: var(--bg-card); }
[data-theme="dark"] .task-card { background: var(--bg-card); }
[data-theme="dark"] .login-card { background: #0c1b2a; }
[data-theme="dark"] .login-overlay { background: #060f18; }
[data-theme="dark"] .dropdown-menu { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .btn-secondary { background: var(--bg); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { color-scheme: dark; }
[data-theme="dark"] .header-search { background: rgba(255,255,255,.05); }
[data-theme="dark"] .tasks-table th { background: var(--bg); }
[data-theme="dark"] .tasks-table td { border-bottom-color: var(--border); }
[data-theme="dark"] .filter-select { background: var(--bg); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .skeleton { background: var(--border); }
[data-theme="dark"] .skeleton-card { background: var(--bg-card); }

/* Focus ring WCAG */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════
   SKELETON SCREENS
   ══════════════════════════════════════════════════════════ */
@keyframes skeleton-pulse {
  0%   { opacity: 1; }
  50%  { opacity: .4; }
  100% { opacity: 1; }
}
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--border) 25%,
    color-mix(in srgb, var(--border) 60%, var(--bg-card)) 37%,
    var(--border) 63%);
  background-size: 800px 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-shimmer 1.6s linear infinite;
}
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg,
    var(--border) 25%,
    color-mix(in srgb, var(--border) 50%, var(--surface)) 37%,
    var(--border) 63%);
  background-size: 800px 100%;
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.wide   { width: 80%; }
.skeleton-line.medium { width: 55%; }
.skeleton-line.narrow { width: 30%; }
.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
}

/* ══════════════════════════════════════════════════════════
   SUBTASKS
   ══════════════════════════════════════════════════════════ */
.subtask-list { list-style: none; padding: 0; margin: 0; }
.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-light);
  transition: background .15s;
}
.subtask-item:last-child { border-bottom: none; }
.subtask-item:hover { background: var(--bg); border-radius: 6px; }
.subtask-item.completed .subtask-title { text-decoration: line-through; color: var(--text-muted); }
.subtask-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.subtask-check.done { background: var(--teal); border-color: var(--teal); color: white; }
.subtask-check svg  { width: 12px; height: 12px; }
.subtask-title { flex: 1; font-size: 13px; color: var(--text-primary); }
.subtask-del { opacity: 0; transition: opacity .15s; color: var(--text-muted); padding: 2px; }
.subtask-item:hover .subtask-del { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   COMMENTS
   ══════════════════════════════════════════════════════════ */
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item  { display: flex; gap: 10px; }
.comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.comment-body   { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment-header strong { font-size: 13px; color: var(--text-primary); }
.comment-time   { font-size: 11px; color: var(--text-muted); }
.comment-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
  background: var(--bg);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 8px 10px;
}

/* ══════════════════════════════════════════════════════════
   BULK ACTIONS BAR — barra flotante inferior
   ══════════════════════════════════════════════════════════ */
.bulk-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--navy);
  color: white;
  border-radius: var(--radius-xl);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.bulk-action-bar.visible {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  opacity: 1;
}
.bulk-action-bar .bulk-count {
  font-size: 13px;
  font-weight: 600;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.2);
}
.bulk-action-bar .btn-bulk {
  background: rgba(255,255,255,.12);
  border: none;
  color: white;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.bulk-action-bar .btn-bulk:hover        { background: rgba(255,255,255,.22); }
.bulk-action-bar .btn-bulk.danger:hover { background: rgba(218,67,87,.6); }
.bulk-checkbox {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--teal);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   ADVANCED SEARCH MODAL
   ══════════════════════════════════════════════════════════ */
#search-modal-overlay .modal { padding: 0; }
.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover  { background: var(--bg); }
.search-result-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.search-result-meta  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.search-result-badges { display: flex; gap: 4px; margin-top: 4px; }

/* ══════════════════════════════════════════════════════════
   MILESTONES / HITOS DE PROYECTO
   ══════════════════════════════════════════════════════════ */
.milestone-timeline { padding: 8px 0; }
.milestone-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0 10px 16px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
  position: relative;
}
.milestone-item::before {
  content: '';
  position: absolute;
  left: -5px; top: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--bg-card);
}
.milestone-item.overdue::before   { background: var(--red); }
.milestone-item.completed::before { background: var(--status-completed); }
.milestone-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.milestone-date { font-size: 11px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   ACCESSIBILITY — Screen reader utilities
   ══════════════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
[aria-disabled="true"] { opacity: .5; pointer-events: none; }
[role="tabpanel"]:focus { outline: none; }

/* ══════════════════════════════════════════════════════════
   TASK CARD — Progreso de subtareas (Board / Lista)
   ══════════════════════════════════════════════════════════ */
.task-subtask-progress {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
}
.task-subtask-bar {
  flex: 1; height: 4px;
  background: var(--border); border-radius: 99px; overflow: hidden;
}
.task-subtask-bar-fill {
  height: 100%;
  background: var(--teal-dark);
  border-radius: 99px;
  transition: width .3s;
}
.task-subtask-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   TASK TEMPLATES — Selector en modal de nueva tarea
   ══════════════════════════════════════════════════════════ */
#template-selector-row {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  transition: border-color .2s;
}

/* ══════════════════════════════════════════════════════════
   WEB PUSH — Indicador de estado en Configuración
   ══════════════════════════════════════════════════════════ */
#push-status-indicator {
  padding: 4px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR FOOTER — clases usadas en el HTML
   ══════════════════════════════════════════════════════════ */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-top: 1px solid rgba(106,189,188,.15);
}
.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.sidebar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-userrole {
  font-size: 11px;
  color: rgba(255,255,255,.5);
}
.sidebar-logout {
  margin-left: auto;
  color: rgba(255,255,255,.4);
  transition: color .2s;
  flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--red); }

/* ══════════════════════════════════════════════════════════
   VIEW HEADER — encabezado común de cada vista
   ══════════════════════════════════════════════════════════ */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: .75rem;
}
.view-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
}
