/* DiskWatch — estética de consola de monitoreo (NOC) */
:root {
  --bg: #0e1418;
  --panel: #151d23;
  --panel-2: #1b252c;
  --line: #26333c;
  --text: #d7e1e8;
  --muted: #7d919e;
  --ok: #37c871;
  --warn: #e8b021;
  --crit: #f05e50;
  --stale: #5c6f7b;
  --accent: #4db8cf;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }

/* ---------- barra superior ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.7rem 1.4rem; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--mono); font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--ok); }
.brand-sub { color: var(--muted); font-weight: 400; font-size: 0.8em; margin-left: 0.5rem; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--text); }
.who { color: var(--muted); font-size: 0.85em; }
.logout { color: var(--muted); }

main { max-width: 1080px; margin: 1.5rem auto 3rem; padding: 0 1.2rem; }
footer {
  text-align: center; color: var(--muted); font-size: 0.8em;
  padding: 1rem; border-top: 1px solid var(--line);
}

/* ---------- LEDs de estado (elemento distintivo) ---------- */
.led {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 0.35rem; vertical-align: baseline;
  box-shadow: 0 0 6px currentColor;
}
.led-ok    { background: var(--ok);    color: var(--ok); }
.led-warn  { background: var(--warn);  color: var(--warn); }
.led-crit  { background: var(--crit);  color: var(--crit); animation: blink 1.2s steps(2) infinite; }
.led-error { background: var(--crit);  color: var(--crit); }
.led-stale { background: var(--stale); color: transparent; box-shadow: none; }
@keyframes blink { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .led-crit { animation: none; } }

/* ---------- panel: tarjetas de servidores ---------- */
.company { margin-bottom: 2.2rem; }
.company-head { display: flex; align-items: center; gap: 1rem; }
.company h2 {
  font-family: var(--mono); font-size: 1rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; flex: 1;
}
.server-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
}
.server-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--stale);
  border-radius: 6px; padding: 0.9rem 1rem; color: var(--text);
}
.server-card:hover { background: var(--panel-2); text-decoration: none; }
.server-card.level-ok   { border-left-color: var(--ok); }
.server-card.level-warn { border-left-color: var(--warn); }
.server-card.level-crit, .server-card.level-error { border-left-color: var(--crit); }
.server-card-top { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.15rem; }
.tag {
  font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 0.05rem 0.4rem; border-radius: 3px; color: var(--muted);
}
.disk-mini { list-style: none; margin: 0.6rem 0 0.4rem; padding: 0; }
.disk-mini li { display: flex; align-items: center; gap: 0.5rem; padding: 0.12rem 0; }
.issue-count { color: var(--warn); font-size: 0.85em; }

/* ---------- detalle de servidor ---------- */
.page-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: start; }
.page-head h1 { margin: 0.2rem 0; font-size: 1.4rem; }
.crumbs { color: var(--muted); font-size: 0.85em; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.disk-panel {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--stale);
  border-radius: 6px; padding: 1rem 1.2rem; margin: 1.1rem 0;
}
.disk-panel.level-ok   { border-left-color: var(--ok); }
.disk-panel.level-warn { border-left-color: var(--warn); }
.disk-panel.level-crit, .disk-panel.level-error { border-left-color: var(--crit); }
.disk-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.disk-head h2 { margin: 0; font-size: 1.05rem; }

.badge {
  font-family: var(--mono); font-size: 0.7em; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 3px; margin-left: 0.4rem;
  vertical-align: middle;
}
.badge-pass { background: rgba(55,200,113,0.15); color: var(--ok); border: 1px solid var(--ok); }
.badge-fail { background: rgba(240,94,80,0.15); color: var(--crit); border: 1px solid var(--crit); }

.issues { list-style: none; margin: 0.7rem 0; padding: 0; }
.issues li {
  color: var(--warn); font-family: var(--mono); font-size: 0.9em; padding: 0.1rem 0;
}

table.smart { border-collapse: collapse; width: 100%; max-width: 560px; margin-top: 0.6rem; }
table.smart th, table.smart td {
  text-align: left; padding: 0.35rem 0.7rem; border: 1px solid var(--line);
}
table.smart th { color: var(--muted); font-weight: 500; width: 220px; background: var(--panel-2); }
table.smart td { font-family: var(--mono); font-size: 0.9em; }
tr.row-warn td { color: var(--warn); font-weight: 700; }

