/* Barra de búsqueda: el campo de texto conserva el espacio principal. */
.toolbar {
  align-items: stretch;
  width: 100%;
}

.toolbar > input[type="search"] {
  flex: 1 1 520px;
  min-width: 240px;
  width: auto;
}

.toolbar > select {
  flex: 0 1 260px;
  width: 260px;
  min-width: 190px;
}

.toolbar > .btn {
  flex: 0 0 auto;
  min-width: 118px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 820px;
}

.mobile-menu-button,
.mobile-menu-close,
.menu-overlay,
.mobile-menu-toggle {
  display: none;
}

.site-context {
  display: grid;
  gap: 3px;
}

.generate-id-option {
  margin-top: -7px;
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid #e1d4df;
  border-radius: 11px;
  background: #faf6f9;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.toggle-option:hover {
  border-color: #c89abd;
  background: #f7eef5;
}

.toggle-option:has(input:checked) {
  border-color: var(--purple);
  background: #f4e9f2;
  box-shadow: 0 0 0 3px rgba(118,35,101,.08);
}

.toggle-option input[type="checkbox"] {
  appearance: none;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  margin: 0;
  border: 0;
  border-radius: 20px;
  background: #b6bfcb;
  cursor: pointer;
  position: relative;
  transition: background .18s ease;
}

.toggle-option input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16,42,67,.25);
  transition: transform .18s ease;
}

.toggle-option input[type="checkbox"]:checked {
  background: var(--purple);
}

.toggle-option input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.toggle-option span {
  display: grid;
  gap: 3px;
}

.toggle-option b {
  color: var(--ink);
  font-size: 13px;
}

.toggle-option small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}

.form-control.is-disabled,
.form-control:disabled {
  color: #778398;
  border-color: #d9dee6;
  background: #eef1f5;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 760px) {
  .content {
    width: 100%;
    overflow-x: hidden;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .toolbar > input[type="search"],
  .toolbar > select,
  .toolbar > .btn {
    width: 100%;
    min-width: 0;
  }

  .toolbar > input[type="search"] {
    min-height: 48px;
  }

  .page-header {
    width: 100%;
  }

  .page-header h1 {
    font-size: 27px;
  }

  .page-header .btn,
  .page-actions .btn {
    width: 100%;
  }

  .page-actions {
    display: grid;
    width: 100%;
  }

  .branch-filter {
    display: grid;
    width: 100%;
  }

  .branch-filter select {
    width: 100%;
    min-height: 42px;
  }

  .form-card {
    width: 100%;
    padding: 20px 16px;
  }

  .choice-row ul {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .choice-row label {
    width: 100%;
    min-height: 46px;
  }

  .movement-layout {
    min-width: 0;
  }

  .step {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .stats article {
    min-width: 0;
  }

  .alert {
    line-height: 1.45;
  }
}

@media (max-width: 600px) {
  body:has(.mobile-menu-toggle:checked) {
    overflow: hidden;
  }

  body.menu-open {
    overflow: hidden;
  }

  .mobile-menu-button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: auto;
    height: 44px;
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: var(--purple);
    box-shadow: 0 5px 14px rgba(118,35,101,.24);
    cursor: pointer;
  }

  .mobile-menu-button i {
    display: grid;
    gap: 4px;
    width: 20px;
  }

  .mobile-menu-button b {
    font-size: 14px;
  }

  .mobile-menu-button span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: #fff;
  }

  .mobile-menu-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 18px;
    right: 15px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: rgba(255,255,255,.1);
    font-size: 27px;
    cursor: pointer;
  }

  .menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    visibility: hidden;
    opacity: 0;
    background: rgba(7,24,39,.58);
    backdrop-filter: blur(2px);
    transition: opacity .2s ease, visibility .2s ease;
  }

  .mobile-menu-toggle:checked ~ .menu-overlay {
    visibility: visible;
    opacity: 1;
  }

  .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 21;
    width: min(86vw, 320px);
    height: 100dvh;
    padding: 22px 16px;
    transform: translateX(-105%);
    transition: transform .24s ease;
    box-shadow: 16px 0 40px rgba(7,24,39,.25);
  }

  .sidebar.is-open,
  .mobile-menu-toggle:checked + .sidebar {
    transform: translateX(0);
  }

  .sidebar .brand {
    display: flex;
    padding-right: 48px;
  }

  .sidebar .brand span,
  .sidebar nav span,
  .sidebar .nav-label,
  .sidebar .sidebar-foot {
    display: block;
  }

  .sidebar nav {
    display: grid;
    justify-content: stretch;
    overflow-y: auto;
    padding-bottom: 12px;
  }

  .sidebar nav a,
  .sidebar nav a:nth-of-type(n+5) {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 13px 14px;
    font-size: 15px;
  }

  .sidebar .sidebar-foot {
    margin-top: auto;
  }

  .app-shell {
    margin-left: 0;
    margin-bottom: 0;
  }

  .topbar {
    gap: 12px;
  }

  .site-context {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 9px;
    row-gap: 2px;
    min-width: 0;
  }

  .site-context small,
  .site-context strong {
    white-space: nowrap;
  }

  .table-wrap {
    margin-left: 0;
    margin-right: 0;
    border-radius: 10px;
  }

  .table-wrap::after {
    content: "Desliza horizontalmente para ver más →";
    display: block;
    position: sticky;
    left: 0;
    padding: 10px 14px;
    color: var(--muted);
    background: #fafbfc;
    border-top: 1px solid var(--line);
    font-size: 11px;
  }

  .user-menu {
    margin-left: auto;
  }

  .login-card h2 {
    font-size: 29px;
  }
}
