/* =========================
   STC Tickets UI (Moderno)
   ========================= */

:root{
  --bg1:#0b1220;
  --bg2:#0b1a2e;
  --glass: rgba(255,255,255,.08);
  --glass2: rgba(255,255,255,.06);
  --stroke: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);

  --ok:#2dd4bf;
  --warn:#fbbf24;
  --bad:#fb7185;
  --pri:#60a5fa;

  --shadow: 0 16px 50px rgba(0,0,0,.45);
  --radius: 18px;
  --radius2: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

body{
  background-image: url("https://stctickets.blob.core.windows.net/$web/Fondodeweb.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;

  margin:0;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% -10%, #1a2b4d 0%, rgba(26,43,77,0) 60%),
              radial-gradient(1000px 700px at 80% 0%, #4a1b2b 0%, rgba(74,27,43,0) 55%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
  min-height:100vh;
}

body.theme-light{
  --bg1:#f3f6ff;
  --bg2:#e9eefb;
  --glass: rgba(0,0,0,.05);
  --glass2: rgba(0,0,0,.04);
  --stroke: rgba(0,0,0,.12);
  --text: rgba(5,10,20,.92);
  --muted: rgba(5,10,20,.65);
  --shadow: 0 16px 50px rgba(20,30,60,.18);
}

.stc-bg{
  background-image:
    radial-gradient(1200px 800px at 20% -10%, rgba(96,165,250,.22) 0%, rgba(96,165,250,0) 60%),
    radial-gradient(1100px 700px at 85% 5%, rgba(244,63,94,.18) 0%, rgba(244,63,94,0) 55%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

.glass{
  background: linear-gradient(180deg, var(--glass), var(--glass2));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.muted{ color: var(--muted); }
.mono{ font-family: var(--mono); }

.btn-primary, .btn-ghost, .btn-danger{
  appearance:none;
  border:1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor:pointer;
  color: var(--text);
  background: rgba(255,255,255,.06);
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}

.btn-primary{
  width:100%;
  background: linear-gradient(135deg, rgba(96,165,250,.95), rgba(45,212,191,.9));
  border-color: rgba(255,255,255,.22);
  color: rgba(5,10,20,.92);
}

.btn-danger{
  background: linear-gradient(135deg, rgba(251,113,133,.9), rgba(244,63,94,.9));
  border-color: rgba(255,255,255,.22);
  color: rgba(5,10,20,.92);
}

.btn-ghost:hover, .btn-danger:hover, .btn-primary:hover{ transform: translateY(-1px); }
.btn-ghost:active, .btn-danger:active, .btn-primary:active{ transform: translateY(0px); }

.login-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding: 22px;
}

.login-card{
  width: min(520px, 92vw);
  position:relative;
  overflow:hidden;
}

.theme-toggle{
  position:absolute;
  right: 14px;
  top: 14px;
}
.login-inner{
  padding: 28px 26px 22px;
}
.login-logo{
  width: 120px;
  height: 120px;
  border-radius: 26px;
  object-fit: cover;
  border:1px solid var(--stroke);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  display:block;
  margin: 6px auto 14px;
}
.login-title{
  text-align:center;
  letter-spacing:.5px;
  font-size: 22px;
  margin: 4px 0 6px;
}
.login-sub{
  text-align:center;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.field{ margin: 14px 0; }
.field-label{
  display:block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-input-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
}
.field-icon{ opacity:.9; }
.field-input-wrap input{
  flex:1;
  border:0;
  outline:none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}
.field-input-wrap input::placeholder{ color: rgba(255,255,255,.45); }
body.theme-light .field-input-wrap input::placeholder{ color: rgba(0,0,0,.45); }

.field-hint{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.login-status{
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
}
.status-muted{ color: var(--muted); }
.status-ok{ color: var(--ok); }
.status-error{ color: var(--bad); }

.tiny-note{
  margin-top: 12px;
  display:flex;
  align-items:center;
  gap:10px;
  color: var(--muted);
  font-size: 12px;
}
.tiny-note .dot{
  width:10px; height:10px; border-radius:999px;
  background: linear-gradient(135deg, rgba(96,165,250,.95), rgba(45,212,191,.9));
  box-shadow: 0 0 0 4px rgba(96,165,250,.12);
}

.foot-badge{
  margin-top: 14px;
  display:flex;
  align-items:center;
  gap:10px;
  font-size: 12px;
  opacity:.85;
}
.foot-badge .sep{ opacity:.5; }

/* ======= App shell ======= */
.app-shell{
  padding: 16px;
  display:grid;
  gap: 14px;
}

.top-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.hdr-left{ display:flex; align-items:center; gap: 12px; }
.hdr-logo{
  width: 56px; height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border:1px solid var(--stroke);
}
.hdr-titles{ line-height:1.05; }
.hdr-title{
  font-size: 16px;
  font-weight: 900;
  letter-spacing:.6px;
  color: rgba(230,235,245,.92);
}
body.theme-light .hdr-title{ color: rgba(10,15,25,.92); }
.hdr-subtitle{
  margin-top: 6px;
  font-size: 13px;
  color: rgba(200,210,225,.75);
}
body.theme-light .hdr-subtitle{ color: rgba(10,15,25,.60); }

.hdr-actions{ display:flex; gap: 10px; align-items:center; }
.hdr-actions .btn-ghost, .hdr-actions .btn-danger{ padding: 10px 12px; }

.profile-strip{ padding: 12px; }
.profile-grid{
  display:grid;
  gap: 10px 14px;
  grid-template-columns: repeat(6, 1fr);
}
.kv{ min-width: 0; }
.k{ font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.v{
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-pill{
  grid-column: span 2;
  border-radius: 14px;
  padding: 8px 10px;
  border:1px dashed rgba(255,255,255,.22);
  background: rgba(96,165,250,.12);
}

/* ======= Tabs ======= */
.main{
  display:grid;
  gap: 12px;
}

.tabs{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  align-items:center;
}

.tab-btn{
  display:flex;
  align-items:center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  cursor:pointer;
  user-select:none;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}
.tab-btn:hover{ transform: translateY(-1px); }
.tab-btn.active{
  background: linear-gradient(135deg, rgba(96,165,250,.95), rgba(45,212,191,.88));
  border-color: rgba(255,255,255,.22);
  color: rgba(5,10,20,.92);
}

.tab-content{ padding: 14px; }

/* ======= Forms / tables ======= */
.grid-2{ display:grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3{ display:grid; gap: 12px; grid-template-columns: repeat(3, minmax(0,1fr)); }

.input, select, textarea{
  width:100%;
  box-sizing:border-box;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 12px;
  outline:none;
}
textarea{ min-height: 120px; resize: vertical; }
label{ display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.card{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius: var(--radius2);
  padding: 12px;
}

.row{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: var(--radius2);
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom:1px solid rgba(255,255,255,.09);
  font-size: 13px;
}
.table th{
  text-align:left;
  font-size: 12px;
  color: var(--muted);
  user-select:none;
  cursor:pointer;
}
.sort{
  margin-left: 6px;
  opacity:.6;
  font-size: 11px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--stroke);
  font-size: 12px;
  font-weight: 800;
}
.badge.ok{ background: rgba(45,212,191,.12); }
.badge.warn{ background: rgba(251,191,36,.14); }
.badge.bad{ background: rgba(251,113,133,.14); }
.badge.info{ background: rgba(96,165,250,.14); }

hr.sep{
  border:0;
  border-top:1px solid rgba(255,255,255,.10);
  margin: 14px 0;
}

/* ======= Modal ======= */
.modal{ position:fixed; inset:0; z-index: 9999; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }
.modal-card{
  position:relative;
  width: min(980px, 94vw);
  height: min(82vh, 720px);
  margin: 8vh auto 0;
  display:flex;
  flex-direction: column;
  overflow:hidden;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.modal-title{ font-weight: 900; }
.modal-body{
  flex:1;
  padding: 0;
  overflow: hidden;
}

/* ======= Mobile ======= */
.mobile-quick{
  min-height: 100vh;
  display:grid;
  gap: 12px;
  padding: 12px;
}
.mq-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}
.mq-logo{ width: 46px; height:46px; border-radius: 14px; object-fit: cover; border:1px solid var(--stroke); }
.mq-title{ font-weight: 900; letter-spacing:.4px; }
.mq-body{ padding: 12px; }

@media (max-width: 980px){
  .profile-grid{ grid-template-columns: repeat(2, 1fr); }
  .role-pill{ grid-column: span 2; }
  .grid-3{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
  .top-header{ flex-direction: column; align-items: stretch; }
  .hdr-actions{ justify-content: space-between; }
}


/* ====== Selects (fix modo oscuro) ====== */
select, option {
  color: var(--fg);
}
body:not(.theme-light) select {
  background: rgba(15, 23, 42, 0.92);
  color: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.18);
}
body:not(.theme-light) select option {
  background: #0b1222;
  color: rgba(255,255,255,0.92);
}

/* ====== Header unificado ====== */
.top-header {
  box-shadow: 0 18px 60px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
}
.profile-strip {
  margin-top: 10px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(255,255,255,0.05);
}

/* ====== Stats chips (solo números) ====== */
.stats-row{
  display:flex;
  gap:10px;
  padding: 10px 14px;
  margin-top: 10px;
}
.stat-chip{
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 92px;
  height: 44px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor: default;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 12px 30px rgba(0,0,0,0.20);
  position:relative;
  overflow:hidden;
}
.stat-chip::after{
  content:"";
  position:absolute;
  inset:-60px;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 45%),
              radial-gradient(circle at 80% 60%, rgba(255,255,255,0.12), transparent 55%);
  transform: rotate(8deg);
  animation: shimmer 6s linear infinite;
  opacity: .6;
}
@keyframes shimmer{
  0%{ transform: translateX(-10%) rotate(8deg); }
  100%{ transform: translateX(10%) rotate(8deg); }
}
.stat-num{
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .5px;
  position:relative;
  z-index:1;
}
.stat-total{ background: rgba(59,130,246,0.18); }
.stat-open{ background: rgba(245,158,11,0.18); }
.stat-closed{ background: rgba(34,197,94,0.18); }

/* ====== Tabs as pills ====== */
.tabs.tabs-as-pills{
  gap:10px;
}
.tab-btn{
  border-radius: 14px !important;
  padding: 10px 14px !important;
  font-weight: 800;
  letter-spacing: .4px;
}
.tab-btn.active{
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

/* ====== Modal (box frame) ====== */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(3,7,18,0.72);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9999;
  padding: 18px;
}
.modal-frame{
  width: min(1100px, 100%);
  max-height: min(92vh, 980px);
  overflow: hidden;
  border-radius: 18px;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 28px 90px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.05);
}
body.theme-light .modal-frame{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.12);
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(90deg, rgba(30,58,138,0.22), rgba(15,23,42,0.10));
}
.modal-title{
  font-weight: 900;
  letter-spacing: .5px;
}
.modal-actions{
  display:flex;
  gap:8px;
}
.modal-body{
  padding: 14px;
  overflow:auto;
  max-height: calc(92vh - 120px);
}
.modal-foot{
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.10);
  display:flex;
  justify-content:flex-end;
  background: rgba(255,255,255,0.03);
}

/* Attach grid */
.attach-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:10px; }
.attach-item{
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 10px;
  background: rgba(255,255,255,0.05);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.attach-name{
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-weight: 700;
}
.attach-actions{ display:flex; gap:8px; }

/* Maintenance layout */
.mnt-layout{
  display:grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
}
.mnt-side{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  height: fit-content;
}
.mnt-item{
  width: 100%;
  text-align:left;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: var(--fg);
  cursor:pointer;
  margin-bottom: 8px;
  font-weight: 800;
}
.mnt-item.active{
  background: rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.35);
}
.mnt-sep{
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 10px 0;
}
.mnt-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 10px; }
.mnt-title{ font-weight: 900; font-size: 16px; }
.list-box{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  overflow:hidden;
}
.list-row{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.list-row:last-child{ border-bottom:none; }

/* ====== Cliente: cards ====== */
.card-list{ display:grid; gap:12px; margin-top: 12px; }
.tcard{
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 12px 12px;
  background: rgba(255,255,255,0.05);
  box-shadow: 0 16px 40px rgba(0,0,0,0.22), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.tcard-top{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 10px; }
.tcard-id{ font-weight: 900; letter-spacing: .6px; }
.tcard-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap:10px; }
.tcard .k{ font-size: 12px; opacity:.75; margin-bottom: 4px; }
.tcard .v{ font-weight: 700; }

.fatal-error{
  margin: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(239,68,68,0.18);
  border: 1px solid rgba(239,68,68,0.35);
  color: rgba(255,255,255,0.92);
  font-weight: 800;
}
body.theme-light .fatal-error{ color: rgba(15,23,42,0.92); }



/* ===================== v5 Adjustments (UI requested) ===================== */

/* Fondo global (sitio completo) */
body.stc-bg{
  background-image: url("https://stctickets.blob.core.windows.net/$web/Fondodeweb.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* TOP FRAME: header + perfil en un solo marco */
.top-frame{
  margin: 18px auto 10px auto;
  max-width: 1280px;
  padding: 14px 14px 10px 14px;
  border-radius: 18px;
}
.top-frame .top-header{
  padding: 6px 6px 10px 6px;
  margin: 0;
  border-radius: 14px;
  background: transparent;
}
.profile-strip-inner{
  margin-top: 6px;
  padding: 0 6px 6px 6px;
}
.tabs-and-stats{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 8px 6px 0 6px;
  flex-wrap: wrap;
}
.stats-inline{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.stat-inline{
  display:flex;
  align-items:baseline;
  gap:8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,23,42,.20);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
}
.theme-light .stat-inline{
  background: rgba(255,255,255,.50);
  border: 1px solid rgba(2,6,23,.10);
}
.stat-inline .lab{
  font-size: 11px;
  opacity: .85;
  letter-spacing: .2px;
}
.stat-inline .num{
  font-weight: 900;
  font-size: 16px;
}

/* Tabs más pegadas al header y con aspecto de pestaña */
.tabs.tabs-as-pills{
  margin: 0;
  padding: 6px 0 0 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.tab-btn{
  border-radius: 14px;
  padding: 10px 14px;
}

/* Content spacing (más espacio para los tiquetes) */
.main{
  margin-top: 8px;
}

/* Filtros compactos en una sola línea */
.list-tools.compact{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.list-tools.compact input.input{
  max-width: 420px;
  height: 36px;
}
.list-tools.compact select{
  height: 36px;
  max-width: 240px;
}

/* Tabla para listas grandes (pendientes/finalizados) */
.table-wrap{
  margin-top: 10px;
  overflow:auto;
  border-radius: 14px;
}
.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
}
.table thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(10px);
}
.theme-light .table thead th{
  background: rgba(255,255,255,.70);
}
.table td, .table th{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.theme-light .table td, .theme-light .table th{
  border-bottom: 1px solid rgba(2,6,23,.08);
}
.table tr:hover td{
  background: rgba(255,255,255,.06);
}
.theme-light .table tr:hover td{
  background: rgba(2,6,23,.04);
}

/* Modal ticket: más sólido, legible */
.modal-frame{
  border-radius: 18px;
  background: rgba(2,6,23,.88);
}
.theme-light .modal-frame{
  background: rgba(255,255,255,.92);
}
.modal-body{
  max-height: 72vh;
  overflow:auto;
}
.detail-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}
@media (max-width: 980px){
  .detail-grid{ grid-template-columns: 1fr; }
}
.card{
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(15,23,42,.25);
  border-radius: 14px;
  padding: 12px;
}
.theme-light .card{
  border: 1px solid rgba(2,6,23,.10);
  background: rgba(255,255,255,.65);
}

/* Adjuntos */
.attach-item{
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15,23,42,.22);
}
.theme-light .attach-item{
  border: 1px solid rgba(2,6,23,.10);
  background: rgba(255,255,255,.65);
}
.attach-actions{
  display:flex;
  gap: 8px;
  margin-top: 8px;
}

/* Mantenimientos: scroll interno y layout fijo */
.mnt-shell{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  margin-top: 10px;
  height: 70vh;
  overflow: hidden;
}
.mnt-side{
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 10px;
  overflow:auto;
  background: rgba(15,23,42,.18);
}
.theme-light .mnt-side{
  border: 1px solid rgba(2,6,23,.10);
  background: rgba(255,255,255,.55);
}
.mnt-main{
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px;
  overflow:auto;
  background: rgba(15,23,42,.18);
}
.theme-light .mnt-main{
  border: 1px solid rgba(2,6,23,.10);
  background: rgba(255,255,255,.55);
}
.mnt-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.mnt-title{
  font-size: 18px;
  font-weight: 900;
}
.mnt-item{
  width:100%;
  text-align:left;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(15,23,42,.16);
  margin-bottom: 8px;
}
.theme-light .mnt-item{
  border: 1px solid rgba(2,6,23,.10);
  background: rgba(255,255,255,.55);
}
.mnt-item.active{
  outline: 2px solid rgba(56,189,248,.55);
}

/* Arregla selects en modo oscuro (opciones legibles) */
select, option{
  color: inherit;
}
body:not(.theme-light) select{
  background-color: rgba(2,6,23,.55);
}
body:not(.theme-light) option{
  background-color: #0b1222;
  color: #e5e7eb;
}
/* ======================================================================= */


/* ===================== v6: Light only + Metallic glass + Sticky header ===================== */
body.theme-light{ color: #0b1222; }
body.theme-light .glass{
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(2,6,23,.10);
  box-shadow: 0 18px 50px rgba(2,6,23,.10);
}
body.theme-light .top-frame{
  position: sticky;
  top: 10px;
  z-index: 60;
  backdrop-filter: blur(14px);
}
body.theme-light .tabs-and-stats{ padding-top: 6px; }
body.theme-light .stat-inline{
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(2,6,23,.10);
}
body.theme-light .tab-btn{
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(2,6,23,.10);
}
body.theme-light .tab-btn.active{
  background: rgba(14,165,233,.22);
  border-color: rgba(14,165,233,.35);
}
body.theme-light .table thead th{
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(2,6,23,.08);
}
body.theme-light select{
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(2,6,23,.12);
  color: #0b1222;
}
body.theme-light option{ background:#fff; color:#0b1222; }
body.theme-light .modal-frame{ background: rgba(255,255,255,.95); }
body.theme-light .card{ background: rgba(255,255,255,.78); }
body.theme-light .mnt-shell{ height: 72vh; }
body.theme-light .table-wrap.compact{ max-height: 54vh; overflow:auto; }
body.theme-light .mnt-side, body.theme-light .mnt-main{
  background: rgba(255,255,255,.62);
}
/* Oculta cualquier UI de tema (por si quedara algo) */
#btnTheme{ display:none !important; }
/* ======================================================================= */

/* v6 table column sizing + sortable */
.col-small{ width: 90px; white-space: nowrap; }
.mono{ font-variant-numeric: tabular-nums; }
th .sort-ind{ opacity:.7; font-size: 11px; margin-left:6px; }


/* v12: Header fijo ancho completo + contenido con scroll (evita que suba bajo el header) */
:root{ --stc-header-h: 160px; }
.stc-header{ position: sticky; top: 0; z-index: 50; width: 100%; }
.stc-page{ height: 100vh; overflow: hidden; }
.stc-main{ height: calc(100vh - var(--stc-header-h)); overflow: auto; padding-top: 10px; }
@media (max-width: 720px){ :root{ --stc-header-h: 180px; } }


/* v14: Header ancho como el contenido + scroll correcto */
.top-frame{
  width: 100%;
  max-width: none;
}
.app-shell{
  min-height: calc(100vh - 24px);
  display: grid;
  grid-template-rows: auto 1fr;
}
.main{ min-height: 0; }
.tab-content{
  height: 100%;
  overflow: auto;
}

/* v14: colores estado */
.badge{ display:inline-block; padding:4px 10px; border-radius:999px; font-weight:700; font-size:12px; line-height:1; }
.badge-urgente{ background: rgba(255,0,0,0.18); color: #b40000; border: 1px solid rgba(255,0,0,0.25); }
.badge-encurso{ background: rgba(0,255,0,0.14); color: #0a7a21; border: 1px solid rgba(0,255,0,0.22); }
.badge-pendiente{ background: rgba(255,193,7,0.20); color:#7a5a00; border: 1px solid rgba(255,193,7,0.30); }


/* v15: scroll tabs y tablas (sin afectar lógica) */
.main { min-height: 0 !important; }
.tab-content { min-height: 0 !important; overflow: auto !important; }
.tab-content > * { min-height: 0; }
.table-wrap { overflow: auto !important; max-height: calc(100vh - 320px) !important; }
@media (max-width: 720px){
  .table-wrap{ max-height: calc(100vh - 360px) !important; }
}



/* v16: Ajustes layout (sin tocar lógica) */
.stc-page{
  height: auto !important;
  min-height: 100vh !important;
  overflow: auto !important;
}

/* Header pegado arriba y alineado con contenido */
.app-shell{ padding-top: 0 !important; }
.top-frame{
  margin: 0 0 10px 0 !important;
  max-width: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.theme-light .top-frame{
  top: 0 !important;
}

/* Scroll real en panel principal (crear/listas) */
.tab-content{
  max-height: calc(100vh - 250px) !important;
  overflow: auto !important;
}
.table-wrap{
  max-height: calc(100vh - 300px) !important;
}
@media (max-width: 720px){
  .tab-content{ max-height: calc(100vh - 270px) !important; }
  .table-wrap{ max-height: calc(100vh - 330px) !important; }
}


/* v17: Un solo scroll en listas (tabla) + encabezados fijos */
.list-shell{
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.list-shell .section-head,
.list-shell .list-tools{
  flex: 0 0 auto;
}
.list-shell .table-wrap{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto !important;
  max-height: none !important;
}

/* Encabezado de tabla fijo */
.table thead th{
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
}

/* Botón de orden */
.th-sort{
  width: 100%;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 10px 10px;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
}
.th-sort .sort-ind{
  opacity: .55;
  font-size: 12px;
}
th.sort-asc .th-sort .sort-ind{ opacity: 1; }
th.sort-desc .th-sort .sort-ind{ opacity: 1; }


/* v18: quitar scroll global, cada pestaña maneja su scroll interno */
.stc-page{
  height: 100vh !important;
  overflow: hidden !important;
}
.app-shell{
  height: calc(100vh - 0px) !important;
}
.main{
  overflow: hidden !important;
}
.tab-content{
  height: 100%;
  overflow: auto !important; /* por defecto: listas usan tabla; crear se activa con clase */
}

/* Crear: scroll interno */
.tab-content.create-scroll{
  overflow: auto !important;
}

/* Listas: solo scroll en tabla */
.list-shell{ height: 100%; overflow: hidden; }
.list-shell .table-wrap{ overflow:auto !important; }

/* v19: borde visible y sin scroll global */
.main{ padding-bottom: 14px !important; box-sizing:border-box; }

.list-shell .form-grid{ flex:1 1 auto; min-height:0; overflow:auto !important; }

/* ===== Layout: evitar scroll global y mantener scroll interno ===== */
html, body{ height:100%; }
body{ overflow:hidden; }
.app-shell{ height:100vh; display:flex; flex-direction:column; }
.main{ flex:1 1 auto; min-height:0; }
.tab-content{ flex:1 1 auto; min-height:0; overflow:hidden; }

/* ===== Mobile simple ===== */
@media (max-width: 820px){
  body{ overflow:hidden; }
  .mobile-quick{ height:100vh; display:flex; flex-direction:column; }
  .mq-header{ flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px; }
  .mq-title{ font-weight:800; font-size:14px; line-height:1.1; text-transform:uppercase; }
  .mq-actions{ display:flex; gap:8px; }
  .mq-body{ flex:1 1 auto; min-height:0; overflow:hidden; padding:12px; }
  #mqMount{ height:100%; }
  .mobile-quick .list-shell{ height:100%; min-height:0; }
  .mobile-quick .section-head{ display:none !important; } /* solo header superior */
  .mobile-quick .form-grid{ overflow:auto !important; min-height:0 !important; }
  .mobile-quick .btn-primary{ width:100%; }
  .mobile-quick .mq-save-overlay{
    position:fixed;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    z-index: 9999;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    text-align:center;
  }
}



/* ==========================================================
   NUEVO: Tabla tipo Excel (solo para LISTA DE TIQUETES y FINALIZADOS)
   - NO afecta CREAR ni móvil (scoped a .excel-shell)
   ========================================================== */
.excel-shell{
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.excel-head{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(2,6,23,.10);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
}

.excel-title{
  font-weight: 800;
  letter-spacing: .2px;
}

.excel-tools{
  display: flex;
  align-items: center;
  gap: 10px;
}

.excel-search{
  width: 320px;
  max-width: 48vw;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(2,6,23,.18);
  outline: none;
  background: rgba(255,255,255,.95);
}

.excel-btn{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(2,6,23,.18);
  background: rgba(255,255,255,.95);
  cursor: pointer;
}

.excel-btn:hover{ filter: brightness(0.98); }

.excel-btn-mini{
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 12px;
}

.excel-wrap{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto; /* único scroll del módulo */
  border: 1px solid rgba(2,6,23,.10);
  border-radius: 0 0 14px 14px;
  background: rgba(255,255,255,.96);
}

.excel-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.excel-table thead th{
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(245,247,250,.98);
  border-bottom: 1px solid rgba(2,6,23,.12);
}

.xl-th{
  padding: 8px 10px;
  border-right: 1px solid rgba(2,6,23,.10);
  white-space: nowrap;
}

.xl-th:last-child{ border-right: 0; }

.xl-sort{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  color: rgba(2,6,23,.78);
}

.xl-ind{
  font-size: 10px;
  opacity: .55;
}

th.xl-asc .xl-ind{ opacity: 1; }
th.xl-desc .xl-ind{ opacity: 1; }

.xl-td{
  padding: 8px 10px;
  border-bottom: 1px solid rgba(2,6,23,.08);
  border-right: 1px solid rgba(2,6,23,.06);
  background: rgba(255,255,255,.98);
  vertical-align: middle;
}

.xl-td:last-child{ border-right: 0; }

.xl-tr:nth-child(even) .xl-td{ background: rgba(248,250,252,.98); }

.xl-td-action{
  width: 90px;
  text-align: right;
}

.xl-th-action{ width: 90px; }

.xl-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }


/* ==========================================================
   Excel-like List - Footer (paginación + export)
   - Scoped a .excel-shell (NO afecta CREAR ni móvil)
   ========================================================== */
.excel-foot{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(148,163,184,.35);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
}

body:not(.theme-light) .excel-foot{
  background: rgba(15,23,42,.85);
}

.excel-foot-left{ display:flex; align-items:center; gap:10px; }

.excel-foot-right{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.excel-pageinfo{
  font-size: 12px;
  opacity: .9;
}

.excel-pager{
  display:flex;
  align-items:center;
  gap: 8px;
}

.excel-page{
  width: 70px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.45);
  background: rgba(255,255,255,.9);
  color: inherit;
}

body:not(.theme-light) .excel-page{
  background: rgba(2,6,23,.55);
}

.excel-page-total{
  font-size: 12px;
  opacity: .9;
}

.excel-pagesize{
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.45);
  background: rgba(255,255,255,.9);
  color: inherit;
}

body:not(.theme-light) .excel-pagesize{
  background: rgba(2,6,23,.55);
}


/* ======= Empresa row coloring (pendientes/finalizados) ======= */
.excel-table tr.empresa-novogar td{ background: rgba(34,197,94,.14); } /* Verde claro */
.excel-table tr.empresa-fmsfood td{ background: rgba(250,204,21,.16); } /* Amarillo suave */
.excel-table tr.empresa-maccsa td{ background: rgba(244,114,182,.14); } /* Rosado */
.excel-table tr.empresa-izquierdo td{ background: rgba(59,130,246,.12); } /* Celeste */
.excel-table tr.empresa-perstige td{ background: rgba(249,115,22,.14); } /* Naranja */
.excel-table tr.empresa-oftalmologica td{ background: rgba(161,98,7,.10); } /* Café muy claro */
.excel-table tr.empresa-stc td{ background: rgba(148,163,184,.14); } /* Grisáceo */
.excel-table tr.empresa-otros td{ background: rgba(203,213,225,.10); } /* Neutro */

/* Legacy random buckets (no usados) */
.excel-table tr.empresa-c1 td{ background: rgba(59,130,246,.10); }
.excel-table tr.empresa-c2 td{ background: rgba(168,85,247,.10); }
.excel-table tr.empresa-c3 td{ background: rgba(20,184,166,.10); }
.excel-table tr.empresa-c4 td{ background: rgba(244,63,94,.08); }
.excel-table tr.empresa-c5 td{ background: rgba(234,179,8,.10); }


/* Urgente: rojo parpadeando */
@keyframes urgentBlink{
  0%, 49% { filter: none; }
  50%, 100% { filter: brightness(1.08); }
}
.excel-table tr.ticket-urgente td{
  background: rgba(239,68,68,.20) !important;
  animation: urgentBlink 1s linear infinite;
}
.excel-table tr.ticket-urgente:hover td{
  background: rgba(239,68,68,.26) !important;
}

/* Legend modal */
.legend-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.legend-item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}
.legend-swatch{
  width: 22px;
  height: 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.16);
  display:inline-block;
}
.legend-swatch.empresa-novogar{ background: rgba(34,197,94,.26); }
.legend-swatch.empresa-fmsfood{ background: rgba(250,204,21,.34); }
.legend-swatch.empresa-c1{ background: rgba(59,130,246,.22); }
.legend-label{ font-weight: 700; }
