/* ============================================
   ABRIL DASHBOARD · Vector89
   Dark Editorial Aesthetic
   ============================================ */

/* --- Variables --- */
:root {
  --bg:          #0d0d12;
  --sidebar:     #111118;
  --card:        #18181f;
  --accent:      #c47d8a;
  --accent-dim:  rgba(196,125,138,0.15);
  --accent-hover:rgba(196,125,138,0.25);
  --text:        #e2e2e8;
  --muted:       #8888aa;
  --border:      rgba(255,255,255,0.07);
  --success:     #5cb88a;
  --amber:       #d4945a;
  --blue:        #5a9fd4;
  --red:         #c45a5a;
  --font:        'DM Sans', sans-serif;
  --font-title:  'Cormorant Garamond', serif;
  --radius:      10px;
  --radius-sm:   6px;
  --transition:  200ms ease;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN
   ============================================ */

#login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.login-brand {
  text-align: center;
}

.login-logo {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 34px;
  color: var(--accent);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.login-agency {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
}

.login-name {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 36px;
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.1;
  text-align: center;
}

.login-role {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  opacity: 0.85;
  text-align: center;
}

.login-clock {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.lc-time {
  font-size: 30px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.lc-date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.lc-tz {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
  letter-spacing: 0.3px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Password eye toggle */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.pw-wrap input[type="password"],
.pw-wrap input[type="text"] {
  width: 100%;
  padding: 12px 44px 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.pw-wrap input:focus { border-color: var(--accent); }
.pw-wrap input::placeholder { color: var(--muted); }

.pw-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  opacity: 0.55;
  transition: opacity var(--transition);
}
.pw-toggle:hover { opacity: 1; }

.login-form input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.login-form input[type="password"]:focus {
  border-color: var(--accent);
}

.login-form input[type="password"]::placeholder {
  color: var(--muted);
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.btn-login:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-login:active {
  transform: translateY(0);
  opacity: 1;
}

.login-err {
  font-size: 12px;
  color: var(--red);
  text-align: center;
  min-height: 16px;
}

/* ============================================
   APP LAYOUT
   ============================================ */

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sb-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-logo-text {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--accent-dim);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.nav-icon {
  font-size: 16px;
  line-height: 1;
}

.nav-label {
  line-height: 1;
}

.sb-footer {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sb-clock {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sb-time-main {
  font-size: 22px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.sb-date-line {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.75;
  letter-spacing: 0.2px;
  line-height: 1.4;
}

.sb-user {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.sb-team-clocks {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sb-team-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1.3;
}

.sb-team-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  min-width: 46px;
}

.sb-team-city {
  font-size: 10px;
  color: var(--muted);
  flex: 1;
  opacity: 0.65;
}

.sb-team-time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* --- Pages --- */
.page {
  display: none;
  flex-direction: column;
  padding: 28px 32px;
  min-height: 100%;
}

.page.active {
  display: flex;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.card-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

/* ============================================
   CLIENT TABS
   ============================================ */

.client-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tab-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ============================================
   CLIENT PANELS
   ============================================ */

.client-panel {
  display: none;
}

.client-panel.active {
  display: block;
}

/* ============================================
   VIDEO TABLE
   ============================================ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: 13.5px;
}

thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255,255,255,0.025);
}

tbody td {
  padding: 12px 14px;
  color: var(--text);
  vertical-align: middle;
}

td:first-child {
  color: var(--muted);
  font-size: 12px;
  width: 36px;
}

td.td-titulo {
  max-width: 340px;
}

.titulo-display {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.titulo-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.btn-edit-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--transition);
  opacity: 0;
}

tbody tr:hover .btn-edit-icon {
  opacity: 1;
}

.btn-edit-icon:hover {
  color: var(--accent);
}

.titulo-edit-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.titulo-edit-form input {
  flex: 1;
  padding: 5px 9px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-grabado {
  background: rgba(90,159,212,0.18);
  color: var(--blue);
  border: 1px solid rgba(90,159,212,0.3);
}

.badge-edicion {
  /* T-060 (ADR-0017): "En edición" → morado (estándar Mavys). */
  background: rgba(108,52,131,0.18);
  color: #b97cc7;
  border: 1px solid rgba(108,52,131,0.35);
}

.badge-publicado {
  background: rgba(92,184,138,0.18);
  color: var(--success);
  border: 1px solid rgba(92,184,138,0.3);
}

.badge-propuesto {
  background: rgba(136,136,170,0.15);
  color: var(--muted);
  border: 1px solid rgba(136,136,170,0.25);
}

/* --- Action Buttons --- */
.actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.btn-sm {
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn-sm:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-amber {
  background: var(--amber);
  color: #fff;
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

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

.btn-open {
  background: rgba(196,125,138,0.12);
  color: var(--accent);
  border: 1px solid rgba(196,125,138,0.25);
}

.btn-danger {
  background: rgba(196,90,90,0.15);
  color: var(--red);
  border: 1px solid rgba(196,90,90,0.25);
}

/* ============================================
   SYNC STATUS
   ============================================ */

.sync-status {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  min-height: 16px;
  transition: color var(--transition);
}

.sync-status.saving {
  color: var(--amber);
}

.sync-status.saved {
  color: var(--success);
}

.sync-status.error {
  color: var(--red);
}

/* ============================================
   LDT SECTION
   ============================================ */

.ldt-links-card {
  margin-bottom: 16px;
}

.ldt-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ldt-link-row:last-child {
  margin-bottom: 0;
}

.ldt-link-label {
  width: 50px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  flex-shrink: 0;
}

.ldt-link-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.ldt-link-input:focus {
  border-color: var(--accent);
}

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

.ldt-videos-card {
  margin-bottom: 16px;
}

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

.ldt-videos-header .card-subtitle {
  margin-bottom: 0;
}

.btn-add {
  padding: 6px 14px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(196,125,138,0.3);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

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

.ldt-add-form {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ldt-add-form input {
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.ldt-add-form input:focus {
  border-color: var(--accent);
}

.ldt-add-form input::placeholder {
  color: var(--muted);
}

.ldt-form-actions {
  display: flex;
  gap: 8px;
}

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

.ldt-video-item:last-child {
  border-bottom: none;
}

.ldt-video-title {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  min-width: 120px;
}

.ldt-video-link a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
}

.ldt-video-link a:hover {
  opacity: 1;
  text-decoration: underline;
}

.ldt-no-videos {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

/* ============================================
   SUBCAPTIONS
   ============================================ */

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

.subcap-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.subcap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.subcap-client-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.subcap-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: visible;
  user-select: text;
}

.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-copy.copied {
  background: rgba(92,184,138,0.15);
  color: var(--success);
  border-color: rgba(92,184,138,0.3);
}

/* ============================================
   CALENDARIO
   ============================================ */

.calendario-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 32px;
  text-align: center;
  max-width: 480px;
}

.cal-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.btn-calendar {
  display: inline-block;
  padding: 14px 36px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: opacity var(--transition), transform var(--transition);
}

.btn-calendar:hover {
  opacity: 0.88;
  transform: translateY(-2px);
}

/* ============================================
   REGISTRO
   ============================================ */

.registro-card {
  opacity: 0.45;
  cursor: not-allowed;
  max-width: 500px;
}

.registro-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ============================================
   MOBILE TOPBAR + HAMBURGER DRAWER
   ============================================ */

.mobile-topbar {
  display: none;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  z-index: 599;
  opacity: 0;
  transition: opacity 250ms ease;
}

.mobile-overlay.visible {
  opacity: 1;
}

/* ============================================
   MOBILE / RESPONSIVE
   ============================================ */

@media (max-width: 768px) {

  /* Topbar FIXED — no se oculta al scrollear */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(54px + env(safe-area-inset-top));
    min-height: calc(54px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    flex-shrink: 0;
    background: var(--sidebar);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding-left: 16px;
    padding-right: 16px;
    z-index: 500;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  }

  .mobile-logo {
    font-family: var(--font-title);
    font-style: italic;
    font-size: 22px;
    color: var(--accent);
    letter-spacing: -0.3px;
  }

  .mobile-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 6px;
    transition: background var(--transition);
  }

  .mobile-hamburger:hover {
    background: rgba(255,255,255,0.08);
  }

  .mobile-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,0.65);
    border-radius: 2px;
  }

  .mobile-overlay {
    display: block;
    pointer-events: none;
  }

  .mobile-overlay.visible {
    pointer-events: auto;
  }

  #app {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding-top: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    min-width: unset;
    height: 100vh;
    z-index: 601;
    border-right: 1px solid rgba(255,255,255,0.07);
    box-shadow: 4px 0 24px rgba(0,0,0,0.28);
    transition: left 260ms cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .sb-nav {
    flex-direction: column;
    padding: 12px 10px;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    font-size: 13.5px;
    padding: 10px 12px;
  }

  .nav-icon {
    font-size: 16px;
  }

  .main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    min-height: 0;
    min-width: 0;
    padding-top: calc(54px + env(safe-area-inset-top));
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 60px;
  }
  .main-content.no-bottom-padding {
    padding-bottom: 0;
  }

  .page {
    padding: 20px 16px;
  }

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

  /* Video tables — título truncado con ... para evitar empalme */
  td.td-titulo {
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-title {
    font-size: 17px;
  }

  .ldt-link-row {
    flex-wrap: wrap;
  }

  .ldt-link-label {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .client-tabs {
    gap: 6px;
  }

  .tab-btn {
    padding: 6px 13px;
    font-size: 12px;
  }

  .page {
    padding: 16px 12px;
  }

  thead th {
    padding: 10px 10px;
  }

  tbody td {
    padding: 10px 10px;
  }
}

/* ============================================
   FILTER BAR
   ============================================ */

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

.filter-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
}

.filter-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}

.filter-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}

.filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   GUION MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}

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

.guion-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  padding: 12px 14px;
  resize: vertical;
  min-height: 220px;
  line-height: 1.6;
  transition: border-color var(--transition);
}

.guion-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-undo {
  opacity: 0.55;
  font-size: 13px;
  padding: 3px 8px;
  transition: opacity var(--transition), color var(--transition);
}

.btn-undo:hover {
  opacity: 1;
  color: var(--amber);
}

.filter-sep {
  color: var(--border);
  font-size: 16px;
  padding: 0 2px;
}

.filter-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  padding: 5px 10px;
  cursor: pointer;
  appearance: auto;
}

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

.filter-select option {
  background: #1a1a24;
  color: var(--text);
}

.td-sesion {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.titulo-clickable {
  cursor: pointer;
  transition: color var(--transition);
}

.titulo-clickable:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
}

.modal-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.edit-titulo-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  padding: 9px 12px;
  transition: border-color var(--transition);
}

.edit-titulo-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ============================================
   PANEL TOP BAR + QUICK LINKS
   ============================================ */

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  margin-bottom: 4px;
}

.panel-quicklinks {
  display: flex;
  gap: 8px;
}

.btn-quicklink {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(196,125,138,0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
  font-family: var(--font);
}

.btn-quicklink:hover {
  background: var(--accent-hover);
  border-color: rgba(196,125,138,0.5);
}

/* ============================================
   MATERIAL LINKS
   ============================================ */

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding-bottom: 32px;
}

.mat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mat-client-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.mat-edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}

