/* =========================================================
   DRIVE DEVBLK · LAYOUT
   Sidebar · Topbar · Contenido principal
   ========================================================= */

.app-layout {
  display: grid;
  grid-template-columns:
    var(--sidebar-width)
    minmax(0, 1fr);

  width: 100%;
  min-height: 100vh;

  background: transparent;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 700;

  display: flex;
  flex-direction: column;

  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;

  overflow: hidden;

  border-right: 1px solid var(--sidebar-line-strong);

  color: var(--sidebar-text);

  background:
    linear-gradient(
      180deg,
      rgba(9, 13, 19, 0.995),
      rgba(5, 8, 12, 0.995)
    );
}

.app-sidebar::before {
  position: absolute;
  top: 0;
  right: -1px;

  width: 1px;
  height: 120px;

  content: "";

  background:
    linear-gradient(
      to bottom,
      var(--accent),
      transparent
    );
}

.app-sidebar__grid {
  position: absolute;
  inset: 0;

  pointer-events: none;

  opacity: 0.18;

  background-image:
    linear-gradient(
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    );

  background-size: 32px 32px;
}

/* =========================================================
   SIDEBAR · MARCA
   ========================================================= */

.app-sidebar__brand {
  position: relative;

  display: grid;
  grid-template-columns:
    auto
    minmax(0, 1fr)
    auto;
  align-items: center;
  gap: 12px;

  min-height: var(--topbar-height);
  padding: 14px 16px;

  border-bottom: 1px solid var(--sidebar-line-strong);
}

.app-sidebar__brand::after {
  position: absolute;
  right: 16px;
  bottom: -1px;

  width: 46px;
  height: 1px;

  content: "";

  background: var(--accent);
}

.app-sidebar__logo {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 46px;
  min-width: 46px;
  height: 46px;

  border: 1px solid var(--accent-border);
  border-radius: 11px;

  color: var(--accent);

  background:
    linear-gradient(
      145deg,
      rgba(0, 229, 255, 0.09),
      rgba(0, 229, 255, 0.02)
    );

  transition:
    border-color var(--transition),
    transform var(--transition);
}

.app-sidebar__logo:hover {
  border-color: var(--accent);

  transform: rotate(-3deg);
}

.app-sidebar__logo svg {
  width: 21px;
  height: 21px;

  stroke-width: 1.8;
}

.app-sidebar__logo-status {
  position: absolute;
  right: -3px;
  bottom: -3px;

  width: 10px;
  height: 10px;

  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;

  background: var(--success);

  animation:
    sidebar-status-pulse
    2s
    ease-in-out
    infinite;
}

.app-sidebar__brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;

  min-width: 0;
}

.app-sidebar__brand-copy strong {
  overflow: hidden;

  color: var(--sidebar-text);

  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__brand-copy span {
  overflow: hidden;

  color: var(--sidebar-text-muted);

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 8px;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-sidebar__version {
  padding: 4px 6px;

  border: 1px solid var(--sidebar-line);
  border-radius: 5px;

  color: var(--sidebar-text-muted);

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
}

/* =========================================================
   SIDEBAR · ESTADO
   ========================================================= */

.app-sidebar__system {
  padding: 13px 16px;

  border-bottom: 1px solid var(--sidebar-line);
}

.app-sidebar__system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin-bottom: 8px;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.app-sidebar__system-row span {
  color: var(--sidebar-text-muted);
}

.app-sidebar__system-row strong {
  color: var(--success);

  font-weight: 700;
}

.app-sidebar__system-line {
  height: 2px;

  overflow: hidden;

  background: var(--sidebar-line);
}

.app-sidebar__system-line span {
  display: block;

  width: 78%;
  height: 100%;

  background:
    linear-gradient(
      90deg,
      var(--success),
      var(--accent)
    );

  animation:
    sidebar-system-line
    2.8s
    ease-in-out
    infinite;
}

/* =========================================================
   SIDEBAR · NAVEGACIÓN
   ========================================================= */

.app-sidebar__nav {
  position: relative;

  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;

  min-height: 0;
  padding: 13px 11px;

  overflow-x: hidden;
  overflow-y: auto;

  scrollbar-width: thin;
  scrollbar-color:
    var(--sidebar-line-strong)
    transparent;
}

.app-sidebar__nav::-webkit-scrollbar {
  width: 5px;
}

.app-sidebar__nav::-webkit-scrollbar-track {
  background: transparent;
}

.app-sidebar__nav::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background: var(--sidebar-line-strong);
}

.app-sidebar__section-label {
  margin: 12px 10px 5px;

  color: #4f5c69;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-sidebar__section-label:first-child {
  margin-top: 2px;
}

.app-sidebar__link {
  position: relative;

  display: grid;
  grid-template-columns:
    24px
    auto
    minmax(0, 1fr)
    auto;
  align-items: center;
  gap: 9px;

  width: 100%;
  min-height: 46px;
  padding: 0 10px;

  overflow: hidden;

  border: 1px solid transparent;
  border-radius: 9px;

  color: var(--sidebar-text-muted);

  font-size: 12px;
  font-weight: 650;
  text-align: left;

  background: transparent;

  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition),
    transform var(--transition);
}

