/* Lupidesk · estilos (sin dependencias) */
:root {
  --bg: #f1f4fa;
  --card: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e9f2;
  --brand: #2563eb;
  --brand-d: #1e40af;
  --brand-dd: #14296b;
  --accent: #06b6d4;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(30, 64, 175, .18);
  --grad: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #0ea5e9 100%);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; letter-spacing: -.02em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
small, .muted { color: var(--muted); }
.small { font-size: .85rem; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.hide, [hidden] { display: none !important; }
.right { margin-left: auto; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.grow { flex: 1; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1460px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }
.container.mid { max-width: 980px; }
main { flex: 1; padding: 26px 0 50px; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); }

/* ---------- barra superior ---------- */
.topbar { background: var(--grad); color: #fff; box-shadow: 0 6px 20px -10px rgba(20, 41, 107, .8); position: sticky; top: 0; z-index: 50; }
.topbar .container { display: flex; align-items: center; gap: 22px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-size: 1.05rem; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: rgba(255, 255, 255, .86); padding: 8px 13px; border-radius: 9px; font-weight: 500; font-size: .93rem; display: inline-flex; align-items: center; gap: 7px; }
.nav a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .22); color: #fff; }
.nav .pill { background: #fff; color: var(--brand-d); border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 1px 7px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.topbar .who a { color: #fff; }
.topbar form { margin: 0; }
.btn-ghost-w { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .3); padding: 6px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-size: .85rem; }
.btn-ghost-w:hover { background: rgba(255, 255, 255, .28); }
.menu-toggle { display: none; }

.foot { color: var(--muted); font-size: .85rem; padding: 22px 0; text-align: center; }

/* ---------- tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-h { background: var(--grad); color: #fff; padding: 12px 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.card-h h2, .card-h h3 { margin: 0; color: #fff; font-size: 1.02rem; }
.card-h .cnt { background: rgba(255, 255, 255, .25); border-radius: 99px; padding: 0 9px; font-size: .8rem; }
.card-h a, .card-h label { color: #fff; }
.card-h.plain { background: #f7f9fd; color: var(--ink); border-bottom: 1px solid var(--line); }
.card-h.plain h2, .card-h.plain h3 { color: var(--ink); }
.card-b { padding: 18px; }
.card-f { padding: 14px 18px; border-top: 1px solid var(--line); background: #fafbfe; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; color: var(--ink); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 10px 28px -14px rgba(30, 64, 175, .45); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c, var(--brand)); }
.stat .n { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; color: var(--c, var(--brand)); line-height: 1.1; }
.stat .l { color: var(--muted); font-weight: 500; }
.stat.on { outline: 2px solid var(--c, var(--brand)); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfe; white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #f6f9ff; }
table.t tr.unread td { font-weight: 600; background: #f8fbff; }
table.t td.actions { text-align: right; white-space: nowrap; width: 1%; }
table.t .subject { font-weight: 600; color: var(--ink); }
table.t .subject:hover { color: var(--brand); }
table.t .sub { color: var(--muted); font-size: .82rem; font-weight: 400; }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 2rem; display: block; margin-bottom: 6px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; color: var(--c, #475467); background: color-mix(in srgb, var(--c, #475467) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c, #475467) 30%, #fff); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, #475467); }
.badge.flat::before { display: none; }
.urg-High { --c: #dc2626; } .urg-Medium { --c: #d97706; } .urg-Low { --c: #16a34a; }
.tag { display: inline-block; background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 0 8px; font-size: .78rem; margin: 0 3px 3px 0; }
.chip-role { background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 1px 8px; font-size: .78rem; font-weight: 600; }
.chip-role.super { background: #fef3c7; color: #92400e; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; background: var(--brand); color: #fff; transition: filter .15s, transform .05s, box-shadow .15s; text-decoration: none; line-height: 1.2; }
.btn:hover { filter: brightness(1.08); text-decoration: none; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
.btn:active { transform: translateY(1px); }
.btn.sec { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.sec:hover { background: #f6f8fc; box-shadow: none; }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); color: #111; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn.sm { padding: 5px 11px; font-size: .84rem; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 1.1rem; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: #eef2fb; color: var(--ink); text-decoration: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- menú desplegable ---------- */
.dd { position: relative; display: inline-block; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -14px rgba(16, 24, 40, .35); padding: 6px; z-index: 40; text-align: left; display: none; }
.dd.open .dd-menu { display: block; }
.dd-menu a, .dd-menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 8px; color: var(--ink); font: inherit; font-size: .9rem; background: none; border: 0; cursor: pointer; text-align: left; }
.dd-menu a:hover, .dd-menu button:hover { background: #f1f5fd; text-decoration: none; }
.dd-menu .danger { color: var(--danger); }
.dd-menu form { margin: 0; }
.dd-menu hr { margin: 5px 0; }

/* ---------- formularios ---------- */
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 5px; }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d3dbe9; border-radius: 10px; background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: -3px; }
input[type=color] { width: 54px; height: 38px; padding: 2px; border: 1px solid #d3dbe9; border-radius: 8px; background: #fff; }
.field { margin-bottom: 16px; }
.row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: repeat(3, 1fr); }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; flex: none; }
.check .hint { display: block; margin-top: 0; }
.inline-form { display: inline; margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; padding: 7px 10px; border-radius: 9px; }
.card-h .filters input, .card-h .filters select { border-color: transparent; }

