/* ============================================================
   Z3ro LiveShop — Design System v3
   Referencia visual: Google Workspace / Gmail
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Text:wght@400;500&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  /* Superficies */
  --bg:     #F8F9FA;
  --sur:    #FFFFFF;
  --sur2:   #F1F3F4;
  --sur3:   #E8EAED;

  /* Bordes */
  --ln:     #E0E0E0;
  --ln2:    #BDBDBD;

  /* Texto */
  --tx:     #202124;
  --tx2:    #5F6368;
  --tx3:    #9AA0A6;

  /* Brand */
  --br:     #1A73E8;
  --br-dk:  #1557B0;
  --br-lt:  #E8F0FE;
  --br-md:  #AECBFA;

  /* Semánticos */
  --rd:     #D93025;
  --rd-lt:  #FCE8E6;
  --rd-md:  #F5C6C2;

  --gn:     #188038;
  --gn-lt:  #E6F4EA;
  --gn-md:  #A8D5B5;

  --yw:     #E37400;
  --yw-lt:  #FEF3E2;
  --yw-md:  #FDD663;

  --cy:     #0097A7;
  --cy-lt:  #E0F7FA;

  --pu:     #7B1FA2;
  --pu-lt:  #F3E5F5;

  /* Tipografía */
  --font:      'Google Sans Text', 'Google Sans', system-ui, sans-serif;
  --font-head: 'Google Sans', system-ui, sans-serif;
  --mono:      'Roboto Mono', monospace;

  /* Layout */
  --sb-w:   220px;
  --top-h:  64px;

  /* Radios */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-pill: 999px;
  --r-full: 50%;

  /* Sombras — muy sutiles, estilo Google */
  --sh-1:     0 1px 2px rgba(60,64,67,.10), 0 1px 3px rgba(60,64,67,.08);
  --sh-2:     0 1px 3px rgba(60,64,67,.12), 0 2px 6px rgba(60,64,67,.10);
  --sh-3:     0 4px 8px rgba(60,64,67,.12), 0 2px 4px rgba(60,64,67,.08);
  --sh-modal: 0 11px 15px rgba(0,0,0,.12), 0 9px 46px rgba(0,0,0,.08);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--tx);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--br); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, select, textarea { font-family: var(--font); }
svg { display: block; flex-shrink: 0; }

/* ── App shell — sidebar en DOM, no inyectado ── */
.z3-app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.z3-sidebar {
  width: var(--sb-w);
  flex-shrink: 0;
  background: var(--sur);
  border-right: 1px solid var(--ln);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.z3-sb-logo {
  height: var(--top-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--ln);
}
.z3-sb-mark {
  width: 28px; height: 28px;
  background: var(--br);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-head);
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -.02em;
}
.z3-sb-name {
  font-family: var(--font-head);
  font-size: 16px; font-weight: 500;
  color: var(--tx);
}
.z3-sb-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}
.z3-sb-section {
  padding: 16px 20px 4px;
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--tx3);
}
.z3-sb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  height: 40px;
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  margin-right: 16px;
  font-size: 13.5px; font-weight: 400;
  color: var(--tx2);
  cursor: pointer;
  transition: background .1s, color .1s;
  text-decoration: none;
  white-space: nowrap;
}
.z3-sb-item:hover {
  background: var(--sur2);
  color: var(--tx);
  text-decoration: none;
}
.z3-sb-item.active {
  background: var(--br-lt);
  color: var(--br);
  font-weight: 600;
}
.z3-sb-item svg { color: var(--tx3); flex-shrink: 0; }
.z3-sb-item.active svg { color: var(--br); }
.z3-sb-item:hover svg { color: var(--tx2); }
.z3-sb-divider { height: 1px; background: var(--ln); margin: 6px 0; }
.z3-sb-bottom {
  border-top: 1px solid var(--ln);
  padding: 8px 0;
}

/* ── Main ── */
.z3-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.z3-topbar {
  height: var(--top-h);
  background: var(--sur);
  border-bottom: 1px solid var(--ln);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.z3-topbar-title {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 400;
  color: var(--tx);
  flex: 1;
}
.z3-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.z3-sess-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--ln);
  border-radius: var(--r-pill);
  font-size: 13px;
  color: var(--tx2);
  cursor: pointer;
  transition: background .1s;
  max-width: 240px;
  background: var(--sur);
}
.z3-sess-chip:hover { background: var(--sur2); }
.z3-sess-dot {
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--sur3);
  flex-shrink: 0;
}
.z3-sess-dot.live   { background: var(--rd); }
.z3-sess-dot.active { background: var(--gn); }
.z3-sess-chip span  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z3-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: var(--br);
  color: #fff;
  font-family: var(--font-head);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Page content ── */
