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

* { box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, "Segoe UI", Arial, sans-serif;
  background: #14171f;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(199,138,74,0.08), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(74,150,199,0.06), transparent 45%);
  color: #e9e7e2;
  margin: 0;
  min-height: 100vh;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 40px 24px; }
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 26px; letter-spacing: -0.02em;
  margin: 0 0 4px; color: #f5f1ea;
}
.sub { color: #8b8f9c; margin-bottom: 28px; font-size: 14px; }

.login-box {
  max-width: 380px; margin: 100px auto; background: #1b1f2a;
  padding: 36px; border-radius: 16px; border: 1px solid #2a2f3d;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
input, select {
  width: 100%; padding: 11px 14px; margin: 6px 0 16px;
  background: #14171f; border: 1px solid #2f3444; border-radius: 9px;
  color: #e9e7e2; font-size: 14px; font-family: 'Inter', sans-serif;
  transition: border-color .15s ease;
}
input:focus, select:focus { outline: none; border-color: #c78a4a; }
label { font-size: 12px; color: #8b8f9c; letter-spacing: 0.02em; text-transform: uppercase; }
button {
  cursor: pointer; border: none; border-radius: 9px; padding: 11px 18px;
  font-size: 14px; font-weight: 600; font-family: 'Inter', sans-serif;
  background: #c78a4a; color: #14171f;
  transition: background .15s ease, transform .1s ease;
}
button:hover { background: #db9c58; }
button:active { transform: scale(0.98); }
button.secondary { background: #262b38; color: #e9e7e2; }
button.secondary:hover { background: #2f3444; }
button.danger { background: #b8503f; color: #f5f1ea; }
button.danger:hover { background: #cc5b48; }
.btn-icon-text { display: inline-flex; align-items: center; gap: 7px; }
.btn-icon-text svg { width: 15px; height: 15px; }
.error { color: #e07a68; font-size: 13px; margin-bottom: 8px; min-height: 16px; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
.card {
  background: #1b1f2a; border: 1px solid #262b38; border-radius: 14px; padding: 20px;
  transition: border-color .2s ease;
}
.card h3 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600;
  margin: 0 0 4px; font-size: 17px; color: #f5f1ea;
}
.loc { color: #8b8f9c; font-size: 13px; margin-bottom: 12px; }
.status {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
  padding: 5px 10px; border-radius: 20px; background: #14171f; border: 1px solid #262b38;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7080; }
.dot.on { background: #6fbf73; animation: pulse-green 1.8s infinite; }
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(111,191,115,0.55); }
  50% { box-shadow: 0 0 0 6px rgba(111,191,115,0); }
}
.dot.off { background: #e07a68; }
.out-banner {
  display: none; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 14px;
  border-radius: 9px; font-size: 13px; font-weight: 600;
}
.out-banner.success { background: rgba(111,191,115,0.12); color: #8fd393; border: 1px solid rgba(111,191,115,0.3); }
.out-banner.fail { background: rgba(224,122,104,0.12); color: #e79684; border: 1px solid rgba(224,122,104,0.3); }
.out {
  margin-top: 12px; background: #0f1218; border-radius: 9px; padding: 10px 12px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; white-space: pre-wrap;
  height: 220px; min-height: 100px; max-height: 80vh; overflow: auto; resize: vertical;
  border: 1px solid #262b38; display: none; color: #b8bcc8; position: relative;
}
.out::-webkit-resizer {
  background: linear-gradient(135deg, transparent 0 50%, #c78a4a 50% 60%, transparent 60% 70%, #c78a4a 70% 80%, transparent 80% 100%);
  background-color: #0f1218;
}
.out-toolbar { display: none; justify-content: flex-end; margin-top: 12px; margin-bottom: -6px; }
.out-toolbar button { font-size: 12px; padding: 6px 12px; }
.out-fullscreen {
  position: fixed; inset: 20px; z-index: 1000; height: auto !important; max-height: none !important;
  resize: none; box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}
a.linklike { color: #c78a4a; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 500; }
a.linklike:hover { text-decoration: underline; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th {
  text-align: left; padding: 9px 10px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: #8b8f9c; border-bottom: 1px solid #2a2f3d; font-weight: 600;
}
td {
  text-align: left; padding: 10px; border-bottom: 1px solid #22262f; font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Glass ---------- */
.glass {
  background: rgba(27, 31, 42, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ---------- Modal de confirmacion ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,16,0.65);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
  animation: modal-fade .15s ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box { max-width: 420px; width: 90%; padding: 26px; }
.modal-box h4 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 16px;
  margin: 0 0 10px; color: #f5f1ea;
}
.modal-box p { color: #b8bcc8; font-size: 14px; line-height: 1.5; margin: 0 0 22px; white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid #262b38; }
.tabs button.tabbtn {
  background: none; color: #8b8f9c; font-weight: 600; font-size: 13px;
  padding: 10px 18px; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tabs button.tabbtn:hover { color: #e9e7e2; background: rgba(255,255,255,0.04); }
.tabs button.tabbtn.active { color: #c78a4a; border-bottom-color: #c78a4a; background: none; }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

/* ---------- Client accordion ---------- */
.client-card { margin-bottom: 10px; padding: 0; overflow: hidden; }
.client-row {
  padding: 14px 16px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: background .15s ease;
}
.client-row:hover { background: rgba(255,255,255,0.05); }
.client-row .name { font-weight: 600; font-size: 14px; }
.client-row .meta { color: #8b8f9c; font-size: 12px; font-family: 'IBM Plex Mono', monospace; }
.client-body { display: none; padding: 0 16px 14px; }
.client-body.open { display: block; }

.totem-row {
  border-radius: 10px; margin-bottom: 6px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.02);
}
.totem-row-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; cursor: pointer;
}
.totem-row-head:hover { background: rgba(255,255,255,0.04); }
.totem-row-head .tname { font-weight: 600; font-size: 13.5px; }
.totem-row-head .tmeta { color: #8b8f9c; font-size: 11.5px; font-family: 'IBM Plex Mono', monospace; }
.totem-row-body { display: none; padding: 4px 12px 14px; }
.totem-row-body.open { display: block; }

/* ---------- Pastillas de tótem (cliente) ---------- */
.totem-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.pill {
  padding: 10px 18px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,0.04); border: 1px solid #2a2f3d; color: #b8bcc8;
  transition: all .15s ease; display: flex; align-items: center; gap: 8px;
}
.pill:hover { border-color: #3a4152; }
.pill.active { background: rgba(199,138,74,0.14); border-color: #c78a4a; color: #f0dcc0; }
.pill.active:has(.pdot.on) {
  border-color: #6fbf73;
  box-shadow: 0 0 0 3px rgba(111,191,115,0.18), 0 0 22px rgba(111,191,115,0.25);
}
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; background: #6b7080; }
.pill .pdot.on { background: #6fbf73; animation: pulse-green 1.8s infinite; }
.pill .pdot.off { background: #e07a68; }

/* ---------- Botones de acción con icono ---------- */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; }
.action-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; border-radius: 14px; cursor: pointer; text-align: center;
  background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.07);
  color: #e9e7e2; font-size: 12px; font-weight: 600; font-family: 'Inter', sans-serif;
  transition: all .15s ease;
}
.action-btn:hover { background: rgba(199,138,74,0.10); border-color: rgba(199,138,74,0.4); transform: translateY(-1px); }
.action-btn.disabled { opacity: 0.5; pointer-events: none; }
.action-btn.destructive { border-color: rgba(224,122,104,0.25); }
.action-btn.destructive:hover { background: rgba(224,122,104,0.10); border-color: rgba(224,122,104,0.5); }
.action-btn.destructive svg { stroke: #d68f7d; }
.action-btn svg { width: 20px; height: 20px; stroke: #c78a4a; }
.action-led {
  position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: #4a4f5c; transition: background .2s ease;
}
.action-led.ok { background: #6fbf73; box-shadow: 0 0 6px rgba(111,191,115,0.7); }
.action-led.fail { background: #e07a68; box-shadow: 0 0 6px rgba(224,122,104,0.7); }
.action-led.pending { background: #c78a4a; animation: blink-amber 0.9s infinite; }
@keyframes blink-amber {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.totem-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.totem-icon-badge {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: rgba(199,138,74,0.12); border: 1px solid rgba(199,138,74,0.3);
  display: flex; align-items: center; justify-content: center;
}
.totem-icon-badge svg { width: 21px; height: 21px; stroke: #c78a4a; }
.totem-icon-badge.small { width: 28px; height: 28px; border-radius: 8px; }
.totem-icon-badge.small svg { width: 14px; height: 14px; }
.icon-btn {
  width: 30px; height: 30px; padding: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: 1px solid #2a2f3d; cursor: pointer; color: #b8bcc8;
  transition: all .15s ease;
}
.icon-btn:hover { background: rgba(199,138,74,0.14); border-color: #c78a4a; color: #f0dcc0; }
.icon-btn svg { width: 15px; height: 15px; stroke: #b8bcc8; }
.icon-btn:hover svg { stroke: #f0dcc0; }
.icon-btn-danger:hover { background: rgba(224,122,104,0.14); border-color: #e07a68; }
.icon-btn-danger:hover svg { stroke: #f5b5a5; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
