/* ============================= TOKENS ============================= */
:root {
  --bg: #0a0e16;
  --bg-panel: #111827;
  --bg-panel-2: #161f33;
  --bg-raised: #1b2540;
  --border: #262f47;
  --border-soft: #1c2438;
  --text: #e7ecf7;
  --text-muted: #8b93ad;
  --text-dim: #5c6480;
  --accent: #ffb100;
  --accent-dim: #6b5423;
  --teal: #2dd4bf;
  --teal-dim: #123834;
  --mirror: #7dd3fc;
  --danger: #fb4b4e;
  --led-green: #46e08a;
  --sin-usar: #3a4360;
  --chart-grid: #232f47;
  --font-display: "Space Grotesk", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-body: "Inter", sans-serif;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(255, 177, 0, 0.06), transparent 40%),
    radial-gradient(
      circle at 88% 20%,
      rgba(45, 212, 191, 0.06),
      transparent 45%
    );
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
main {
  padding-inline: 2rem;
}
@media (max-width: 480px) {
  .main {
    padding-inline: 1rem;
  }
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
}
p {
  margin: 0;
}
a {
  color: var(--teal);
}
a:hover {
  color: var(--accent);
}
button {
  font-family: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(24px, 4vw, 64px);
}
.mono {
  font-family: var(--font-mono);
}

@media (max-width: 900px) {
  .wrap {
    padding: 0 20px;
  }
}
@media (max-width: 480px) {
  .wrap {
    padding: 0 16px;
  }
}

/* ============================= TOPBAR ============================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 14, 22, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #0c1120;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand small {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  margin-left: 4px;
}
.topbar nav {
  display: flex;
  gap: 22px;
}
.topbar nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}
.topbar nav a:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  .topbar .wrap {
    height: 58px;
  }
  .brand {
    font-size: 0.95rem;
  }
  .topbar nav {
    gap: 14px;
  }
  .topbar nav a {
    font-size: 0.82rem;
  }
}
@media (max-width: 480px) {
  .topbar .wrap {
    height: 52px;
  }
  .brand-mark {
    width: 28px;
    height: 28px;
  }
  .brand small {
    display: none;
  }
  .topbar nav {
    gap: 10px;
  }
  .topbar nav a {
    font-size: 0.76rem;
  }
}

/* ============================= HERO ============================= */
.hero {
  padding: 76px 0 56px;
}

@media (max-width: 900px) {
  .hero {
    padding: 52px 0 40px;
  }
}
@media (max-width: 480px) {
  .hero {
    padding: 40px 0 32px;
  }
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 22px;
}
.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--led-green);
  box-shadow: 0 0 8px var(--led-green);
}
.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 700;
  max-width: 15ch;
  margin-bottom: 20px;
}
.hero p.lead {
  color: var(--text-muted);
  max-width: 56ch;
  font-size: 1.05rem;
  margin-bottom: 30px;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    justify-content: center;
  }
}

.btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: var(--accent);
  color: #191100;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #ffc233;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--text-dim);
  background: var(--bg-panel);
}

/* ============================= SECTION HEAD ============================= */
section.block {
  padding: 64px 0;
  border-top: 1px solid var(--border-soft);
}
.section-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 34px;
  max-width: 720px;
}
.section-head .tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--bg);
  background: var(--teal);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
}
.section-head h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.section-head p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  section.block {
    padding: 48px 0;
  }
  .section-head {
    margin-bottom: 26px;
  }
}
@media (max-width: 480px) {
  section.block {
    padding: 36px 0;
  }
  .section-head {
    gap: 12px;
    margin-bottom: 20px;
  }
  .section-head .tag {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
  }
  .section-head h2 {
    font-size: 1.22rem;
  }
  .section-head p {
    font-size: 0.88rem;
  }
}

/* ============================= DISK PALETTE ============================= */
.disk-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 46px;
}
.disk-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
  flex: 0 1 80px;
}

@media (max-width: 900px) {
  .disk-palette {
    gap: 0.9rem;
    margin-bottom: 34px;
  }
  .disk-card {
    padding: 8px 6px;
    flex-basis: 72px;
  }
  .disk-card-visual img {
    width: 46px;
  }
  .disk-card-cap {
    top: -2px;
  }
  .disk-card-add {
    font-size: 0.72rem;
  }
}
@media (max-width: 480px) {
  .disk-palette {
    gap: 0.6rem;
    margin-bottom: 26px;
  }
  .disk-card {
    flex-basis: 64px;
    padding: 6px 4px;
  }
  .disk-card-visual img {
    width: 38px;
  }
  .disk-card-cap {
    font-size: 0.64rem;
    padding: 2px 6px;
    top: -3px;
  }
  .disk-card-add {
    font-size: 0.6rem;
  }
}
.disk-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  background: var(--bg-panel-2);
}
.disk-card:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}
.disk-card:disabled .disk-card-add {
  display: none;
}
.disk-card {
  color: var(--text);
}
.disk-card-cap {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
  color: #2c2c2c;
  padding: 2px 9px;
  white-space: nowrap;
  z-index: 1;
}
.disk-card-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.disk-card-visual img {
  width: 54px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
  transition: transform 0.15s ease;
}
.disk-card-add {
  position: absolute;
  inset: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--teal);
  background: rgba(10, 14, 22, 0.78);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
  white-space: nowrap;
  padding: 0 4px;
}
.disk-card:hover .disk-card-add,
.disk-card:focus-visible .disk-card-add {
  opacity: 1;
}
.disk-card:hover .disk-card-visual img {
  transform: translateY(-2px);
}

