@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #08111f;
  --navy:    #0d1b2e;
  --navy2:   #132438;
  --sky:     #3b82f6;
  --sky2:    #60a5fa;
  --dhl-red:    #D40511;
  --dhl-yellow: #FFCC00;
  --amber:   #f59e0b;
  --amber2:  #fcd34d;
  --green:   #10b981;
  --green2:  #34d399;
  --purple:  #8b5cf6;
  --purple2: #a78bfa;
  --teal:    #14b8a6;
  --teal2:   #2dd4bf;
  --coral:   #ef4444;
  --coral2:  #f87171;
  --orange:  #ea580c;
  --orange2: #fb923c;
  --slate:   #94a3b8;
  --slate2:  #64748b;
  --slate3:  #475569;
  --white:   #f1f5f9;
  --white2:  #e2e8f0;
  --card:    rgba(255,255,255,0.04);
  --border:  rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.13);
  --mono:    'IBM Plex Mono', monospace;
  --sans:    'IBM Plex Sans', sans-serif;
}

.taad-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
  background: var(--bg, #0d1117);
  z-index: 100;
}
.taad-footer-copy { font-size: 11px; color: rgba(255,255,255,0.18); letter-spacing: 0.04em; }
.taad-shield {
  height: 48px; width: auto; object-fit: contain;
  opacity: 0.12; mix-blend-mode: screen;
  pointer-events: none; transition: opacity 0.3s;
}
.taad-shield:hover { opacity: 0.25; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--white);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ── HEADER ──────────────────────────────────────────────────────────────── */
.hdr {
  background: linear-gradient(135deg, #0a1830 0%, #111f36 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
}
.hdr-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px 13px 0;
  border-right: 1px solid var(--border);
  margin-right: 16px;
}
.dhl-badge {
  background: var(--dhl-red);
  border-radius: 5px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--dhl-yellow);
  font-family: var(--mono);
  letter-spacing: 1.5px;
}
.hdr-info { display: flex; flex-direction: column; justify-content: center; }
.hdr-title { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.hdr-sub   { font-size: 10px; color: var(--slate); font-family: var(--mono); margin-top: 2px; }

.hdr-stats {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
}
#btn-ingresar { align-self: center; margin-left: auto; margin-right: 8px; flex-shrink: 0; }
#btn-ingresar.active { background: rgba(59,130,246,0.2); color: var(--sky2); border: 1px solid rgba(59,130,246,0.4); }
.stat-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Sync indicator */
.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  align-self: center;
  margin-left: 10px;
  transition: background .3s;
  flex-shrink: 0;
}
.sync-indicator.syncing { background: var(--amber); animation: pulse 1s infinite; }
.sync-indicator.error   { background: var(--coral); }

/* ── TABS ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--navy);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--slate);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.tab:hover { color: var(--white2); }
.tab.active { color: var(--sky2); border-bottom-color: var(--sky); background: rgba(59,130,246,0.07); }
.tab i { font-size: 14px; }
.tbadge {
  background: var(--sky);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}
.tbadge.amber { background: var(--amber); }

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */
.main    { padding: 16px 20px; }
.panel   { display: none; }
.panel.active { display: block; }

/* ── SECTIONS ────────────────────────────────────────────────────────────── */
.sec {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.sec-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--sky2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-title i { font-size: 14px; }

/* ── INPUTS ──────────────────────────────────────────────────────────────── */
.igrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.igroup { display: flex; flex-direction: column; gap: 3px; }
.igroup label { font-size: 10px; color: var(--slate); font-family: var(--mono); letter-spacing: .3px; }
.igroup input,
.igroup textarea,
.igroup select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 7px 10px;
  color: var(--white);
  font-family: var(--mono);
  font-size: 12px;
  width: 100%;
  transition: border-color .15s;
  outline: none;
}
.igroup input:focus,
.igroup textarea:focus,
.igroup select:focus { border-color: var(--sky); }
.igroup textarea { resize: vertical; min-height: 90px; }
.igroup select option { background: var(--navy2); }
.full { grid-column: 1 / -1; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  cursor: pointer;
  border: none;
  border-radius: 5px;
  padding: 7px 14px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--sky); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--sky2); }
