/* AGENTFORGE-IA — Implantación */
.dep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.dep-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; transition: border-color 140ms, transform 140ms, box-shadow 140ms; }
.dep-card:hover { border-color: var(--line-3); }
.dep-card.active { border-color: color-mix(in oklab, var(--brand) 50%, var(--line-2)); box-shadow: 0 0 0 1px var(--brand-soft) inset, var(--shadow-2); }
.dep-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.dep-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; border: 1px solid; flex-shrink: 0; }
.dep-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.dep-tag { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tier-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; border: 1px solid; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.dep-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 0 0 12px; }
.dep-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.dep-stats > div { display: flex; flex-direction: column; gap: 2px; }
.dep-stats .lbl { font-family: var(--mono); font-size: 9.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.08em; }
.dep-stats .val { font-size: 12.5px; color: var(--ink); font-weight: 500; }
.dep-expand { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; padding: 14px 0 4px; margin-top: 12px; border-top: 1px dashed var(--line); }
.dep-h { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.dep-expand ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.dep-expand ul li { font-size: 11.5px; color: var(--ink-2); display: flex; gap: 5px; line-height: 1.45; }
.dep-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

.dep-svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.dep-svc { display: flex; gap: 10px; padding: 12px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; }
.dep-svc-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.dep-svc-name { font-size: 13px; font-weight: 600; }
.dep-svc-desc { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.dep-svc-dur { font-size: 10.5px; color: var(--ink-4); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }

/* Agendado / Citas */
.cal-layout { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.cal-side { display: flex; flex-direction: column; gap: 14px; }
.cal-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.cal-card h3 { margin: 0 0 10px; font-size: 12.5px; font-weight: 600; }
.cal-card .h-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-card .h-row .ttl { font-size: 12.5px; font-weight: 600; }

.appt-type { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; color: var(--ink); text-align: left; border: 1px solid transparent; transition: background 140ms, border-color 140ms, box-shadow 140ms; }
.appt-type:hover { background: color-mix(in oklab, var(--brand) 7%, var(--bg-2)); border-color: var(--line-2); }
.appt-type.active { background: color-mix(in oklab, var(--brand) 12%, var(--bg-2)); border-color: color-mix(in oklab, var(--brand) 52%, var(--line-2)); box-shadow: 0 0 0 1px color-mix(in oklab, var(--brand) 28%, transparent) inset; }
.appt-type .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.appt-type .nm { font-size: 12.5px; flex: 1; }
.appt-type .dur { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.cal-conn { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cal-conn:last-child { border-bottom: 0; }
.cal-conn-logo { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 12px; flex-shrink: 0; }
.cal-conn-name { font-size: 12.5px; font-weight: 500; }
.cal-conn-sub { font-size: 10.5px; color: var(--ink-3); }
.dot-status { width: 7px; height: 7px; border-radius: 50%; }

.cal-main { background: linear-gradient(180deg, color-mix(in oklab, #1f2937 38%, var(--bg-1)), color-mix(in oklab, #111827 82%, var(--bg-1))); border: 1px solid color-mix(in oklab, #64748b 26%, var(--line)); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px rgba(148,163,184,0.04) inset; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid color-mix(in oklab, #64748b 22%, var(--line)); background: rgba(20, 25, 35, 0.72); }
.cal-toolbar .nav { display: flex; gap: 4px; }
.cal-toolbar .nav button { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--ink-3); }
.cal-toolbar .nav button:hover { background: var(--bg-2); color: var(--ink); }
.cal-toolbar h2 { margin: 0; font-size: 14px; font-weight: 600; }
.cal-views { display: flex; gap: 4px; padding: 3px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; margin-left: auto; }
.cal-views button { padding: 4px 10px; border-radius: 6px; font-size: 11.5px; color: var(--ink-3); }
.cal-views button.active { background: var(--bg-1); color: var(--ink); }

.cal-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); height: 560px; }
.cal-head-cell { padding: 8px 6px; border-right: 1px solid color-mix(in oklab, #64748b 24%, var(--line)); border-bottom: 1px solid color-mix(in oklab, #64748b 24%, var(--line)); font-size: 11px; color: color-mix(in oklab, var(--ink-2) 82%, #93c5fd); text-align: center; background: rgba(24, 31, 44, 0.9); }
.cal-head-cell.today { color: var(--brand); }
.cal-head-cell .d { font-size: 18px; font-weight: 600; color: var(--ink); display: block; line-height: 1.1; }
.cal-head-cell.today .d { color: var(--brand); }
.cal-time-col { background: rgba(22, 29, 42, 0.88); border-right: 1px solid color-mix(in oklab, #64748b 22%, var(--line)); }
.cal-time-cell { height: 56px; padding: 4px 6px; font-family: var(--mono); font-size: 10px; color: color-mix(in oklab, var(--ink-3) 78%, #93c5fd); text-align: right; border-bottom: 1px solid color-mix(in oklab, #64748b 16%, var(--line)); }
.cal-day-col { position: relative; border-right: 1px solid color-mix(in oklab, #64748b 20%, var(--line)); background: rgba(18, 24, 34, 0.58); }
.cal-day-col:last-child { border-right: 0; }
.cal-hour-line { height: 56px; border-bottom: 1px solid color-mix(in oklab, #64748b 15%, var(--line)); }
.cal-hour-line.half::after { content: ""; display: block; height: 28px; border-bottom: 1px dashed color-mix(in oklab, #64748b 18%, var(--line)); }
.cal-event { position: absolute; left: 4px; right: 4px; border-radius: 6px; padding: 5px 7px; font-size: 11px; line-height: 1.3; cursor: pointer; overflow: hidden; border-left: 3px solid; box-shadow: var(--shadow-1); }
.cal-event .nm { font-weight: 600; }
.cal-event .sub { font-size: 10px; opacity: 0.8; margin-top: 1px; display: flex; align-items: center; gap: 4px; }
.cal-event .by { font-family: var(--mono); font-size: 9.5px; opacity: 0.7; margin-top: 2px; }
.cal-now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--brand); z-index: 3; }
.cal-now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; background: var(--brand); border-radius: 50%; }
.cal-empty { padding: 10px 14px; color: var(--ink-3); font-size: 12px; border-top: 1px solid var(--line); }
.cal-month-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; padding: 12px; }
.cal-month-head { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 4px 4px; }
.cal-month-empty,
.cal-month-day { min-height: 104px; border: 1px solid color-mix(in oklab, #64748b 24%, var(--line)); border-radius: 10px; background: linear-gradient(180deg, rgba(31, 41, 55, 0.72), rgba(17, 24, 39, 0.76)); padding: 8px; }
.cal-month-day:hover { border-color: color-mix(in oklab, var(--brand) 35%, var(--line-2)); background: linear-gradient(180deg, rgba(38, 50, 68, 0.84), rgba(22, 30, 44, 0.86)); }
.cal-month-num { font-size: 11px; color: color-mix(in oklab, var(--ink-2) 75%, #93c5fd); margin-bottom: 7px; }
.cal-month-event { font-size: 11.5px; line-height: 1.25; padding: 4px 6px; border-radius: 7px; margin-bottom: 5px; cursor: pointer; background: color-mix(in oklab, var(--bg-3) 72%, transparent); border-left: 3px solid var(--brand); }
.cal-month-event:hover { background: var(--bg-3); }
.cal-month-more { font-size: 11px; color: var(--ink-3); }
.cal-form { display: grid; gap: 10px; }
.cal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cal-sync-note { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); color: var(--ink-3); font-size: 12px; line-height: 1.45; padding: 10px 12px; }

.af-date-picker-wrap { position: relative; min-width: 0; }
.af-date-input { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; color: var(--ink); }
.af-date-input.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.af-date-popover { position: absolute; left: 0; top: calc(100% + 8px); width: 336px; max-width: min(336px, 88vw); padding: 12px; border-radius: 12px; border: 1px solid color-mix(in oklab, #9ca3af 28%, var(--line-2)); background: linear-gradient(160deg, rgba(45,45,42,0.98), rgba(25,27,31,0.98)); box-shadow: 0 24px 70px rgba(0,0,0,0.62), 0 0 0 1px rgba(255,255,255,0.035) inset; z-index: 120; }
.af-date-title { width: 100%; height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: var(--ink); background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; font-size: 13px; text-align: left; }
.af-date-title:hover { background: rgba(255,255,255,0.07); }
.af-date-monthbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 6px 8px; }
.af-date-monthbar strong { font-size: 13px; color: var(--ink); text-transform: lowercase; }
.af-date-monthbar div { display: flex; gap: 6px; }
.af-date-monthbar button,
.af-date-footer button { min-width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid rgba(255,255,255,0.08); border-radius: 7px; color: var(--ink-2); background: rgba(255,255,255,0.035); }
.af-date-monthbar button:hover,
.af-date-footer button:hover { color: var(--ink); background: rgba(255,255,255,0.075); }
.af-date-weekdays,
.af-date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.af-date-weekdays { padding: 4px 0 6px; }
.af-date-weekdays span { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.af-date-grid button { aspect-ratio: 1; border-radius: 999px; display: grid; place-items: center; color: var(--ink); font-size: 13px; background: transparent; border: 1px solid transparent; }
.af-date-grid button:hover { background: rgba(255,255,255,0.075); border-color: rgba(255,255,255,0.08); }
.af-date-grid button.muted { color: var(--ink-4); }
.af-date-grid button.today { border-color: color-mix(in oklab, var(--brand) 45%, transparent); }
.af-date-grid button.selected { color: #180703; background: linear-gradient(180deg, #ff916e, var(--brand)); border-color: #ffb199; box-shadow: 0 8px 20px color-mix(in oklab, var(--brand) 28%, transparent); }
.af-date-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.af-date-footer button { width: auto; padding: 0 10px; font-size: 12px; }

.cal-rule { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cal-rule:last-child { border-bottom: 0; }
.cal-rule .ic { width: 24px; height: 24px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3); flex-shrink: 0; }
.cal-rule .nm { font-size: 12px; font-weight: 500; }
.cal-rule .sub { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

.cal-req { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cal-req-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.cal-req-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cal-req-h .ic { width: 26px; height: 26px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.cal-req-h .nm { font-size: 12.5px; font-weight: 600; }
.cal-req-card ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cal-req-card ul li { font-size: 11.5px; color: var(--ink-2); display: flex; gap: 6px; line-height: 1.45; }

/* Agendado: modo claro sobre dark, estilo Outlook oscuro */
.cal-layout .cal-main {
  background:
    radial-gradient(circle at 18% 8%, rgba(59, 130, 246, 0.12), transparent 28%),
    linear-gradient(180deg, #1b2432 0%, #151d29 48%, #121923 100%) !important;
  border-color: rgba(148, 163, 184, 0.32) !important;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.26), 0 0 0 1px rgba(255, 255, 255, 0.035) inset !important;
}
.cal-layout .cal-toolbar {
  background: linear-gradient(180deg, rgba(35, 45, 62, 0.98), rgba(26, 34, 48, 0.96)) !important;
  border-bottom-color: rgba(148, 163, 184, 0.34) !important;
}
.cal-layout .cal-toolbar h2 {
  color: #f8fafc !important;
  letter-spacing: -0.01em;
}
.cal-layout .cal-views {
  display: flex !important;
  gap: 5px !important;
  padding: 5px !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(30, 41, 59, 0.98)) !important;
  border: 1px solid rgba(148, 163, 184, 0.55) !important;
  border-radius: 11px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.04) inset !important;
}
.cal-layout .cal-views button {
  min-width: 72px !important;
  padding: 8px 13px !important;
  border-radius: 8px !important;
  color: #cbd5e1 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border: 1px solid transparent !important;
}
.cal-layout .cal-views button:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}
.cal-layout .cal-views button.active {
  color: #170704 !important;
  background: linear-gradient(180deg, #ff9f80, var(--brand)) !important;
  border-color: #ffb69f !important;
  box-shadow: 0 9px 24px rgba(255, 91, 31, 0.28) !important;
}
.cal-layout .cal-grid {
  display: grid !important;
  background: #182131 !important;
  min-height: 620px !important;
}
.cal-layout .cal-head-cell {
  background: linear-gradient(180deg, #202b3c, #1a2433) !important;
  border-color: rgba(148, 163, 184, 0.32) !important;
  color: #cbd5e1 !important;
}
.cal-layout .cal-head-cell .d {
  color: #f8fafc !important;
}
.cal-layout .cal-head-cell.today,
.cal-layout .cal-head-cell.today .d {
  color: #ff8a5c !important;
}
.cal-layout .cal-time-col {
  background: #182131 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}
.cal-layout .cal-time-cell {
  color: #9fb0c7 !important;
  border-bottom-color: rgba(148, 163, 184, 0.23) !important;
}
.cal-layout .cal-day-col {
  background: #1a2331 !important;
  border-right-color: rgba(148, 163, 184, 0.25) !important;
}
.cal-layout .cal-hour-line {
  border-bottom-color: rgba(148, 163, 184, 0.22) !important;
}
.cal-layout .cal-month-grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(150px, 1fr)) !important;
  gap: 0 !important;
  padding: 0 !important;
  background: #182131 !important;
  border-top: 1px solid rgba(148, 163, 184, 0.32) !important;
  min-height: 690px !important;
}
.cal-layout .cal-month-head {
  min-height: 34px !important;
  padding: 10px 12px !important;
  color: #b8c4d6 !important;
  background: linear-gradient(180deg, #202b3c, #1a2433) !important;
  border-right: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.32) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}
.cal-layout .cal-month-empty,
.cal-layout .cal-month-day {
  min-height: 122px !important;
  border: 0 !important;
  border-right: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 0 !important;
  background: #1a2331 !important;
  padding: 9px 10px !important;
}
.cal-layout .cal-month-day:hover {
  background: #202b3c !important;
  box-shadow: 0 0 0 1px rgba(255, 91, 31, 0.45) inset !important;
}
.cal-layout .cal-month-num {
  color: #dbeafe !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  margin-bottom: 8px !important;
}
.cal-layout .cal-month-event {
  background: rgba(96, 165, 250, 0.22) !important;
  border: 1px solid rgba(147, 197, 253, 0.26) !important;
  color: #f8fafc !important;
  border-left-width: 4px !important;
  border-radius: 5px !important;
}
.cal-layout .cal-empty {
  background: #151d29 !important;
  border-top-color: rgba(148, 163, 184, 0.25) !important;
  color: #aebed4 !important;
}

/* Selector de idioma */
.lang-switch { position: relative; }
.lang-btn { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border-radius: 8px; color: var(--ink-2); background: transparent; }
.lang-btn:hover { background: var(--bg-2); color: var(--ink); }
.lang-btn .mono { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.lang-menu { position: absolute; top: 100%; right: 0; margin-top: 6px; width: 200px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 50; }
.lang-h { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 8px 6px; }
.lang-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 7px; font-size: 13px; color: var(--ink); }
.lang-opt:hover { background: var(--bg-2); }
.lang-opt.active { background: var(--brand-soft); color: var(--ink); }
.lang-opt.active svg { color: var(--brand); }