/* ============================= CHASSIS ============================= */
.chassis {
  display: grid;
  grid-template-columns: 17.6% 1fr;
  align-items: flex-start;
  gap: 0.9rem;

  height: 100%;
  margin: 0 auto;
  max-width: 860px;
  aspect-ratio: 1471 / 526;
  background-image: url("../img/nas-desktop.webp");
  background-repeat: no-repeat;
  background-size: cover;

  border: 1px solid var(--border);
  border-radius: 20px;
}

@media (max-width: 900px) {
  .chassis {
    grid-template-columns: 21.2% 1fr;
    gap: 0.45rem;
    max-width: 440px;
    background-image: url("../img/nas-tablet.webp");
    aspect-ratio: 1243 / 763;
  }
}

@media (max-width: 480px) {
  .chassis {
    grid-template-columns: 26.3% 1fr;
    gap: 0.5rem;
    max-width: 300px;
    background-image: url("../img/nas-movil.webp");
    aspect-ratio: 845 / 1307;
  }
}

.chassis-rail {
  margin: 3.6rem 0.3rem 0.75rem 0.55rem;
  padding: 0.2rem 0.58rem;
  background: #2c2c2c;

  border: 1px solid #393939;
  border-radius: 14px;
}

@media (max-width: 900px) {
  .chassis-rail {
    margin: 3.2rem 0.4rem 0 0.6rem;
    padding: 0rem 0.65rem;
  }
}

@media (max-width: 480px) {
  .chassis-rail {
    margin: 5rem 0.35rem 0 0.65rem;
    padding: 0.3rem 0.2rem;
  }
}

.rail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 3px 0;
}

@media (max-width: 900px) {
  .rail-row {
    font-size: 0.43rem;
  }
}

.rail-row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
  .rail-row--two {
    grid-template-columns: 1fr;
  }
}

.rail-row .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #28304a;
  flex-shrink: 0;
}
.rail-row.on .dot {
  background: var(--led-green);
  box-shadow: 0 0 6px var(--led-green);
}
.rail-row.active .dot {
  background: var(--led-green);
  box-shadow: 0 0 6px var(--led-green);
}
.rail-row.down .dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  animation: faultBlink 1.4s ease-in-out infinite;
}
.rail-divider {
  height: 1px;
  background: #393939;
  margin: 3px 0;
}

.chassis-disks {
  padding: 0.2rem 1.8rem 0rem 0.6rem;
}

@media (max-width: 900px) {
  .chassis-disks {
    padding: 0.6rem 1.2rem 0rem 0.3rem;
  }
}

@media (max-width: 480px) {
  .chassis-disks {
    padding: 0.05rem 1.61rem 0rem 0.5rem;
  }
}

.chassis-note {
  margin-bottom: 0.43rem;
  font-size: 0.8rem;
  text-align: end;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .chassis-note {
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 480px) {
  .chassis-note {
    font-size: 0.7rem;
    margin-bottom: 0.61rem;
  }
}

.chassis-note b {
  color: var(--text-muted);
}

.bay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
  gap: 6px;
  align-content: start;
}

@media (max-width: 900px) {
  .bay-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 7px 20px;
  }
}

@media (max-width: 480px) {
  .bay-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.bay {
  aspect-ratio: 139/549;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  position: relative;
  background: rgba(255, 255, 255, 0.015);
}

@media (max-width: 900px) {
  .bay {
    aspect-ratio: 519/190;
  }
}

@media (max-width: 480px) {
  .bay {
    aspect-ratio: 519/169;
  }
}

.bay.filled {
  background-image: url("../img/disc-inserted-vertical.webp");
  background-size: cover;
  background-position: center;
  color: #fff;
}

@media (max-width: 900px) {
  .bay.filled {
    background-image: url("../img/disc-inserted.webp");
    background-position: 10% center;
  }
}

.bay.filled::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
}

.bay-num {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 0.62rem;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .bay-num {
    top: 1px;
    left: 3px;
  }
}