.btn-ghost    { background: rgba(255,255,255,0.07); color: var(--white2); border: 1px solid var(--border2); }
.btn-ghost:hover:not(:disabled)   { background: rgba(255,255,255,0.12); }
.btn-success  { background: rgba(16,185,129,0.18); color: var(--green2); border: 1px solid rgba(16,185,129,0.35); }
.btn-success:hover:not(:disabled) { background: rgba(16,185,129,0.28); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── FILE DROP ───────────────────────────────────────────────────────────── */
.fdrop {
  border: 1.5px dashed rgba(59,130,246,0.35);
  border-radius: 7px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  color: var(--slate);
  background: rgba(59,130,246,0.03);
}
.fdrop:hover, .fdrop.over {
  border-color: var(--sky);
  background: rgba(59,130,246,0.08);
  color: var(--white2);
}
.fdrop i { font-size: 28px; display: block; margin-bottom: 7px; color: var(--sky); }
.fdrop-hint { font-size: 11px; margin-top: 4px; color: var(--slate2); }
#file-inp { display: none; }

/* ── ALERTS ──────────────────────────────────────────────────────────────── */
.alert {
  border-radius: 6px;
  padding: 9px 13px;
  font-size: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.alert i { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.a-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.25); color: var(--sky2); }
.a-ok   { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: var(--green2); }
.a-warn { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25); color: var(--amber2); }
.a-err  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: var(--coral2); }

/* ── DHL NOTE ────────────────────────────────────────────────────────────── */
.dhl-note {
  background: rgba(212,5,17,0.07);
  border: 1px solid rgba(212,5,17,0.22);
  border-radius: 6px;
  padding: 9px 13px;
  font-size: 11px;
  color: #fca5a5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.dhl-note i    { color: var(--dhl-red); font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.dhl-note code { font-family: var(--mono); background: rgba(255,255,255,0.1); padding: 1px 5px; border-radius: 3px; }

/* ── TABLE ───────────────────────────────────────────────────────────────── */
.twrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
table  { width: 100%; border-collapse: collapse; font-size: 11.5px; min-width: 560px; }
thead tr { background: rgba(255,255,255,0.05); }
th {
  padding: 8px 9px;
  text-align: left;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--white2); }
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.03); transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody tr:last-child { border-bottom: none; }
td { padding: 7px 9px; color: var(--white2); vertical-align: middle; }
.mono { font-family: var(--mono); font-size: 11px; }

