/* Latinos IA · Consejero — negro, monocromo, una columna centrada. Sin escena 3D. */
:root {
  --bg: #000; --side: #0d0d0d; --surface: #161616; --surface-2: #1f1f1f; --hover: #1a1a1a;
  --ink: #f5f5f5; --ink-soft: #d4d4d4; --muted: #8b8b8b; --muted-2: #5e5e5e;
  --rule: #262626; --rule-2: #333;
  --accent: #ff7a1a; --blue: #8ab4ff; --green: #7be3a5; --danger: #ff6b6b;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --side-w: 264px; --col: 768px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; overflow: hidden; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: var(--danger); font-size: 14px; }
.only-mobile { display: none !important; }
::selection { background: rgba(255,255,255,.2); }
* { scrollbar-width: thin; scrollbar-color: #2a2a2a transparent; }

.logo { font-weight: 700; font-size: 19px; letter-spacing: -.03em; }
.logo span { color: var(--muted); font-weight: 600; }

.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--ink); background: var(--surface-2); }

/* ---- Estructura ---- */
.app { display: flex; height: 100dvh; }

/* ---- Barra lateral ---- */
.sidebar { width: var(--side-w); flex: none; background: var(--side); border-right: 1px solid #141414; display: flex; flex-direction: column; padding: calc(12px + var(--sat)) 10px calc(10px + var(--sab)); gap: 2px; z-index: 40; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 14px; }
.side-top .icon-btn { display: none; }
.side-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 10px; color: var(--ink-soft); font-size: 14.5px; font-weight: 500; text-align: left; width: 100%; transition: background .15s; }
.side-item:hover, .side-item.on { background: var(--hover); color: var(--ink); }
.side-item svg { width: 19px; height: 19px; color: var(--muted); }
.side-item span { flex: 1; }
.side-item.strong { color: var(--ink); margin-bottom: 6px; border: 1px solid var(--rule); }
.side-item .count { font-size: 12px; font-weight: 500; color: var(--muted-2); }
.side-label { font-size: 12px; color: var(--muted-2); font-weight: 500; padding: 18px 10px 6px; }
.chat-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.chat-row { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 10px; border-radius: 10px; font-size: 14px; cursor: pointer; color: var(--ink-soft); }
.chat-row:hover { background: var(--hover); }
.chat-row.on { background: var(--surface-2); color: var(--ink); }
.chat-row span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .del { opacity: 0; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.chat-row .del svg { width: 15px; height: 15px; }
.chat-row:hover .del { opacity: 1; }
.chat-row .del:hover { color: var(--danger); background: rgba(255,107,107,.12); }
.chat-empty { padding: 8px 10px; color: var(--muted-2); font-size: 13.5px; }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid #1a1a1a; margin-top: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.user-name { flex: 1; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Principal ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.main-top { display: flex; align-items: center; gap: 4px; height: calc(56px + var(--sat)); padding: var(--sat) 14px 0; flex: none; }
.chat-title { flex: 1; font-size: 14.5px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; padding: 0 8px; }

.messages { flex: 1; overflow-y: auto; padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 28px; -webkit-overflow-scrolling: touch; }
.messages > * { width: 100%; max-width: var(--col); margin-inline: auto; }
.msg { display: flex; flex-direction: column; gap: 8px; }
.msg.user { align-items: flex-end; }
.bubble { font-size: 16px; line-height: 1.7; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--surface-2); padding: 10px 18px; border-radius: 22px; max-width: 80%; white-space: pre-wrap; line-height: 1.55; }
.msg.model .bubble { color: var(--ink); }
.bubble h3 { font-size: 17px; font-weight: 600; margin: 18px 0 6px; }
.bubble p { margin: 0 0 12px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 12px 22px; } .bubble li { margin: 4px 0; padding-left: 2px; }
.bubble strong { font-weight: 600; }
.bubble code { font-family: var(--mono); font-size: 13.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.bubble pre { background: #0f0f0f; border: 1px solid var(--rule); padding: 14px; border-radius: 12px; overflow-x: auto; margin: 8px 0 12px; } .bubble pre code { background: none; padding: 0; }
.bubble a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.bubble.typing { color: var(--muted); font-size: 15px; background: linear-gradient(90deg, var(--muted-2) 0%, var(--ink) 50%, var(--muted-2) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.msg-actions { display: flex; gap: 2px; margin-left: -8px; }
.msg-actions .icon-btn { width: 32px; height: 32px; }
.msg-actions svg { width: 17px; height: 17px; }
.msg-atts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.msg-atts img, .msg-atts video { max-width: 240px; max-height: 240px; border-radius: 16px; display: block; border: 1px solid var(--rule); }
.msg-atts audio { max-width: 260px; height: 40px; }
.msg-atts .doc { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); font-size: 14px; max-width: 260px; }
.msg-atts .doc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; }
.src { font-size: 12.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
a.src, .src.empresa { cursor: pointer; }
a.src:hover, .src.empresa:hover { color: var(--ink); border-color: var(--rule-2); }
.src.mem { color: var(--green); }

/* ---- Dock: saludo + compositor (centrado cuando no hay conversación) ---- */
.dock { flex: none; width: 100%; max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 0 20px calc(12px + var(--sab)); display: flex; flex-direction: column; }
.greeting, .sugs { display: none; }
.main.is-empty .messages { display: none; }
.main.is-empty .dock { flex: 1; justify-content: center; padding-bottom: 12vh; }
.main.is-empty .greeting { display: block; font-size: clamp(28px, 4vw, 38px); font-weight: 600; letter-spacing: -.035em; text-align: center; margin-bottom: 28px; }
.main.is-empty .sugs { display: flex; }
.fine { font-size: 12px; color: var(--muted-2); text-align: center; margin-top: 10px; }
.main.is-empty .fine { display: none; }

.composer { background: var(--surface); border: 1px solid var(--rule); border-radius: 28px; padding: 14px 12px 10px 20px; transition: border-color .15s; box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 12px 40px -12px rgba(0,0,0,.8); }
.composer:focus-within { border-color: var(--rule-2); }
.composer textarea { display: block; width: 100%; resize: none; background: none; border: 0; outline: none; font-size: 16px; line-height: 1.5; max-height: 220px; min-height: 26px; padding-right: 8px; }
.composer textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; gap: 4px; margin: 8px 0 0 -10px; }
.spacer { flex: 1; }
.tool { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); border: 1px solid var(--rule); transition: background .15s, border-color .15s; }
.tool:hover { background: var(--surface-2); border-color: var(--rule-2); }
.tool.listening { background: var(--danger); border-color: transparent; color: #fff; animation: pulse-red 1.2s ease-out infinite; }
.send { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #000; margin-left: 4px; transition: opacity .15s, transform .1s; }
.send:active { transform: scale(.94); }
.send:disabled { opacity: .35; cursor: default; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255,107,107,.55); } 100% { box-shadow: 0 0 0 12px rgba(255,107,107,0); } }

.sugs { flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.sug { padding: 8px 16px; border-radius: 999px; font-size: 14px; border: 1px solid var(--rule); color: var(--ink-soft); transition: background .15s, border-color .15s; }
.sug:hover { background: var(--surface); border-color: var(--rule-2); color: var(--ink); }

.attach-row { display: flex; gap: 8px; padding-bottom: 8px; overflow-x: auto; }
.att { position: relative; flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); font-size: 13px; max-width: 220px; }
.att img { width: 40px; height: 40px; object-fit: cover; border-radius: 9px; }
.att .ic { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; }
.att .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.att .pr { font-size: 11px; color: var(--muted); }
.att .x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--rule-2); display: grid; place-items: center; }
.att .x svg { width: 12px; height: 12px; }
.att.err { border-color: rgba(255,107,107,.5); }