.z3-page { flex: 1; padding: 28px 32px; }
.z3-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.z3-page-title {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 400;
  color: var(--tx);
}
.z3-page-sub {
  font-size: 13px;
  color: var(--tx3);
  margin-top: 3px;
}
.z3-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.z3-section-label {
  font-size: 11px; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx3);
  margin-bottom: 10px;
}

/* ── Cards ── */
.card {
  background: var(--sur);
  border: 1px solid var(--ln);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  transition: box-shadow .15s, border-color .15s;
}
.card-p { padding: 20px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ln);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: var(--font-head);
  font-size: 14px; font-weight: 500;
  color: var(--tx);
}
.card-body { padding: 16px 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--ln);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* KPI card */
.kpi-card {
  background: var(--sur);
  border: 1px solid var(--ln);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  padding: 20px;
}
.kpi-label { font-size: 12px; color: var(--tx2); margin-bottom: 8px; }
.kpi-val {
  font-family: var(--font-head);
  font-size: 28px; font-weight: 400;
  color: var(--tx);
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-sub { font-size: 12px; color: var(--tx3); }
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  font-family: var(--font);
  min-height: 36px;
  padding: 0 16px;
  transition: background .1s, box-shadow .1s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn:disabled { opacity: .38; pointer-events: none; }
.btn-primary  { background: var(--br); color: #fff; box-shadow: 0 1px 2px rgba(26,115,232,.3); }
.btn-primary:hover { background: var(--br-dk); box-shadow: 0 2px 6px rgba(26,115,232,.4); }
.btn-ghost    { background: var(--sur); border-color: var(--ln); color: var(--tx2); }
.btn-ghost:hover { background: var(--sur2); border-color: var(--ln2); color: var(--tx); }
.btn-text     { background: transparent; color: var(--br); padding: 0 8px; }
.btn-text:hover { background: var(--br-lt); }
.btn-tonal    { background: var(--br-lt); color: var(--br); }
.btn-tonal:hover { background: #d2e3fc; }
.btn-danger   { background: transparent; border-color: var(--rd-md); color: var(--rd); }
.btn-danger:hover { background: var(--rd-lt); }
.btn-sm  { min-height: 30px; padding: 0 12px; font-size: 12px; }
.btn-xs  { min-height: 26px; padding: 0 10px; font-size: 12px; }
.btn-icon    { padding: 0; width: 36px; min-height: 36px; border-radius: var(--r-full); }
.btn-icon-sm { padding: 0; width: 30px; min-height: 30px; border-radius: var(--r-full); }

/* ── Chips ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ln);
  background: var(--sur);
  color: var(--tx2);
  cursor: pointer;
  transition: all .1s;
  white-space: nowrap;
}
.chip:hover { background: var(--sur2); border-color: var(--ln2); }
.chip.active { background: var(--br-lt); border-color: var(--br-md); color: var(--br); font-weight: 600; }
.chip-count {
  font-size: 11px; font-weight: 600;
  background: var(--sur2);
  border-radius: var(--r-pill);
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}
.chip.active .chip-count { background: var(--br-md); color: var(--br); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  line-height: 1.5;
}
.badge-blue   { background: var(--br-lt); color: var(--br); }
.badge-green  { background: var(--gn-lt); color: var(--gn); }
.badge-red    { background: var(--rd-lt); color: var(--rd); }
.badge-amber  { background: var(--yw-lt); color: var(--yw); }
.badge-gray   { background: var(--sur2);  color: var(--tx2); border: 1px solid var(--ln); }
.badge-purple { background: var(--pu-lt); color: var(--pu); }

/* ── Inputs ── */
.z3-input, .z3-select, .z3-textarea {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--ln);
  border-radius: var(--r-sm);
  font-size: 14px; font-family: var(--font);
  color: var(--tx); background: var(--sur);
  transition: border-color .1s, box-shadow .1s;
  width: 100%; outline: none;
}
.z3-textarea { height: auto; padding: 10px 12px; resize: vertical; }
.z3-input::placeholder, .z3-textarea::placeholder { color: var(--tx3); }
.z3-input:focus, .z3-select:focus, .z3-textarea:focus {
  border-color: var(--br);
  box-shadow: 0 0 0 2px rgba(26,115,232,.2);
}
.z3-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.z3-field:last-child { margin-bottom: 0; }
.z3-field-label { font-size: 12px; font-weight: 500; color: var(--tx2); display: block; margin-bottom: 4px; }

/* Search */
.z3-search { position: relative; display: flex; align-items: center; }
.z3-search-ico { position: absolute; left: 10px; color: var(--tx3); pointer-events: none; }
.z3-search input {
  height: 36px; padding: 0 12px 0 36px;
  border: 1px solid var(--ln); border-radius: var(--r-pill);
  font-size: 13.5px; font-family: var(--font);
  color: var(--tx); background: var(--sur2);
  width: 100%; outline: none;
  transition: background .1s, border-color .1s, box-shadow .1s;
}
.z3-search input:focus { background: var(--sur); border-color: var(--br); box-shadow: 0 0 0 2px rgba(26,115,232,.2); }
.z3-search input::placeholder { color: var(--tx3); }

/* ── Table ── */
.z3-table-wrap { overflow-x: auto; }
.z3-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.z3-table th {
  text-align: left; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--tx3); padding: 10px 16px;
  border-bottom: 1px solid var(--ln);
  white-space: nowrap; background: var(--sur);
}
.z3-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--ln);
  color: var(--tx2); vertical-align: middle;
}
.z3-table tr:last-child td { border-bottom: none; }
.z3-table tbody tr { transition: background .1s; }
.z3-table tbody tr:hover td { background: var(--sur2); }
.z3-table td.primary { color: var(--tx); font-weight: 500; }

