/* =========================================================================
   Centro de Gestión — Santiago Aroca · Estudio Creativo
   Rediseño 2026: estilo suizo. Helvetica grande, retícula, esquinas
   rectas, líneas negras y el naranja de la marca como único acento.
   Todas las clases y variables anteriores se mantienen, así que las
   páginas PHP funcionan igual: solo cambia cómo se ven.
   ========================================================================= */

:root {
  /* marca */
  --ink: #151B21;
  --paper: #F5F3EE;
  --brand-orange: #EE730D;
  --orange-text: #A14A04;          /* naranja oscuro para texto chico (contraste AA) */
  --danger: #A12A1A;

  /* variables originales, remapeadas a la nueva paleta */
  --bg-canvas: #F5F3EE;
  --card-bg: #FFFFFF;
  --card-soft: #F5F3EE;
  --text-1: #151B21;
  --text-2: #4F4B42;
  --text-3: #6B665A;
  --border: #E2DED4;
  --brand: #151B21;
  --brand-soft: #E6E2D8;
  --orange: #EE730D;
  --orange-soft: #FDEBDC;
  --yellow: #EE730D;               /* barras de progreso: naranja de marca */
  --yellow-soft: #F6EDCF;
  --green: #2F8A45;
  --green-soft: #E1EFE3;
  --r-lg: 0px;
  --r-md: 0px;
  --r-sm: 0px;
  --shadow: none;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* navegadores viejos */
  overflow-x: clip;   /* corta lo que se pasa de ancho sin romper el menú fijo */
}

h1, h2, h3, .heading { font-family: var(--font); letter-spacing: -0.025em; }

a { color: var(--orange-text); text-decoration: none; transition: color .2s; }
a:hover { color: var(--ink); }

img { max-width: 100%; }

::selection { background: var(--brand-orange); color: var(--ink); }

:focus-visible { outline: 3px solid var(--brand-orange); outline-offset: 2px; }

/* Estilo suizo: todo recto. Los avatares siguen siendo círculos. */
.main-content [style*="border-radius"]:not(.avatar),
.portal-content [style*="border-radius"]:not(.avatar),
.login-card [style*="border-radius"]:not(.avatar) { border-radius: 0 !important; }

/* Links con naranja de marca en línea: pasan al naranja legible */
a[style*="color:var(--orange)"], a[style*="color: var(--orange)"] { color: var(--orange-text) !important; }