/* ---- Panel derecho ---- */
.panel { position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: flex; flex-direction: column; background: var(--side); border-left: 1px solid var(--rule); box-shadow: -20px 0 60px rgba(0,0,0,.6); padding-top: var(--sat); animation: slide-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px 20px; flex: none; }
.panel-head h2 { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 20px calc(20px + var(--sab)); -webkit-overflow-scrolling: touch; }
.panel-body p { color: var(--ink-soft); }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.6); }

.btn { min-height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px; background: var(--surface); border: 1px solid var(--rule); }
.btn:hover { border-color: var(--rule-2); }
.btn.primary { background: var(--ink); color: #000; border-color: transparent; }
.btn.primary:hover { opacity: .9; }
.btn.big { height: 50px; font-size: 16px; }
.btn.danger { background: rgba(255,107,107,.14); border-color: rgba(255,107,107,.4); color: #ffd0d0; }
.mem-add { display: flex; gap: 8px; margin-bottom: 14px; }
.mem-add input { flex: 1; min-width: 0; height: 42px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); outline: none; font-size: 15px; }
.mem-add input:focus { border-color: var(--rule-2); }
.mem { display: flex; gap: 10px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid #1a1a1a; }
.mem .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 9px; flex: none; background: var(--green); }
.mem.aprendido .dot { background: var(--blue); }
.mem .t { flex: 1; font-size: 15px; }
.mem .meta { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.mem .del { color: var(--muted-2); width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.mem .del svg { width: 15px; height: 15px; }
.mem .del:hover { color: var(--danger); background: rgba(255,107,107,.12); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.grp { margin: 18px 0 6px; font-size: 12px; font-weight: 500; color: var(--muted-2); }
.proj { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 10px; margin: 0 -10px; border-radius: 12px; cursor: pointer; }
.proj:hover { background: var(--hover); }
.proj .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 16px; flex: none; }
.proj .n { font-weight: 600; font-size: 15px; } .proj .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj > div { min-width: 0; }
.ficha h3 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.ficha .tag { display: inline-block; margin: 8px 6px 12px 0; padding: 4px 11px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--ink-soft); }
.ficha dl { margin: 12px 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.ficha dt { color: var(--muted); } .ficha dd { color: var(--ink-soft); word-break: break-word; }
.ficha .txt { white-space: pre-wrap; font-size: 14px; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 12px; }
.ficha .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.ficha .pend li { margin: 4px 0 4px 18px; }

/* ---- Hojas ---- */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; padding: 12px; padding-bottom: calc(12px + var(--sab)); }
.sheet-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--rule); border-radius: 22px; padding: 8px; display: flex; flex-direction: column; gap: 2px; animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-opt { min-height: 52px; padding: 0 16px; border-radius: 14px; font-size: 16px; font-weight: 500; text-align: left; }
.sheet-opt:hover { background: var(--surface-2); }
.sheet-opt.cancel { text-align: center; color: var(--muted); }
.sheet-card.rec { align-items: center; text-align: center; padding: 24px 16px; gap: 10px; }
.rec-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--danger); animation: pulse-red 1.2s ease-out infinite; }
.rec-time { font-family: var(--mono); font-size: 32px; font-weight: 500; }
.rec-acts { display: flex; gap: 10px; margin-top: 6px; }

