/* ============================================================
   Diego Digital CRM — Hoja de estilos (Brand Kit v1.0)
   ============================================================ */

:root {
  --primary-dark: #003D5C;
  --primary-light: #00A9C9;
  --accent: #F5A623;
  --accent-hover: #D68A1F;
  --accent-active: #BF7A15;
  --text-dark: #001A2E;
  --text-body: #2C3E50;
  --text-secondary: #7F8C8D;
  --text-light: #FFFFFF;
  --bg-white: #FFFFFF;
  --bg-light: #F0F0F0;
  --bg-very-light: #F7F9FA;
  --border: #E3E9EC;

  --font-heading: 'Montserrat', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-script: 'Dancing Script', cursive;

  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 4px 12px rgba(0, 61, 92, 0.12);
  --shadow-hover: 0 8px 20px rgba(0, 61, 92, 0.22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-very-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-family: var(--font-heading); color: var(--primary-dark); line-height: 1.25; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: 0.5px; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: 0.5px; }
h3 { font-size: 18px; font-weight: 600; }
a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Barra superior ---------- */

.topbar {
  background: var(--primary-dark);
  color: var(--text-light);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }

/* Versión blanca del logo, directa sobre la barra azul marino */
.brand-logo { height: 44px; width: auto; display: block; }

.mainnav { display: flex; gap: 8px; flex: 1; }
.mainnav a {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: var(--radius);
  text-decoration: none !important;
  transition: background 0.2s ease;
}
.mainnav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.mainnav a.active { background: rgba(0, 169, 201, 0.25); color: #fff; }

/* Menú desplegable "Más" en la barra */
.nav-group { position: relative; display: flex; align-items: center; }
.nav-group-toggle {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-body);
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
}
.nav-group-toggle:hover,
.nav-group.open .nav-group-toggle,
.nav-group-toggle.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-group-toggle .caret { font-size: 11px; transition: transform 0.2s ease; }
.nav-group.open .nav-group-toggle .caret { transform: rotate(180deg); }
.nav-group-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 26, 46, 0.22);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
}
.nav-group.open .nav-group-menu { display: flex; }
.nav-group-menu a {
  color: var(--primary-dark) !important;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 6px;
  text-decoration: none !important;
  white-space: nowrap;
}
.nav-group-menu a:hover { background: var(--bg-light, #eef3f6); color: var(--primary-dark) !important; }
.nav-group-menu a.active { background: rgba(0, 169, 201, 0.18); }

.topbar-user { display: flex; align-items: center; gap: 14px; }
.topbar-name { font-size: 14px; opacity: 0.9; }

/* Botón hamburguesa (solo visible en móvil) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2.5px;
  border-radius: 2px;
  background: #FFFFFF;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---------- Contenido ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.page-head p { color: var(--text-secondary); margin-top: 4px; }

.breadcrumb { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.breadcrumb a { color: var(--primary-light); font-weight: 600; }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.25s ease;
  line-height: 1.2;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-light);
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 16px rgba(245, 166, 35, 0.4); transform: translateY(-2px); }
.btn-primary:active { background: var(--accent-active); transform: translateY(0); }

.btn-secondary { background: var(--primary-dark); color: var(--text-light); border: 1px solid var(--primary-dark); }
.btn-secondary:hover { background: #00527A; }

.btn-tertiary { background: transparent; color: var(--primary-light); border: 2px solid var(--primary-light); }
.btn-tertiary:hover { background: var(--primary-light); color: var(--text-light); }

.btn-outline { background: transparent; color: var(--text-light); border: 1px solid rgba(255,255,255,0.5); }
.btn-outline:hover { background: rgba(255,255,255,0.12); }

.btn-danger { background: transparent; color: #C0392B; border: 1px solid #C0392B; }
.btn-danger:hover { background: #C0392B; color: #fff; }

.btn-sm { padding: 6px 16px; min-height: 34px; font-size: 13px; }

/* ---------- Tarjetas ---------- */

.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card-hover { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Tarjetas de estadística */
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary-light);
}
.stat-card.stat-accent { border-top-color: var(--accent); }
.stat-card.stat-dark { border-top-color: var(--primary-dark); }
.stat-card.stat-green { border-top-color: #2E9E5B; }
.stat-value { font-family: var(--font-heading); font-size: 36px; font-weight: 700; color: var(--primary-dark); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Tarjetas de métricas clicables */
a.stat-card { text-decoration: none !important; display: block; transition: transform 0.2s ease, box-shadow 0.2s ease; }
a.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-card.stat-alert { border-top-color: #C0392B; }
.stat-card.stat-alert .stat-value { color: #A33B22; }

/* Sección "Requiere atención" */
.attention-list { padding: 12px 8px; }
.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  text-decoration: none !important;
  color: var(--text-body);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.attention-item:last-child { border-bottom: none; }
.attention-item:hover { background: rgba(0, 169, 201, 0.07); }
.attention-icon { font-size: 18px; flex-shrink: 0; }
.attention-text { flex: 1; font-size: 14px; }
.attention-item .chip { flex-shrink: 0; }

/* Campana de notificaciones */
.bell {
  position: relative;
  font-size: 19px;
  text-decoration: none !important;
  padding: 6px 8px;
  border-radius: var(--radius);
  line-height: 1;
}
.bell:hover, .bell.active { background: rgba(255, 255, 255, 0.12); }
.bell-count {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 17px;
  text-align: center;
  font-family: var(--font-body);
}

/* Buscador en la barra */
.topbar-search { margin-left: 8px; }
.topbar-search input {
  width: 150px;
  padding: 7px 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  transition: all 0.2s ease;
}
.topbar-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.topbar-search input:focus { outline: none; background: #fff; color: var(--text-dark); width: 190px; }

/* Lista de notificaciones / resultados */
.notif-list { padding: 8px; }
.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius);
  text-decoration: none !important;
  color: var(--text-body);
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(0, 169, 201, 0.07); }
.notif-item.unread { background: rgba(0, 169, 201, 0.06); }
.notif-item.unread .notif-msg { font-weight: 700; color: var(--primary-dark); }
.notif-icon { font-size: 18px; flex-shrink: 0; }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-msg { font-size: 14px; }
.notif-date { font-size: 12px; color: var(--text-secondary); }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* Tarjeta de cliente */
.client-card { display: flex; flex-direction: column; gap: 12px; }
.client-card h3 { font-size: 20px; }
.client-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid var(--primary-light);
  background: rgba(0, 169, 201, 0.1);
  color: var(--primary-dark);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.client-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
.client-meta strong { color: var(--primary-dark); }

/* ---------- Tablas ---------- */

.table-wrap { overflow-x: auto; background: var(--bg-white); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}
table.data thead { background: var(--primary-dark); color: var(--text-light); }
table.data th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  border-bottom: 3px solid var(--accent);
  white-space: nowrap;
}
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: rgba(0, 169, 201, 0.05); }
.td-actions { white-space: nowrap; text-align: right; }
.td-actions .btn { margin-left: 6px; }

/* ---------- Chips (tipo y estado) ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-post     { background: #FDF0DC; color: #8A5A00; }
.chip-carrusel { background: #DDF1FA; color: #005C7A; }
.chip-reel     { background: #E2F3E8; color: #1E6B40; }
.chip-historia { background: #F3E4F0; color: #7A2E6B; }

.chip-status .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip-pendiente { background: #EEF1F2; color: #5A6B72; }
.chip-pendiente .dot { background: #8FA0A8; }
.chip-aprobado { background: #E2F3E8; color: #1E6B40; }
.chip-aprobado .dot { background: #2E9E5B; }
.chip-cambios { background: #FCE9E4; color: #A33B22; }
.chip-cambios .dot { background: #D35400; }

/* ---------- Formularios ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid .full { grid-column: 1 / -1; }

label { display: block; font-weight: 600; font-size: 14px; color: var(--primary-dark); margin-bottom: 6px; }

input[type="text"], input[type="password"], input[type="date"], input[type="url"],
input[type="email"], input[type="tel"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dark);
  background: var(--bg-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(0, 169, 201, 0.15);
}
textarea { resize: vertical; min-height: 120px; }
.hint { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }

/* ---------- Panel de enlace de invitación ---------- */

.invite-panel {
  background: #FDF6E9;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  font-size: 14px;
}
.invite-panel p { margin-bottom: 12px; }
.invite-row { display: flex; gap: 10px; flex-wrap: wrap; }
.invite-row input {
  flex: 1;
  min-width: 220px;
  font-size: 13px;
  font-family: monospace;
  background: #fff;
}

/* ---------- Mensajes flash ---------- */

.flash {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}
.flash-ok { background: #E2F3E8; color: #1E6B40; border-left: 4px solid #2E9E5B; }
.flash-error { background: #FCE9E4; color: #A33B22; border-left: 4px solid #D35400; }

/* ---------- Login ---------- */

.login-body {
  background: linear-gradient(135deg, #003D5C 0%, #00A9C9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 26, 46, 0.35);
  width: 100%;
  max-width: 420px;
  padding: 48px 40px 36px;
  text-align: center;
}

.login-logo {
  display: block;
  margin: 0 auto 20px;
  width: 170px;
  max-width: 60%;
  height: auto;
}

.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-link { color: var(--accent, #00A9C9); font-size: 14px; font-weight: 600; text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.login-foot { margin-top: 28px; font-family: var(--font-script); font-size: 24px; color: var(--primary-dark); }
.login-foot-sub { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Portal del cliente ---------- */

.portal-hero {
  background: linear-gradient(135deg, #003D5C 0%, #00A9C9 100%);
  color: var(--text-light);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 32px;
}
.portal-hero h1 { color: var(--text-light); font-size: 30px; }
.portal-hero p { opacity: 0.95; margin-top: 6px; max-width: 640px; }

.month-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary-dark);
  margin: 32px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.month-label::after { content: ''; flex: 1; border-top: 2px dashed var(--accent); opacity: 0.6; }

/* Detalle de publicación */
.copy-block {
  background: var(--bg-very-light);
  border-left: 4px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  white-space: pre-wrap;
  font-size: 15px;
}

.item-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 12px 0 20px; }
.item-meta .date { color: var(--text-secondary); font-size: 14px; }

.approve-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Comentarios */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  background: rgba(0, 169, 201, 0.12);
  color: var(--primary-dark);
  border: 2px solid var(--primary-light);
}
.comment-avatar.admin { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.comment-body p { font-size: 14.5px; }
.comment-head { font-size: 13px; color: var(--text-secondary); margin-bottom: 2px; }
.comment-head strong { color: var(--primary-dark); }

/* ---------- Tablero de proyectos (kanban) ---------- */

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

.kanban-col {
  background: rgba(0, 61, 92, 0.05);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 200px;
}

.kanban-head {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: var(--primary-dark);
  padding: 4px 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-count {
  background: var(--primary-dark);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  padding: 1px 10px;
}

.task-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  cursor: grab;
}
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.45; transform: rotate(1.5deg); }
.kanban-col.drop-target {
  outline: 2px dashed var(--primary-light);
  outline-offset: -2px;
  background: rgba(0, 169, 201, 0.1);
}
.task-card.task-done { opacity: 0.75; }
.task-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.task-title { font-weight: 600; font-size: 14.5px; color: var(--primary-dark); line-height: 1.35; }
.task-done .task-title { text-decoration: line-through; }
.task-desc { font-size: 13px; color: var(--text-body); margin-top: 6px; }
.task-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }
.task-assignee { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--primary-dark); }
.avatar-xs, .comment-avatar.avatar-xs, img.avatar-xs { width: 24px; height: 24px; font-size: 11px; border-width: 1.5px; }
.task-due.overdue { color: #A33B22; font-weight: 700; }
.task-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.task-actions .btn-sm { padding: 4px 12px; min-height: 30px; font-size: 12px; }

.chip-prio-alta  { background: #FCE9E4; color: #A33B22; }
.chip-prio-media { background: #FDF0DC; color: #8A5A00; }
.chip-prio-baja  { background: #EEF1F2; color: #5A6B72; }

/* Añadir tarjeta directo en la columna (estilo Trello) */
.kanban-add { margin-top: 4px; }
.kanban-add-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 9px 10px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.kanban-add-btn:hover { background: rgba(0, 61, 92, 0.08); color: var(--primary-dark); }
.kanban-add-form {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-add-form[hidden] { display: none; }
.task-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-edit-form[hidden], .task-view[hidden] { display: none; }
.task-card.editing { cursor: default; }
.kanban-add-form textarea,
.task-edit-form textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
}
.kanban-add-form textarea:focus,
.task-edit-form textarea:focus { outline: none; border-color: var(--primary-light); }
.task-edit-form textarea[name="title"] { font-weight: 600; }
.kanban-add-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.kanban-add-fields select,
.kanban-add-fields input[type="date"] {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
  background: var(--bg-very-light);
}
.kanban-add-actions { display: flex; gap: 8px; align-items: center; }

/* Selector de varios responsables */
.assignee-pick {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-very-light);
}
.assignee-pick-label { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); width: 100%; }
.assignee-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-dark);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 7px;
  cursor: pointer;
}
.assignee-opt input { accent-color: var(--accent, #00A9C9); cursor: pointer; }
.assignee-opt:has(input:checked) { background: rgba(0, 169, 201, 0.15); border-color: var(--primary-light); }

/* Pila de responsables en la tarjeta */
.task-assignees { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-assignees .task-assignee { gap: 0; }
.task-assignees .assignee-name { margin-left: 2px; font-weight: 600; color: var(--primary-dark); }

@media (max-width: 900px) {
  .kanban { grid-template-columns: 1fr; }
}

/* ---------- Avatares con foto ---------- */

.avatar-photo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
  flex-shrink: 0;
}
.avatar-photo.admin { border-color: var(--primary-dark); }
.avatar-sm, .comment-avatar.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg, .comment-avatar.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
img.avatar-lg { width: 64px; height: 64px; }

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

input[type="file"] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--bg-very-light);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  background: var(--primary-dark);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 7px 14px;
  margin-right: 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Cola de archivos (seleccionar, previsualizar y ordenar) ---------- */

.file-queue { margin-top: 12px; }
.fq-head {
  font-size: 13px;
  color: var(--text-soft, #5a6b78);
  margin-bottom: 10px;
}
.fq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.fq-item {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-very-light);
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.fq-item.fq-dragging { opacity: 0.45; }
.fq-item.fq-over { border-color: var(--accent, #00A9C9); box-shadow: 0 0 0 2px var(--accent, #00A9C9); }
.fq-item img,
.fq-item .fq-vid {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
}
.fq-item .fq-vid {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: #0b2231;
}
.fq-pos {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--primary-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.fq-name {
  display: block;
  padding: 6px 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-soft, #5a6b78);
}
.fq-tools {
  display: flex;
  border-top: 1px solid var(--border);
}
.fq-btn {
  flex: 1;
  border: none;
  background: #fff;
  padding: 5px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
}
.fq-btn + .fq-btn { border-left: 1px solid var(--border); }
.fq-btn:hover:not(:disabled) { background: var(--bg-light, #eef3f6); }
.fq-btn:disabled { color: #b8c4cc; cursor: default; }
.fq-btn.fq-del { color: var(--danger, #c0392b); }

.onboarding { max-width: 720px; margin: 0 auto; }

/* Avatar editable (Mi perfil) — clic para cambiar foto, con vista previa */
.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;
}
.avatar-edit { position: relative; display: inline-block; cursor: pointer; flex-shrink: 0; line-height: 0; }
.avatar-edit .avatar-lg { display: flex; }
.avatar-edit [hidden] { display: none !important; } /* evita que el img/inicial oculto ocupe espacio */
.avatar-edit .avatar-cam {
  position: absolute; right: -3px; bottom: -3px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent, #00A9C9); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; border: 2px solid #fff;
  box-shadow: var(--shadow); transition: transform 0.15s ease;
  z-index: 2;
}
.avatar-edit:hover .avatar-cam { transform: scale(1.1); }
.avatar-edit:hover .avatar-lg { filter: brightness(0.95); }
.avatar-hint { color: var(--accent, #00A9C9); font-weight: 600; margin-top: 6px; }

/* Recorte / centrado de foto de perfil */
.crop-box { margin: 0 0 20px; max-width: 240px; }
.crop-box[hidden] { display: none; }
.crop-stage {
  width: 220px; height: 220px; border-radius: 50%;
  overflow: hidden; position: relative; background: #0b2231;
  cursor: grab; touch-action: none; margin-bottom: 12px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.7), var(--shadow);
}
.crop-stage:active { cursor: grabbing; }
.crop-img { position: absolute; top: 0; left: 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.crop-controls { display: flex; align-items: center; gap: 8px; }
.crop-controls input[type="range"] { flex: 1; accent-color: var(--accent, #00A9C9); }
.crop-zoom-icon { font-size: 15px; }

/* ---------- Visor de diseños (carrusel embebido) ---------- */

.design-viewer { margin-bottom: 8px; }
.dv-stage {
  position: relative;
  background: #0b2231;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.dv-slide { display: none; }
.dv-slide.active { display: block; }
.dv-slide img,
.dv-slide video {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
}
.dv-prev, .dv-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 26, 46, 0.65);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 2;
}
.dv-prev { left: 12px; }
.dv-next { right: 12px; }
.dv-prev:hover, .dv-next:hover { background: var(--primary-light); }
.dv-count {
  position: absolute;
  bottom: 12px;
  right: 14px;
  background: rgba(0, 26, 46, 0.7);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  z-index: 2;
}

@media (max-width: 768px) {
  .dv-slide img, .dv-slide video { max-height: 380px; }
  .dv-prev, .dv-next { width: 38px; height: 38px; font-size: 22px; }
}

/* ---------- Galería de medios (Publitio / local) ---------- */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.media-item {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 0;
}
.media-item img,
.media-item video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #0b2231;
}
.media-item video { object-fit: contain; }
.media-item figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}
.media-item figcaption .btn-sm { padding: 2px 10px; min-height: 28px; flex-shrink: 0; }
.media-item figcaption .mg-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Miniatura de diseño en tablas */
.media-thumb {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b2231;
  box-shadow: var(--shadow);
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-thumb .mt-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 22px;
}
.media-thumb .mt-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: rgba(0, 26, 46, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.media-thumb .mt-play {
  right: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(50%, -50%);
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Reordenar adjuntos */
.media-grid-reorder .media-item { cursor: grab; }
.media-grid-reorder .media-item.mg-dragging { opacity: 0.4; }
.mg-move { display: inline-flex; flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mg-move .fq-btn { min-width: 26px; padding: 2px 0; }
.mg-move .fq-btn + .fq-btn { border-left: 1px solid var(--border); }

@media (max-width: 600px) {
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

/* ---------- Pie de página ---------- */

.footer {
  text-align: center;
  padding: 32px 24px 40px;
  background: var(--bg-light);
  margin-top: auto;
}
.footer-sig { font-family: var(--font-script); font-size: 26px; color: var(--primary-dark); }
.footer-sub { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* ---------- Filtros ---------- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filters a {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  text-decoration: none !important;
  transition: all 0.2s ease;
}
.filters a:hover { border-color: var(--primary-light); color: var(--primary-dark); }
.filters a.active { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- Barra de filtros + selector de vista ---------- */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.view-toggle { display: flex; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-white); }
.view-toggle a {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  text-decoration: none !important;
  transition: all 0.2s ease;
}
.view-toggle a.active { background: var(--primary-dark); color: #fff; }
.view-toggle a:not(.active):hover { background: rgba(0, 169, 201, 0.08); }

/* ---------- Vista de calendario ---------- */

.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

.cal-head {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-dark);
  text-align: center;
  padding: 8px 4px;
}

.cal-day {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  background: var(--bg-very-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-empty { background: transparent; border-style: dashed; opacity: 0.5; }
.cal-today { border: 2px solid var(--primary-light); background: rgba(0, 169, 201, 0.06); }
.cal-num { font-family: var(--font-heading); font-weight: 700; font-size: 13px; color: var(--primary-dark); }
.cal-today .cal-num { color: var(--primary-light); }

.cal-item {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 4px 6px;
  border-radius: 4px;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid transparent;
  transition: transform 0.15s ease;
}
.cal-item:hover { transform: translateX(2px); }
.cal-item.cal-pendiente { background: #EEF1F2; color: #44545C; border-left-color: #8FA0A8; }
.cal-item.cal-aprobado { background: #E2F3E8; color: #1E6B40; border-left-color: #2E9E5B; }
.cal-item.cal-cambios { background: #FCE9E4; color: #A33B22; border-left-color: #D35400; }

/* ---------- Tablero de herramientas ---------- */

.grid-2-tools { grid-template-columns: repeat(2, 1fr); margin-bottom: 8px; }

.tool-card { position: relative; padding: 24px; }
.tool-link { text-decoration: none !important; display: block; }
.tool-link h3 { font-size: 17px; margin-bottom: 6px; }
.tool-arrow { color: var(--accent); font-weight: 700; }
.tool-desc { font-size: 13.5px; color: var(--text-body); margin-bottom: 8px; }
.tool-url { font-size: 12px; color: var(--text-secondary); }
.tool-delete { position: absolute; top: 12px; right: 12px; }
.tool-delete .btn { padding: 2px 10px; min-height: 28px; }

/* ---------- Asignación de clientes (checkboxes) ---------- */

.check-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-white);
  transition: all 0.2s ease;
  margin-bottom: 0;
}
.check-pill:hover { border-color: var(--primary-light); }
.check-pill:has(input:checked) { background: rgba(0, 169, 201, 0.12); border-color: var(--primary-light); color: var(--primary-dark); }
.check-pill input { accent-color: #00A9C9; width: 16px; height: 16px; }

/* ---------- Google Drive embebido ---------- */

.drive-embed {
  margin-top: 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.drive-embed iframe { width: 100%; height: 420px; border: none; display: block; background: #fff; }

/* ---------- Responsive ---------- */

/* Anclas (#usuarios, etc.): que la barra sticky no tape el destino */
[id] { scroll-margin-top: 90px; }

/* Tablet y móvil: menú hamburguesa (los 7 enlaces no caben en anchos medios) */
@media (max-width: 1023px) {
  .topbar-inner { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .brand-logo { height: 36px; }
  .topbar-name { display: none; }
  .topbar-avatar { width: 30px; height: 30px; }
  .nav-toggle { display: flex; order: 2; margin-left: auto; }
  .topbar-user { order: 3; }
  .mainnav {
    display: none;
    order: 4;
    flex: 0 0 100%;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 4px;
  }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 13px 14px; font-size: 15px; }
  /* En móvil el grupo "Más" se aplana: se muestran todos los links en lista */
  .nav-group { position: static; display: block; }
  .nav-group-toggle { display: none; }
  .nav-group-menu {
    position: static;
    display: flex;
    min-width: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    gap: 4px;
  }
  .nav-group-menu a {
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 13px 14px;
    font-size: 15px;
  }
  .nav-group-menu a:hover { background: rgba(255, 255, 255, 0.1); color: #fff !important; }
  .nav-group-menu a.active { background: rgba(0, 169, 201, 0.25); color: #fff !important; }
  .topbar-search { margin: 6px 0 0; }
  .topbar-search input, .topbar-search input:focus { width: 100%; }
  .bell { order: 1; margin-left: auto; }
  .nav-toggle { margin-left: 0; }
}

@media (max-width: 768px) {
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .page { padding: 20px 14px 48px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid { gap: 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }

  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .btn { justify-content: center; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .view-toggle { align-self: stretch; }
  .view-toggle a { flex: 1; text-align: center; padding: 10px 8px; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters a { flex-shrink: 0; white-space: nowrap; padding: 9px 15px; }

  .card { padding: 20px 16px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 28px; }
  .stat-label { font-size: 11.5px; }
  .portal-hero { padding: 24px 20px; }
  .portal-hero h1 { font-size: 24px; }

  table.data { font-size: 13.5px; }
  table.data th, table.data td { padding: 10px 12px; }
  .td-actions .btn { margin-left: 4px; margin-top: 4px; }

  .cal-nav { justify-content: center; }
  .cal-nav h2 { width: 100%; text-align: center; order: -1; }

  .approve-bar { flex-direction: column; }
  .approve-bar .btn { width: 100%; }
  .kanban-col { min-height: 0; }
}

@media (max-width: 768px) {
  .grid-2-tools { grid-template-columns: 1fr; }
  .cal-day { min-height: 64px; padding: 4px; }
  .cal-item span { display: none; } /* en móvil solo se ve el emoji */
  .drive-embed iframe { height: 320px; }
}

@media (max-width: 480px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
