/* Identidad visual inspirada en movistar.com.pe */
:root {
  --blue: #019df4;
  --blue-dark: #0b7ac2;
  --navy: #0b2739;
  --ink: #313235;
  --muted: #6e7894;
  --bg: #f6f6f6;
  --line: #e0e3ea;
  --white: #fff;
  --green: #5cb615;
  --pink: #e63780;
  --orange: #f28d15;
  --red: #e22c2c;
  --purple: #a13ea1;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(11, 39, 57, .07);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 15px; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; color: var(--navy); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.mono { font-family: Consolas, monospace; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.link { color: var(--blue); font-weight: 600; }
.link:hover { text-decoration: underline; }
.boot { padding: 80px; text-align: center; color: var(--muted); }
.ok-text { color: var(--green); font-weight: 600; }
.danger-text { color: var(--red) !important; font-weight: 600; }

/* --- Barras superiores --- */
.topstrip { background: var(--navy); color: #fff; font-size: 13px; }
.topstrip .wrap { display: flex; justify-content: space-between; padding-top: 9px; padding-bottom: 9px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: 72px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--blue); font-size: 20px; }
.brand img { height: 50px; width: 50px; object-fit: cover; object-position: center 30%; }
.topbar nav { display: flex; gap: 6px; flex: 1; }
.topbar nav a { padding: 10px 14px; border-radius: 999px; color: var(--ink); }
.topbar nav a:hover { background: #eef7fe; }
.topbar nav a.active { color: var(--blue); font-weight: 600; background: #eef7fe; }
.user-menu { display: flex; gap: 8px; align-items: center; }
.main { padding-top: 26px; padding-bottom: 48px; }

/* --- Botones --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 2px solid transparent; border-radius: 999px;
  padding: 9px 20px; font: inherit; font-weight: 600; cursor: pointer; background: #e9edf3; color: var(--ink); transition: .15s; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.outline { background: #fff; border-color: var(--blue); color: var(--blue); }
.btn.outline:hover, .btn.outline.active { background: #eef7fe; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef1f6; }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 5px 12px; font-size: 13px; border-width: 1.5px; }
.btn.block { width: 100%; margin-top: 8px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.icon-btn { border: none; background: transparent; font-size: 20px; cursor: pointer; padding: 6px 9px; border-radius: 10px; }
.icon-btn:hover { background: #eef1f6; }

/* --- Tarjetas y formularios --- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; border: 1px solid #eef0f4; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--navy); }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(1, 157, 244, .15); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--blue); padding: 0; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 10px; }
.form-error { color: var(--red); font-size: 14px; min-height: 18px; margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span2 { grid-column: span 2; }
.search { max-width: 420px; }

/* --- Login --- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(140deg, var(--navy) 0%, #08415f 55%, var(--blue) 140%); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center; }
.auth-side img { width: 120px; height: 120px; border-radius: 26px; object-fit: cover; background: #fff; margin-bottom: 28px; }
.auth-side h1 { color: #fff; font-size: 38px; }
.auth-side p { max-width: 420px; opacity: .85; line-height: 1.5; }
.auth-card { align-self: center; justify-self: center; width: min(420px, 92%); padding: 34px; }
.code-input { font-size: 26px; letter-spacing: 8px; text-align: center; font-family: Consolas, monospace; }
.qr { display: block; margin: 8px auto 12px; border: 1px solid var(--line); border-radius: 12px; }
.secret { display: block; background: #f1f4f8; padding: 10px; border-radius: 8px; word-break: break-all; margin: 8px 0; font-size: 13px; }
.secret.big { font-size: 22px; text-align: center; letter-spacing: 1px; }
.steps { padding-left: 18px; color: var(--muted); font-size: 14px; }

/* --- Dashboard --- */
.hero { background: #000 linear-gradient(110deg, #000 35%, var(--navy) 75%, #0a5b8c 110%); color: #fff; border-radius: 18px;
  padding: 30px 34px; display: flex; justify-content: space-between; gap: 30px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.hero h1 { color: #fff; font-size: 32px; margin: 10px 0 6px; }
.hero p { margin: 0; opacity: .85; }
.tag { background: #e8f6fe; color: var(--blue); padding: 4px 10px; border-radius: 4px; font-weight: 600; font-size: 13px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; padding: 14px 20px; min-width: 112px; text-align: center; }
.stat strong { display: block; font-size: 30px; color: var(--blue); }
.stat span { font-size: 13px; opacity: .85; }
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; }
.toolbar .btn.primary { margin-left: auto; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.case-card { display: flex; flex-direction: column; gap: 4px; transition: .15s; }
.case-card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(1, 157, 244, .15); }
.case-card h3 { font-size: 17px; margin: 8px 0 2px; }
.case-card p { margin: 0; font-size: 14px; }
.case-card-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.case-card-foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.code { font-family: Consolas, monospace; font-weight: 700; color: var(--blue); font-size: 13px; }
.empty { color: var(--muted); padding: 30px; text-align: center; }

.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #eef1f6; color: var(--muted); }
.st-abierto { background: #e8f6de; color: #3f8a07; }
.st-en_tramite { background: #e6f5fe; color: var(--blue-dark); }
.st-suspendido { background: #fff2e0; color: #b8680a; }
.st-cerrado { background: #eceef2; color: #666; }
.pr-critica { background: #fde6ef; color: var(--pink); }
.pr-alta { background: #fff2e0; color: #b8680a; }
.conf { background: var(--navy); color: #fff; }
.role, .responsable { background: #e6f5fe; color: var(--blue-dark); }
.admin { background: var(--navy); color: #fff; }

/* --- Caso --- */
.case-header { margin-bottom: 14px; }
.back { font-size: 14px; }
.case-title { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.case-title h1 { margin: 0; font-size: 26px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 11px 18px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.active { color: var(--blue); border-color: var(--blue); }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.facts { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0 0 18px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-weight: 500; }
.perm-list { list-style: none; padding: 0; margin: 0; }
.perm-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.perm-list .yes { color: #3f8a07; }
.perm-list .no { color: #b0b6c3; }
.perm-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #fafcfe; }
.table tr.warn td { background: #fff6f8; }
.table .actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* --- Modal --- */
.modal-back { position: fixed; inset: 0; background: rgba(11, 39, 57, .55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: 92vh; overflow: auto; padding: 24px; }
.modal.wide { width: min(1100px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.doc-modal { display: grid; grid-template-columns: 330px 1fr; gap: 18px; min-height: 70vh; }
.doc-side { overflow: auto; max-height: 76vh; padding-right: 6px; }
.versions, .history { list-style: none; padding: 0; margin: 0 0 16px; }
.versions li, .history li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.versions .btn-row { margin-top: 6px; }
.viewer { background: #f1f4f8; border-radius: 12px; display: grid; place-items: center; overflow: hidden; }
.viewer iframe { width: 100%; height: 76vh; border: 0; background: #fff; }
.viewer img { max-width: 100%; max-height: 76vh; }

/* --- Chat --- */
.chat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; height: calc(100vh - 300px); min-height: 460px; border: 1px solid #eef0f4; }
.global-chat .chat { height: calc(100vh - 180px); }
.chat-title { padding: 14px 20px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--navy); }
.chat-list { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; background: #fafbfd; }
.msg { max-width: 72%; background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 9px 13px; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: #e6f5fe; border-color: #c4e7fd; border-radius: 14px 4px 14px 14px; }
.msg.ai { background: #f5f0ff; border-color: #ddd0f7; }
.msg.ai-claude { background: #fdf3ec; border-color: #f2d6c2; }
.msg-head { display: flex; gap: 10px; align-items: baseline; font-size: 13px; margin-bottom: 3px; }
.msg-head strong { color: var(--navy); }
.msg-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.msg audio { display: block; margin-top: 4px; max-width: 300px; }
.msg-img { max-width: 320px; max-height: 260px; border-radius: 10px; margin-top: 4px; display: block; }
.msg-file { background: #f4f6fa; border-radius: 8px; padding: 8px 10px; margin-top: 4px; font-size: 14px; }
.transcript { font-size: 13px; color: var(--muted); margin-top: 4px; font-style: italic; }
.chat-typing { font-size: 13px; color: var(--purple); padding: 0 20px; min-height: 20px; }
.chat-form { border-top: 1px solid var(--line); padding: 10px 14px 14px; }
.mentions { display: flex; gap: 6px; margin-bottom: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chat-row { display: flex; gap: 6px; align-items: flex-end; }
.chat-input { resize: none; min-height: 44px; }
.recording { background: #fde6ef !important; color: var(--pink); font-size: 14px; font-weight: 700; }

/* --- Toasts --- */
#toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 380px; transition: .4s; }
.toast.ok { background: #3f8a07; }
.toast.error { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(10px); }
.error-card { color: var(--red); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 34px; }
  .two-col, .doc-modal, .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .topbar .wrap { gap: 10px; }
  .topbar nav a { padding: 8px; font-size: 14px; }
  .msg { max-width: 92%; }
  .topstrip span:first-child { display: none; }
}

/* ===================== Chat flotante ===================== */
.dock { position: fixed; right: 26px; bottom: 26px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.dock-fab { width: 64px; height: 64px; border-radius: 50%; border: none; background: var(--pink); color: #fff; cursor: pointer;
  box-shadow: 0 8px 22px rgba(230, 55, 128, .4); display: grid; place-items: center; position: relative; transition: .2s; }
.dock-fab:hover { transform: scale(1.06); }
.dock-fab.open { background: var(--navy); box-shadow: 0 8px 22px rgba(11, 39, 57, .35); }
.dock-icon { display: grid; place-items: center; }
.dock-badge { position: absolute; top: -4px; right: -4px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700;
  min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; border: 2px solid #fff; }
.dock-panel { width: min(420px, calc(100vw - 40px)); height: min(620px, calc(100vh - 140px)); background: #fff; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(11, 39, 57, .28); display: flex; flex-direction: column; overflow: hidden; animation: dockIn .18s ease-out; }
@keyframes dockIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.dock-head { background: var(--navy); display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0 12px; }
.dock-tabs { display: flex; gap: 2px; overflow-x: auto; }
.dock-tab { border: none; background: transparent; color: rgba(255, 255, 255, .7); font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 14px; border-radius: 10px 10px 0 0; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dock-tab.active { background: #fff; color: var(--navy); }
.dock-tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }
.icon-btn.light { color: #fff; font-size: 16px; }
.icon-btn.light:hover { background: rgba(255, 255, 255, .12); }
.dock-body { flex: 1; min-height: 0; display: flex; }
.dock-body .chat { flex: 1; height: auto; min-height: 0; border: none; border-radius: 0; box-shadow: none; }
.dock-body .msg { max-width: 88%; }
.dock-body .chat-list { padding: 14px; }

/* ===================== Campana de alertas ===================== */
.bell-wrap { position: relative; }
.bell { position: relative; font-size: 20px; }
.bell-badge { position: absolute; top: 0; right: 0; background: var(--pink); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.bell-menu { position: absolute; right: 0; top: 46px; width: 380px; max-height: 70vh; overflow: auto; z-index: 60; padding: 14px; }
.bell-list { display: flex; flex-direction: column; }
.bell-item { display: block; padding: 10px; border-radius: 10px; border-bottom: 1px solid var(--line); }
.bell-item:hover { background: #f4f8fc; }
.bell-item.unread { background: #eef7fe; }
.bell-item.unread .bell-title { font-weight: 700; }
.bell-title { color: var(--navy); font-size: 14px; }
#toasts { top: 120px; bottom: auto; }
.toast.alert { background: var(--blue); }

/* ===================== Agenda del caso ===================== */
.agenda-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ev-list { list-style: none; padding: 0; margin: 0; }
.ev-item, .task-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ev-item.past { opacity: .6; }
.ev-main { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.ev-date { width: 50px; text-align: center; background: #eef7fe; border-radius: 10px; padding: 6px 0; flex-shrink: 0; }
.ev-date strong { display: block; font-size: 20px; color: var(--blue); line-height: 1.1; }
.ev-date span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.ev-badge-audiencia { background: #fde6ef; color: var(--pink); }
.ev-badge-presentacion { background: #e6f5fe; color: var(--blue-dark); }
.ev-badge-vencimiento { background: #fff2e0; color: #b8680a; }
.ev-badge-reunion { background: #f0e8fa; color: var(--purple); }
.task-item.overdue { background: #fff6f8; }
.task-item .done { text-decoration: line-through; color: var(--muted); }
.status-select { width: auto; padding: 5px 8px; font-size: 13px; }
.m0 { margin: 0; }

/* ===================== Calendario personal ===================== */
.agenda-page { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.agenda-side { display: flex; flex-direction: column; gap: 18px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; text-transform: capitalize; }
.cal-head select { width: auto; padding: 5px 10px; }
.cal-legend { display: flex; gap: 16px; margin-bottom: 10px; }
.lg::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.lg.ev::before { background: var(--blue); }
.lg.task::before { background: var(--green); }
.lg.rem::before { background: var(--orange); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfd; }
.cal-cell { min-height: 108px; padding: 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell:hover { background: #f6fafe; }
.cal-cell.other { background: #fafafa; }
.cal-cell.other .cal-num { color: #b8bfcc; }
.cal-cell.today .cal-num { background: var(--blue); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; }
.cal-num { font-size: 13px; font-weight: 600; color: var(--navy); width: 26px; height: 26px; display: grid; place-items: center; }
.cal-chip { border: none; text-align: left; font: inherit; font-size: 11.5px; padding: 3px 6px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #e6f5fe; color: var(--blue-dark); border-left: 3px solid var(--blue); }
.cal-chip.ev-audiencia { background: #fde6ef; color: #b01f5d; border-color: var(--pink); }
.cal-chip.ev-vencimiento { background: #fff2e0; color: #9a5608; border-color: var(--orange); }
.cal-chip.k-tarea { background: #eaf6e0; color: #3f7a0f; border-color: var(--green); }
.cal-chip.k-recordatorio { background: #fff7e6; color: #9a5608; border-color: #f5b400; }
.cal-chip.done { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.mini-list li:hover { background: #f4f8fc; }

/* ===================== Notas ===================== */
.toolbar h2 { margin-right: auto; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.note-card { border-radius: 14px; padding: 14px 16px; cursor: pointer; border: 1px solid transparent; transition: .15s; display: flex; flex-direction: column; gap: 6px; min-height: 140px; }
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.note-card h4 { margin: 0; }
.note-card p { margin: 0; }
.note-card.done { opacity: .55; }
.note-card.done h4 { text-decoration: line-through; }
.note-top { display: flex; justify-content: space-between; align-items: center; }
.note-top .check { margin: 0; }
.c-blue { background: #e6f5fe; } .c-green { background: #eaf6e0; } .c-yellow { background: #fff7d6; }
.c-pink { background: #fde6ef; } .c-purple { background: #f0e8fa; } .c-gray { background: #eef0f4; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.sel { box-shadow: 0 0 0 2px var(--blue); }

@media (max-width: 1000px) {
  .agenda-page, .agenda-cols { grid-template-columns: 1fr; }
  .cal-cell { min-height: 70px; }
  .cal-chip { font-size: 10px; }
}

/* ===================== Asistente IA (ventana propia) ===================== */
.dock { right: 26px; bottom: 26px; }
.ai-dock { right: 104px; }
.dock-panel { position: fixed; right: 26px; bottom: 104px; }
.ai-fab { background: var(--blue); box-shadow: 0 8px 22px rgba(1, 157, 244, .4); width: 58px; height: 58px; margin-top: 3px; }
.ai-fab.open { background: var(--navy); }
.ai-head { padding: 8px 8px 8px 8px; gap: 6px; }
.ai-head .ai-title { color: #fff; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-panel { border-top: 4px solid var(--blue); }
.ai-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.ai-body .chat { flex: 1; height: auto; min-height: 0; border: none; border-radius: 0; box-shadow: none; }
.ai-body .msg { max-width: 92%; }
.ai-home { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-home h4 { margin: 10px 0 0; }
.ai-option { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px; font: inherit; cursor: pointer; }
.ai-option:hover { border-color: var(--blue); background: #f6fbff; }
.ai-option span { color: var(--muted); font-size: 13px; }
.ai-option select { width: auto; flex: 1; padding: 6px 8px; font-size: 13px; }
.msg.err { background: #fff4f4; border-color: #f3c6c6; }
.conv-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.icon-btn.small-x { font-size: 14px; padding: 2px 6px; opacity: .6; }
.icon-btn.small-x:hover { opacity: 1; }

/* ===================== Conversaciones directas ===================== */
.directs { padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: auto; flex: 1; }
.dm-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dm-wrap .chat { flex: 1; min-height: 0; }
.dm-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.count { background: var(--pink); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.case-tag { color: var(--blue-dark); font-weight: 600; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===================== Ayuda ===================== */
.help-page { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 90px; }
.help-toc ol { padding-left: 18px; margin: 0 0 14px; }
.help-toc li { padding: 4px 0; }
.help-toc a { color: var(--blue-dark); }
.help-body { line-height: 1.6; max-width: 900px; }
.help-body h2 { font-size: 28px; }
.help-body h3 { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--blue-dark); }
.help-body h4 { margin-top: 18px; }
.help-body code { background: #f1f4f8; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
@media (max-width: 900px) { .help-page { grid-template-columns: 1fr; } .help-toc { position: static; } }

/* ===================== Casos archivados ===================== */
.case-card.archived { opacity: .7; background: #fafafa; }
.archived-banner { margin-top: 10px; background: #eef0f4; border-left: 4px solid var(--navy); padding: 10px 14px; border-radius: 8px; font-size: 14px; }

/* ===================== Informes ===================== */
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.report-card { display: flex; flex-direction: column; gap: 4px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: .15s; }
.report-card:hover { border-color: var(--blue); background: #f8fcff; }
.pending-tag { font-size: 12px; font-weight: 700; color: var(--orange); }
.rs-borrador { background: #eef1f6; color: var(--muted); }
.rs-en_revision { background: #fff2e0; color: #b8680a; }
.rs-aprobado { background: #e8f6de; color: #3f8a07; }
.report-head { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.report-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.report-side { display: flex; flex-direction: column; gap: 14px; }
.report-editor { width: 100%; min-height: 55vh; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.6; padding: 16px; resize: vertical; }
.report-save { display: flex; gap: 8px; margin-top: 10px; }
.report-save input { flex: 1; }
.report-read { max-width: none; }
.versions li.current { background: #f4faff; border-radius: 8px; padding-left: 6px; }
.task-report { display: block; font-size: 13px; color: var(--blue-dark); font-weight: 600; margin-top: 4px; }
.task-report:hover { text-decoration: underline; }
.diff-wrap { display: flex; flex-direction: column; gap: 8px; }
.diff-legend { display: flex; gap: 12px; }
.d-add { color: #2e7d0e; font-weight: 600; }
.d-del { color: var(--red); font-weight: 600; }
.diff-view { white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.6; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 65vh; overflow: auto; }
.diff-view ins { background: #dff5d0; color: #1f5f06; text-decoration: none; border-radius: 3px; }
.diff-view del { background: #fde2e2; color: #a01717; border-radius: 3px; }
@media (max-width: 1000px) { .report-layout { grid-template-columns: 1fr; } }

/* ===================== Reportes de avance ===================== */
.progress-form { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto auto; gap: 0 12px; align-items: end; }
.progress-form .field { margin-bottom: 8px; }
.ai-check { margin-bottom: 18px; white-space: nowrap; }
.progress-form .btn { margin-bottom: 14px; }
.progress-out { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.progress-live { white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.6; background: #f7fbff; border: 1px dashed var(--blue); border-radius: 10px; padding: 14px; max-height: 55vh; overflow: auto; color: var(--ink); }
.progress-preview { border: 1px solid var(--line); border-radius: 10px; padding: 6px 20px; max-height: 58vh; overflow: auto; }
.progress-edit { min-height: 50vh; }
.warn-box { background: #fff7e6; border-left: 4px solid var(--orange); padding: 10px 14px; border-radius: 8px; font-size: 14px; }
@media (max-width: 900px) { .progress-form { grid-template-columns: 1fr; } }