/* ── BADGES ──────────────────────────────────────────────────────────────── */
.bs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--mono);
}
.sdot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.dhl-notif  { background: rgba(59,130,246,0.13);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.28); }
.dhl-llegado{ background: rgba(16,185,129,0.13);  color: #34d399; border: 1px solid rgba(16,185,129,0.28); }

.aaca-sg   { background: rgba(100,116,139,0.13); color: #94a3b8; border: 1px solid rgba(100,116,139,0.22); }
.aaca-num  { background: rgba(59,130,246,0.13);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.28); }
.aaca-ped  { background: rgba(245,158,11,0.13);  color: #fcd34d; border: 1px solid rgba(245,158,11,0.28); }
.aaca-tram { background: rgba(16,185,129,0.13);  color: #34d399; border: 1px solid rgba(16,185,129,0.28); }

/* ── PIPELINE ────────────────────────────────────────────────────────────── */
.pip { display: flex; align-items: center; gap: 0; }
.pd  { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); flex-shrink: 0; }
.pd.done { background: var(--green); border-color: var(--green); }
.pd.cur  { background: var(--sky);   border-color: var(--sky); }
.pl { height: 2px; width: 8px; background: rgba(255,255,255,0.08); flex-shrink: 0; }
.pl.done { background: var(--green); }

/* ── FILTER ROW ──────────────────────────────────────────────────────────── */
.frow { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.swrap { position: relative; flex: 1; min-width: 150px; max-width: 220px; }
.swrap i { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--slate); font-size: 13px; pointer-events: none; }
.sbox {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 7px 8px 7px 28px;
  color: var(--white);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
}
.sbox:focus { border-color: var(--sky); }
.fsel {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 7px 10px;
  color: var(--white);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}
.fsel option { background: var(--navy2); }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.mbg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 1000; align-items: center; justify-content: center; }
.mbg.open { display: flex; }
.modal {
  background: #0e1e30;
  border: 1px solid var(--border2);
  border-radius: 10px;
  width: 580px;
  max-width: 96vw;
  max-height: 93vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
}
.mhdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
.mtitle { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mtitle i { color: var(--sky); }
.mclose { background: none; border: none; color: var(--slate); cursor: pointer; font-size: 18px; padding: 2px; transition: color .15s; line-height: 1; flex-shrink: 0; }
.mclose:hover { color: var(--white); }
.msec { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 6px; padding: 13px; margin-bottom: 10px; }
.msec-title { font-size: 10px; font-weight: 600; color: var(--sky2); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; display: flex; align-items: center; gap: 5px; }
.msec-title i { font-size: 12px; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.full-m { grid-column: 1 / -1; }
.mf { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.mf:last-child { margin-bottom: 0; }
.mf label { font-size: 10px; color: var(--slate); font-family: var(--mono); }
.mf input, .mf select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  padding: 7px 10px;
  color: var(--white);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.mf input:focus, .mf select:focus { border-color: var(--sky); }
.mf select option { background: var(--navy2); }

/* ── STAGE ROWS ──────────────────────────────────────────────────────────── */
.stage-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.stage-row:last-child { border-bottom: none; }
.stage-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; margin-top: 1px; transition: all .2s; }
.si-done    { background: rgba(16,185,129,0.15); color: var(--green2); border: 1px solid rgba(16,185,129,0.3); }
.si-pending { background: rgba(255,255,255,0.04); color: var(--slate);  border: 1px solid var(--border); }
.stage-label { font-size: 12px; font-weight: 500; margin-bottom: 6px; }

/* ── SUMMARY CARDS ───────────────────────────────────────────────────────── */
.sgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 9px; margin-bottom: 14px; }
.scard { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 8px; padding: 11px; }
.scard-label { font-size: 9px; color: var(--slate); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 5px; }
.scard-val   { font-size: 20px; font-weight: 600; font-family: var(--mono); }
.scard-sub   { font-size: 9px; color: var(--slate2); margin-top: 2px; }

/* ── IMPORT TAGS ─────────────────────────────────────────────────────────── */
.itag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-family: var(--mono); margin: 2px; }
.inew { background: rgba(16,185,129,0.13); color: var(--green2); }
.idup { background: rgba(245,158,11,0.13);  color: var(--amber2); }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 36px 20px; color: var(--slate); }
.empty i { font-size: 32px; display: block; margin-bottom: 8px; color: var(--slate3); }
.empty-hint { font-size: 11px; margin-top: 4px; color: var(--slate2); }

/* ── ACTION BUTTONS ──────────────────────────────────────────────────────── */
.abt {
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  font-size: 13px;
  transition: all .15s;
  line-height: 1;
}
.abt:hover        { background: rgba(255,255,255,0.09); color: var(--white); }
.abt.edit:hover   { color: var(--sky2); }
.abt.del:hover    { color: var(--coral2); }
.abt.track {
  color: var(--dhl-yellow);
  background: rgba(212,5,17,0.18);
  border: 1px solid rgba(212,5,17,0.3);
  font-size: 9.5px;
  padding: 3px 7px;
  font-weight: 700;
  font-family: var(--mono);
  border-radius: 4px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.abt.track:hover { background: var(--dhl-red); }

/* ── TOAST ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1e2d42;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--white2);
  z-index: 2000;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── LOADING SKELETON ────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  height: 12px;
  width: 100%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── ANIMATIONS ──────────────────────────────────────────────────────────── */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 580px) {
  .igrid, .mgrid { grid-template-columns: 1fr; }
  .hdr { padding: 0 12px; }
  .hdr-stats { display: none; }
}

/* ── License bar ── */
.taad-footer-lic { font-size: 10px; color: rgba(255,255,255,0.14); }
.taad-footer-lic a { color: rgba(255,255,255,0.28); text-decoration: none; }
.taad-footer-lic a:hover { text-decoration: underline; }
.taad-version { color: rgba(255,255,255,0.30); font-size: 10px; }
