@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300;500;700&display=swap");

:root {
  --bg: #0f1115;
  --panel: #161a22;
  --accent: #4f8cff;
  --ink: #e6eaf2;
  --muted: #a0a6b3;
  --line: #232836;
  --success: #2ecc71;
  --warning: #f1c40f;
  --error: #e74c3c;
  --hover: #1f2a44;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at top, #141824 0%, var(--bg) 60%);
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0b0d12;
  color: var(--ink);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 20;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
}

.brand-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f131b;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-link {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  transition: background 0.2s ease;
}

.nav-link:hover {
  background: var(--hover);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}

.content {
  padding: 32px;
}

.sidebar-overlay {
  display: none;
}

.mobile-menu-btn {
  display: none;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.btn.warning {
  background: var(--warning);
  color: #0f1115;
  border-color: transparent;
}

.btn.success {
  background: var(--success);
  color: #0f1115;
  border-color: transparent;
}

.btn.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.search {
  display: flex;
  gap: 8px;
}

.search input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0f131b;
  color: var(--ink);
  min-width: 220px;
}

.search select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0f131b;
  color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.card-title {
  font-size: 13px;
  color: var(--muted);
}

.card-value {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0;
}

.card-foot {
  font-size: 12px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 20px;
}

.panel-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.panel-title.with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-body.empty {
  color: var(--muted);
  font-size: 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.parts-table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

.parts-table thead th {
  border-bottom: 1px solid var(--line);
}

.parts-table tbody tr {
  background: #0f131b;
}

.parts-table tbody td {
  border-bottom: none;
}

.parts-table .group-detail,
.parts-table .group-detail td {
  background: transparent;
}

.empty-row td {
  color: var(--muted);
  font-size: 14px;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-count {
  color: var(--muted);
  font-size: 13px;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.chart-card {
  background: #111521;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.chart-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.chart-wrap {
  height: 220px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.form-grid input,
.form-grid select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0f131b;
  color: var(--ink);
}

.autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #0f131b;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
}

.autocomplete-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.autocomplete-item:hover {
  background: var(--hover);
}

.autocomplete-item small {
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  grid-column: 1 / -1;
}

.service-block {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #111521;
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.service-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.hidden {
  display: none !important;
}

.subtable {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f131b;
}
.new-client {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #111521;
}
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}

.alert.error {
  background: rgba(231, 76, 60, 0.2);
  color: var(--error);
  border: 1px solid rgba(231, 76, 60, 0.35);
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.libre {
  background: rgba(46, 204, 113, 0.2);
  color: var(--success);
}

.badge.ocupada {
  background: rgba(241, 196, 15, 0.2);
  color: var(--warning);
}

.badge.pendiente {
  background: rgba(231, 76, 60, 0.2);
  color: var(--error);
}

.badge.caida {
  background: rgba(231, 76, 60, 0.35);
  color: var(--error);
}
.message-box {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #0f131b;
  color: var(--ink);
  resize: vertical;
  font-family: "Manrope", sans-serif;
  line-height: 1.4;
}

.message-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.transfer-form {
  flex-wrap: wrap;
  gap: 6px;
}

.transfer-form select {
  min-width: 180px;
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #0f131b;
  color: var(--ink);
}

.transfer-form .btn {
  padding: 8px 12px;
}

.btn.danger {
  border-color: rgba(231, 76, 60, 0.6);
  color: var(--error);
}

.mini {
  width: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #0f131b;
  color: var(--ink);
}

.quick-actions {
  display: inline-flex;
  gap: 6px;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #111521;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.tab-link.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.value {
  font-size: 16px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    max-width: 86vw;
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.45);
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .nav-link {
    padding: 8px 10px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
  }

  .content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 8px 12px;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.6);
    backdrop-filter: blur(2px);
    z-index: 15;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

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

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .card-value {
    font-size: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .service-row {
    grid-template-columns: 1fr;
  }

  .new-client {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .table.responsive-card thead {
    display: none;
  }

  .table.responsive-card tbody {
    display: grid;
    gap: 10px;
  }

  .table.responsive-card tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f131b;
    padding: 8px 10px;
  }

  .table.responsive-card tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 4px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  }

  .table.responsive-card tbody td:last-child {
    border-bottom: none;
  }

  .table.responsive-card tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .table.responsive-card .inline {
    flex-wrap: wrap;
  }

  .transfer-form select {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .page-header h1 {
    font-size: 22px;
  }

  .panel,
  .card {
    padding: 14px;
    border-radius: 14px;
  }
}
