/* ============================================================
   Consola de soporte (técnicos y administrador)
   ============================================================ */

html, body { height: 100%; }
body { overflow: hidden; }

/* ---------------- Ingreso ---------------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(79, 134, 242, .35), transparent 60%),
    linear-gradient(160deg, #0E2747 0%, #0A1C36 100%);
  overflow: auto;
}
.login__card { width: min(420px, 100%); }
.login__card > .stub-top, .login__card > .stub-bottom { --notch: 14px; }
.login__top { padding: 32px 32px 22px; }
.login__body { padding: 24px 32px 28px; display: grid; gap: 18px; }
.login__brand { display: flex; align-items: center; gap: 12px; }
.login__brand img { width: 46px; height: 46px; }
.login__name { font-family: var(--font-narrow); font-weight: 700; font-size: 24px; color: var(--ink); line-height: 1; }
.login__sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.login__foot { color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------------- Estructura ---------------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100vh; }
.side {
  display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto;
  padding: 18px 12px 14px; background: var(--navy); color: #C5D3EA;
}
:root[data-theme='dark'] .side { background: #071121; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .side { background: #071121; } }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 16px; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand__name { font-family: var(--font-narrow); font-weight: 700; font-size: 18px; color: #fff; line-height: 1.05; }
.brand__sub { font-size: 12px; color: #8EA6CB; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: #C5D3EA; text-decoration: none; font-weight: 500;
}
.nav a svg { width: 19px; height: 19px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a[aria-current='page'] { background: rgba(255, 255, 255, .11); color: #fff; box-shadow: inset 3px 0 0 #5B8FF5; }
.nav__count { margin-left: auto; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; background: #2F6AE0; color: #fff; font-size: 12px; font-weight: 700; }
.nav__count--warn { background: #F5B700; color: #3A2900; }
.nav__group { margin: 18px 10px 6px; font-size: 12px; font-weight: 600; color: #7E95BA; }
.side__foot { margin-top: auto; padding-top: 14px; display: grid; gap: 8px; }
.me { display: grid; gap: 2px; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.me__name { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__role { font-size: 12px; color: #8EA6CB; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #A9BBD8; padding: 0 10px; }
.side__actions { display: flex; gap: 4px; }
.side__actions button, .side__actions a {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; border: 0; border-radius: 8px; background: transparent; color: #C5D3EA; cursor: pointer; font-size: 12.5px; text-decoration: none;
}
.side__actions button:hover, .side__actions a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side__actions svg { width: 17px; height: 17px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 24px 12px; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar__menu { display: none; }
.page { flex: 1; min-height: 0; overflow: auto; padding: 4px 24px 32px; }

/* ---------------- Barra de herramientas ---------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 24px 14px; }
.search { position: relative; flex: 1 1 260px; max-width: 460px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 36px; }
.toolbar__group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.month-input { width: 150px; }

/* ---------------- Cola de tickets + detalle ---------------- */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 440px; border-top: 1px solid var(--line); }
.queue { min-height: 0; overflow: auto; }
.qtable { width: 100%; border-collapse: separate; border-spacing: 0; }
.qtable th {
  position: sticky; top: 0; z-index: 1; background: var(--bg);
  padding: 9px 12px; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.qtable td { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); vertical-align: middle; }
