:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --dark: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f3f6fb;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  background: var(--bg);
  color: #1e293b;
}
a {
  text-decoration: none;
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
}
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 255px 1fr;
}
.sidebar {
  background: var(--dark);
  color: #cbd5e1;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  padding: 0 10px 25px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
}
.nav-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #718096;
  margin: 20px 12px 8px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 9px;
  margin: 4px 0;
}
.nav a:hover,
.nav a.active {
  color: #fff;
  background: #26344f;
}
.nav-icon {
  width: 22px;
  text-align: center;
}
.main {
  min-width: 0;
}
.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.content {
  padding: 30px;
  max-width: 1500px;
  margin: auto;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.page-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
}
.subtitle {
  margin: 0;
  color: var(--muted);
}
.btn {
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 650;
  background: #e2e8f0;
  color: #334155;
}
.btn:hover {
  filter: brightness(0.96);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-outline {
  background: #fff;
  border: 1px solid var(--line);
}
.btn-sm {
  padding: 7px 10px;
  font-size: 13px;
}
.grid {
  display: grid;
  gap: 20px;
}
.stats {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}
.stat span {
  color: var(--muted);
  font-size: 14px;
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 23px;
  background: #dbeafe;
  color: var(--primary);
}
.green {
  background: #dcfce7;
  color: var(--success);
}
.orange {
  background: #fef3c7;
  color: #d97706;
}
.red {
  background: #fee2e2;
  color: var(--danger);
}
.two-col {
  grid-template-columns: 2fr 1fr;
}
.card-title {
  margin: 0 0 18px;
  font-size: 18px;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  flex: 1;
  min-width: 210px;
}
.search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.search:before {
  content: "⌕";
  position: absolute;
  left: 14px;
  top: 8px;
  font-size: 20px;
  color: var(--muted);
}
.control {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.table th,
.table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}
.table tr:hover td {
  background: #fafcff;
}
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #dbeafe;
  color: var(--primary);
}
.badge.success {
  background: #dcfce7;
  color: #15803d;
}
.badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}
.badge.warning {
  background: #fef3c7;
  color: #b45309;
}
.actions {
  display: flex;
  gap: 6px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field.full {
  grid-column: 1/-1;
}
.field label {
  font-size: 14px;
  font-weight: 650;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 11px 12px;
  background: #fff;
}
.field textarea {
  min-height: 100px;
  resize: vertical;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 22px 30px;
}
.timeline li:before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}
.timeline li:after {
  content: "";
  position: absolute;
  left: 9px;
  top: 17px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.timeline li:last-child:after {
  display: none;
}
.timeline small {
  color: var(--muted);
}
.empty-note {
  padding: 14px;
  border-radius: 9px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 14px;
}
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: #fff;
}
.login-art {
  padding: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, #172033, #2563eb);
  position: relative;
  overflow: hidden;
}
.login-art:after {
  content: "";
  width: 420px;
  height: 420px;
  border: 70px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  position: absolute;
  right: -160px;
  bottom: -180px;
}
.login-art h1 {
  font-size: 44px;
  max-width: 560px;
  margin: 24px 0 14px;
}
.login-art p {
  font-size: 18px;
  line-height: 1.6;
  max-width: 500px;
  color: #dbeafe;
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 35px;
}
.login-box {
  width: 100%;
  max-width: 420px;
}
.login-box h2 {
  font-size: 30px;
  margin: 0 0 8px;
}
.login-box .field {
  margin-top: 18px;
}
.login-box .btn {
  width: 100%;
  margin-top: 22px;
  padding: 13px;
}
.help {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 20px;
}
.code-input {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 25px 0;
}
.code-input input {
  min-width: 0;
  text-align: center;
  font-size: 23px;
  font-weight: 800;
  padding: 13px 2px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.mobile-menu {
  display: none;
}
.quick {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.quick a {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  transition: 0.2s;
}
.quick a:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
@media (max-width: 1050px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .login-art {
    padding: 45px;
  }
  .login-art h1 {
    font-size: 36px;
  }
}
@media (max-width: 760px) {
  .layout {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }
  .brand {
    padding-bottom: 10px;
  }
  .nav-title {
    display: none;
  }
  .nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }
  .nav a {
    white-space: nowrap;
  }
  .topbar {
    height: 62px;
    padding: 0 16px;
  }
  .topbar .role {
    display: none;
  }
  .content {
    padding: 20px 14px;
  }
  .page-head {
    flex-direction: column;
  }
  .page-head .btn {
    width: 100%;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-art {
    display: none;
  }
  .login-panel {
    min-height: 100vh;
    padding: 24px;
  }
  .quick {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 17px;
  }
  .form-actions {
    flex-direction: column-reverse;
  }
  .form-actions .btn {
    width: 100%;
  }
}
/* Navegacion movil tipo hamburguesa */
.mobile-menu {
  display: none;
  border: 0;
  background: transparent;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
  color: var(--dark);
  padding: 6px;
}
.sidebar-close {
  display: none;
}
.sidebar-overlay {
  display: none;
}
.login-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}
.login-actions .btn {
  margin-top: 0;
}
.login-actions .btn-outline {
  color: var(--primary);
  border-color: var(--primary);
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed !important;
    left: -280px;
    top: 0;
    width: 270px;
    height: 100vh !important;
    padding: 20px 14px !important;
    z-index: 50;
    transition: left 0.25s ease;
    box-shadow: 8px 0 25px rgba(0, 0, 0, 0.2);
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-close {
    display: block;
    position: absolute;
    right: 13px;
    top: 17px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 27px;
    cursor: pointer;
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 40;
  }
  .sidebar-overlay.show {
    display: block;
  }
  .sidebar .brand {
    padding-bottom: 22px;
  }
  .sidebar .nav-title {
    display: block;
  }
  .sidebar .nav {
    display: block;
    overflow: visible;
  }
  .sidebar .nav a {
    white-space: normal;
  }
  .mobile-menu {
    display: block;
  }
  .topbar {
    justify-content: flex-start !important;
    gap: 13px;
  }
  .topbar .user {
    margin-left: auto;
  }
}

/* Ajustes para evitar desbordes en cualquier tamano de pantalla */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}
.layout,
.main,
.content,
.card,
.grid {
  min-width: 0;
}
.table-wrap {
  max-width: 100%;
}
.actions {
  flex-wrap: wrap;
}
.toolbar > * {
  max-width: 100%;
}
img,
svg {
  max-width: 100%;
  height: auto;
}
@media (max-width: 760px) {
  .main {
    width: 100%;
    max-width: 100vw;
  }
  .content {
    width: 100%;
    overflow: hidden;
  }
  .topbar {
    width: 100%;
    min-width: 0;
  }
  .topbar > strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .user strong {
    display: block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .toolbar .search,
  .toolbar .control,
  .toolbar .btn,
  .toolbar input,
  .toolbar select {
    width: 100%;
    min-width: 0;
  }
  .page-head {
    width: 100%;
  }
  .page-head > * {
    min-width: 0;
    max-width: 100%;
  }
  .page-head h1 {
    font-size: 24px;
    overflow-wrap: anywhere;
  }
  .subtitle {
    overflow-wrap: anywhere;
  }
  .card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .table-wrap {
    overflow: visible;
    width: 100%;
  }
  .table {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .table thead {
    display: none;
  }
  .table tbody {
    display: grid;
    gap: 14px;
    width: 100%;
  }
  .table tr {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }
  .table td {
    display: flex;
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .table td:last-child {
    border-bottom: 0;
  }
  .table td:before {
    content: attr(data-label);
    flex: 0 0 38%;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
  }
  .table td:empty:before {
    display: none;
  }
  .table .actions {
    justify-content: flex-end;
  }
  .table .actions .btn {
    flex: 1;
    min-width: 75px;
  }
  .form-grid {
    width: 100%;
  }
  .field,
  .field input,
  .field select,
  .field textarea {
    min-width: 0;
    max-width: 100%;
  }
  .code-input {
    gap: 5px;
  }
  .code-input input {
    font-size: 18px;
    padding: 11px 0;
  }
  .login-box {
    min-width: 0;
  }
  .login-actions {
    width: 100%;
  }
  .quick a {
    overflow-wrap: anywhere;
  }
}
@media (min-width: 761px) and (max-width: 1150px) {
  .content {
    padding: 24px 20px;
  }
  .table {
    min-width: 680px;
  }
  .toolbar .search {
    flex-basis: 100%;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
