:root {
  /* NexoStream — terminal-dark con verde neón */
  --bg: #08090c;
  --bg-2: #0b0d11;
  --surface: #10131a;
  --surface-solid: #10131a;
  --surface-2: #161a24;
  --surface-3: #1c2130;
  --border: #22283a;
  --border-strong: #2d3448;
  --text: #e6ebf5;
  --text-dim: #7c8398;
  --text-muted: #545a70;

  --accent: #22c55e;
  --accent-2: #16a34a;
  --accent-soft: #4ade80;
  --accent-dim: #15803d;
  --accent-glow: rgba(34, 197, 94, 0.28);

  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --warn: #f59e0b;
  --danger: #f43f5e;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, .45);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 20px 44px -12px rgba(0, 0, 0, .65);
  --shadow-glow: 0 0 0 1px var(--accent-glow), 0 8px 24px -8px var(--accent-glow);
}

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

body {
  font-family: var(--font-body);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 12% -10%, rgba(34, 197, 94, .055), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(34, 197, 94, .03), transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- FORM CONTROLS ---------- */
input,
select,
textarea {
  font-family: inherit;
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #3a4260;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
}

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 34px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: cardIn .5s cubic-bezier(.2, .7, .2, 1);
}

.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -1px;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.brand .dot {
  color: var(--accent);
}

.login-sub {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 28px;
  font-family: var(--mono);
  letter-spacing: .3px;
  position: relative;
  z-index: 1;
}

.login-sub::before {
  content: '// ';
  color: var(--accent);
}

.field {
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: transform .12s, border-color .18s, background .18s, box-shadow .18s;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  color: #041209;
  border: 1px solid var(--accent);
  font-weight: 700;
  box-shadow: 0 4px 14px -4px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  box-shadow: 0 8px 22px -6px var(--accent-glow);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  border-color: var(--danger);
  background: rgba(244, 63, 94, .08);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.hint {
  margin-top: 22px;
  padding: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.hint b {
  color: var(--text);
}

/* ---------- SHELL / SIDEBAR ---------- */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -.5px;
  margin-bottom: 4px;
  padding: 4px 10px;
  color: var(--text);
}

.side-brand span {
  color: var(--accent);
}

.side-role {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 0 12px;
  margin: 0 0 24px;
  color: var(--text-dim);
  letter-spacing: .6px;
  font-weight: 500;
  text-transform: uppercase;
}

.side-role::before {
  content: '// ';
  color: var(--accent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  border: 1px solid transparent;
  transition: all .15s;
  position: relative;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(34, 197, 94, .08);
  color: var(--accent);
  border-color: rgba(34, 197, 94, .18);
  font-weight: 600;
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.side-user {
  font-size: 13px;
  font-weight: 700;
  padding: 0 12px 2px;
  color: var(--text);
}

.side-mail {
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 12px 12px;
  word-break: break-all;
  font-family: var(--mono);
}

.access-badge {
  margin: 0 6px 12px;
  padding: 10px 12px;
  font-size: 11px;
  background: rgba(34, 197, 94, .06);
  border: 1px solid rgba(34, 197, 94, .18);
  border-radius: var(--radius-sm);
}

.access-badge .lbl {
  color: var(--text-dim);
  font-weight: 500;
}

.access-badge .val {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
}

/* ---------- MAIN ---------- */
.main {
  flex: 1;
  padding: 32px 38px;
  max-width: 1200px;
  overflow-x: hidden;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.7px;
  color: var(--text);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

/* ---------- STATS ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat {
  position: relative;
  padding: 20px 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s, border-color .18s, background .18s;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 197, 94, .35);
  background: var(--surface-2);
}

.stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.stat.violet::before {
  background: var(--violet);
}

.stat.warn::before {
  background: var(--warn);
}

.stat.cyan::before {
  background: var(--cyan);
}

.stat-num {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
}

.stat-lbl {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
}

/* ---------- PANEL / TABLES ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 13px 20px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  transition: background .12s;
}

tbody tr:hover {
  background: rgba(34, 197, 94, .03);
}

tbody tr:last-child td {
  border-bottom: none;
}

.cell-main {
  font-weight: 600;
  color: var(--text);
}

.cell-sub {
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--mono);
}

/* ---------- TAGS ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  border: 1px solid transparent;
  font-family: var(--mono);
}

.tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.tag-green {
  background: rgba(34, 197, 94, .1);
  color: #4ade80;
  border-color: rgba(34, 197, 94, .2);
}

.tag-blue {
  background: rgba(59, 130, 246, .1);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, .2);
}

.tag-warn {
  background: rgba(245, 158, 11, .1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, .2);
}

.tag-red {
  background: rgba(244, 63, 94, .1);
  color: #fb7185;
  border-color: rgba(244, 63, 94, .2);
}

.tag-gray {
  background: rgba(138, 145, 166, .08);
  color: var(--text-dim);
  border-color: rgba(138, 145, 166, .15);
}

.slot-state .tag {
  font-size: 10px;
  padding: 2px 8px;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 34px;
  margin-bottom: 12px;
  opacity: .5;
}

.slot-del {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .12s;
}

.slot-del:hover {
  color: var(--danger);
  background: rgba(244, 63, 94, .08);
}

/* ---------- SEARCH BAR ---------- */
.search-input {
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c8398' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 14px;
}

/* ---------- INVENTARIO ---------- */
.inv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

.inv-card:hover {
  border-color: rgba(34, 197, 94, .28);
  box-shadow: var(--shadow-sm);
}

.inv-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
}

.inv-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--border-strong);
}

.inv-logo-text {
  display: grid;
  place-items: center;
  background: rgba(34, 197, 94, .1);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  border-color: rgba(34, 197, 94, .25);
}

.inv-info {
  flex: 1;
  min-width: 0;
}

.inv-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inv-slots-count {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 500;
  font-family: var(--mono);
}

.inv-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-family: var(--mono);
}

.inv-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.slots-list {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

.slot-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.slot-row:last-child {
  border-bottom: none;
}

.slot-pos {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
  min-width: 30px;
}

.slot-main {
  flex: 1;
  min-width: 0;
}

.slot-name {
  font-weight: 600;
  color: var(--text);
}

.slot-date {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  font-family: var(--mono);
}

.slot-state {
  flex-shrink: 0;
}

.slot-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- UPLOAD ZONE ---------- */
.upload-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  color: var(--text);
  font-weight: normal;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(34, 197, 94, .04);
}

.upload-zone .preview {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.upload-zone .preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-zone .preview .placeholder {
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--mono);
}

.upload-zone .upload-text {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.upload-zone .upload-text strong {
  color: var(--accent);
  font-family: var(--mono);
}

/* ---------- MODAL ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, .72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn .18s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  width: 100%;
  max-width: 470px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s cubic-bezier(.2, .7, .2, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 19px;
  margin-bottom: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.modal-actions .btn {
  flex: 1;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 22px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: .28s cubic-bezier(.2, .7, .2, 1);
  z-index: 300;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toast::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.ok::before {
  background: var(--accent);
}

.toast.err::before {
  background: var(--danger);
}

.toast.err {
  border-color: rgba(244, 63, 94, .4);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 6px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 760px) {
  .shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px;
  }

  .side-brand {
    margin-bottom: 0;
  }

  .side-role,
  .side-foot,
  .access-badge,
  .side-mail {
    display: none;
  }

  .nav-item {
    margin-bottom: 0;
    padding: 8px 11px;
  }

  .main {
    padding: 20px 16px;
  }

  .page-head {
    padding-bottom: 12px;
    margin-bottom: 18px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  thead th,
  tbody td {
    padding: 11px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}