/* ---------- alertas ---------- */
.alert { padding: 12px 16px; border-radius: 12px; border: 1px solid; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert ul { margin: 0; padding-left: 18px; }
.alert.success { background: #ecfdf3; border-color: #a6f4c5; color: #05603a; }
.alert.danger { background: #fef3f2; border-color: #fecdca; color: #912018; }
.alert.warning { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.alert.info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }

/* ---------- editor markdown ---------- */
.editor { border: 1px solid #d3dbe9; border-radius: 12px; background: #fff; overflow: hidden; }
.editor:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.editor .bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px; background: #f7f9fd; border-bottom: 1px solid var(--line); align-items: center; }
.editor .bar button { border: 0; background: transparent; padding: 5px 9px; border-radius: 7px; cursor: pointer; font: inherit; font-weight: 700; color: #475467; min-width: 30px; }
.editor .bar button:hover { background: #e6edfb; color: var(--brand); }
.editor .bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; }
.editor .bar .tabs { margin-left: auto; display: flex; gap: 2px; }
.editor .bar .tabs button { font-weight: 600; font-size: .82rem; }
.editor .bar .tabs button.on { background: var(--brand); color: #fff; }
.editor textarea { border: 0; border-radius: 0; box-shadow: none; min-height: 170px; display: block; }
.editor textarea:focus { box-shadow: none; }
.editor .preview { padding: 12px 14px; min-height: 170px; }

/* ---------- mensajes (hilo del ticket) ---------- */
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.msg-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: #f7f9fd; border-bottom: 1px solid var(--line); }
.msg-h .who { font-weight: 700; }
.msg-h .when { color: var(--muted); font-size: .82rem; margin-left: auto; }
.msg.staff { border-color: #b7cdfb; }
.msg.staff .msg-h { background: #e9f0fe; border-bottom-color: #cfdcf9; }
.msg.note { border-color: #f8d77a; background: #fffcf0; }
.msg.note .msg-h { background: #fff3c9; border-bottom-color: #f8e3a3; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none; }
.msg.staff .avatar { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.msg.note .avatar { background: linear-gradient(135deg, #d97706, #fbbf24); }
.msg-b { padding: 14px 18px; overflow-wrap: anywhere; }
.msg-b > :first-child { margin-top: 0; } .msg-b > :last-child { margin-bottom: 0; }
.msg-b blockquote { margin: .6em 0; padding: .1em 1em; border-left: 3px solid #bfd0f6; color: #475467; background: #f8faff; }
.msg-b pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 10px; overflow-x: auto; }
.msg-b code { background: #eef2fb; padding: 1px 5px; border-radius: 5px; }
.msg-b pre code { background: none; padding: 0; }
.msg-b img { max-width: 100%; }
.msg-b table { border-collapse: collapse; } .msg-b td, .msg-b th { border: 1px solid var(--line); padding: 4px 9px; }
.files { padding: 10px 18px 14px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: inline-flex; gap: 6px; align-items: center; background: #f3f6fd; border: 1px solid var(--line); padding: 4px 11px; border-radius: 8px; font-size: .85rem; color: var(--ink); }
.file:hover { background: #e8effc; text-decoration: none; }
.attach-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.attach-row input[type=file] { flex: 1; padding: 7px; background: #fff; border: 1px dashed #b9c5de; border-radius: 10px; font: inherit; }

/* ---------- ticket (disposición) ---------- */
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.side .card { margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.tabs-head { display: flex; gap: 4px; padding: 8px 10px 0; background: #f7f9fd; border-bottom: 1px solid var(--line); }
.tabs-head button { border: 0; background: transparent; padding: 9px 16px; font: inherit; font-weight: 600; color: var(--muted); border-radius: 10px 10px 0 0; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs-head button.on { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }
.log { font-size: .83rem; color: var(--muted); max-height: 260px; overflow: auto; }
.log div { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.stars { display: inline-flex; gap: 2px; flex-direction: row-reverse; }
.stars input { display: none; }
.stars label { font-size: 1.7rem; color: #cbd5e1; cursor: pointer; margin: 0; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f59e0b; }

/* ---------- auth / hero ---------- */
body.auth { background: var(--grad); align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 20px; padding: 32px 30px; box-shadow: 0 30px 70px -20px rgba(8, 20, 70, .7); }
.auth-card .brand { color: var(--brand-d); justify-content: center; margin-bottom: 4px; font-size: 1.4rem; }
.auth-card .brand .logo { background: var(--grad); color: #fff; width: 40px; height: 40px; font-size: 1.3rem; }
.auth-card h1 { text-align: center; font-size: 1.15rem; color: var(--muted); font-weight: 500; margin-bottom: 22px; }
.hero { background: var(--grad); color: #fff; padding: 42px 0 70px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -140px; top: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 65%); }
.hero h1 { color: #fff; font-size: 2.1rem; margin-bottom: 6px; }
.hero p { color: rgba(255, 255, 255, .86); margin: 0; font-size: 1.05rem; }
.pull { margin-top: -48px; position: relative; z-index: 2; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.dept-opt { border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; background: #fff; transition: all .15s; display: block; margin: 0; }
.dept-opt:hover { border-color: #93b4f6; }
.dept-opt input { display: none; }
.dept-opt b { display: block; } .dept-opt span { color: var(--muted); font-size: .82rem; font-weight: 400; }
.dept-opt:has(input:checked) { border-color: var(--brand); background: #eff4ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

/* ---------- paginación ---------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .88rem; }
.pager span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager a:hover { background: #eff4ff; text-decoration: none; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 18, 40, .55); display: none; place-items: center; z-index: 100; padding: 16px; backdrop-filter: blur(2px); }
.modal-bg.open { display: grid; }
.modal { background: #fff; border-radius: 16px; max-width: 440px; width: 100%; padding: 24px; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6); }
.modal h3 { margin-top: 0; }
.modal .btn-row { justify-content: flex-end; margin-top: 18px; }

.codebox { background: #0f172a; color: #cde3ff; padding: 10px 14px; border-radius: 10px; overflow-x: auto; display: block; white-space: pre; user-select: all; }
.toolbar-sel { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: .85rem; font-weight: 500; }
.toolbar-sel select { width: auto; padding: 4px 8px; border-radius: 8px; border: 0; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, .7); animation: pulse 2s infinite; display: inline-block; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

@media (max-width: 960px) {
  .ticket-grid { grid-template-columns: 1fr; }
  .row.c2, .row.c3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar .container { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .menu-toggle { display: inline-block; margin-left: auto; }
  .nav { display: none; width: 100%; order: 5; }
  .nav.open { display: flex; }
  .topbar .who { order: 4; }
  table.t th:nth-child(n+4), table.t td:nth-child(n+4) { display: none; }
  table.t td.actions, table.t th.actions { display: table-cell; }
  .hero h1 { font-size: 1.6rem; }
}


/* ============================================================================
 * INFOAL SUPPORT TICKETS (WHMCS Addon Exact Design & Components)
 * ============================================================================ */
:root {
    --ist-primary: #3b82f6;
    --ist-primary-dark: #2563eb;
    --ist-primary-light: #eff6ff;
    --ist-success: #22c55e;
    --ist-success-light: #f0fdf4;
    --ist-warning: #f59e0b;
    --ist-warning-light: #fffbeb;
    --ist-danger: #ef4444;
    --ist-danger-light: #fef2f2;
    --ist-purple: #8b5cf6;
    --ist-purple-light: #f5f3ff;
    --ist-cyan: #06b6d4;
    --ist-cyan-light: #ecfeff;
    --ist-gray-50: #f8fafc;
    --ist-gray-100: #f1f5f9;
    --ist-gray-200: #e2e8f0;
    --ist-gray-300: #cbd5e1;
    --ist-gray-400: #94a3b8;
    --ist-gray-500: #64748b;
    --ist-gray-600: #475569;
    --ist-gray-700: #334155;
    --ist-gray-800: #1e293b;
    --ist-gray-900: #0f172a;
    --ist-radius: 10px;
    --ist-radius-sm: 6px;
    --ist-radius-xs: 4px;
    --ist-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --ist-shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
}

/* Iconos integrados sin CDN externo (FontAwesome-compatible) */
.fa { display: inline-block; font-style: normal; font-variant: normal; text-rendering: auto; line-height: 1; }
.fa-ticket::before { content: "🎫"; }
.fa-sync-alt::before { content: "↻"; font-weight: 700; }
.fa-plus::before { content: "＋"; font-weight: 700; }
.fa-search::before { content: "🔍"; font-size: .9em; }
.fa-times::before { content: "✕"; font-weight: 700; }
.fa-star::before { content: "★"; }
.fa-inbox::before { content: "📥"; }
.fa-users::before { content: "👥"; }
.fa-sort::before { content: "⇅"; }
.fa-sort-up::before { content: "▲"; font-size: .85em; }
.fa-sort-down::before { content: "▼"; font-size: .85em; }
.fa-eye::before { content: "👁"; }
.fa-robot::before { content: "🤖"; }
.fa-sticky-note::before { content: "📝"; }
.fa-ellipsis-v::before { content: "⋮"; font-weight: 800; font-size: 1.15em; }
.fa-check-circle::before { content: "✔"; }
.fa-undo::before { content: "↺"; font-weight: 700; }
.fa-user-tag::before { content: "👤"; }
.fa-chevron-left::before { content: "◂"; }
.fa-chevron-right::before { content: "▸"; }
.fa-chevron-down::before { content: "▾"; }
.fa-user-check::before { content: "👤"; }
.fa-code-branch::before { content: "⑂"; font-weight: 700; }
.fa-trash-alt::before, .fa-trash::before { content: "🗑"; }
.fa-arrow-left::before { content: "←"; font-weight: 700; }
.fa-external-link-alt::before { content: "↗"; font-weight: 700; }
.fa-times-circle::before { content: "⊗"; font-weight: 700; }
.fa-user::before { content: "👤"; }
.fa-envelope::before { content: "✉"; }
.fa-building::before { content: "🏢"; }
.fa-flag::before { content: "⚑"; }
.fa-clock::before { content: "🕒"; }
.fa-reply::before { content: "↩"; font-weight: 700; }
.fa-lock::before { content: "🔒"; }
.fa-link::before { content: "🔗"; font-size: .9em; }
.fa-list-ul::before { content: "•≡"; font-weight: 700; }
.fa-list-ol::before { content: "1≡"; font-weight: 700; }
.fa-code::before { content: "</>"; font-weight: 700; font-size: .85em; }
.fa-quote-right::before { content: "❝"; font-size: 1.1em; }
.fa-question-circle::before { content: "?"; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: currentColor; color: #fff; font-size: 10px; font-weight: 700; }
.fa-paper-plane::before { content: "➤"; }
.fa-cloud-upload-alt::before { content: "☁"; font-size: 1.2em; }
.fa-pencil-alt::before { content: "✎"; }
.fa-save::before { content: "💾"; }
.fa-check::before { content: "✓"; font-weight: 700; }
.fa-paperclip::before { content: "📎"; }
.fa-search-plus::before { content: "🔍"; }
.fa-download::before { content: "⬇"; }
.fa-cog::before { content: "⚙"; }
.fa-thumbtack::before { content: "📌"; }
.fa-copy::before { content: "📋"; }
.fa-plus-circle::before { content: "⊕"; font-weight: 700; }
.fa-list-alt::before { content: "📋"; }
.fa-book::before { content: "📖"; }
.fa-exclamation-circle::before { content: "⚠"; }
.fa-user-clock::before { content: "👤"; }
.fa-file::before, .fa-file-alt::before { content: "📄"; }
.fa-file-pdf::before { content: "📕"; }
.fa-file-word::before { content: "📘"; }
.fa-file-excel::before { content: "📗"; }
.fa-file-archive::before { content: "🗜"; }

.ist-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ist-gray-800);
    max-width: 100%;
    line-height: 1.5;
    font-size: 14px;
}
.ist-wrap * { box-sizing: border-box; }

/* Alertas Infoal */
.ist-alert {
    padding: 12px 16px; border-radius: var(--ist-radius-sm); margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 13px;
    animation: istSlideDown .25s ease;
}
@keyframes istSlideDown { from { opacity:0; transform: translateY(-6px); } to { opacity:1; transform: translateY(0); } }
.ist-alert-success { background: var(--ist-success-light); color: #15803d; border: 1px solid #bbf7d0; }
.ist-alert-error   { background: var(--ist-danger-light);  color: #b91c1c; border: 1px solid #fecaca; }

/* Topbar */
.ist-topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.ist-topbar-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 20px; font-weight: 700; color: var(--ist-gray-900); margin: 0;
}
.ist-topbar-title .ist-icon {
    width: 36px; height: 36px; background: var(--ist-primary); color: #fff;
    border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px;
}

/* Stat cards */
.ist-stats { display: flex; gap: 10px; margin-bottom: 0; }
.ist-stat-card {
    background: #fff; border-radius: var(--ist-radius) var(--ist-radius) 0 0;
    padding: 14px 18px; border: 1px solid var(--ist-gray-200); border-bottom: 2px solid var(--ist-gray-200);
    transition: all .15s; cursor: pointer; text-decoration: none !important; color: inherit !important;
    position: relative; overflow: hidden; flex: 1; text-align: center;
}
.ist-stat-card-lg { flex: 2; }
.ist-stat-card:hover { background: var(--ist-gray-50); text-decoration: none !important; }
.ist-stat-card.active {
    background: var(--ist-primary-light);
    border-color: var(--ist-primary);
    border-bottom: 2px solid var(--ist-primary-light);
    z-index: 2; margin-bottom: -1px;
}
.ist-stat-card .ist-stat-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.ist-stat-card .ist-stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; margin-bottom: 2px; }
.ist-stat-card-lg .ist-stat-num { font-size: 32px; }
.ist-stat-card .ist-stat-label { font-size: 12px; color: var(--ist-gray-500); font-weight: 600; }
.ist-stat-card.active .ist-stat-label { color: var(--ist-primary-dark); font-weight: 700; }

/* Filter bar */
.ist-filters {
    background: #fff; border-radius: 0 0 var(--ist-radius) var(--ist-radius); padding: 14px 18px;
    border: 1px solid var(--ist-gray-200); box-shadow: var(--ist-shadow);
    margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.ist-filter-group {
    display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 140px;
}
.ist-filter-group label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--ist-gray-500); margin: 0;
}
.ist-filter-group input, .ist-filter-group select {
    height: 36px; padding: 0 10px; border: 1px solid var(--ist-gray-300);
    border-radius: var(--ist-radius-sm); font-size: 13px; color: var(--ist-gray-800);
    background: #fff; transition: border-color .15s; width: 100%;
}
.ist-filter-group input:focus, .ist-filter-group select:focus {
    outline: none; border-color: var(--ist-primary); box-shadow: 0 0 0 2px rgba(59,130,246,.12);
}

/* Botones Infoal */
.ist-btn {
    display: inline-flex; align-items: center; gap: 5px;
    height: 36px; padding: 0 14px; border-radius: var(--ist-radius-sm);
    font-size: 13px; font-weight: 600; border: none; cursor: pointer;
    transition: all .15s; text-decoration: none !important; white-space: nowrap;
}
.ist-btn-primary { background: var(--ist-primary); color: #fff !important; }
.ist-btn-primary:hover { background: var(--ist-primary-dark); }
.ist-btn-success { background: var(--ist-success); color: #fff !important; }
.ist-btn-success:hover { background: #16a34a; }
.ist-btn-danger  { background: var(--ist-danger); color: #fff !important; }
.ist-btn-danger:hover  { background: #dc2626; }
.ist-btn-warning { background: var(--ist-warning); color: #fff !important; }
.ist-btn-outline {
    background: #fff; color: var(--ist-gray-700) !important;
    border: 1px solid var(--ist-gray-300);
}
.ist-btn-outline:hover { background: var(--ist-gray-50); border-color: var(--ist-gray-400); }
.ist-btn-ghost { background: transparent; color: var(--ist-gray-600) !important; padding: 0 8px; }
.ist-btn-ghost:hover { background: var(--ist-gray-100); color: var(--ist-gray-800) !important; }
.ist-btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.ist-btn-xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: var(--ist-radius-xs); }

/* Tabla de tickets */
.ist-table-wrap {
    background: #fff; border-radius: var(--ist-radius);
    border: 1px solid var(--ist-gray-200); box-shadow: var(--ist-shadow); overflow: visible;
}
.ist-table-header {
    padding: 12px 18px; border-bottom: 1px solid var(--ist-gray-200);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    border-radius: var(--ist-radius) var(--ist-radius) 0 0;
}
.ist-table-header h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ist-gray-800); }
.ist-table { width: 100%; border-collapse: collapse; }
.ist-table th {
    padding: 9px 14px; text-align: left; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px; color: var(--ist-gray-500);
    background: var(--ist-gray-50); border-bottom: 1px solid var(--ist-gray-200); white-space: nowrap;
}
.ist-th-sort {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--ist-gray-500) !important; text-decoration: none !important;
    cursor: pointer; user-select: none; transition: color .12s;
}
.ist-th-sort:hover { color: var(--ist-primary) !important; }
.ist-th-sort.active { color: var(--ist-primary) !important; font-weight: 800; }
.ist-sort-icon { font-size: 10px; opacity: .35; transition: opacity .12s; }
.ist-th-sort:hover .ist-sort-icon { opacity: .7; }
.ist-sort-icon.active { opacity: 1; color: var(--ist-primary); }
.ist-table td {
    padding: 11px 14px; border-bottom: 1px solid var(--ist-gray-100);
    font-size: 13px; vertical-align: middle;
}
.ist-table tr:last-child td { border-bottom: none; }
.ist-table tr:hover td { background: var(--ist-gray-50); }
.ist-table tr.ist-unread td { background: #eff6ff; }
.ist-table tr.ist-unread td:first-child { border-left: 3px solid var(--ist-primary); }
.ist-table tr.ist-row-other td { background: #fff0f0; }
.ist-table tr.ist-row-other:hover td { background: #ffe4e4; }

/* Vista previa hover último mensaje */
.ist-prev-wrap {
    position: relative; display: inline-flex; align-items: center;
    margin-left: 5px; vertical-align: middle; cursor: pointer;
}
.ist-prev-icon {
    color: var(--ist-gray-400); font-size: 13px; padding: 2px 5px;
    border-radius: 4px; transition: all .15s;
}
.ist-prev-wrap:hover .ist-prev-icon { color: var(--ist-primary); background: var(--ist-primary-light); }
.ist-prev-card {
    display: none; position: fixed;
    width: 480px; max-width: 90vw; background: #fff; border: 1px solid var(--ist-gray-200);
    border-radius: var(--ist-radius-sm); box-shadow: 0 12px 32px rgba(0,0,0,.18);
    padding: 14px 16px; z-index: 99999; font-weight: 400; text-align: left;
    line-height: 1.5; pointer-events: none;
}
.ist-prev-wrap:hover .ist-prev-card { display: block; animation: istFadeIn .15s ease; }
@keyframes istFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ist-prev-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--ist-gray-100);
    font-size: 11px; color: var(--ist-gray-500);
}
.ist-prev-author { font-weight: 700; color: var(--ist-gray-800); display: flex; align-items: center; gap: 5px; font-size: 12px; }
.ist-prev-badge-client { background: #dbeafe; color: #1d4ed8; padding: 1px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.ist-prev-badge-admin { background: #dcfce7; color: #15803d; padding: 1px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.ist-prev-body {
    font-size: 12.5px; color: var(--ist-gray-700); white-space: pre-line;
    max-height: 280px; overflow: hidden; word-break: break-word;
}
.ist-note-icon {
    color: #db2777; font-size: 13px; padding: 2px 5px;
    border-radius: 4px; transition: all .15s; background: #fdf2f8;
}
.ist-note-wrap:hover .ist-note-icon { color: #fff; background: #ec4899; }
.ist-note-card { border-color: #f9a8d4 !important; background: #fffbfd !important; }
.ist-prev-badge-note { background: #fce7f3; color: #be185d; padding: 1px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; text-transform: uppercase; }

/* Menú de acciones rápidas (⋮) */
.ist-qa-wrap { position: relative; display: inline-block; }
.ist-qa-btn {
    width: 30px; height: 30px; border-radius: var(--ist-radius-sm);
    border: 1px solid transparent; background: transparent; color: var(--ist-gray-500);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; transition: all .15s;
}
.ist-qa-btn:hover, .ist-qa-wrap.open .ist-qa-btn {
    background: var(--ist-gray-100); border-color: var(--ist-gray-300); color: var(--ist-gray-800);
}
.ist-qa-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px);
    min-width: 210px; background: #fff; border: 1px solid var(--ist-gray-200);
    border-radius: var(--ist-radius-sm); box-shadow: 0 10px 25px rgba(0,0,0,.14);
    z-index: 9999; padding: 4px 0; text-align: left;
}
.ist-qa-wrap.open .ist-qa-menu { display: block; animation: istSlideDown .12s ease; }
.ist-qa-item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; padding: 8px 14px; font-size: 12.5px; font-weight: 500;
    color: var(--ist-gray-700); background: none; border: none; text-align: left;
    cursor: pointer; text-decoration: none !important; transition: background .1s; white-space: nowrap;
}
.ist-qa-item:hover { background: var(--ist-primary-light); color: var(--ist-primary-dark); }
.ist-qa-item.danger { color: var(--ist-danger); }
.ist-qa-item.danger:hover { background: var(--ist-danger-light); color: #b91c1c; }
.ist-qa-divider { height: 1px; background: var(--ist-gray-100); margin: 4px 0; }
.ist-qa-sub-wrap { position: relative; }
.ist-qa-sub {
    display: none; position: absolute; right: 100%; top: -4px;
    min-width: 220px; max-height: 280px; overflow-y: auto;
    background: #fff; border: 1px solid var(--ist-gray-200);
    border-radius: var(--ist-radius-sm); box-shadow: 0 10px 25px rgba(0,0,0,.14);
    padding: 4px 0; z-index: 10000;
}
.ist-qa-sub-wrap:hover > .ist-qa-sub { display: block; }
.ist-qa-sub-header {
    padding: 5px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase;
    color: var(--ist-gray-400); letter-spacing: .5px; border-bottom: 1px solid var(--ist-gray-100);
}

/* Badges de estado Infoal */
.ist-status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 11px;
    font-weight: 600; white-space: nowrap;
}
.ist-status-open           { background: #dbeafe; color: #1d4ed8; }
.ist-status-answered       { background: #dcfce7; color: #15803d; }
.ist-status-customer-reply { background: #fef3c7; color: #92400e; }
.ist-status-on-hold        { background: #ede9fe; color: #5b21b6; }
.ist-status-in-progress    { background: #cffafe; color: #0e7490; }
.ist-status-closed         { background: #f1f5f9; color: #475569; }

.ist-priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ist-priority-Low    { background: var(--ist-success); }
.ist-priority-Medium { background: var(--ist-warning); }
.ist-priority-High   { background: var(--ist-danger); }

.ist-tid {
    font-family: "SFMono-Regular", Consolas, monospace; font-weight: 700;
    color: var(--ist-primary-dark); font-size: 12px; background: var(--ist-primary-light);
    padding: 2px 7px; border-radius: var(--ist-radius-xs); text-decoration: none !important;
}
.ist-tid:hover { background: #dbeafe; }
.ist-subject-link { color: var(--ist-gray-900) !important; font-weight: 600; text-decoration: none !important; transition: color .12s; }
.ist-subject-link:hover { color: var(--ist-primary) !important; }
.ist-meta-sub { font-size: 11px; color: var(--ist-gray-400); margin-top: 1px; }
.ist-flag-badge {
    font-size: 11px; background: var(--ist-purple-light); color: var(--ist-purple);
    padding: 2px 7px; border-radius: var(--ist-radius-xs); font-weight: 600;
}

/* Paginación Infoal */
.ist-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; border-top: 1px solid var(--ist-gray-200);
    font-size: 12px; color: var(--ist-gray-500); flex-wrap: wrap; gap: 10px;
}
.ist-page-btns { display: flex; gap: 3px; }
.ist-page-btn {
    min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex;
    align-items: center; justify-content: center; border-radius: var(--ist-radius-xs);
    border: 1px solid var(--ist-gray-200); background: #fff; color: var(--ist-gray-700) !important;
    font-size: 12px; font-weight: 600; text-decoration: none !important; transition: all .12s;
}
.ist-page-btn:hover { background: var(--ist-gray-100); }
.ist-page-btn.active { background: var(--ist-primary); color: #fff !important; border-color: var(--ist-primary); }
.ist-page-btn.disabled { opacity: .4; pointer-events: none; }

/* ============== VISTA DETALLE DE TICKET ============== */
.ist-detail-grid {
    display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start;
}
@media (max-width: 1024px) { .ist-detail-grid { grid-template-columns: 1fr; } }

.ist-ticket-header {
    background: #fff; border-radius: var(--ist-radius); padding: 18px 22px;
    border: 1px solid var(--ist-gray-200); box-shadow: var(--ist-shadow); margin-bottom: 18px;
}
.ist-ticket-header-top {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.ist-ticket-title { font-size: 21px; font-weight: 800; color: var(--ist-gray-900); margin: 4px 0 0; line-height: 1.3; }
.ist-ticket-meta {
    display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid var(--ist-gray-100); font-size: 13px; color: var(--ist-gray-500);
}
.ist-ticket-meta-item { display: flex; align-items: center; gap: 6px; }
.ist-ticket-meta-item strong { color: var(--ist-gray-700); }

/* Mensajes en el hilo */
.ist-message {
    border-radius: var(--ist-radius); margin-bottom: 12px; overflow: hidden;
    box-shadow: var(--ist-shadow); transition: box-shadow .15s;
}
.ist-message:hover { box-shadow: var(--ist-shadow-md); }
.ist-message-admin { background: #fcf8e3; border: 1px solid #f0e6a0; border-left: 4px solid #c9a227; }
.ist-message-admin .ist-message-head { background: rgba(201,162,39,.10); border-bottom: 1px solid #ede29b; }
.ist-message-client { background: #d9edf7; border: 1px solid #b8d9ed; border-left: 4px solid #5b9dc9; }
.ist-message-client .ist-message-head { background: rgba(91,157,201,.10); border-bottom: 1px solid #b0d4ea; }
.ist-message-note { background: #fde8f0; border: 1px solid #f5c0d8; border-left: 4px solid #ec4899; }
.ist-message-note .ist-message-head { background: rgba(236,72,153,.08); border-bottom: 1px solid #f3b8d2; }

.ist-message-head {
    padding: 11px 22px; display: flex; align-items: center;
    justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.ist-message-author {
    display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ist-gray-800);
}
.ist-author-badge {
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 3px;
    text-transform: uppercase; letter-spacing: .3px;
}
.ist-badge-staff  { background: #dbeafe; color: #1d4ed8; }
.ist-badge-client { background: #dcfce7; color: #15803d; }
.ist-badge-note   { background: #fce7f3; color: #be185d; }
.ist-message-right { display: flex; align-items: center; gap: 6px; }
.ist-message-date { font-size: 12.5px; color: var(--ist-gray-500); }
.ist-message-body {
    padding: 18px 24px; font-size: 15px; line-height: 1.75; color: var(--ist-gray-700); word-break: break-word;
}
.ist-message-body p { margin: 0 0 8px; }
.ist-message-body p:last-child { margin-bottom: 0; }
.ist-message-body pre, .ist-message-body code {
    background: rgba(0,0,0,.05); border-radius: 3px; padding: 1px 5px; font-size: 12px;
    font-family: "SFMono-Regular", Consolas, monospace;
}
.ist-message-body pre { padding: 10px; overflow-x: auto; }
.ist-message-body blockquote {
    border-left: 3px solid var(--ist-gray-400); margin: 8px 0; padding: 4px 12px;
    color: var(--ist-gray-500); background: rgba(0,0,0,.03); border-radius: 0 4px 4px 0;
}

.ist-msg-action {
    background: none; border: none; cursor: pointer; padding: 2px 6px;
    border-radius: 3px; font-size: 11px; color: var(--ist-gray-400); transition: all .12s;
}
.ist-msg-action:hover { background: rgba(0,0,0,.07); color: var(--ist-gray-700); }
.ist-msg-action-edit {
    background: #fff; border: 1px solid var(--ist-gray-300); cursor: pointer;
    padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;
    color: var(--ist-gray-700); transition: all .12s; display: inline-flex; align-items: center; gap: 4px;
}
.ist-msg-action-edit:hover { background: var(--ist-gray-100); border-color: var(--ist-gray-400); }
.ist-msg-action-delete {
    background: #ef4444; border: 1px solid #dc2626; cursor: pointer;
    padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;
    color: #fff; transition: all .12s; display: inline-flex; align-items: center; gap: 4px;
}
.ist-msg-action-delete:hover { background: #dc2626; }

.ist-inline-edit { display: none; padding: 12px 18px 16px; border-top: 1px solid rgba(0,0,0,.08); }
.ist-inline-edit.active { display: block; }
.ist-inline-edit textarea {
    width: 100%; min-height: 100px; padding: 10px; border: 1px solid var(--ist-gray-300);
    border-radius: var(--ist-radius-sm); font-size: 13px; font-family: inherit; resize: vertical;
}

.ist-attachments {
    padding: 12px 22px; border-top: 1px solid rgba(0,0,0,.06);
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start;
}
.ist-att-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.1);
    border-radius: var(--ist-radius-xs); font-size: 12px; color: var(--ist-gray-700) !important;
    text-decoration: none !important; transition: all .12s;
}
.ist-att-badge:hover { background: #fff; border-color: var(--ist-primary); color: var(--ist-primary) !important; }
.ist-att-image-card {
    display: flex; flex-direction: column; background: #fff;
    border: 1px solid var(--ist-gray-200); border-radius: var(--ist-radius-sm);
    overflow: hidden; box-shadow: var(--ist-shadow); max-width: 220px; transition: all .15s;
}
.ist-att-image-card:hover { border-color: var(--ist-primary); box-shadow: var(--ist-shadow-md); }
.ist-att-image-thumb-wrap {
    position: relative; width: 220px; height: 140px; background: var(--ist-gray-100);
    overflow: hidden; cursor: zoom-in; display: flex; align-items: center; justify-content: center;
}
.ist-att-image-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.ist-att-image-card:hover .ist-att-image-thumb { transform: scale(1.04); }
.ist-att-image-zoom {
    position: absolute; bottom: 6px; right: 6px; background: rgba(15,23,42,.7);
    color: #fff; width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 11px; opacity: 0; transition: opacity .15s;
}
.ist-att-image-card:hover .ist-att-image-zoom { opacity: 1; }
.ist-att-image-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 6px 10px; font-size: 11px; background: #fff; border-top: 1px solid var(--ist-gray-100);
}
.ist-att-image-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ist-gray-700); font-weight: 500; flex: 1; }
.ist-att-image-dl { color: var(--ist-primary) !important; font-size: 12px; padding: 2px 5px; border-radius: 3px; text-decoration: none !important; flex-shrink: 0; }
.ist-att-image-dl:hover { background: var(--ist-primary-light); }

.ist-lightbox-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.85);
    z-index: 100000; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.ist-lightbox-overlay.open { display: flex; animation: istFadeIn .15s ease; }
.ist-lightbox-inner {
    position: relative; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; cursor: default;
}
.ist-lightbox-img {
    max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: var(--ist-radius-sm);
    box-shadow: 0 20px 50px rgba(0,0,0,.5); background: #fff;
}
.ist-lightbox-bar {
    margin-top: 10px; display: flex; align-items: center; gap: 14px; color: #fff; font-size: 13px; font-weight: 600;
}
.ist-lightbox-close {
    position: fixed; top: 18px; right: 24px; width: 40px; height: 40px;
    border-radius: 50%; background: rgba(255,255,255,.15); color: #fff;
    border: none; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ist-lightbox-close:hover { background: rgba(255,255,255,.3); }

/* Área de respuesta / nota con Markdown */
.ist-reply-area {
    background: #fff; border-radius: var(--ist-radius); padding: 18px 22px;
    border: 1px solid var(--ist-gray-200); box-shadow: var(--ist-shadow); margin-bottom: 18px;
}
.ist-reply-tabs {
    display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid var(--ist-gray-200);
}
.ist-reply-tab {
    padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--ist-gray-500);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all .15s; background: none; border-top: none; border-left: none; border-right: none;
    border-radius: 6px 6px 0 0;
}
.ist-reply-tab:hover { color: var(--ist-gray-800); }
.ist-reply-tab.active { color: var(--ist-primary); border-bottom-color: var(--ist-primary); }
.ist-reply-tab.active-note { color: #db2777; border-bottom-color: #ec4899; background: #fdf2f8; }
.ist-reply-area.note-mode { border-color: #f9a8d4; background: #fffbfd; }
.ist-reply-area.note-mode .ist-md-editor { border-color: #f472b6; }
.ist-reply-area.note-mode .ist-md-toolbar { background: #fdf2f8; border-bottom-color: #fbcfe8; }
.ist-reply-area.note-mode .ist-md-textarea { background: #fff5f9; }
.ist-reply-area.note-mode .ist-md-footer { background: #fdf2f8; border-top-color: #fbcfe8; }
.ist-btn-pink { background: #ec4899; color: #fff !important; }
.ist-btn-pink:hover { background: #db2777; }

.ist-md-editor { border: 1px solid var(--ist-gray-300); border-radius: var(--ist-radius-sm); overflow: hidden; }
.ist-md-editor:focus-within { border-color: var(--ist-primary); box-shadow: 0 0 0 2px rgba(59,130,246,.12); }
.ist-md-toolbar {
    display: flex; align-items: center; gap: 2px; padding: 6px 8px;
    background: var(--ist-gray-50); border-bottom: 1px solid var(--ist-gray-200); flex-wrap: wrap;
}
.ist-md-btn {
    width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 1px solid transparent; border-radius: var(--ist-radius-xs);
    color: var(--ist-gray-600); cursor: pointer; font-size: 13px; transition: all .1s;
}
.ist-md-btn:hover { background: #fff; border-color: var(--ist-gray-300); color: var(--ist-gray-900); }
.ist-md-sep { width: 1px; height: 18px; background: var(--ist-gray-200); margin: 0 4px; }
.ist-md-preview-btn {
    padding: 3px 10px; height: 26px; display: inline-flex; align-items: center; gap: 5px;
    background: var(--ist-primary); color: #fff !important; border: none;
    border-radius: var(--ist-radius-xs); font-size: 11px; font-weight: 600; cursor: pointer; transition: all .12s;
}
.ist-md-preview-btn:hover { background: var(--ist-primary-dark); }
.ist-md-preview-btn.active { background: var(--ist-gray-700); }
.ist-md-help-btn {
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--ist-gray-500); cursor: pointer; font-size: 14px; border-radius: 50%;
}
.ist-md-help-btn:hover { color: var(--ist-gray-800); background: var(--ist-gray-200); }

.ist-md-textarea {
    width: 100%; min-height: 220px; padding: 12px 14px; border: none;
    font-size: 13px; font-family: inherit; line-height: 1.6; resize: vertical; color: var(--ist-gray-800); background: #fff;
}
.ist-md-textarea:focus { outline: none; box-shadow: none; }
.ist-md-preview {
    display: none; min-height: 220px; padding: 12px 14px;
    font-size: 13px; line-height: 1.7; color: var(--ist-gray-700); background: #fafbfc;
}
.ist-md-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 12px; background: var(--ist-gray-50); border-top: 1px solid var(--ist-gray-100);
    font-size: 11px; color: var(--ist-gray-400);
}

/* Modal Guía Markdown */
.ist-modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 99999; align-items: center; justify-content: center;
}
.ist-modal-overlay.open { display: flex; }
.ist-modal {
    background: #fff; border-radius: var(--ist-radius); width: 580px; max-width: 92vw;
    max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.ist-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--ist-gray-200);
}
.ist-modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.ist-modal-close { background: none; border: none; font-size: 20px; color: var(--ist-gray-400); cursor: pointer; padding: 4px 8px; }
.ist-modal-close:hover { color: var(--ist-gray-800); }
.ist-modal-body { padding: 18px 22px; font-size: 13px; line-height: 1.6; }
.ist-modal-body h4 { margin: 16px 0 8px; font-size: 14px; font-weight: 700; color: var(--ist-gray-800); border-bottom: 1px solid var(--ist-gray-100); padding-bottom: 4px; }
.ist-modal-body h4:first-child { margin-top: 0; }
.ist-md-example {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    background: var(--ist-gray-50); border-radius: var(--ist-radius-sm);
    padding: 8px 12px; margin-bottom: 8px; font-size: 12px;
}
.ist-md-example code { background: none; padding: 0; font-size: 12px; color: var(--ist-gray-700); }

.ist-reply-options {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px;
}
@media (max-width: 768px) { .ist-reply-options { grid-template-columns: repeat(2, 1fr); } }
.ist-reply-options select {
    height: 34px; padding: 0 8px; border: 1px solid var(--ist-gray-300);
    border-radius: var(--ist-radius-sm); font-size: 12px; color: var(--ist-gray-700); background: #fff;
}
.ist-reply-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ist-gray-100); flex-wrap: wrap; gap: 10px;
}

.ist-dropzone {
    margin-top: 12px; border: 2px dashed var(--ist-gray-300);
    border-radius: var(--ist-radius-sm); background: var(--ist-gray-50);
    padding: 16px; text-align: center; cursor: pointer; transition: all .15s; position: relative;
}
.ist-dropzone:hover, .ist-dropzone.dragover { border-color: var(--ist-primary); background: var(--ist-primary-light); }
.ist-dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ist-dropzone-title { font-size: 13px; font-weight: 600; color: var(--ist-gray-700); display: flex; align-items: center; justify-content: center; gap: 8px; }
.ist-dropzone-title span { color: var(--ist-primary); text-decoration: underline; }
.ist-dropzone-sub { font-size: 11px; color: var(--ist-gray-400); margin-top: 3px; }
.ist-file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ist-file-item {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--ist-gray-200);
    border-radius: var(--ist-radius-sm); padding: 5px 10px;
    font-size: 12px; color: var(--ist-gray-700); box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.ist-file-thumb { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; border: 1px solid var(--ist-gray-200); }
.ist-file-size { font-size: 10px; color: var(--ist-gray-400); }
.ist-file-remove {
    background: none; border: none; color: var(--ist-gray-400);
    cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px;
}
.ist-file-remove:hover { color: var(--ist-danger); }

/* Sidebar derecha */
.ist-sidebar-card {
    background: #fff; border-radius: var(--ist-radius); padding: 16px 18px;
    border: 1px solid var(--ist-gray-200); box-shadow: var(--ist-shadow); margin-bottom: 14px;
}
.ist-sidebar-card h4 {
    margin: 0 0 12px; font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--ist-gray-500);
    padding-bottom: 8px; border-bottom: 1px solid var(--ist-gray-100);
}
.ist-sidebar-field { margin-bottom: 10px; }
.ist-sidebar-field:last-child { margin-bottom: 0; }
.ist-sidebar-field label {
    display: block; font-size: 11px; font-weight: 600; color: var(--ist-gray-500); margin-bottom: 3px;
}
.ist-sidebar-field select, .ist-sidebar-field input {
    width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--ist-gray-300);
    border-radius: var(--ist-radius-sm); font-size: 12px; color: var(--ist-gray-800); background: #fff;
}

.ist-tag-input {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    min-height: 36px; padding: 4px 6px; border: 1px solid var(--ist-gray-300);
    border-radius: var(--ist-radius-sm); background: #fff; cursor: text; transition: border-color .15s;
}
.ist-tag-input:focus-within { border-color: var(--ist-primary); box-shadow: 0 0 0 2px rgba(59,130,246,.12); }
.ist-tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--ist-primary-light); color: var(--ist-primary-dark);
    border: 1px solid #bfdbfe; border-radius: 4px;
    padding: 2px 6px; font-size: 11px; font-weight: 600; max-width: 100%; word-break: break-all;
}
.ist-tag-chip button {
    background: none; border: none; color: var(--ist-primary-dark);
    cursor: pointer; font-size: 13px; line-height: 1; padding: 0 1px; opacity: .7;
}
.ist-tag-chip button:hover { opacity: 1; color: var(--ist-danger); }
.ist-tag-input input {
    border: none !important; outline: none !important; box-shadow: none !important;
    flex: 1; min-width: 90px; height: 24px !important; padding: 0 4px !important; font-size: 12px !important; background: transparent !important;
}

/* Sticky Note */
.ist-stickynote-box {
    background: #fef9c3; border: 1px solid #fde047; border-left: 4px solid #eab308;
    border-radius: var(--ist-radius-sm); padding: 10px 12px;
    font-size: 12.5px; color: #713f12; line-height: 1.55; word-break: break-word;
}
.ist-sticky-link { color: #1d4ed8 !important; font-weight: 600; text-decoration: underline !important; word-break: break-all; }
.ist-sticky-link:hover { color: #1e40af !important; background: rgba(59,130,246,.1); border-radius: 2px; }
.ist-stickynote-meta {
    margin-top: 6px; padding-top: 5px; border-top: 1px dashed #fde047;
    font-size: 10px; color: #a16207; display: flex; justify-content: space-between;
}
.ist-stickynote-empty {
    font-size: 12px; color: var(--ist-gray-400); text-align: center;
    padding: 10px; border: 1px dashed var(--ist-gray-300); border-radius: var(--ist-radius-sm);
    cursor: pointer; transition: all .15s;
}
.ist-stickynote-empty:hover { border-color: #eab308; color: #a16207; background: #fefce8; }

.ist-collapsible-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none; margin: 0 !important; padding-bottom: 0 !important; border-bottom: none !important;
}
.ist-collapsible-header .ist-chevron { transition: transform .2s; font-size: 11px; color: var(--ist-gray-400); }
.ist-collapsible-card.open .ist-collapsible-header {
    margin-bottom: 12px !important; padding-bottom: 8px !important; border-bottom: 1px solid var(--ist-gray-100) !important;
}
.ist-collapsible-card.open .ist-collapsible-header .ist-chevron { transform: rotate(180deg); }
.ist-collapsible-body { display: none; }
.ist-collapsible-card.open .ist-collapsible-body { display: block; }

/* Typing banner & @mention dropdown */
.ist-typing-banner {
    display: none; align-items: center; gap: 10px;
    background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid #f59e0b;
    color: #92400e; padding: 10px 16px; border-radius: var(--ist-radius-sm);
    margin-bottom: 14px; font-size: 13px; font-weight: 600; animation: istSlideDown .2s ease;
}
.ist-typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.ist-typing-dots span {
    width: 6px; height: 6px; border-radius: 50%; background: #d97706;
    animation: istBounce 1.2s infinite ease-in-out;
}
.ist-typing-dots span:nth-child(2) { animation-delay: .2s; }
.ist-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes istBounce { 0%, 80%, 100% { transform: scale(0.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.ist-at-dropdown {
    display: none; position: fixed; background: #fff; border: 1px solid #f9a8d4;
    border-radius: var(--ist-radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 99999; max-height: 200px; overflow-y: auto; min-width: 220px; padding: 4px 0;
}
.ist-at-item {
    padding: 7px 12px; font-size: 12.5px; cursor: pointer; display: flex;
    align-items: center; justify-content: space-between; gap: 8px; color: var(--ist-gray-800);
}
.ist-at-item:hover, .ist-at-item.active { background: #fdf2f8; color: #db2777; font-weight: 600; }

/* Client live search dropdown in New Ticket */
.ist-client-results {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    background: #fff; border: 1px solid var(--ist-gray-200); border-radius: var(--ist-radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto; z-index: 999;
}
.ist-client-result-item {
    padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--ist-gray-100); font-size: 12.5px;
}
.ist-client-result-item:hover { background: var(--ist-primary-light); }

/* Empty state */
.ist-empty { text-align: center; padding: 40px 20px; color: var(--ist-gray-400); }
.ist-empty-icon { font-size: 40px; margin-bottom: 8px; opacity: .4; }
.ist-empty-text { font-size: 15px; font-weight: 600; color: var(--ist-gray-500); }
