/*
 * Estilos del portal de clientes. Se cargan después de app.css, que aporta el reset, los colores
 * y los botones. Portados de la versión Node, sin estilos en línea (la CSP no los permite).
 */

/* ── Pantallas de acceso ───────────────────────────────────────────────── */

.portal-login {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(340px, .9fr) minmax(0, 1.1fr);
}

.portal-login.single {
  grid-template-columns: 1fr;
}

.login-form-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.5rem, 5vw, 5rem);
  background: #f8f9fc;
  color: var(--ink);
}

.login-brand { display: flex; align-items: center; gap: .7rem; font-weight: 800; }
.login-box { width: min(100%, 27rem); margin: 4rem auto; }
.login-box h1 { margin: 1.2rem 0 .8rem; font-size: clamp(2.6rem, 5vw, 4.5rem); font-weight: 760; }
.login-box > p { color: var(--muted); line-height: 1.65; }
.login-form { display: grid; gap: 1rem; margin-top: 2.2rem; }
.login-field { display: grid; gap: .45rem; }
.login-field label { color: #5a6171; font-size: .72rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.login-field input {
  min-height: 3.45rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .9rem;
  padding: .8rem 1rem;
  background: white;
  outline: none;
}
.login-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,169,216,.12); }
.login-field input.code-input { font-size: 1.5rem; letter-spacing: .35em; text-align: center; }
.login-error { min-height: 1.4rem; color: #bb2056; font-size: .82rem; }
.login-helper { color: #858b98; font-size: .73rem; line-height: 1.5; }
.login-helper.spaced { margin-top: 1.2rem; }
.login-link { justify-self: end; color: var(--purple); font-size: .75rem; font-weight: 700; }
.login-link:hover { text-decoration: underline; }
.login-back { display: inline-block; margin-top: 1.3rem; color: var(--purple); font-size: .75rem; font-weight: 700; }
.login-notice {
  margin-top: 1.5rem;
  border-radius: .9rem;
  padding: .85rem 1rem;
  color: #2b5a0d;
  background: rgba(143, 200, 63, .16);
  font-size: .85rem;
  line-height: 1.5;
}
.login-secondary {
  margin-top: .4rem;
  color: var(--purple);
  font-size: .78rem;
  font-weight: 700;
}
.login-secondary:hover { text-decoration: underline; }
.login-box .btn-primary { width: 100%; }
.login-box .btn-primary svg:last-child { margin-left: auto; }

.login-visual {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  padding: 4rem;
  color: white;
  background:
    radial-gradient(circle at 70% 25%, rgba(49,169,216,.2), transparent 25rem),
    radial-gradient(circle at 25% 75%, rgba(223,33,121,.17), transparent 25rem),
    #0d1224;
}
.login-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
}
.login-orbit { position: relative; display: grid; width: min(70vw, 34rem); aspect-ratio: 1; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.login-orbit::before, .login-orbit::after { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }
.login-orbit::before { inset: 12%; }
.login-orbit::after { inset: 25%; }
.login-symbol { position: relative; z-index: 2; width: 42%; aspect-ratio: .68; overflow: hidden; border-radius: 8rem; background: white; box-shadow: 0 0 80px rgba(49,169,216,.18); }
.login-symbol img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.login-caption { position: absolute; right: 8%; bottom: 9%; max-width: 19rem; }
.login-caption strong { display: block; font-size: 1.15rem; }
.login-caption span { display: block; margin-top: .5rem; color: #7f899e; font-size: .8rem; line-height: 1.6; }

/* ── Portal con sesión ─────────────────────────────────────────────────── */

.portal-body {
  min-height: 100svh;
  color: #e9edf7;
  background:
    radial-gradient(circle at 74% 8%, rgba(49, 169, 216, .12), transparent 24rem),
    #0c1020;
}

.portal-shell { display: grid; min-height: 100svh; grid-template-columns: 17rem minmax(0, 1fr); }
.portal-sidebar { position: sticky; top: 0; display: flex; height: 100svh; flex-direction: column; border-right: 1px solid rgba(255,255,255,.08); padding: 1.2rem; background: rgba(8,12,25,.74); backdrop-filter: blur(18px); }
.portal-brand { display: flex; align-items: center; gap: .75rem; padding: .4rem .3rem 2rem; font-weight: 800; }
.portal-brand small { display: block; margin-top: .15rem; color: #6d7890; font-size: .58rem; letter-spacing: .13em; text-transform: uppercase; }
.portal-nav { display: grid; gap: .35rem; }
.portal-nav a, .portal-nav button { display: flex; width: 100%; min-height: 2.9rem; align-items: center; gap: .75rem; border-radius: .8rem; padding: .65rem .8rem; color: #8d97aa; font-size: .82rem; font-weight: 650; text-align: left; transition: background 160ms ease, color 160ms ease; }
.portal-nav a:hover, .portal-nav button:hover { color: white; background: rgba(255,255,255,.06); }
.portal-nav .active { color: white; background: linear-gradient(90deg, rgba(49,169,216,.17), rgba(93,49,134,.12)); box-shadow: inset 2px 0 var(--blue); }
.portal-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; }
.portal-user-card { display: grid; grid-template-columns: 2.25rem 1fr; gap: .65rem; align-items: center; padding: .4rem; }
.portal-avatar { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: 50%; color: white; background: linear-gradient(135deg, var(--blue), var(--purple)); font-size: .72rem; font-weight: 800; }
.portal-user-card strong { display: block; overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.portal-user-card span { display: block; overflow: hidden; margin-top: .15rem; color: #6f7990; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.portal-main { min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 3rem) 4rem; }
.portal-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; margin-bottom: 2.2rem; }
.portal-topbar p { color: #737e94; font-size: .78rem; }
.portal-actions { display: flex; align-items: center; gap: .6rem; }
.portal-icon-btn { display: grid; width: 2.7rem; height: 2.7rem; place-items: center; border: 1px solid rgba(255,255,255,.1); border-radius: .8rem; color: #929caf; background: rgba(255,255,255,.03); }
.portal-primary { display: inline-flex; min-height: 2.7rem; align-items: center; justify-content: center; gap: .5rem; border-radius: .8rem; padding: .65rem 1rem; color: #07121c; background: #fff; font-size: .78rem; font-weight: 800; transition: transform 160ms ease; }
.portal-primary:hover { transform: translateY(-2px); }
.portal-primary:disabled { opacity: .7; transform: none; }

.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.dashboard-heading h1 { margin: .4rem 0 0; font-size: clamp(2.5rem, 5vw, 5rem); font-weight: 740; }
.dashboard-heading p { max-width: 28rem; color: #7d879d; line-height: 1.65; }
.portal-kicker { color: var(--blue); font-size: .66rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }

.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.portal-panel { border: 1px solid rgba(255,255,255,.08); border-radius: 1.2rem; background: rgba(255,255,255,.035); }
.portal-panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; min-height: 4rem; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid rgba(255,255,255,.07); padding: 1rem 1.2rem; }
.panel-head h2 { font-size: .9rem; }
.panel-head a { color: var(--blue); font-size: .7rem; font-weight: 700; }
.panel-body { padding: 1.2rem; color: #a3adbf; font-size: .82rem; line-height: 1.65; }
.panel-body p + p { margin-top: .75rem; }

.fact-list { display: grid; gap: .1rem; padding: .4rem 1.2rem 1rem; }
.fact-list > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid rgba(255,255,255,.06); padding: .85rem 0; }
.fact-list > div:last-child { border-bottom: 0; }
.fact-list dt { color: #7d879d; font-size: .75rem; }
.fact-list dd { color: #e9edf7; font-size: .8rem; font-weight: 650; text-align: right; }

.badge { display: inline-block; border-radius: 999px; padding: .3rem .6rem; font-size: .62rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.badge.ok { color: var(--lime); background: rgba(143,200,63,.14); }
.badge.warn { color: var(--orange); background: rgba(244,154,28,.14); }
.badge.info { color: var(--blue); background: rgba(49,169,216,.14); }

.empty-state { padding: 3rem 1rem; color: #68748a; text-align: center; font-size: .8rem; line-height: 1.6; }
.empty-state strong { display: block; margin-bottom: .4rem; color: #e9edf7; font-size: 1rem; }

.portal-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; padding: 1.2rem; }
.portal-field { display: grid; gap: .45rem; }
.portal-field.full { grid-column: 1 / -1; }
.portal-field label { color: #8994a9; font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.portal-input { min-height: 3rem; width: 100%; border: 1px solid rgba(255,255,255,.1); border-radius: .8rem; padding: .7rem .85rem; color: white; background: rgba(255,255,255,.04); outline: none; }
.portal-input:focus { border-color: rgba(49,169,216,.55); box-shadow: 0 0 0 3px rgba(49,169,216,.08); }
.portal-hint { color: #6d7890; font-size: .72rem; line-height: 1.55; }
.form-actions { display: flex; align-items: center; gap: 1rem; grid-column: 1 / -1; }

.portal-alert { grid-column: 1 / -1; border-radius: .8rem; padding: .8rem 1rem; font-size: .8rem; line-height: 1.5; }
.portal-alert.error { color: #ffd0db; background: rgba(223,33,121,.14); }
.portal-alert.ok { color: #d6f0b8; background: rgba(143,200,63,.14); }

.portal-mobile-nav { display: none; }

/* ── Adaptación a pantallas ────────────────────────────────────────────── */

@media (max-width: 1050px) {
  .portal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .portal-login { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .portal-shell { display: block; }
  .portal-sidebar { display: none; }
  .portal-main { padding-bottom: 6rem; }
  .portal-mobile-nav { position: fixed; z-index: 30; right: .6rem; bottom: .6rem; left: .6rem; display: flex; align-items: center; justify-content: space-around; border: 1px solid rgba(255,255,255,.1); border-radius: 1rem; padding: .45rem; background: rgba(10,14,28,.9); backdrop-filter: blur(18px); }
  .portal-mobile-nav a, .portal-mobile-nav button { display: grid; min-width: 3.4rem; min-height: 3rem; place-items: center; color: #768197; }
  .portal-mobile-nav .active { color: white; }
  .dashboard-heading { align-items: start; flex-direction: column; }
  .portal-form { grid-template-columns: 1fr; }
  .portal-field.full { grid-column: auto; }
}

@media (max-width: 480px) {
  .portal-topbar > p { display: none; }
  .portal-main { padding-inline: .7rem; }
}

/* ── Utilidades del portal ─────────────────────────────────────────────── */

.spaced { margin-top: .8rem; }
.grow { flex: 1 1 16rem; }
.full { grid-column: 1 / -1; }
.inline-icon { display: inline; vertical-align: -1px; }
.field-label { color: #8994a9; font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.portal-body .field-error { color: #ffb3c7; font-size: .72rem; }
.portal-input[aria-invalid="true"] { border-color: rgba(223,33,121,.6); }
.portal-input option { color: var(--ink); }
.portal-textarea { min-height: 11rem; width: 100%; border: 1px solid rgba(255,255,255,.1); border-radius: .8rem; padding: .7rem .85rem; color: white; background: rgba(255,255,255,.04); outline: none; resize: vertical; }
.portal-textarea:focus { border-color: rgba(49,169,216,.55); box-shadow: 0 0 0 3px rgba(49,169,216,.08); }
.portal-textarea.short { min-height: 7rem; }
.portal-textarea.tiny { min-height: 4.5rem; }
.portal-textarea::placeholder, .portal-input::placeholder { color: #59647a; }
a.portal-input, button.portal-input { display: inline-flex; align-items: center; gap: .4rem; color: #c6cedd; cursor: pointer; }
.check-field { display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; align-items: center; color: #dce2ec; font-size: .8rem; }
.check-field small { grid-column: 2; color: #68748a; font-size: .68rem; line-height: 1.5; }
.link-button { color: #df6a8f; font-size: .7rem; font-weight: 700; }
.link-button:hover { text-decoration: underline; }
.panel-title { margin-bottom: .6rem; font-size: .88rem; color: white; }
.empty-state.compact { padding: 1.6rem 1rem; }

.bell { position: relative; }
.bell-count { position: absolute; top: -.35rem; right: -.35rem; min-width: 1.15rem; height: 1.15rem; border-radius: 999px; padding: 0 .3rem; color: white; background: var(--magenta); font-size: .6rem; font-weight: 800; line-height: 1.15rem; text-align: center; }

/* ── Tickets ───────────────────────────────────────────────────────────── */

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: .35rem 0 0; font-size: clamp(2.2rem, 5vw, 4.2rem); letter-spacing: -.06em; }
.ticket-filter { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.pager { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.ticket-table { overflow: hidden; }
.ticket-row { display: grid; grid-template-columns: minmax(8rem,.55fr) minmax(12rem,1.5fr) minmax(7rem,.5fr) minmax(6rem,.45fr); gap: 1rem; align-items: center; min-height: 4.7rem; border-bottom: 1px solid rgba(255,255,255,.06); padding: .8rem 1.2rem; transition: background 160ms ease; }
.ticket-table .ticket-row { grid-template-columns: .5fr 1.5fr .65fr .55fr .55fr; }
.ticket-row:last-child { border-bottom: 0; }
.ticket-row:hover { background: rgba(255,255,255,.025); }
.ticket-number { color: #9ca6ba; font-size: .7rem; font-weight: 750; }
.ticket-title { min-width: 0; }
.ticket-title strong { display: block; overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.ticket-title span { display: block; margin-top: .25rem; color: #657087; font-size: .65rem; }
.ticket-badge { --badge: #7b879b; justify-self: start; border-radius: 999px; padding: .35rem .55rem; color: var(--badge); background: color-mix(in srgb, var(--badge), transparent 88%); font-size: .6rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.ticket-date { justify-self: end; color: #68748a; font-size: .67rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: .8rem; }
.stat-card { min-height: 10rem; border: 1px solid rgba(255,255,255,.08); border-radius: 1.2rem; padding: 1.1rem; background: rgba(255,255,255,.035); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: #737e94; font-size: .7rem; }
.stat-icon { display: grid; width: 2.3rem; height: 2.3rem; place-items: center; border-radius: .7rem; color: var(--tone, var(--blue)); background: color-mix(in srgb, var(--tone, var(--blue)), transparent 87%); }
.stat-value { display: block; margin-top: 1.7rem; font-size: 2.1rem; letter-spacing: -.06em; }
.stat-card small { color: #69758c; font-size: .65rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(280px,.6fr); gap: .8rem; margin-top: .8rem; align-items: start; }
.side-stack { display: grid; gap: .8rem; align-content: start; }
.chart-wrap { padding: 1rem 1.2rem; }
.chart { display: block; width: 100%; height: 11rem; }
.chart-axis { display: flex; justify-content: space-between; margin-top: .4rem; color: #68748a; font-size: .62rem; }

.activity-list { display: grid; padding: .4rem 1.2rem 1rem; }
.activity-item { display: grid; grid-template-columns: .7rem 1fr; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.activity-item:last-child { border-bottom: 0; }
.activity-item.unseen strong { color: white; }
.activity-dot { --badge: var(--tone, #31a9d8); width: .55rem; height: .55rem; margin-top: .25rem; border-radius: 50%; background: var(--badge); box-shadow: 0 0 0 .3rem color-mix(in srgb, var(--badge), transparent 88%); }
.activity-item strong { display: block; font-size: .75rem; }
.activity-item span span { display: block; margin-top: .3rem; color: #68748b; font-size: .65rem; line-height: 1.45; }

.new-ticket-grid { display: grid; grid-template-columns: minmax(0,1fr) 19rem; gap: .8rem; align-items: start; }
.form-aside { padding: 1.2rem; }
.form-aside h2 { font-size: .85rem; }
.form-aside p { margin-top: .75rem; color: #6d7890; font-size: .72rem; line-height: 1.65; }

.back-link { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: 1.4rem; color: #748096; font-size: .72rem; }
.back-link:hover { color: white; }
.badge-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.ticket-detail-head h1 { margin: .6rem 0 .5rem; font-size: clamp(2rem,5vw,4.2rem); letter-spacing: -.06em; overflow-wrap: anywhere; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 1.2rem; color: #6f7a91; font-size: .7rem; }
.ticket-detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 20rem; gap: .8rem; margin-top: 2rem; align-items: start; }
.conversation { padding: 1.2rem; }
.message { max-width: 78%; margin-bottom: 1rem; border: 1px solid rgba(255,255,255,.08); border-radius: .3rem 1.1rem 1.1rem 1.1rem; padding: 1rem; background: rgba(255,255,255,.04); scroll-margin-top: 1rem; }
.message.own { margin-left: auto; border-radius: 1.1rem .3rem 1.1rem 1.1rem; background: rgba(49,169,216,.1); }
.message.internal { border-color: rgba(244,154,28,.25); background: rgba(244,154,28,.07); }
.message-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .65rem; }
.message-head strong { font-size: .72rem; }
.message-head span { color: #667188; font-size: .62rem; white-space: nowrap; }
.message p { color: #a3adbf; font-size: .78rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-form { border-top: 1px solid rgba(255,255,255,.08); }
.reply-internal { display: flex; align-items: center; gap: .6rem; margin-right: auto; color: #d7ad6a; font-size: .72rem; }
.ticket-side-data { display: grid; gap: 1rem; padding: 1.2rem; }
.ticket-side-data div { border-bottom: 1px solid rgba(255,255,255,.07); padding-bottom: .8rem; }
.ticket-side-data div:last-child { border-bottom: 0; padding-bottom: 0; }
.ticket-side-data small { display: block; color: #657087; font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; }
.ticket-side-data strong { display: block; margin-top: .35rem; font-size: .76rem; }
.side-form { display: grid; gap: .5rem; padding: 1rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-form:last-child { border-bottom: 0; }
.side-form label { color: #8994a9; font-size: .64rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.assignee-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; color: #dce2ec; font-size: .76rem; }
.assign-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .5rem; }

/* ── Adjuntos ──────────────────────────────────────────────────────────── */

.attach-block { display: grid; gap: .6rem; }
.js .attach-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attach-input { color: #9aa3b5; font-size: .75rem; }
.attach-drop { display: flex; align-items: center; gap: .8rem; border: 1px dashed rgba(255,255,255,.18); border-radius: .9rem; padding: .9rem 1rem; color: #8e99ad; background: rgba(255,255,255,.02); cursor: pointer; transition: border-color 160ms ease, background 160ms ease, color 160ms ease; }
.attach-drop:hover, .attach-drop:focus-visible { border-color: rgba(49,169,216,.5); color: #c6cedd; background: rgba(49,169,216,.05); }
.attach-drop.over { border-color: var(--blue); border-style: solid; color: white; background: rgba(49,169,216,.12); }
.attach-drop strong { display: block; color: white; font-size: .78rem; font-weight: 650; }
.attach-drop small { display: block; margin-top: .2rem; color: #68748a; font-size: .68rem; line-height: 1.45; }
.attach-warn { min-height: 0; margin: 0; color: var(--orange); font-size: .72rem; }
.attach-list { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.attach-list li { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: .55rem; align-items: center; border: 1px solid rgba(255,255,255,.08); border-radius: .7rem; padding: .5rem .7rem; color: #9aa3b5; background: rgba(255,255,255,.03); }
.attach-name { overflow: hidden; color: #dce2ec; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { color: #68748a; font-size: .68rem; font-variant-numeric: tabular-nums; }
.attach-tag { border-radius: 999px; padding: .15rem .45rem; color: var(--blue); background: rgba(49,169,216,.14); font-size: .6rem; font-weight: 700; text-transform: uppercase; }
.attach-list button { border-radius: .45rem; padding: .2rem .45rem; color: #7e8aa3; font-size: .7rem; }
.attach-list button:hover { color: #df6a8f; background: rgba(223,106,143,.12); }
.msg-attachments { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.msg-thumb { display: block; overflow: hidden; width: 8.5rem; height: 6rem; border: 1px solid rgba(255,255,255,.12); border-radius: .6rem; transition: border-color 160ms ease; }
.msg-thumb:hover { border-color: var(--blue); }
.msg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.msg-file { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid rgba(255,255,255,.12); border-radius: .6rem; padding: .45rem .7rem; color: var(--blue); font-size: .7rem; transition: border-color 160ms ease; }
.msg-file:hover { border-color: var(--blue); }
.msg-file small { color: #68748a; font-size: .64rem; }
.attach-panel { display: grid; }
.attach-panel-row { display: grid; grid-template-columns: 2.6rem minmax(0,1fr); gap: .7rem; align-items: center; border-bottom: 1px solid rgba(255,255,255,.06); padding: .7rem 1.2rem; transition: background 160ms ease; }
.attach-panel-row:last-child { border-bottom: 0; }
.attach-panel-row:hover { background: rgba(255,255,255,.03); }
.attach-panel-kind { display: grid; height: 2.1rem; place-items: center; border-radius: .5rem; color: #9aa3b5; background: rgba(255,255,255,.07); font-size: .58rem; font-weight: 800; letter-spacing: .04em; }
.attach-panel-kind.image { color: var(--blue); background: rgba(49,169,216,.14); }
.attach-panel-name { min-width: 0; }
.attach-panel-name strong { display: block; overflow: hidden; color: #dce2ec; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.attach-panel-name small { display: block; margin-top: .15rem; color: #68748a; font-size: .64rem; }

/* ── Administración ────────────────────────────────────────────────────── */

.admin-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.admin-tabs a { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid rgba(255,255,255,.1); border-radius: .8rem; padding: .6rem .9rem; color: #9ca6ba; background: rgba(255,255,255,.03); font-size: .73rem; font-weight: 650; transition: color 160ms ease, border-color 160ms ease, background 160ms ease; }
.admin-tabs a:hover { color: white; border-color: rgba(255,255,255,.2); }
.admin-tabs a.active { color: white; border-color: rgba(49,169,216,.55); background: rgba(49,169,216,.12); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; }
.admin-card { display: grid; align-content: start; gap: .3rem; min-height: 8.5rem; border: 1px solid rgba(255,255,255,.08); border-radius: 1.1rem; padding: 1.1rem; background: rgba(255,255,255,.03); transition: border-color 160ms ease, background 160ms ease; }
.admin-card.compact { min-height: 7rem; }
a.admin-card:hover { border-color: rgba(49,169,216,.45); background: rgba(49,169,216,.06); }
.admin-card strong { font-size: 1.9rem; letter-spacing: -.04em; line-height: 1; color: white; }
.admin-card-label { color: white; font-size: .78rem; font-weight: 700; }
.admin-card-hint { color: #68748a; font-size: .67rem; }
.admin-table { overflow: hidden; }
.admin-row { display: grid; grid-template-columns: minmax(11rem,1.4fr) minmax(8rem,1fr) minmax(8rem,1fr) minmax(7rem,auto); gap: 1rem; align-items: center; border-bottom: 1px solid rgba(255,255,255,.06); padding: .9rem 1.2rem; }
.admin-row:last-child { border-bottom: 0; }
.admin-row-link { transition: background 160ms ease; }
.admin-row-link:hover { background: rgba(255,255,255,.025); }
.admin-cell-main { min-width: 0; }
.admin-cell-main strong { display: block; overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-cell-main span { display: block; margin-top: .25rem; color: #657087; font-size: .65rem; overflow-wrap: anywhere; }
.admin-cell-soft { overflow: hidden; color: #7c869a; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-pills { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.admin-pill { border-radius: 999px; padding: .3rem .6rem; font-size: .6rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.admin-pill.ok { color: #8fc83f; background: rgba(143,200,63,.12); }
.admin-pill.off { color: #9aa3b5; background: rgba(255,255,255,.07); }
.admin-pill.admin { color: var(--blue); background: rgba(49,169,216,.14); }
.admin-detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }
.admin-detail-body { display: grid; gap: .9rem; padding: 1.2rem; }
.admin-detail-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-detail-line strong { display: block; font-size: .78rem; }
.admin-detail-line small { display: block; margin-top: .25rem; color: #68748a; font-size: .67rem; line-height: 1.5; }
.admin-detail-line .portal-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.admin-selfnote { border-left: 2px solid rgba(49,169,216,.5); padding-left: .8rem; color: #7c869a; font-size: .68rem; line-height: 1.6; }
.membership-row { display: grid; grid-template-columns: minmax(0,1fr) 15rem; gap: .6rem; align-items: center; }
.membership-row label { overflow: hidden; color: #dce2ec; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.membership-empty { color: #68748a; font-size: .72rem; }

.sec-num { font-size: 2rem; letter-spacing: -.04em; line-height: 1; }
.sec-ok { color: #8fc83f !important; }
.sec-bad { color: #df6a8f !important; }
.sec-warn { color: var(--orange) !important; }
.sec-info { color: var(--blue) !important; }
.admin-pill.sec-ok { background: rgba(143,200,63,.12); }
.admin-pill.sec-bad { background: rgba(223,106,143,.14); }
.admin-pill.sec-warn { background: rgba(244,154,28,.14); }
.admin-pill.sec-info { background: rgba(49,169,216,.14); }
.sec-row { display: grid; grid-template-columns: 9.5rem 11rem minmax(0,1fr) 9rem; gap: 1rem; align-items: center; border-bottom: 1px solid rgba(255,255,255,.06); padding: .7rem 1.2rem; }
.sec-row:last-child { border-bottom: 0; }
.sec-date { color: #7c869a; font-size: .68rem; font-variant-numeric: tabular-nums; }
.sec-row .admin-pill { justify-self: start; }
.sec-chips { display: flex; flex-wrap: wrap; gap: .45rem; padding: 1rem 1.2rem; }
.sec-chip { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid rgba(223,106,143,.28); border-radius: 999px; padding: .4rem .75rem; color: #b9c2d3; background: rgba(223,106,143,.07); font-size: .7rem; }
.sec-chip:hover { color: white; border-color: rgba(223,106,143,.6); }
.sec-chip strong { color: #df6a8f; font-size: .72rem; }

/* ── Ayuda ─────────────────────────────────────────────────────────────── */

.help-print { cursor: pointer; }
.help-scope { margin-bottom: .8rem; }
.help-scope-body { display: grid; gap: .5rem; justify-items: start; padding: 1.2rem; }
.help-scope-body p { margin: 0; color: white; font-size: .92rem; }
.help-scope-body small { color: #68748a; font-size: .72rem; line-height: 1.55; }
.help-layout { display: grid; grid-template-columns: minmax(11rem,15rem) minmax(0,1fr); gap: .8rem; align-items: start; }
.help-index { position: sticky; top: 1rem; display: grid; gap: .1rem; max-height: calc(100svh - 2rem); overflow-y: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 1.1rem; padding: 1rem .8rem; background: rgba(255,255,255,.03); }
.help-index > div { display: grid; gap: .1rem; margin-bottom: .7rem; }
.help-index-section { padding: .3rem .4rem; color: white; font-size: .76rem; font-weight: 700; }
.help-index-article { padding: .25rem .4rem .25rem .9rem; color: #7e8aa3; font-size: .72rem; line-height: 1.35; }
.help-index-article:hover, .help-index-section:hover { color: var(--blue); }
.help-content { display: grid; gap: .8rem; }
.help-section-body { display: grid; gap: 1.6rem; padding: 1.4rem; }
.help-summary { margin: 0; color: #8f9ab0; font-size: .8rem; }
.help-article { scroll-margin-top: 1rem; }
.help-article h3 { margin: 0 0 .55rem; font-size: .95rem; color: white; }
.help-article p, .help-article-text { margin: 0 0 .7rem; color: #aeb8cc; font-size: .82rem; line-height: 1.65; }
.help-section a { color: var(--blue); text-decoration: underline; }
.help-items { display: grid; gap: .7rem; margin: 0; }
.help-items > div { display: grid; grid-template-columns: 12rem minmax(0,1fr); gap: 1rem; }
.help-items dt { color: white; font-size: .8rem; font-weight: 700; }
.help-items dd { margin: 0; color: #aeb8cc; font-size: .82rem; line-height: 1.6; }
.help-steps { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; }
.help-steps li { display: grid; grid-template-columns: 1.7rem minmax(0,1fr); gap: .75rem; align-items: start; }
.help-step-num { display: grid; width: 1.7rem; height: 1.7rem; place-items: center; border-radius: 999px; color: var(--blue); background: rgba(49,169,216,.14); font-size: .72rem; font-weight: 800; }
.help-steps strong { display: block; margin-bottom: .2rem; color: white; font-size: .82rem; }
.help-steps span:last-child { color: #aeb8cc; font-size: .82rem; line-height: 1.6; }
.help-note { border-left: 2px solid rgba(244,154,28,.55); padding-left: .85rem; color: #9aa3b5 !important; font-size: .78rem !important; }
.help-badges { display: grid; gap: .5rem; }
.help-badge-row { display: grid; grid-template-columns: 10rem minmax(0,1fr); gap: 1rem; align-items: center; }
.help-badge-row > span:last-child { color: #8f9ab0; font-size: .78rem; }

@media print {
  .portal-sidebar, .portal-mobile-nav, .portal-topbar, .help-index, .help-print { display: none !important; }
  .portal-shell, .portal-main { display: block !important; padding: 0 !important; }
  body, html { background: white !important; color: #101424 !important; }
  .portal-panel { border: 1px solid #d5dae4 !important; background: white !important; }
  .panel-head { border-bottom: 1px solid #d5dae4 !important; }
  .help-layout, .help-content { display: block !important; }
  .help-section { margin-bottom: 1rem; }
  h1, h2, h3, dt, .help-steps strong, .help-scope-body p { color: #101424 !important; }
  p, dd, .help-summary, .help-steps span:last-child, .help-badge-row > span:last-child, small { color: #3d4658 !important; }
  .help-article { break-inside: avoid; margin-bottom: 1.1rem; }
  a { color: #2361a9 !important; }
}

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid, .new-ticket-grid, .ticket-detail-grid, .admin-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .sec-row { grid-template-columns: minmax(0,1fr) auto; row-gap: .4rem; }
  .sec-row > .admin-cell-soft { display: none; }
  .help-layout { grid-template-columns: 1fr; }
  .help-index { position: static; max-height: none; }
  .help-items > div, .help-badge-row { grid-template-columns: 1fr; gap: .25rem; }
}
@media (max-width: 860px) {
  .admin-row { grid-template-columns: minmax(0,1.3fr) minmax(0,auto); row-gap: .5rem; }
  .admin-row > .admin-cell-soft { display: none; }
  .membership-row { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .page-head { align-items: start; flex-direction: column; }
  .ticket-row, .ticket-table .ticket-row { grid-template-columns: .7fr 1.3fr .7fr; }
  .ticket-row > :nth-child(4), .ticket-table .ticket-row > :nth-child(5) { display: none; }
  .message { max-width: 92%; }
}
@media (max-width: 640px) {
  .msg-thumb { width: 6.5rem; height: 4.8rem; }
  .attach-list li { grid-template-columns: minmax(0,1fr) auto; }
  .attach-list .attach-size, .attach-list .attach-tag { display: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 8.8rem; padding: .85rem; }
  .stat-value { margin-top: 1.2rem; }
}