.qtable tbody tr { cursor: pointer; }
.qtable tbody tr:hover td { background: var(--surface-2); }
.qtable tbody tr[aria-selected='true'] td { background: var(--brand-soft); }
.qtable td:first-child { box-shadow: inset 3px 0 0 var(--row-c, transparent); padding-left: 16px; }
.qtable tr[data-status='nuevo'] { --row-c: var(--st-nuevo); }
.qtable tr[data-status='en_proceso'] { --row-c: var(--st-proceso); }
.qtable tr[data-status='pendiente'] { --row-c: var(--st-pendiente); }
.cell-main { color: var(--ink); font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.cell-subject { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; min-width: 120px; }
.cell-when { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cell-state { width: 1%; white-space: nowrap; }
.inproc { display: flex; align-items: center; gap: 8px; color: var(--st-proceso); font-weight: 600; font-size: 13px; white-space: normal; width: 170px; line-height: 1.3; }
.inproc--me { color: var(--ink); }
.pend { display: grid; gap: 6px; justify-items: start; }
.pend__left { font-size: 12px; color: var(--st-pendiente); font-weight: 600; }
.empty {
  display: grid; place-items: center; text-align: center; gap: 8px; padding: 60px 24px; color: var(--muted);
}
.empty svg { width: 40px; height: 40px; color: var(--line-strong); }
.empty strong { color: var(--ink); font-size: 16px; }
.qfoot { padding: 12px 16px; color: var(--muted); font-size: 12.5px; }

.detail { min-height: 0; overflow: auto; border-left: 1px solid var(--line); background: var(--surface); }
.detail__placeholder { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.detail__placeholder svg { width: 46px; height: 46px; color: var(--line-strong); margin: 0 auto 10px; }
.detail__close { display: none; }

.dhead { padding: 18px 20px 6px; }
.dstub { --stub-bg: var(--surface-2); }
.dstub__top { padding: 16px 18px 16px; }
.dstub__row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 10px; }
.dstub .tcode { font-size: 25px; line-height: 1.1; }
.dstub__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; color: var(--muted); font-size: 13px; align-items: center; }
.dstub__act { padding: 16px 18px 18px; display: grid; gap: 12px; }
.act-note { color: var(--muted); font-size: 13px; }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; }
.act-row .btn { flex: 1 1 0; }
.act-live { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; color: var(--st-proceso); }
.act-live .led { margin-top: 6px; }
.act-live small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.act-form { display: grid; gap: 10px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.result { padding: 12px 14px; border-radius: 10px; display: grid; gap: 6px; }
.result--atendido { background: var(--st-atendido-bg); }
.result--cancelado { background: var(--st-cancelado-bg); }
.result__who { font-weight: 600; color: var(--ink); }
.result__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pending-box { padding: 12px 14px; border-radius: 10px; background: var(--st-pendiente-bg); display: grid; gap: 6px; }
.pending-box b { color: var(--st-pendiente); }

.dsec { padding: 16px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.dsec__title { font-size: 13px; font-weight: 700; color: var(--muted); }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 7px 12px; align-items: center; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; display: flex; align-items: center; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.kv dd a { color: inherit; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.subject { font-weight: 600; color: var(--ink); font-size: 15px; }
.remotes { display: grid; gap: 6px; }
.remote {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px 10px 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
}
.remote__label { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remote__tool { font-size: 12px; color: var(--muted); }
.remote__id { font-family: var(--font-narrow); font-weight: 700; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .3px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding-bottom: 12px; }
.timeline li::before { content: ''; position: absolute; left: 10px; top: 20px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline__dot { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.timeline__dot svg { width: 12px; height: 12px; }
.timeline__text { font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.timeline__note { color: var(--muted); font-size: 13px; white-space: pre-wrap; margin-top: 2px; }
.timeline__time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------------- Páginas de administración ---------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel__title { font-size: 15px; font-weight: 700; color: var(--ink); }
.panel__body { padding: 16px 18px; }
.stack { display: grid; gap: 18px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }

.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--navy); border-radius: 14px; overflow: hidden; }
.board__cell { padding: 16px 18px 18px; border-right: 1px solid rgba(255, 255, 255, .08); color: #B9C9E3; display: grid; gap: 6px; }
.board__cell:last-child { border-right: 0; }
.board__label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.board__num { font-family: var(--font-narrow); font-size: 36px; font-weight: 700; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.board__hint { font-size: 12px; color: #8EA6CB; }
.board .led--nuevo { --c: #6E9CF5; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.metric { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.metric__num { font-family: var(--font-narrow); font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric__label { color: var(--muted); font-size: 13px; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 8px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.bars__bar { width: 100%; max-width: 22px; background: var(--brand); border-radius: 4px 4px 1px 1px; min-height: 2px; }
.bars__bar--zero { background: var(--line); }
.bars__day { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars__n { font-size: 11px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.meter { display: grid; gap: 6px; }
.meter__track { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter__fill { height: 100%; background: var(--brand); border-radius: 99px; }
.meter__fill--full { background: var(--st-cancelado); }

.dtable { width: 100%; border-collapse: collapse; }
.dtable th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtable td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable .right { text-align: right; }
.dtable .actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag--ok { background: var(--st-atendido-bg); color: var(--st-atendido); border-color: transparent; }
.tag--bad { background: var(--st-cancelado-bg); color: var(--st-cancelado); border-color: transparent; }
.tag--warn { background: var(--st-pendiente-bg); color: var(--st-pendiente); border-color: transparent; }
.tag--info { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.remote-rows { display: grid; gap: 8px; }
.remote-row { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .remote-row { grid-template-columns: 1fr 1fr; } }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.secret { font-family: var(--font-narrow); font-size: 20px; font-weight: 700; letter-spacing: .5px; color: var(--ink); }
.cred { display: grid; gap: 8px; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); }

.suggest { position: relative; }
.suggest__list {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-pop);
}
.suggest__item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; cursor: pointer; }
.suggest__item:hover, .suggest__item:focus { background: var(--brand-soft); outline: none; }
.picked { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--brand-soft); }

.newform { max-width: 760px; display: grid; gap: 18px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .detail {
    position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(500px, 100vw);
    box-shadow: var(--shadow-pop); transform: translateX(105%); transition: transform .2s ease;
  }
  .detail.is-open { transform: none; }
  .detail__close { display: inline-grid; }
  .detail__placeholder { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 260px; transform: translateX(-105%); transition: transform .2s ease; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .topbar__menu { display: inline-grid; }
  .topbar { padding: 12px 14px 10px; }
  .toolbar { padding: 0 14px 12px; }
  .page { padding: 4px 14px 24px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board__cell { border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .hide-sm { display: none; }
  .dstub .tcode { font-size: 21px; }
}
