/* ===== D3M SOFTWARE SOLUTIONS — Panel del sistema ===== */
:root {
  --bg: #070b14;
  --bg-2: #0c1220;
  --surface: #121a2b;
  --surface-2: #182235;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eef8;
  --muted: #93a0b8;
  --brand: #2f7bff;
  --brand-2: #19d3c5;
  --accent: #7aa7ff;
  --white: #ffffff;
  --danger: #ff7b7b;
  --ok: #19d3c5;
  --warn: #f5c542;
  --radius: 16px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --font: "Outfit", sans-serif;
  --display: "Syne", sans-serif;
  --sidebar-w: 260px;
  --header-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--white);
}

p {
  margin: 0 0 1rem;
  color: var(--muted);
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(47, 123, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(25, 211, 197, 0.12), transparent 50%),
    linear-gradient(180deg, #070b14 0%, #0a1020 40%, #070b14 100%);
}

/* ---------- Login ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(100%, 420px);
  padding: 2rem 1.75rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line);
  background: rgba(18, 26, 43, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  text-align: center;
}

.auth-brand__logo {
  height: 72px;
  width: auto;
}

.auth-brand h1 {
  font-size: 1.35rem;
  margin: 0;
}

.auth-brand p {
  margin: 0;
  font-size: 0.95rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

/* ---------- Layout app ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(12, 18, 32, 0.92);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
}

.sidebar__brand img {
  height: 48px;
  width: auto;
}

.sidebar__brand span {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sidebar__nav {
  display: grid;
  gap: 0.35rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.is-active {
  border: 1px solid rgba(47, 123, 255, 0.35);
  background: linear-gradient(135deg, rgba(47, 123, 255, 0.18), rgba(25, 211, 197, 0.08));
}

.sidebar__footer {
  padding: 0.5rem;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(14px);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--white);
  cursor: pointer;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: right;
}

.topbar__user strong {
  display: block;
  color: var(--white);
  font-size: 0.95rem;
}

.topbar__user span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: capitalize;
}

.content {
  padding: 1.75rem 1.5rem 2.5rem;
  flex: 1;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-head h1 {
  font-size: clamp(1.45rem, 2.5vw, 1.9rem);
  margin-bottom: 0.25rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-2);
}

/* ---------- Cards / grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

.card {
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.card:hover {
  border-color: rgba(47, 123, 255, 0.4);
  transform: translateY(-3px);
}

.card__label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.card__value {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--white);
}

.card__meta {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 26, 43, 0.75);
  overflow: hidden;
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.panel__body {
  padding: 1.25rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.quick-link {
  display: grid;
  gap: 0.35rem;
  padding: 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.quick-link:hover {
  border-color: rgba(25, 211, 197, 0.45);
  transform: translateX(4px);
}

.quick-link strong {
  color: var(--white);
  font-family: var(--display);
}

.quick-link span {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 0.4rem;
}

.field label {
  font-size: 0.88rem;
  color: var(--text);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--white);
  outline: none;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(47, 123, 255, 0.7);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand), #4d8dff 55%, var(--brand-2));
  color: var(--white);
  box-shadow: 0 10px 30px rgba(47, 123, 255, 0.28);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--white);
}

.btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.btn--danger {
  background: rgba(255, 123, 123, 0.12);
  border-color: rgba(255, 123, 123, 0.35);
  color: var(--danger);
}

.btn--sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.btn--full {
  width: 100%;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert--error {
  background: rgba(255, 123, 123, 0.1);
  border-color: rgba(255, 123, 123, 0.35);
  color: #ffc9c9;
}

.alert--ok {
  background: rgba(25, 211, 197, 0.1);
  border-color: rgba(25, 211, 197, 0.35);
  color: #b7fff7;
}

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table th,
.table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.table td {
  color: var(--text);
  font-size: 0.93rem;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--ok {
  background: rgba(25, 211, 197, 0.15);
  color: var(--brand-2);
}

.badge--off {
  background: rgba(255, 123, 123, 0.12);
  color: var(--danger);
}

.badge--admin {
  background: rgba(47, 123, 255, 0.15);
  color: var(--accent);
}

.badge--user {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 1.25rem;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.modal.is-open {
  display: grid;
}

.modal__dialog {
  width: min(100%, 520px);
  max-height: min(90vh, 720px);
  overflow: auto;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.modal__head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--white);
  cursor: pointer;
}

.modal__body {
  padding: 1.25rem;
}

.overlay-nav {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, var(--sidebar-w));
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
  }

  .sidebar.is-open {
    transform: none;
  }

  .overlay-nav.is-visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.5);
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 1.25rem 1rem 2rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .auth-card {
    padding: 1.5rem 1.2rem;
  }
}