.mat-card:hover .mat-edit-btn {
  opacity: 1;
}

.mat-edit-btn:hover {
  color: var(--accent);
}

.mat-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mat-link-btn {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(196,125,138,0.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-family: var(--font);
}

.mat-link-btn:hover:not(.disabled) {
  background: var(--accent-hover);
  border-color: rgba(196,125,138,0.4);
}

.mat-link-btn.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.mat-no-links {
  font-size: 12px;
  color: var(--muted);
}

/* Edit mode */
.mat-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mat-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mat-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  width: 46px;
  flex-shrink: 0;
}

.mat-link-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  min-width: 0;
  font-family: var(--font);
  transition: border-color var(--transition);
}

.mat-link-input:focus {
  outline: none;
  border-color: var(--accent);
}

.mat-btn-add {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: color var(--transition), border-color var(--transition);
}

.mat-btn-add:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.mat-edit-actions {
  display: flex;
  gap: 8px;
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

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

/* ============================================
   INICIO PAGE
   ============================================ */

.inicio-hero {
  margin-bottom: 28px;
}

.inicio-greeting {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 48px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.inicio-date {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.inicio-summary {
  font-size: 16px;
  color: var(--text);
  font-weight: 400;
  line-height: 1.5;
}

.inicio-summary strong {
  color: var(--accent);
  font-weight: 600;
}

/* Stats row */
.inicio-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.istat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.istat-pending { border-left: 3px solid var(--amber); }
.istat-done    { border-left: 3px solid var(--success); }
.istat-total   { border-left: 3px solid var(--blue); }

.istat-num {
  font-size: 36px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.istat-pending .istat-num { color: var(--amber); }
.istat-done    .istat-num { color: var(--success); }
.istat-total   .istat-num { color: var(--blue); }

.istat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Client breakdown */
.inicio-clients {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.iclient-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.iclient-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.iclient-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.iclient-pct {
  font-size: 18px;
  font-weight: 300;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.iclient-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}

.iclient-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}

.iclient-detail {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.iclient-ed {
  font-size: 12px;
  color: var(--amber);
}

.iclient-pub {
  font-size: 12px;
  color: var(--success);
}

@media (max-width: 600px) {
  .inicio-stats {
    grid-template-columns: 1fr;
  }
  .inicio-greeting {
    font-size: 36px;
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.18);
}

/* Calendario — sin padding lateral para que use todo el ancho */
#pg-calendario.page { padding-left: 0 !important; padding-right: 0 !important; }
#pg-calendario .page-header { padding: 0 28px; }
#pg-calendario #cal-abril { padding-left: 8px; padding-right: 8px; }