.bay.filled .bay-num {
  color: rgba(255, 255, 255, 0.7);
}
.bay-capacity {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  z-index: 1;
}
.bay.filled.down {
  filter: grayscale(0.55) brightness(0.6);
}
.bay.filled.down::after {
  background: rgba(251, 75, 78, 0.16);
  border: 1px solid rgba(251, 75, 78, 0.5);
}
.bay-fault {
  position: absolute;
  top: 75%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--danger);
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 2;
  white-space: nowrap;
  animation: faultBlink 1.4s ease-in-out infinite;
}
@keyframes faultBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.bay-power {
  position: absolute;
  top: 10px;
  right: 27%;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #2c2c2c, #393939e0);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.bay-power svg {
  width: 12px;
  height: 12px;
  color: var(--led-green);
  transition: color 0.15s ease;
}
.bay-power.is-off svg {
  color: var(--danger);
}
.bay-power:hover,
.bay-power:focus-visible {
  border-color: var(--text-dim);
}

@media (max-width: 900px) {
  .bay-power {
    top: 30%;
    left: 3px;
    width: 26px;
    height: 26px;
  }
  .bay-power svg {
    width: 10px;
    height: 10px;
  }
  .bay-fault {
    font-size: 0.5rem;
    top: 65%;
  }
}

.bay-eject {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #2c2c2c, #393939e0);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.bay-eject svg {
  width: 12px;
  height: 12px;
  fill: var(--text-dim);
  transition: fill 0.15s ease;
}
.bay-eject:hover,
.bay-eject:focus-visible {
  background: linear-gradient(180deg, #5a2020, #29100f);
  border-color: var(--danger);
}
.bay-eject:hover svg,
.bay-eject:focus-visible svg {
  fill: var(--danger);
}

@media (max-width: 900px) {
  .bay-eject {
    bottom: auto;
    left: auto;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 18px;
    height: 38px;
    border-radius: 4px;
  }
  .bay-eject svg {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  .bay-eject {
    right: 2px;
  }
  .bay-eject svg {
    width: 9px;
    height: 9px;
  }
}

/* ============================= COMPARE ============================= */
.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
}
@media (max-width: 900px) {
  .compare-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}

.raid-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

@media (max-width: 480px) {
  .raid-panel {
    padding: 16px;
  }
}
.raid-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-raised)
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6"><path d="M0 0l5 6 5-6z" fill="%238b93ad"/></svg>')
    no-repeat right 14px center;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 36px 12px 14px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 18px;
}
.raid-select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.raid-select.has-error {
  border-color: var(--accent);
}
.raid-select.has-error:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  background: #0c1120;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
}

@media (max-width: 480px) {
  .stat-grid {
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat {
    padding: 10px 12px;
  }
  .stat .v {
    font-size: 0.95rem;
  }
}
.stat .k {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .k .swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.stat .v {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
}
.stat .v small {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.7rem;
}
.chart-box {
  background: #0c1120;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  min-width: 0;
}
.chart-box .label {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.chart-box .label .unit {
  color: var(--text-dim);
  opacity: 0.6;
}
.chart-pie-wrap {
  height: 220px;
  width: 100%;
  min-width: 0;
  position: relative;
}
.chart-bar-wrap {
  height: 90px;
  width: 100%;
  min-width: 0;
  position: relative;
}
.chart-pie-wrap canvas,
.chart-bar-wrap canvas {
  max-width: 100%;
}
.panel-msg {
  background: #241407;
  border: 1px solid #4a2c0e;
  color: #ffc266;
  border-radius: 10px;
  padding: 14px;
  font-size: 0.86rem;
  margin-bottom: 14px;
}

.estado-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  background: #0c1120;
}
.estado-pill:empty {
  display: none;
}
.estado-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.estado-pill.ok {
  color: var(--led-green);
  border-color: rgba(70, 224, 138, 0.35);
}
.estado-pill.ok .dot {
  background: var(--led-green);
  box-shadow: 0 0 6px var(--led-green);
}
.estado-pill.degradado {
  color: var(--accent);
  border-color: rgba(255, 177, 0, 0.4);
}
.estado-pill.degradado .dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.estado-pill.perdida {
  color: var(--danger);
  border-color: rgba(251, 75, 78, 0.4);
}
.estado-pill.perdida .dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  animation: faultBlink 1.2s ease-in-out infinite;
}

@media (max-width: 480px) {
  .chart-pie-wrap {
    height: 190px;
  }
  .chart-bar-wrap {
    height: 76px;
  }
  .panel-msg {
    padding: 12px;
    font-size: 0.82rem;
  }
}

/* ============================= FOOTER ============================= */
footer {
  border-top: 1px solid var(--border-soft);
  padding: 34px 0;
}
footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.82rem;
}
footer a {
  text-decoration: none;
}

@media (max-width: 480px) {
  footer {
    padding: 24px 0;
  }
  footer .wrap {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    font-size: 0.76rem;
  }
}