details { margin-top: 0.8rem; }

/* ---------- progreso de self-test y uso de disco ---------- */
.test-progress {
  border: 1px solid var(--accent); border-radius: 6px;
  background: rgba(77,184,207,0.07); padding: 0.7rem 0.9rem; margin: 0.7rem 0;
}
.test-progress-label { margin-bottom: 0.4rem; }
.bar {
  height: 10px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 5px; overflow: hidden;
}
.bar-fill { height: 100%; background: var(--accent); }
.bar-small { height: 7px; width: 90px; display: inline-block; vertical-align: middle; margin-right: 0.4rem; }
.bar-warn .bar-fill { background: var(--warn); }
.bar-crit .bar-fill { background: var(--crit); }

/* ---------- test extendido en curso: recuadro parpadeante ---------- */
.disk-panel.testing {
  border-color: var(--accent);
  animation: testing-pulse 1s ease-in-out infinite;
}
@keyframes testing-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77,184,207,0); border-color: var(--line); }
  50%      { box-shadow: 0 0 12px 1px rgba(77,184,207,0.45); border-color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .disk-panel.testing { animation: none; border-color: var(--accent);
                        box-shadow: 0 0 10px 1px rgba(77,184,207,0.35); }
}
.tag-testing { color: var(--accent); border-color: var(--accent); }

.storage-title {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin: 1.1rem 0 0.3rem;
}
table.storage { border-collapse: collapse; width: 100%; font-size: 0.9em; }
table.storage th, table.storage td {
  text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--line);
}
table.storage th { color: var(--muted); font-weight: 500; }
.tag-raid { color: var(--accent); border-color: var(--accent); }
summary { cursor: pointer; color: var(--muted); }
table.history { border-collapse: collapse; width: 100%; margin-top: 0.6rem; font-size: 0.85em; }
table.history th, table.history td {
  text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--line);
}
table.history th { color: var(--muted); font-weight: 500; }

/* ---------- formularios ---------- */
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.45rem 0.6rem;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button {
  background: var(--accent); color: #06252c; font-weight: 600;
  cursor: pointer; border-color: transparent;
}
button:hover { filter: brightness(1.1); }
.btn-ghost {
  display: inline-block; background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.45rem 0.6rem;
  font-weight: 400; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-ghost.danger:hover { color: var(--crit); border-color: var(--crit); }

.login-box, .form-box {
  max-width: 560px; margin: 3rem auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 1.6rem 1.8rem;
}
.login-box { max-width: 360px; }
.login-box h1, .form-box h1 { margin-top: 0; font-size: 1.3rem; }
form label { display: block; margin: 0.8rem 0; }
form label input, form label select, form label textarea { width: 100%; margin-top: 0.25rem; }
form label.check { display: flex; gap: 0.5rem; align-items: center; }
form label.check input { width: auto; margin: 0; }
.form-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0.7rem; }
.inline-form { display: flex; gap: 0.5rem; margin-bottom: 1.4rem; }

/* ---------- filtro por empresa ---------- */
.company-filter {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.3rem;
}
.chip {
  font-family: var(--mono); font-size: 0.85em;
  padding: 0.3rem 0.85rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); background: var(--panel);
}
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--muted); }
.chip-active {
  color: #06252c; background: var(--accent); border-color: var(--accent);
  font-weight: 700;
}
.chip-active:hover { color: #06252c; }

/* ---------- avisos ---------- */
.flash { padding: 0.6rem 1rem; border-radius: 5px; margin-bottom: 1rem; border: 1px solid; }
.flash-info  { border-color: var(--accent); color: var(--accent); background: rgba(77,184,207,0.08); }
.flash-error { border-color: var(--crit);  color: var(--crit);  background: rgba(240,94,80,0.08); }
.empty {
  color: var(--muted); border: 1px dashed var(--line); border-radius: 6px;
  padding: 1.2rem; text-align: center; margin: 1rem 0;
}
.empty.small { padding: 0.7rem; text-align: left; margin: 0.6rem 0; }

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}