.app-sidebar__link::after {
  position: absolute;
  bottom: 0;
  left: 0;

  width: 0;
  height: 1px;

  content: "";

  background: var(--accent);

  transition:
    width var(--transition-slow);
}

.app-sidebar__link:hover {
  border-color: var(--sidebar-line-strong);

  color: var(--sidebar-text);

  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025),
      rgba(255, 255, 255, 0.008)
    );

  transform: translateX(3px);
}

.app-sidebar__link:hover::after {
  width: 100%;
}

.app-sidebar__link.is-active {
  border-color: var(--accent-border);

  color: var(--sidebar-text);

  background:
    linear-gradient(
      90deg,
      rgba(0, 229, 255, 0.11),
      rgba(0, 229, 255, 0.025)
    );
}

.app-sidebar__link.is-active::before {
  position: absolute;
  top: 50%;
  left: -1px;

  width: 2px;
  height: 27px;

  content: "";

  background: var(--accent);

  transform: translateY(-50%);
}

.app-sidebar__link.is-active::after {
  width: 100%;
}

.app-sidebar__link-index {
  color: #46515e;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 8px;
  font-weight: 600;
}

.app-sidebar__link > svg:not(.app-sidebar__link-arrow) {
  width: 18px;
  min-width: 18px;
  height: 18px;

  stroke-width: 1.75;
}

.app-sidebar__link.is-active > svg:not(.app-sidebar__link-arrow) {
  color: var(--accent);
}

.app-sidebar__link-arrow {
  width: 14px !important;
  height: 14px !important;

  color: #46515e;

  opacity: 0;

  transform: translateX(-5px);

  transition:
    opacity var(--transition),
    transform var(--transition);
}

.app-sidebar__link:hover .app-sidebar__link-arrow,
.app-sidebar__link.is-active .app-sidebar__link-arrow {
  opacity: 1;

  transform: translateX(0);
}

.app-sidebar__separator {
  height: 1px;
  margin: 10px 5px;

  background:
    linear-gradient(
      90deg,
      transparent,
      var(--sidebar-line-strong),
      transparent
    );
}

/* =========================================================
   SIDEBAR · USUARIO
   ========================================================= */

.app-sidebar__footer {
  position: relative;

  padding: 12px;

  border-top: 1px solid var(--sidebar-line-strong);

  background: rgba(0, 0, 0, 0.12);
}

.app-sidebar__user {
  display: grid;
  grid-template-columns:
    auto
    minmax(0, 1fr)
    auto;
  align-items: center;
  gap: 10px;

  min-width: 0;
  padding: 10px;

  border: 1px solid var(--sidebar-line);
  border-radius: 11px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.026),
      rgba(255, 255, 255, 0.008)
    );

  transition:
    border-color var(--transition),
    background-color var(--transition),
    transform var(--transition);
}

.app-sidebar__user:hover {
  border-color: var(--accent-border);

  background: var(--accent-soft);

  transform: translateY(-1px);
}

.app-sidebar__avatar {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  min-width: 38px;
  height: 38px;

  border: 1px solid var(--accent-border);
  border-radius: 9px;

  color: var(--accent);

  font-size: 10px;
  font-weight: 800;

  background: rgba(0, 229, 255, 0.06);
}

.app-sidebar__avatar span {
  position: absolute;
  right: -2px;
  bottom: -2px;

  width: 8px;
  height: 8px;

  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;

  background: var(--success);
}

.app-sidebar__user-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;

  min-width: 0;
}

.app-sidebar__user-copy strong {
  overflow: hidden;

  color: var(--sidebar-text);

  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__user-copy span {
  overflow: hidden;

  color: var(--sidebar-text-muted);

  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__user-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  color: var(--success);
}

.app-sidebar__user-status svg {
  width: 15px;
  height: 15px;
}

.app-sidebar__footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin-top: 9px;
  padding: 0 4px;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
}

.app-sidebar__footer-meta span {
  color: #485460;
}

.app-sidebar__footer-meta strong {
  color: var(--success);

  font-weight: 700;
}

/* =========================================================
   ÁREA PRINCIPAL
   ========================================================= */

.app-main {
  position: relative;

  display: flex;
  flex-direction: column;

  width: 100%;
  min-width: 0;
  min-height: 100vh;
}

.app-main__content {
  width: 100%;
  max-width: var(--content-max-width);
  min-width: 0;
  margin: 0 auto;
  padding: 22px;
}