/* ============================= MODAL ============================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 7, 12, 0.75);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.open {
  display: flex;
}
.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 760px;
  width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-panel);
}
.modal-content::-webkit-scrollbar {
  width: 10px;
}
.modal-content::-webkit-scrollbar-track {
  background: var(--bg-panel);
}
.modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid var(--bg-panel);
}
.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

@media (max-width: 480px) {
  .modal {
    padding: 14px;
  }
  .modal-content {
    border-radius: 14px;
    max-height: 88vh;
  }
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
}
.modal-header h2 {
  font-size: 1.2rem;
}
.modal-header .close {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 1.4rem;
  line-height: 1;
  background: none;
  border: none;
}
.modal-header .close:hover {
  color: var(--text);
}
.modal-body {
  padding: 10px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 480px) {
  .modal-header {
    padding: 16px 18px;
  }
  .modal-header h2 {
    font-size: 1.05rem;
  }
  .modal-body {
    padding: 8px 18px 18px;
    gap: 12px;
  }
}
.raid-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  background: #0c1120;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px;
}
.raid-card svg {
  width: 100%;
  height: auto;
}
.raid-card h3 {
  font-size: 0.98rem;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}
.raid-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
@media (max-width: 480px) {
  .raid-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  .raid-card svg {
    width: 70px;
  }
  .raid-card h3 {
    font-size: 0.9rem;
  }
  .raid-card p {
    font-size: 0.8rem;
  }
}

/* ============================= WRITE SIMULATOR ============================= */
.write-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.write-controls .raid-select {
  margin-bottom: 0;
  flex: 0 0 auto;
}
.write-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  flex: 1 1 220px;
  min-width: 160px;
}
.write-input::placeholder {
  color: var(--text-dim);
}
.write-input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.write-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.write-toggle input {
  accent-color: var(--teal);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.estado-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  border: 1px solid var(--border-soft);
  background: #0c1120;
  color: var(--text-muted);
}
.estado-banner:not(:empty) {
  display: flex;
}
.estado-banner .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--text-dim);
}
.estado-banner b {
  color: var(--text);
}
.estado-banner.ok {
  border-color: rgba(70, 224, 138, 0.35);
}
.estado-banner.ok .dot {
  background: var(--led-green);
  box-shadow: 0 0 6px var(--led-green);
}
.estado-banner.degradado {
  border-color: rgba(255, 177, 0, 0.4);
}
.estado-banner.degradado .dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.estado-banner.perdida {
  border-color: rgba(251, 75, 78, 0.4);
}
.estado-banner.perdida .dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  animation: faultBlink 1.2s ease-in-out infinite;
}

@media (max-width: 480px) {
  .estado-banner {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}

.write-grid {
  display: flex;
  justify-content: center;
  justify-content: safe center;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}
@media (max-width: 900px) {
  .write-grid {
    justify-content: flex-start;
  }
}
.write-col {
  flex: 0 0 96px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.write-col-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  font-size: 0.66rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  transition: color 0.2s ease;
}
.write-col-head span {
  color: var(--text-muted);
}
.write-col.down .write-col-head {
  color: var(--danger);
}
.write-col-fault {
  display: block;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--danger);
}
.write-cell {
  background: #0c1120;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 8px 4px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}
.write-cell.in {
  opacity: 1;
  transform: translateY(0);
}
.write-cell.data {
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.08);
}
.write-cell.mirror {
  border-color: rgba(125, 211, 252, 0.4);
  background: rgba(125, 211, 252, 0.08);
}
.write-cell.paridad {
  border-color: rgba(255, 177, 0, 0.5);
  background: rgba(255, 177, 0, 0.1);
}
.write-cell.is-recuperado {
  border-style: dashed;
  border-color: rgba(255, 177, 0, 0.65);
  background: rgba(255, 177, 0, 0.1);
  position: relative;
}
.write-cell.is-recuperado::after {
  content: "↻";
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.62rem;
  color: var(--accent);
}
.write-cell.is-perdido {
  border-color: rgba(251, 75, 78, 0.6);
  background: rgba(251, 75, 78, 0.12);
}
.write-cell.is-perdido .write-cell-tag {
  color: var(--danger);
}
.write-cell.is-perdido .write-cell-val {
  color: var(--danger);
  font-weight: 700;
}
.write-cell-tag {
  display: block;
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.write-cell-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.write-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.write-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.write-legend-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.write-legend-item .swatch-recuperado {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1.5px dashed var(--accent);
  background: rgba(255, 177, 0, 0.15);
}

@media (max-width: 480px) {
  .write-col {
    flex-basis: 72px;
  }
  .write-cell-val {
    font-size: 0.72rem;
  }
  .write-controls {
    gap: 10px;
  }
  .write-input {
    flex-basis: 100%;
  }
}