/* ---- Login ---- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card .logo { font-size: 34px; }
.login-card .muted { margin-top: -8px; margin-bottom: 14px; }
.login-card input { height: 52px; padding: 0 20px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); outline: none; font-size: 16px; text-align: center; }
.login-card input:focus { border-color: var(--rule-2); }

.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(110px + var(--sab)); transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #000; font-weight: 500; font-size: 14px; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; box-shadow: 0 10px 30px rgba(0,0,0,.6); }

/* ---- Vídeos ---- */
.vid-drop { text-align: center; padding: 22px 14px; border: 1.5px dashed var(--rule-2); border-radius: 18px; cursor: pointer; margin-bottom: 14px; transition: background .2s, border-color .2s; }
.vid-drop.over, .vid-drop:hover { background: var(--surface); border-color: var(--muted-2); }
.vid-drop .big { font-size: 30px; line-height: 1.2; margin-bottom: 4px; }
.vid-drop p { margin-bottom: 4px; }
.vid-drop .btn { margin-top: 10px; }
.vq { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--rule); background: var(--surface); margin-bottom: 8px; }
.vq-n { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vq-bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin: 8px 0 4px; overflow: hidden; }
.vq-bar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .3s; }
.vq-s { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vq.error .vq-s { color: var(--danger); } .vq.ok .vq-s { color: var(--green); }
.vid-filtros { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.vid-filtros .muted { margin-left: auto; }
.vf { min-height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--rule); font-weight: 500; font-size: 14px; color: var(--muted); }
.vf.on { background: var(--surface-2); color: var(--ink); border-color: var(--rule-2); }
.vid { border: 1px solid var(--rule); border-radius: 16px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.vid-media video, .vid-media img { display: block; width: 100%; max-height: 300px; background: #000; object-fit: contain; }
.vid-media audio { width: 100%; padding: 8px; }
.vid-doc { font-size: 40px; text-align: center; padding: 14px; }
.vid-info { padding: 10px 14px 14px; }
.vid-n { font-weight: 600; word-break: break-word; }
.vid-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.vid-acts .btn { display: inline-flex; align-items: center; justify-content: center; }
.vid-acts .btn.primary { flex: 1; }

/* ---- Móvil ---- */
@media (max-width: 760px) {
  .only-mobile { display: grid !important; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); transform: translateX(-100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
  body.side-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.7); }
  .side-top .icon-btn { display: grid; }
  .chat-row .del { opacity: .7; }
  .main-top { padding-left: 8px; padding-right: 8px; }
  .messages { padding: 4px 16px 20px; gap: 24px; }
  .dock { padding: 0 10px calc(8px + var(--sab)); }
  .main.is-empty .dock { padding-bottom: 8vh; }
  .composer { border-radius: 26px; padding-left: 18px; }
  .msg.user .bubble { max-width: 88%; }
  .sugs { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin-inline: -10px; padding: 0 10px; scrollbar-width: none; }
  .sug { flex: none; }
  .fine { display: none; }
  .panel { width: 100vw; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Correos (direccion@) ---- */
.side-item .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.mail { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
.mail-top { gap: 12px; padding-left: 20px; }
.mail-h { font-size: 18px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.mail-h .muted { font-size: 13px; font-weight: 400; margin-left: 6px; letter-spacing: 0; }
.mail-search { flex: 1; max-width: 420px; margin-left: auto; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--rule); color: var(--muted); }
.mail-search:focus-within { border-color: var(--rule-2); }
.mail-search svg { width: 17px; height: 17px; }
.mail-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 14.5px; color: var(--ink); }
.mail-filtros { display: flex; gap: 6px; padding: 2px 20px 10px; flex: none; overflow-x: auto; scrollbar-width: none; }
.mf { height: 32px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--rule); font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.mf b { font-weight: 600; color: var(--ink-soft); margin-left: 2px; }
.mf.on { background: var(--ink); color: #000; border-color: transparent; }
.mf.on b { color: #000; }
.mail-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 400px) 1fr; border-top: 1px solid #1a1a1a; }
.mail-list { overflow-y: auto; border-right: 1px solid #1a1a1a; }
.mi { display: block; width: 100%; text-align: left; padding: 12px 18px 12px 30px; border-bottom: 1px solid #141414; position: relative; transition: background .12s; }
.mi:hover { background: #0c0c0c; }
.mi.on { background: var(--surface); }
.mi::before { content: ""; position: absolute; left: 13px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.mi.imp-urgente::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,107,.18); }
.mi.imp-alta::before { background: var(--accent); }
.mi.imp-normal::before { background: #3a3a3a; }
.mi-top { display: flex; align-items: baseline; gap: 8px; }
.mi-from { flex: 1; font-size: 14.5px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi.nuevo .mi-from { color: var(--ink); font-weight: 650; }
.mi-date { font-size: 12px; color: var(--muted-2); flex: none; }
.mi-subj { font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mi.nuevo .mi-subj { color: var(--ink); }
.mi-res { font-size: 13px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.mi-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tagm { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tagm.resp { color: #ffcf9e; background: rgba(255,122,26,.12); }
.tagm.ok { color: var(--green); background: rgba(123,227,165,.1); }
.mail-more { display: block; margin: 14px auto; }
.mail-vacio { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.mail-reader { overflow-y: auto; padding: 22px 32px 40px; }
.mail-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--ink-soft); }
.mail-empty svg { width: 40px; height: 40px; color: var(--muted-2); margin: 0 auto 10px; display: block; }
.mr-back { display: none; }
.mr-subj { font-size: 22px; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; margin-bottom: 12px; }
.mr-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.mr-meta .avatar { width: 36px; height: 36px; font-size: 14px; }
.mr-from b { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.mr-meta select { margin-left: auto; height: 30px; padding: 0 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--rule); color: var(--ink-soft); font-size: 13px; }
.ai-card { border: 1px solid var(--rule); background: linear-gradient(180deg, #121212, #0d0d0d); border-radius: 18px; padding: 16px 18px; margin-bottom: 18px; }
.ai-card .ai-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
.ai-card .ai-h svg { width: 15px; height: 15px; color: var(--accent); }
.ai-card .ai-res { font-size: 15px; line-height: 1.6; }
.ai-card .ai-acc { margin-top: 8px; font-size: 14.5px; color: #ffcf9e; }
.ai-card .ai-mot { margin-top: 6px; font-size: 13px; color: var(--muted); }
.ai-card .ai-learn { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
.ai-card .ai-learn li { margin: 2px 0 2px 16px; }
.ai-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ai-acts .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; font-size: 14px; }
.ai-acts .btn svg { width: 16px; height: 16px; }
.reply { border: 1px solid var(--rule-2); border-radius: 18px; padding: 14px; margin-bottom: 18px; background: var(--surface); }
.reply-h { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.reply textarea { width: 100%; min-height: 200px; resize: vertical; background: #0d0d0d; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.6; outline: none; }
.reply textarea:focus { border-color: var(--rule-2); }
.reply-ins { display: flex; gap: 8px; margin-top: 10px; }
.reply-ins input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 99px; background: #0d0d0d; border: 1px solid var(--rule); outline: none; font-size: 14px; }
.reply-acts { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; flex-wrap: wrap; }
.mr-atts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mr-atts a { font-size: 13px; padding: 7px 12px; border-radius: 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-soft); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-atts a:hover { border-color: var(--rule-2); color: var(--ink); }
.mr-frame { width: 100%; border: 0; border-radius: 14px; background: #fff; min-height: 300px; display: block; }
.mr-text { white-space: pre-wrap; font-size: 15px; line-height: 1.65; color: var(--ink-soft); overflow-wrap: anywhere; }
.cargando { color: var(--muted); padding: 30px 0; }

@media (max-width: 760px) {
  .mail-top { padding-left: 8px; }
  .mail-search { max-width: none; }
  .mail-h .muted { display: none; }
  .mail-filtros { padding: 2px 12px 10px; }
  .mail-body { grid-template-columns: 1fr; }
  .mail-list { border-right: 0; }
  .mail-reader { display: none; padding: 14px 16px 40px; }
  .mail.leyendo .mail-list, .mail.leyendo .mail-filtros, .mail.leyendo .mail-top { display: none; }
  .mail.leyendo .mail-reader { display: block; padding-top: calc(10px + var(--sat)); }
  .mr-back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); font-size: 15px; margin: 0 0 12px -6px; height: 36px; }
  .mr-subj { font-size: 20px; }
  .mr-meta select { margin-left: 0; }
}

/* ---------------------------------------------------------------- Agenda */
.agenda { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
.ag-nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.ag-nav .mf { height: 30px; }
.ag-nueva { margin-left: auto; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px 0 12px; border-radius: 99px; background: var(--ink); color: #000; font-size: 14px; font-weight: 600; }
.ag-nueva svg { width: 18px; height: 18px; }
.ag-nueva:hover { background: #fff; }
.ag-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; border-top: 1px solid var(--rule); }
.ag-cal { display: flex; flex-direction: column; min-height: 0; padding: 10px 16px 16px; }
.ag-dows { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 0 6px; }
.ag-dows span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-left: 8px; }
.ag-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, minmax(0, 1fr)); gap: 4px; min-height: 0; }
.ag-d { position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; min-height: 0; overflow: hidden; padding: 6px 6px 4px; border-radius: 10px; background: var(--surface); border: 1px solid transparent; transition: background .12s, border-color .12s; }
.ag-d:hover { background: var(--surface-2); }
.ag-d.finde { background: #121212; }
.ag-d.fuera { opacity: .38; }
.ag-d.sel { border-color: var(--ink-soft); }
.ag-n { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 99px; color: var(--ink-soft); }
.ag-d.hoy .ag-n { background: var(--accent); color: #000; }
.ag-evs { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; min-height: 0; }
.ag-ev { font-style: normal; font-size: 11.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 6px; border-radius: 5px; color: var(--ink); background: color-mix(in srgb, var(--c) 22%, transparent); border-left: 2px solid var(--c); }
.ag-ev em { font-style: normal; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ag-mas { font-style: normal; font-size: 11px; color: var(--muted); padding-left: 6px; }
.ag-dot { display: none; }
.ag-dia { border-left: 1px solid var(--rule); padding: 18px 18px 24px; overflow-y: auto; }
.ag-dia h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 12px; }
.ag-sub { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 26px 0 10px; }
.ag-lista { display: flex; flex-direction: column; gap: 6px; }
.ag-item { display: flex; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface); width: 100%; }
.ag-item:hover { background: var(--surface-2); }
.ag-barra { width: 3px; border-radius: 3px; background: var(--c); flex: none; }
.ag-item-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-item-h { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-item-h b { color: var(--ink-soft); font-weight: 600; text-transform: capitalize; }
.ag-item-n { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ag-item-l { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ag-item-l svg { width: 13px; height: 13px; }
.ag-vacio { font-size: 14px; color: var(--muted); padding: 6px 2px; }
.ag-link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.ag-tip { margin-top: 22px; line-height: 1.5; }
/* Formulario */
.ag-modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); }
.ag-form { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--side); border: 1px solid var(--rule-2); border-radius: 18px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.ag-form-h { display: flex; align-items: center; justify-content: space-between; }
.ag-form-h h2 { font-size: 17px; font-weight: 600; }
.ag-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ag-in { width: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px; font-size: 15px; color: var(--ink); outline: none; color-scheme: dark; }
.ag-in:focus { border-color: var(--rule-2); background: var(--surface-2); }
.ag-in:disabled { opacity: .7; }
textarea.ag-in { resize: vertical; min-height: 70px; }
.ag-titulo { font-size: 17px; font-weight: 500; padding: 11px 12px; }
.ag-fila { display: flex; gap: 10px; }
.ag-fila > label { flex: 1; min-width: 0; }
.ag-form label.ag-chk { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.ag-chk input { width: 16px; height: 16px; accent-color: var(--accent); }
.ag-colores { display: flex; gap: 8px; align-items: center; height: 40px; }
.ag-col { width: 22px; height: 22px; border-radius: 99px; background: var(--c); box-shadow: 0 0 0 2px var(--side); }
.ag-col.on { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px var(--ink); }
.ag-acciones { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ag-pri { height: 38px; padding: 0 18px; border-radius: 99px; background: var(--ink); color: #000; font-weight: 600; font-size: 14.5px; }
.ag-pri:disabled { opacity: .5; }
.ag-sec { height: 38px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--rule-2); font-size: 14.5px; color: var(--ink-soft); }
.ag-borrar { height: 38px; padding: 0 14px; border-radius: 99px; color: var(--danger); font-size: 14.5px; }
.ag-borrar:hover { background: rgba(255,107,107,.1); }
@media (max-width: 1100px) { .ag-body { grid-template-columns: minmax(0, 1fr) 290px; } }
@media (max-width: 760px) {
  .agenda { overflow-y: auto; height: 100dvh; }
  .agenda .mail-top { padding-left: 8px; gap: 4px; }
  .ag-nav { margin-left: 0; }
  .ag-nueva { height: 34px; padding: 0 12px 0 10px; }
  .ag-nueva span { display: none; }
  .ag-body { display: block; flex: none; }
  .ag-cal { padding: 8px 8px 4px; }
  .ag-grid { grid-template-rows: none; grid-auto-rows: 48px; gap: 2px; }
  .ag-d { padding: 4px 0 0; align-items: center; border-radius: 8px; background: transparent; }
  .ag-d.finde { background: transparent; }
  .ag-evs { display: none; }
  .ag-dot { display: block; width: 5px; height: 5px; border-radius: 99px; background: var(--ink-soft); margin-top: 4px; }
  .ag-dows span { text-align: center; padding: 0; }
  .ag-dia { border-left: 0; border-top: 1px solid var(--rule); padding: 16px 14px calc(28px + var(--sab)); overflow: visible; }
  .ag-fila { flex-wrap: wrap; }
  .ag-modal { place-items: end center; padding: 0; }
  .ag-form { border-radius: 18px 18px 0 0; max-height: 92dvh; padding-bottom: calc(20px + var(--sab)); }
}