/* =========================================================
   TOPBAR
   ========================================================= */

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 300;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;

  width: 100%;
  min-height: var(--topbar-height);
  padding: 0 22px;

  overflow: hidden;

  border-bottom: 1px solid var(--line-strong);

  background:
    linear-gradient(
      90deg,
      rgba(9, 13, 19, 0.985),
      rgba(6, 9, 13, 0.985)
    );

  backdrop-filter: blur(12px);
}

.app-topbar::after {
  position: absolute;
  right: 0;
  bottom: 0;

  width: 180px;
  height: 1px;

  content: "";

  background:
    linear-gradient(
      90deg,
      transparent,
      var(--accent)
    );
}

.app-topbar__ambient {
  position: absolute;
  top: -80px;
  right: 18%;

  width: 240px;
  height: 160px;

  border-radius: 50%;

  pointer-events: none;

  background:
    radial-gradient(
      circle,
      rgba(0, 229, 255, 0.075),
      transparent 68%
    );
}

/* =========================================================
   TOPBAR · IZQUIERDA
   ========================================================= */

.app-topbar__left {
  position: relative;

  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;

  min-width: 0;
}

.app-topbar__heading {
  display: flex;
  flex-direction: column;
  gap: 2px;

  min-width: 0;
}

.app-topbar__eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;

  color: #53616f;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.app-topbar__eyebrow span {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: var(--success);

  animation:
    sidebar-status-pulse
    2s
    ease-in-out
    infinite;
}

.app-topbar__heading h1 {
  overflow: hidden;

  color: var(--text);

  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar__heading p {
  overflow: hidden;

  color: var(--text-muted);

  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   TOPBAR · DERECHA
   ========================================================= */

.app-topbar__right {
  position: relative;

  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  min-width: 0;
}

/* =========================================================
   TOPBAR · BUSCADOR
   ========================================================= */

.app-topbar__search {
  position: relative;

  display: flex;
  flex: 0 0 390px;
  align-items: center;
  gap: 10px;

  width: 390px;
  min-width: 280px;
  height: 44px;
  padding: 0 12px;

  overflow: hidden;

  border: 1px solid var(--line-strong);
  border-radius: 9px;

  background:
    linear-gradient(
      145deg,
      rgba(15, 20, 27, 0.97),
      rgba(8, 11, 16, 0.98)
    );

  transition:
    border-color var(--transition),
    background-color var(--transition);
}

.app-topbar__search::after {
  position: absolute;
  bottom: 0;
  left: 0;

  width: 0;
  height: 1px;

  content: "";

  background: var(--accent);

  transition:
    width var(--transition-slow);
}

.app-topbar__search:hover {
  border-color: #475360;
}

.app-topbar__search:focus-within {
  border-color: var(--accent-border);

  background: #091017;
}

.app-topbar__search:focus-within::after,
.app-topbar__search.has-value::after {
  width: 100%;
}

.app-topbar__search > svg {
  flex: 0 0 18px;

  width: 18px;
  min-width: 18px;
  height: 18px;

  color: var(--text-soft);

  stroke-width: 1.8;
}

.app-topbar__search:focus-within > svg {
  color: var(--accent);
}

.app-topbar__search input {
  display: block;
  flex: 1 1 auto;

  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0;

  border: 0;
  outline: 0;

  color: var(--text);

  font-size: 12px;
  font-weight: 500;

  background: transparent;
}

.app-topbar__search input::placeholder {
  color: #596674;
}

.app-topbar__search-code {
  color: #45515e;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
}

/* =========================================================
   TOPBAR · BOTONES
   ========================================================= */

.app-topbar__right .button,
.app-topbar__right .icon-button {
  flex: 0 0 auto;
}

.app-topbar__right .button {
  min-height: 44px;
}

.app-topbar__right .icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
}

.app-topbar__logout:hover:not(:disabled) {
  border-color: var(--danger-border);

  color: var(--danger);

  background: var(--danger-soft);
}

.app-topbar__logout.is-loading svg {
  animation:
    topbar-logout-spin
    0.7s
    linear
    infinite;
}

.app-topbar__menu-button {
  display: none;
}

/* =========================================================
   OVERLAY SIDEBAR
   ========================================================= */

.app-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;

  display: none;

  width: 100%;
  height: 100%;

  border: 0;

  opacity: 0;

  background: rgba(2, 4, 7, 0.82);

  backdrop-filter: blur(6px);

  animation:
    sidebar-overlay-in
    180ms
    ease
    forwards;
}

body.sidebar-open .app-sidebar-overlay {
  display: block;
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes sidebar-status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

@keyframes sidebar-system-line {
  0%,
  100% {
    width: 72%;
    opacity: 0.8;
  }

  50% {
    width: 96%;
    opacity: 1;
  }
}

@keyframes sidebar-overlay-in {
  to {
    opacity: 1;
  }
}

@keyframes topbar-logout-spin {
  to {
    transform: rotate(360deg);
  }
}