/* ---------- layout: panel de equipo (sidebar oscuro + contenido) ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
  padding: 0;
  gap: 0;
}

.sidebar {
  width: 264px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 24px;
  background: var(--ink);
  color: var(--paper);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 12px 24px;
  border-bottom: 1px solid rgba(245,243,238,.14);
  margin-bottom: 18px;
}
.sidebar-brand-badge {
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.sidebar-brand-badge img { height: 40px; width: auto; display: block; }
.sidebar-brand-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #ACA89D;
  text-align: left;
  margin-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 44px;
  padding: 0 12px;
  border-radius: 0;
  font-size: 15px;
  font-weight: 500;
  color: #D9D5CB;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.nav-item:hover { background: rgba(245,243,238,.07); color: var(--paper); }
.nav-item.active { background: var(--brand-orange); color: var(--ink); font-weight: 700; }
.nav-item.active:hover { color: var(--ink); }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-spacer { flex: 1; }

/* usuario al pie del sidebar */
.sidebar-user {
  margin-top: auto;
  padding: 20px 12px 0;
  border-top: 1px solid rgba(245,243,238,.14);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-user .avatar { width: 40px; height: 40px; font-size: 14px; box-shadow: 0 0 0 2px rgba(245,243,238,.35); }
.sidebar-user-name { font-size: 15px; font-weight: 700; color: var(--paper); line-height: 1.2; }
.sidebar-user-links { display: flex; gap: 12px; margin-top: 4px; }
.sidebar-user-links a { font-size: 13px; color: #ACA89D; }
.sidebar-user-links a:hover { color: var(--brand-orange); }

.main-content { flex: 1; min-width: 0; padding: 28px 48px 56px; }

/* ---------- topbar: fecha + campanilla ---------- */

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 44px;
  margin-bottom: 36px;
  padding: 0;
}
.topbar-date {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.user-chip-top { display: flex; align-items: center; gap: 10px; }
.user-chip-top .name { line-height: 1.2; }

.notif-bell-wrap { position: relative; }
.notif-bell-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 44px;
  border-radius: 0;
  border: 1.5px solid #D6D1C4;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s;
}
.notif-bell-btn:hover { background: transparent; border-color: var(--ink); }
.notif-bell-btn .icon { width: 18px; height: 18px; flex-shrink: 0; }
.notif-bell-btn-icon { width: 44px; justify-content: center; padding: 0; border-radius: 0; position: relative; }
.notif-badge {
  background: var(--brand-orange);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  border-radius: 0;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.notif-bell-btn-icon .notif-badge { position: absolute; top: -8px; right: -8px; }
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--card-bg);
  border-radius: 0;
  border-top: 3px solid var(--ink);
  box-shadow: 0 24px 48px -16px rgba(21,27,33,.35);
  z-index: 20;
  padding: 8px 0;
}
.notif-dropdown-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 10px 16px; }
.notif-empty { padding: 16px; font-size: 14px; color: var(--text-3); }
.notif-item { display: block; padding: 12px 16px; border-top: 1px solid var(--border); text-decoration: none; }
.notif-item:hover { background: var(--card-soft); }
.notif-item-text { font-size: 14px; font-weight: 700; color: var(--text-1); }
.notif-item-detail { font-size: 12.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- encabezado de página ---------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 36px;
}
.page-title {
  font-size: clamp(44px, 6vw, 88px);
  line-height: .86;
  font-weight: 700;
  letter-spacing: -0.055em;
  color: var(--ink);
}
.page-subtitle { font-size: 16px; color: var(--text-2); margin-top: 16px; }
.page-subtitle:first-letter { text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip .name { font-size: 14px; font-weight: 700; line-height: 1.2; }
.user-chip .role { font-size: 12px; color: var(--text-3); }

/* ---------- indicadores (dashboard) ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 36px;
}
.kpi { border-top: 2px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.kpi-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.kpi-value { font-size: clamp(44px, 4.4vw, 64px); line-height: .85; font-weight: 700; letter-spacing: -0.05em; color: var(--ink); }
.kpi.alert { border-top-color: var(--brand-orange); }
.kpi.alert .kpi-label { color: var(--orange-text); }
.kpi.alert .kpi-value { color: var(--brand-orange); }

/* ---------- tarjetas de proyecto (proyectos.php) ---------- */

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.project-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--card-bg);
  padding: 24px;
  border-top: 4px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  transition: background .2s, border-color .2s;
}
.project-card:hover { background: #FAF9F5; border-top-color: var(--brand-orange); color: var(--ink); }
.project-card-client { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.project-card-name { font-size: 26px; line-height: 1.05; font-weight: 700; letter-spacing: -0.035em; }
.project-card-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.project-card-facts span { display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 700; }
.project-card-facts small { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.project-card-facts .muted { color: var(--orange-text); font-weight: 500; }

/* ---------- layout: portal de cliente ---------- */

.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 48px;
  flex-shrink: 0;
  background: var(--ink);
  color: var(--paper);
}
.portal-topbar a { color: #ACA89D; }
.portal-topbar a:hover { color: var(--brand-orange); }
.portal-brand { display: flex; align-items: center; gap: 16px; }
.portal-brand-badge { background: transparent; padding: 0; display: flex; align-items: center; }
.portal-brand-badge img { height: 32px; width: auto; display: block; }
.portal-brand-sub { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #ACA89D; padding-left: 16px; border-left: 1px solid rgba(245,243,238,.2); }

.portal-tabs { display: flex; align-items: center; gap: 28px; }
.nav-tab {
  font-size: 15px;
  font-weight: 500;
  color: #D9D5CB !important;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.nav-tab:hover { color: var(--paper) !important; }
.nav-tab.active { color: var(--paper) !important; font-weight: 700; border-bottom-color: var(--brand-orange); }

.portal-content {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 48px 48px 64px;
}
.portal-inner { width: 100%; max-width: 1120px; display: flex; flex-direction: column; gap: 24px; }
.portal-inner.narrow { max-width: 880px; }

/* ---------- componentes ---------- */

.card {
  background: var(--card-bg);
  border-radius: 0;
  box-shadow: none;
  border-top: 2px solid var(--ink);
}
a.card { color: inherit; transition: background .2s, border-color .2s; }
a.card:hover { background: #FAF9F5; border-top-color: var(--brand-orange); color: inherit; }

/* títulos de bloque dentro de tarjetas: más grandes y apretados */
.card > .heading,
.card > div > .heading:first-child { font-size: 22px !important; font-weight: 700 !important; letter-spacing: -0.03em; line-height: 1.1; }

.avatar {
  width: 36px; height: 36px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.dot { width: 8px; height: 8px; border-radius: 0; flex-shrink: 0; display: inline-block; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 0 10px; height: 26px;
  border-radius: 0; white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 15px; font-weight: 700; padding: 0 22px; height: 50px;
  border-radius: 0; cursor: pointer; border: 1.5px solid transparent; font-family: inherit;
  transition: background .2s, color .2s, border-color .2s;
  text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--paper) !important; }
.btn-primary:hover { background: var(--brand-orange); color: var(--ink) !important; }
.btn-outline { background: transparent; color: var(--ink) !important; border-color: #D6D1C4; }
.btn-outline:hover { background: transparent; border-color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }

/* botones de borrar/eliminar: se reconocen por su texto rojo en línea */
.btn[style*="oklch(42%"] { color: var(--danger) !important; border-color: #E7C4BD !important; }
.btn[style*="oklch(42%"]:hover { background: var(--danger) !important; border-color: var(--danger) !important; color: #FFFFFF !important; }
.btn-outline[style*="border-color:var(--brand-soft)"] { border-color: #D6D1C4 !important; }

.field-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); margin-bottom: 8px; }
.field, input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], input[type=url], select, textarea {
  width: 100%;
  background: #FFFFFF;
  border: 1.5px solid #D6D1C4;
  border-radius: 0;
  padding: 0 14px;
  height: 48px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-1);
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 110px; height: auto; padding: 12px 14px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(238,115,13,.35); }
input[type=file] { font-family: inherit; font-size: 14px; }
input[type=checkbox] { accent-color: var(--ink); width: 18px; height: 18px; }
.form-row { margin-bottom: 18px; }

.tabs { display: flex; gap: 0; border: 1.5px solid var(--ink); }
.tab {
  font-size: 14px; font-weight: 700; color: var(--ink) !important;
  padding: 0 16px; height: 38px; display: inline-flex; align-items: center;
  border-radius: 0; cursor: pointer;
  background: transparent; border: none; font-family: inherit;
  transition: background .2s;
}
.tab:hover { background: #E6E2D8; }
.tab.active { background: var(--ink); color: var(--paper) !important; }

.ptabs { display: flex; gap: 28px; padding: 0; border-bottom: 1px solid var(--border); }
.ptab {
  font-size: 15px; font-weight: 500; color: var(--text-3);
  padding: 14px 0; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px;
  background: none; border-top: none; border-left: none; border-right: none; font-family: inherit;
  text-decoration: none;
}
.ptab:hover { color: var(--ink); }
.ptab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--brand-orange); }

.progress-track { height: 6px; background: var(--border); border-radius: 0; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 0; }

.checkbox {
  width: 22px; height: 22px; border-radius: 0; border: 1.5px solid var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
  background: #FFFFFF; padding: 0;
}
.checkbox:hover { border-color: var(--brand-orange); }
.checkbox.done { background: var(--ink); border-color: var(--ink); }
.checkbox svg { width: 13px; height: 13px; }

.task-row, .file-row, .deadline-row, .history-row {
  display: flex; align-items: center; gap: 16px; padding: 18px 4px;
  border-bottom: 1px solid var(--border);
  transition: background .2s;
}
a.task-row:hover, .file-row:hover { background: #FAF9F5; }
.task-row:last-child, .file-row:last-child, .deadline-row:last-child, .history-row:last-child { border-bottom: none; }

.file-badge {
  width: 40px; height: 40px; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; flex-shrink: 0;
}

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; align-items: start; }
.kanban-col { background: transparent; border-top: 2px solid var(--ink); border-radius: 0; padding: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 6px; font-weight: 700; }
.task-card {
  background: var(--card-bg); border-radius: 0; padding: 16px;
  box-shadow: none; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px;
  transition: border-color .2s;
}
.task-card:hover { border-color: var(--ink); }

.step { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.step-dot { width: 34px; height: 34px; border-radius: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; font-weight: 700; font-size: 14px; }
.step-line { flex: 1; height: 2px; background: var(--border); margin-top: 17px; }
.step-line.done { background: var(--ink); }

.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 0; }
.calendar-grid + .calendar-grid { border-left: 1px solid var(--border); border-top: 2px solid var(--ink); }
.calendar-head { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--text-3); text-align: left; padding: 8px 10px; }
.calendar-grid + .calendar-grid > div:empty { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #FAF9F5; }
.day-cell {
  aspect-ratio: auto; min-height: 92px;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 10px;
  font-size: 20px; font-weight: 700; letter-spacing: -0.03em;
  border-radius: 0; cursor: pointer;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  color: var(--text-1); position: relative; text-decoration: none;
  transition: background .15s;
}
.day-cell:hover { background: #EFECE4; color: var(--text-1); }
.day-cell.today { background: var(--ink); color: var(--paper); }
.day-cell.selected { background: #FFFFFF; color: var(--ink); box-shadow: inset 0 0 0 3px var(--brand-orange); }
.day-dot { position: absolute; bottom: 10px; left: 10px; width: 22px; height: 4px; border-radius: 0; background: var(--brand-orange); }
.day-cell.today .day-dot { background: var(--brand-orange); }

.chip { font-size: 13px; font-weight: 700; color: var(--text-1); background: transparent; border: 1.5px solid #D6D1C4; padding: 0 16px; height: 38px; display: inline-flex; align-items: center; border-radius: 0; cursor: pointer; white-space: nowrap; font-family: inherit; transition: border-color .2s; }
.chip:hover { background: transparent; border-color: var(--ink); }

.chat-card { height: 620px; }

.msg-row { display: flex; }
.msg-row.client { justify-content: flex-end; }
.msg-bubble { max-width: 70%; padding: 12px 16px; border-radius: 0; line-height: 1.5; }
.msg-bubble.team { background: var(--card-soft); color: var(--text-1); border-left: 3px solid var(--brand-orange); }
.msg-bubble.client { background: var(--ink); color: var(--paper); }
.msg-time { font-size: 11px; margin-top: 6px; opacity: 0.7; letter-spacing: .04em; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); font-size: 15px; }

.flash { padding: 14px 18px; border-radius: 0; font-size: 14px; font-weight: 600; margin-bottom: 18px; border-left: 4px solid currentColor; }
.flash-error { background: var(--orange-soft); color: var(--orange-text); }
.flash-ok { background: var(--green-soft); color: #245F33; }

/* ---------- login (equipo y portal) ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--ink);
  background-image: radial-gradient(circle at 88% 88%, #EE730D 0 220px, transparent 221px);
}
.login-card { width: 100%; max-width: 440px; padding: 44px 40px; background: var(--card-bg); border-radius: 0; box-shadow: none; border-top: 4px solid var(--brand-orange); }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; text-align: left; margin-bottom: 32px; }
.login-brand-badge { background: var(--ink); border-radius: 0; padding: 16px 22px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.login-brand-badge img { height: 32px; width: auto; display: block; }
.login-card .heading { font-size: 32px !important; letter-spacing: -0.04em; text-align: left !important; }
.login-card .heading + div { text-align: left !important; }

/* ---------- menú móvil ---------- */

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 0;
  border: 1.5px solid var(--ink);
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
}
.mobile-menu-btn .icon { width: 20px; height: 20px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(21,27,33,.55);
  z-index: 40;
}
.sidebar-overlay.visible { display: block; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .main-content { padding: 24px 28px 48px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .main-content { padding: 16px 16px 40px; }

  .mobile-menu-btn { display: flex; }
  .topbar-date { display: none; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 272px;
    max-width: 84vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }

  .admin-topbar { margin-bottom: 24px; }

  .kanban { grid-template-columns: 1fr; }
  .portal-topbar { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 20px; }
  .portal-tabs { gap: 20px; overflow-x: auto; padding-bottom: 2px; }
  .nav-tab { font-size: 14px; white-space: nowrap; }
  .portal-content { padding: 24px 16px 40px; }

  .day-cell { min-height: 56px; font-size: 16px; padding: 6px; }
  .day-dot { width: 14px; bottom: 6px; left: 6px; }
}

@media (max-width: 680px) {
  .responsive-grid { grid-template-columns: 1fr !important; }
  .responsive-flex-row { flex-wrap: wrap; row-gap: 14px; }
  .responsive-flex-row > * { min-width: 45%; }

  .task-row, .file-row, .deadline-row, .history-row { flex-wrap: wrap; row-gap: 8px; }

  .page-header { flex-wrap: wrap; row-gap: 16px; padding-bottom: 24px; }
  .page-title { font-size: 48px; }

  .kpi-grid { gap: 16px; }
  .kpi-value { font-size: 44px; }
  .project-card-facts { grid-template-columns: 1fr 1fr; }

  .tabs, .ptabs {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .ptabs { gap: 20px; }
  .tab, .ptab { white-space: nowrap; }

  .notif-dropdown { width: min(320px, calc(100vw - 32px)); right: -8px; }

  .login-card { padding: 32px 24px; }
  .login-shell { background-image: none; }

  .chat-card { height: 78vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* botones cuadrados de ícono (flechas del calendario, etc.) */
.icon-square { width: 44px; height: 44px; border: 1.5px solid #D6D1C4; display: flex; align-items: center; justify-content: center; color: var(--ink); transition: border-color .2s; }
.icon-square:hover { border-color: var(--ink); color: var(--ink); }
.icon-square svg { width: 16px !important; height: 16px !important; }
.project-card-facts em { font-style: normal; }
a.kpi:hover .kpi-value { color: var(--ink); }
.notif-badge[hidden] { display: none; }
.sidebar-user-links { flex-wrap: wrap; row-gap: 2px; }
.sidebar-user-links a { white-space: nowrap; font-size: 12.5px; }
.heading[style*="capitalize"] { text-transform: none !important; }
.heading[style*="capitalize"]::first-letter { text-transform: uppercase; }

/* =========================================================================
   Portfolio (portfolio.php / portfolio_editar.php)
   ========================================================================= */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.portfolio-card { display: flex; flex-direction: column; background: var(--card-bg); color: var(--ink); border-top: 4px solid var(--ink); text-decoration: none; transition: border-color .2s, background .2s; }
.portfolio-card:hover { border-top-color: var(--brand-orange); background: #FAF9F5; color: var(--ink); }
.portfolio-card-media { position: relative; aspect-ratio: 4 / 3; background: #E6E2D8; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.portfolio-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.portfolio-card:hover .portfolio-card-media img { transform: scale(1.04); }
.portfolio-card-noimg { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.portfolio-card-state { position: absolute; top: 12px; left: 12px; }
.portfolio-card-state.is-pub { background: var(--ink); color: var(--paper); }
.portfolio-card-state.is-draft { background: #FFFFFF; color: var(--text-2); }
.portfolio-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.portfolio-card-client { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.portfolio-card-title { font-size: 22px; line-height: 1.08; font-weight: 700; letter-spacing: -0.03em; }
.portfolio-star { color: var(--brand-orange); }
.portfolio-card-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
.portfolio-card-meta em { font-style: normal; color: var(--orange-text); }

.pf-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.pf-toggle { display: flex; align-items: center; gap: 12px; border: 1.5px solid #D6D1C4; padding: 14px 16px; cursor: pointer; transition: border-color .2s, background .2s; }
.pf-toggle:hover { border-color: var(--ink); }
.pf-toggle:has(input:checked) { border-color: var(--ink); background: #FAF9F5; }
.pf-toggle input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; }
.pf-toggle span { display: flex; flex-direction: column; gap: 2px; }
.pf-toggle strong { font-size: 15px; }
.pf-toggle small { font-size: 12.5px; color: var(--text-3); }

.pf-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-cat { cursor: pointer; }
.pf-cat input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pf-cat span { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border: 1.5px solid #D6D1C4; font-size: 14px; font-weight: 700; transition: background .2s, color .2s, border-color .2s; }
.pf-cat:hover span { border-color: var(--ink); }
.pf-cat input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pf-cat input:focus-visible + span { outline: 3px solid var(--brand-orange); outline-offset: 2px; }

.pf-count { float: right; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.pf-count.over { color: var(--danger); font-weight: 700; }

.pf-seo { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 6px; }
.pf-seo summary { cursor: pointer; font-size: 15px; font-weight: 700; }
.pf-slug { display: flex; align-items: center; border: 1.5px solid #D6D1C4; background: #FFFFFF; }
.pf-slug span { padding: 0 10px; font-size: 14px; color: var(--text-3); white-space: nowrap; }
.pf-slug input { border: 0 !important; padding-left: 0; box-shadow: none !important; }
.pf-slug:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(238,115,13,.35); }
.pf-serp { background: #FFFFFF; border: 1px solid var(--border); padding: 14px 16px; font-family: Arial, sans-serif; }
.pf-serp-url { font-size: 12px; color: #4D5156; }
.pf-serp-title { font-size: 19px; color: #1A0DAB; margin: 4px 0 2px; line-height: 1.3; }
.pf-serp-desc { font-size: 13.5px; color: #4D5156; line-height: 1.5; }

.pf-cover { aspect-ratio: 4 / 3; background: #E6E2D8; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pf-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-cover span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

.pf-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 96px; border: 2px dashed #D6D1C4; background: #FAF9F5; text-align: center; padding: 16px; cursor: pointer; transition: border-color .2s, background .2s; }
.pf-drop:hover, .pf-drop:focus-within { border-color: var(--ink); background: #FFFFFF; }
.pf-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.pf-drop span { font-size: 15px; font-weight: 700; }
.pf-drop small { font-size: 12.5px; color: var(--text-3); }

.pf-gallery { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--border); }
.pf-img { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.pf-img img { width: 112px; height: 84px; object-fit: cover; display: block; background: #E6E2D8; }
.pf-img-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pf-img-actions .btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.pf-img-actions .btn[disabled] { opacity: .35; cursor: default; }

.pf-checks { list-style: none; margin: 0; padding: 0; }
.pf-checks li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14.5px; }
.pf-checks li span { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid #D6D1C4; font-size: 13px; font-weight: 700; }
.pf-checks li.done span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pf-checks li em { font-style: normal; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--orange-text); margin-left: auto; }
.pf-danger { border-top-color: var(--danger) !important; }
.pf-danger summary { cursor: pointer; font-weight: 700; color: var(--danger); }

@media (max-width: 680px) {
  .pf-toggles { grid-template-columns: 1fr; }
  .pf-img { grid-template-columns: 84px minmax(0, 1fr); }
  .pf-img img { width: 84px; height: 63px; }
}

/* Campanilla: las notificaciones quedan hasta que las borrás (29 sep 2026) */
.notif-dropdown { width: 380px; max-height: min(520px, 75vh); padding: 0; }
.notif-dropdown-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card-bg); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); }
.notif-dropdown-title span { font-weight: 500; letter-spacing: 0; }
.notif-clear { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--orange-text); cursor: pointer; padding: 8px 10px; }
.notif-clear:hover { color: var(--danger); text-decoration: underline; }
.notif-clear[hidden] { display: none; }
.notif-item { position: relative; display: flex; align-items: flex-start; padding: 0; border-top: 0; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; transition: opacity .2s, background .2s; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.is-unread { border-left-color: var(--brand-orange); background: #FFF8F1; }
.notif-item.is-leaving { opacity: .3; pointer-events: none; }
.notif-item:hover { background: var(--card-soft); }
.notif-item-link { flex: 1; min-width: 0; display: block; padding: 12px 8px 12px 14px; text-decoration: none; color: inherit; }
.notif-item-link:hover { color: inherit; }
.notif-item-detail { white-space: normal; overflow: visible; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; margin-top: 3px; }
.notif-item-ago { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.notif-item.is-unread .notif-item-ago { color: var(--orange-text); font-weight: 700; }
.notif-del { flex-shrink: 0; width: 34px; height: 34px; margin: 8px 8px 0 0; border: 1px solid transparent; background: transparent; color: var(--text-3); font-size: 13px; cursor: pointer; }
.notif-del:hover, .notif-del:focus-visible { border-color: var(--ink); color: var(--ink); background: #FFFFFF; }
@media (max-width: 680px) { .notif-dropdown { width: min(380px, calc(100vw - 24px)); } }

/* Clientes: acceso al portal con usuario y contraseña (2 oct 2026) */
.cred-card { padding: 24px 26px; margin-bottom: 18px; border-top: 4px solid var(--brand-orange) !important; display: flex; flex-direction: column; gap: 16px; }
.cred-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cred-kicker { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.cred-note { margin-top: 4px; font-size: 13px; color: var(--text-3); }
.cred-grid { display: grid; grid-template-columns: 1.4fr 1.2fr 1fr; gap: 0; border-top: 1px solid var(--border); }
.cred-grid > div { padding: 12px 16px 0 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cred-grid > div + div { padding-left: 16px; border-left: 1px solid var(--border); }
.cred-grid span { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.cred-grid strong { font-size: 15px; overflow-wrap: anywhere; }
.cred-pw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px !important; color: var(--orange-text); }
#cred-msg { min-height: 0; font-size: 13.5px; color: var(--text-2); background: #FAF9F5; }
.cred-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cli-access { position: relative; }
.cli-access summary { list-style: none; cursor: pointer; white-space: nowrap; }
.cli-access summary::-webkit-details-marker { display: none; }
.cli-access[open] summary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cli-access-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 260px; background: #FFFFFF; padding: 16px; box-shadow: 0 20px 40px -14px rgba(21,27,33,.45); display: flex; flex-direction: column; gap: 10px; }
.cli-access-pop input[type=text] { height: 40px; }
.cli-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
@media (max-width: 680px) {
  .cred-grid { grid-template-columns: 1fr; }
  .cred-grid > div + div { padding-left: 0; border-left: 0; }
  .cli-access-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; }
}

/* Número de leads sin abrir en el menú */
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-orange); color: #1C1206; font-size: 12px; font-weight: 700; }
.nav-item.active .nav-count { background: var(--ink); color: var(--paper); }

/* ---------- ventanas emergentes (formularios) ----------
   <button data-modal-open="m-x">  +  <dialog class="modal" id="m-x">
   data-hash="nuevo" la abre si la URL termina en #nuevo;
   data-autoopen la abre al cargar (ej: volvió con un error). */
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-top: 4px solid var(--ink); background: #FFFFFF; color: var(--ink); box-sizing: border-box; overflow: auto; overscroll-behavior: contain; }
.modal.modal-wide { width: min(760px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(21,27,33,.55); }
.modal[open] { animation: modal-in .18s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-body { padding: 26px 28px 28px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 26px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }
.modal-close { flex-shrink: 0; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid #D6D1C4; background: #FFFFFF; color: var(--ink); font: inherit; font-size: 16px; cursor: pointer; }
.modal-close:hover { border-color: var(--ink); }
.modal-sub { font-size: 14px; color: var(--text-2); line-height: 1.5; margin: 6px 0 20px; }
.modal-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.page-header:has(.page-actions) { flex-wrap: wrap; row-gap: 20px; }
.page-actions { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.page-actions .btn { white-space: nowrap; }
body.modal-lock { overflow: hidden; }
@media (max-width: 680px) {
  .modal, .modal.modal-wide { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-top-width: 4px; }
  .modal[open] { animation-name: modal-up; }
  @keyframes modal-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .modal-body { padding: 22px 18px 26px; }
  .modal-head h2 { font-size: 23px; }
  .modal-grid-2 { grid-template-columns: 1fr; }
  .modal-actions .btn { flex: 1; }
  .page-actions { flex-direction: column-reverse; align-items: stretch; width: 100%; }
  .page-actions .tabs { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }

/* Proyecto: datos en solo lectura y barra de cada pestaña */
.pj-facts { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.pj-facts .field-label { display: block; margin-bottom: 4px; color: var(--text-3); }
.pj-facts p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.pj-facts em { font-style: normal; color: var(--text-3); }
.pj-tabbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }

/* Menú lateral fijo en compu: queda siempre a la vista mientras scrolleás */
@media (min-width: 901px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh; z-index: 40; }
  .main-content { margin-left: 264px; }
}

/* ---------- Planner de contenido: alta rápida en el día y ficha ampliada ---------- */
.cp-day-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cp-add-btn {
  width: 20px; height: 20px; border: 1.5px solid var(--ink); background: #FFFFFF; color: var(--ink);
  font-size: 14px; line-height: 1; font-weight: 700; cursor: pointer; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-family: inherit;
  opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.cp-day:hover .cp-add-btn, .cp-add-btn:focus-visible { opacity: 1; }
.cp-add-btn:hover { background: var(--ink); color: var(--paper); }
@media (hover: none) { .cp-add-btn { opacity: 1; } }

.cp-chip {
  display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font-family: inherit;
  color: #fff; padding: 4px 6px; margin-bottom: 3px; font-size: 10px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-chip:hover { filter: brightness(1.08); }

.cp-card-trigger {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0;
  cursor: pointer; font-family: inherit; color: inherit;
}

.cp-tag {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 8px; border: 1.5px solid #D6D1C4; color: var(--text-2);
  margin: 0 6px 6px 0;
}

.cp-comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.cp-comment:last-child { border-bottom: 0; }
.cp-comment-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cp-comment-meta { font-size: 11px; color: var(--text-3); }
.cp-comment-body { font-size: 13px; line-height: 1.5; color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-comment-del { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 2px 4px; font-family: inherit; }
.cp-comment-del:hover { color: var(--danger); }