/* ── Empty state ── */
.z3-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; text-align: center;
}
.z3-empty-ico {
  width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--sur2); border: 1px solid var(--ln);
  display: flex; align-items: center; justify-content: center;
  color: var(--tx3); margin-bottom: 16px;
}
.z3-empty-title { font-family: var(--font-head); font-size: 15px; font-weight: 500; color: var(--tx); margin-bottom: 6px; }
.z3-empty-desc { font-size: 13px; color: var(--tx3); line-height: 1.6; max-width: 300px; }

/* ── Modal ── */
.z3-overlay {
  position: fixed; inset: 0;
  background: rgba(32,33,36,.5);
  z-index: 200; display: flex;
  align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.z3-overlay.open { opacity: 1; pointer-events: auto; }
.z3-modal {
  background: var(--sur); border-radius: var(--r-lg);
  box-shadow: var(--sh-modal);
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(8px) scale(.98);
  transition: transform .18s;
}
.z3-overlay.open .z3-modal { transform: translateY(0) scale(1); }
.z3-modal-header {
  padding: 20px 24px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-shrink: 0;
}
.z3-modal-title { font-family: var(--font-head); font-size: 16px; font-weight: 500; color: var(--tx); }
.z3-modal-body { padding: 0 24px 20px; overflow-y: auto; flex: 1; }
.z3-modal-footer {
  padding: 12px 24px 16px; border-top: 1px solid var(--ln);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-shrink: 0;
}

/* ── Toast ── */
#z3-toasts {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 500; display: flex;
  flex-direction: column; align-items: center;
  gap: 8px; pointer-events: none;
}
.z3-toast {
  background: #3C4043; color: #fff;
  font-size: 13px; font-weight: 400;
  padding: 10px 20px; border-radius: var(--r-sm);
  box-shadow: var(--sh-3); pointer-events: auto;
  animation: toast-in .2s ease forwards;
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.z3-toast.ok  { background: var(--gn); }
.z3-toast.err { background: var(--rd); }
.z3-toast.out { animation: toast-out .2s ease forwards; }
@keyframes toast-in  { from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)} }
@keyframes toast-out { from{opacity:1}to{opacity:0;transform:translateY(4px)} }

/* ── Toggle ── */
.z3-toggle { position: relative; width: 36px; height: 20px; cursor: pointer; display: inline-flex; }
.z3-toggle input { opacity:0; width:0; height:0; position:absolute; }
.z3-toggle-track { position:absolute; inset:0; background:var(--sur3); border-radius:var(--r-pill); transition:background .15s; }
.z3-toggle input:checked + .z3-toggle-track { background: var(--br); }
.z3-toggle-thumb { position:absolute; top:2px; left:2px; width:16px; height:16px; background:#fff; border-radius:var(--r-full); transition:transform .15s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.z3-toggle input:checked ~ .z3-toggle-thumb { transform:translateX(16px); }

/* ── Divider ── */
.divider { height:1px; background:var(--ln); margin:16px 0; }

/* ── Skeleton ── */
.skel {
  background: linear-gradient(90deg, var(--sur2) 25%, var(--sur3) 50%, var(--sur2) 75%);
  background-size: 200% 100%;
  animation: skel .9s infinite;
  border-radius: var(--r-xs);
}
@keyframes skel { 0%{background-position:200% 0}100%{background-position:-200% 0} }

/* ── Scrollbar ── */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--sur3); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--ln2); }

/* ── Utilities ── */
.flex{display:flex}.flex-col{display:flex;flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-6{gap:24px}.flex-1{flex:1}.min-w-0{min-width:0}.w-full{width:100%}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}.text-sm{font-size:12px}.text-xs{font-size:11px}.text-tx2{color:var(--tx2)}.text-tx3{color:var(--tx3)}.text-br{color:var(--br)}.text-gn{color:var(--gn)}.text-rd{color:var(--rd)}.font-500{font-weight:500}.font-head{font-family:var(--font-head)}.mono{font-family:var(--mono)}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hidden{display:none!important}.cursor-pointer{cursor:pointer}
