:root { --blue: #1f6fb5; --blue-dark: #185a94; --brand: #4a9fdc; --sky: #eaf4fc; --ink: #1d1d1f; --gray: #757679; --muted: #6e6e73; --line: #e5e5ea; --bg: #f5f5f7; --white: #fff; --radius: 16px; }
* { box-sizing: border-box; }
html { font-size: 62.5%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; font-size: 1.7rem; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: clamp(2.6rem, 3vw, 3.4rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 2rem; }
code { background: var(--sky); padding: 2px 6px; border-radius: 6px; font-size: 1.6rem; }
[hidden] { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 28px; padding-bottom: 64px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: 1.45rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.inline { display: inline; }
.narrow { max-width: 760px; margin: 0 auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: 1.3rem; font-weight: 600; color: var(--blue); margin: 0 0 6px; }
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 500; }

/* Encabezado */
.top { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top__in { display: flex; align-items: center; gap: 24px; min-height: 68px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand__name { font-weight: 700; letter-spacing: -.01em; color: var(--ink); font-size: 2.1rem; }
.brand__sub { color: var(--blue); font-weight: 600; font-size: 1.5rem; }
.nav { display: flex; gap: 6px; align-items: center; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: 1.6rem; }
.nav a.on, .nav a:hover { background: var(--sky); color: var(--blue); }
.nav a.btn { color: #fff; }
.who { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 1.45rem; }
.who__name { font-weight: 600; }
.who__co { color: var(--muted); }
.who__link { color: var(--blue); text-decoration: none; font-size: 1.45rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 1.6rem; text-decoration: none; border: 1px solid transparent; cursor: pointer; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); }
.btn--outline { border-color: var(--blue); color: var(--blue); background: #fff; }
.btn--outline:hover { background: var(--sky); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 1.5rem; }
.btn--block { width: 100%; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Tarjetas y formularios */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 1.55rem; }
.field legend { margin-bottom: 8px; }
.req { color: var(--blue); }
input[type=text], input:not([type]), input[type=email], input[type=password], input[type=search], select, textarea { width: 100%; min-height: 50px; padding: 11px 14px; font: inherit; font-size: 1.65rem; border: 1px solid #c7c7cc; border-radius: 12px; background: #fff; color: var(--ink); }
textarea { resize: vertical; min-height: 120px; }
input[type=file] { font-size: 1.5rem; }
.hint { font-size: 1.4rem; color: var(--muted); margin: 2px 0 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 20px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 720px) { .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-weight: 400 !important; }
.choice:has(input:checked) { border-color: var(--blue); background: var(--sky); }
.choice input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.choice strong { display: block; }
.choice small { color: var(--muted); font-size: 1.4rem; }
.check { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; font-size: 1.55rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.note { background: var(--sky); border-radius: 12px; padding: 14px 16px; margin: 0 0 18px; font-size: 1.55rem; }
.flash { border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; font-weight: 500; }
.flash--ok { background: #e8f6ee; color: #145c32; }
.flash--error { background: #fdecec; color: #8a1c1c; }
.inlineform { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.inlineform .field { margin: 0; }
.grow { flex: 1; min-width: 220px; }
.created { border-color: var(--blue); background: var(--sky); }
details > summary { cursor: pointer; font-size: 1.7rem; }
details[open] > summary { margin-bottom: 18px; }

/* Login */
.auth { max-width: 440px; margin: 6vh auto 0; }
.auth__brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.auth__brand .brand__name { font-size: 3rem; }
.auth__tag { background: var(--brand); color: #fff; font-size: 1.1rem; letter-spacing: .2em; padding: 2px 10px; margin-top: 4px; font-weight: 600; }
.auth__card { padding: 32px; }

/* Encabezado de página, pestañas, estadísticas */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { text-decoration: none; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--blue); border-color: var(--blue); }
.count { background: var(--bg); border-radius: 999px; padding: 1px 8px; font-size: 1.3rem; margin-left: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; font-size: 1.45rem; }
.stat__n { font-size: 3rem; font-weight: 700; color: var(--blue); line-height: 1.1; }
.stat--alert .stat__n { color: #c0392b; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-height: 42px; padding: 8px 12px; font-size: 1.5rem; flex: 1 1 170px; }

/* Insignias */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 1.3rem; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--ink); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.st-nuevo { background: #e3effa; color: #134a7a; }
.st-en_revision { background: #efe8fb; color: #4a2a85; }
.st-en_proceso { background: #fff3d6; color: #7a5200; }
.st-esperando_cliente { background: #ffe6d9; color: #8a3a0f; }
.st-resuelto { background: #e2f5e9; color: #145c32; }
.st-cerrado { background: #ececef; color: #555; }
.pr-urgente { background: #c0392b; color: #fff; }
.pr-alta { background: #fde2df; color: #8a1c1c; }
.pr-normal { background: var(--bg); color: var(--ink); }
.pr-baja { background: var(--bg); color: var(--muted); }
.folio { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--blue); text-decoration: none; }

/* Lista del cliente */
.cards { display: grid; gap: 12px; }
.tcard { display: block; text-decoration: none; color: var(--ink); margin: 0; transition: border-color .15s; }
.tcard:hover { border-color: var(--blue); }
.tcard__top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.tcard__title { font-weight: 600; font-size: 1.85rem; margin: 6px 0 2px; }
.tcard__meta { font-size: 1.45rem; }
.empty { text-align: center; padding: 40px 24px; }

/* Tabla del panel */
.tablewrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 1.5rem; }
.table th { text-align: left; font-size: 1.3rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-new td:first-child { box-shadow: inset 4px 0 0 var(--blue); }
.table tr.is-off { opacity: .55; }
.tlink { color: var(--ink); font-weight: 600; text-decoration: none; }
.tlink:hover { color: var(--blue); }

/* Detalle */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 990px) { .layout { grid-template-columns: minmax(0, 1fr) 340px; } }
.msg { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.msg header { font-size: 1.45rem; margin-bottom: 8px; }
.msg__body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--team { border-left: 4px solid var(--blue); }
.msg--client { border-left: 4px solid var(--gray); }
.msg--internal { background: #fffbea; border-color: #f2e3a6; border-left: 4px solid #d4a514; }
.files { list-style: none; padding: 0; margin: 10px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.files a { display: inline-block; background: var(--bg); padding: 6px 12px; border-radius: 999px; font-size: 1.4rem; text-decoration: none; }
.event { display: flex; gap: 10px; align-items: baseline; font-size: 1.45rem; padding: 4px 4px 14px 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; transform: translateY(-1px); }
.reply__actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.reply__actions .check { margin: 0; }
.side__h { font-size: 1.7rem; margin: 0 0 14px; }
.dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 1.5rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.foot { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: 1.4rem; background: #fff; }
@media (max-width: 720px) {
  .who__co { display: none; }
  .card { padding: 18px; }
  .table { min-width: 860px; }
}
.folio { white-space: nowrap; }
@media (max-width: 720px) {
  .top { position: static; }
  .top__in { gap: 6px 14px; }
  .nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  .who__name { display: none; }
  .brand__name { font-size: 1.7rem; }
}
.brand { align-items: center; gap: 12px; }
.brand__logo { height: 40px; width: auto; display: block; }
.brand__sep { width: 1px; height: 30px; background: var(--line); }
.brand__aasp { height: 22px; width: auto; display: block; }
.brand__sub { border-left: 1px solid var(--line); padding-left: 12px; }
.auth__brand { gap: 16px; }
.auth__logo { height: 64px; width: auto; max-width: 100%; }
.auth__aasp { height: 32px; width: auto; }
@media (max-width: 720px) {
  .brand__logo { height: 32px; }
  .brand__aasp { height: 18px; }
  .brand__sub { display: none; }
}
.brand__logo { height: 44px; }
.brand__aasp { height: 30px; }
.brand__sep { height: 36px; }
.auth__aasp { height: 44px; }
@media (max-width: 720px) { .brand__logo { height: 34px; } .brand__aasp { height: 24px; } }

.brand__logo { max-width: 220px; object-fit: contain; }
.brand__aasp { max-width: 160px; object-fit: contain; }
/* Configuración */
.settings h2 { font-size: 1.9rem; margin: 0 0 4px; }
.settings .card { margin-bottom: 20px; }
.settings textarea { min-height: 150px; }
.logo-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.logo-prev { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 64px; display: flex; align-items: center; }
.logo-prev img { max-height: 48px; max-width: 220px; display: block; }
.colorpick { display: flex; gap: 10px; align-items: center; }
.colorpick input[type=color] { width: 56px; height: 50px; padding: 4px; border: 1px solid #c7c7cc; border-radius: 12px; background: #fff; cursor: pointer; }
.colorpick input[type=text] { max-width: 140px; font-family: ui-monospace, Menlo, monospace; }
.swatches { display: flex; gap: 8px; margin-top: 8px; }
.swatches span { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); }
.savebar { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; border-top: 1px solid var(--line); }

/* Encabezado: una sola línea */
.top__in { flex-wrap: nowrap; gap: 28px; min-height: 72px; }
.brand { flex: none; }
.nav { flex: 1; flex-wrap: nowrap; gap: 4px; min-width: 0; }
.nav a { white-space: nowrap; padding: 8px 12px; font-size: 1.55rem; }
.who { position: relative; flex: none; margin-left: auto; display: block; }
.who__btn { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 8px; border-radius: 12px; }
.who__btn::-webkit-details-marker { display: none; }
.who__btn:hover, .who[open] .who__btn { background: var(--sky); }
.who__avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 1.4rem; flex: none; }
.who__text { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.who__name { font-weight: 600; font-size: 1.45rem; white-space: nowrap; }
.who__co { color: var(--muted); font-size: 1.3rem; white-space: nowrap; }
.who__caret { color: var(--muted); font-size: 1.2rem; }
.who__menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1); min-width: 210px; padding: 6px; z-index: 20; }
.who__menu a, .who__menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; font-size: 1.5rem; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; }
.who__menu a:hover, .who__menu button:hover { background: var(--sky); color: var(--blue); }
.who__menu form { margin: 0; }
@media (max-width: 1180px) { .who__text { display: none; } .nav a { padding: 8px 9px; } .top__in { gap: 16px; } }
@media (max-width: 900px) {
  .top__in { flex-wrap: wrap; row-gap: 6px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; padding-bottom: 4px; }
}
