/* ============================================
   RustDesk Manager — Estilos
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #1a73e8;
  --blue-dark: #1558b0;
  --blue-bg:   #e8f0fe;
  --green:     #1e8e3e;
  --green-bg:  #e6f4ea;
  --red:       #c5221f;
  --red-bg:    #fce8e6;
  --amber:     #e37400;
  --amber-bg:  #fef7e0;
  --gray-50:   #f8f9fa;
  --gray-100:  #f1f3f4;
  --gray-200:  #e8eaed;
  --gray-400:  #9aa0a6;
  --gray-600:  #5f6368;
  --gray-900:  #202124;
  --sidebar-w: 220px;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ---------- Login ---------- */
.screen-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 360px;
  text-align: center;
}
.login-logo { margin-bottom: 1rem; }
.login-card h1 { font-size: 20px; font-weight: 600; color: var(--gray-900); }
.login-sub { font-size: 13px; color: var(--gray-600); margin: .25rem 0 1.5rem; }

/* ---------- Layout App ---------- */
#screen-app { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1rem;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--gray-200);
}
nav { padding: .75rem 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .6rem 1rem;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 0 24px 24px 0;
  margin-right: 12px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-item.active { background: var(--blue-bg); color: var(--blue); font-weight: 500; }
.sidebar-footer {
  border-top: 1px solid var(--gray-200);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-info span { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { color: var(--gray-400); font-size: 11px; }

#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

/* ---------- Pages ---------- */
.page { display: none; }
.page.active { display: block; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h2 { font-size: 22px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--gray-600); margin-top: 2px; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .875rem 1rem;
}
.stat-card .num { font-size: 26px; font-weight: 600; }
.stat-card .lbl { font-size: 12px; color: var(--gray-600); margin-top: 2px; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: center;
}
.toolbar input,
.toolbar select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  color: var(--gray-900);
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--blue); }

/* ---------- Table ---------- */
.table-wrap {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--gray-50);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}
tbody tr { border-bottom: 1px solid var(--gray-100); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
td { padding: 9px 12px; vertical-align: middle; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.badge-activo   { background: var(--green-bg); color: var(--green); }
.badge-inactivo { background: var(--gray-100); color: var(--gray-600); }
.badge-admin    { background: var(--blue-bg);  color: var(--blue); }
.badge-tecnico  { background: var(--amber-bg); color: var(--amber); }

/* ---------- Contraseña ---------- */
.pass-wrap { display: flex; align-items: center; gap: 5px; }
.pass-text { font-family: monospace; font-size: 12px; letter-spacing: .05em; }

/* ---------- Botones ---------- */
.btn {
  padding: 7px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  color: var(--gray-900);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn:hover { background: var(--gray-100); }
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-full { width: 100%; padding: 10px; font-size: 14px; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}
.btn-icon:hover { color: var(--gray-900); background: var(--gray-100); }
.btn-danger { color: var(--red); }
.btn-danger:hover { color: var(--red); background: var(--red-bg); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: .875rem; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  color: var(--gray-900);
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 1.5rem 1.25rem;
}

/* ---------- Cards de clientes ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
  gap: 16px;
}
.client-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.client-card .cc-name { font-size: 15px; font-weight: 600; margin-bottom: .5rem; }
.client-card .cc-info { font-size: 12px; color: var(--gray-600); line-height: 1.8; }
.client-card .cc-actions { margin-top: 1rem; display: flex; gap: 6px; }
.cc-eq-count {
  display: inline-block;
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
}

/* ---------- Alertas ---------- */
.alert {
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 1rem;
}
.alert-error { background: var(--red-bg); color: var(--red); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
  font-size: 14px;
}
.empty-state svg { margin: 0 auto 1rem; display: block; opacity: .4; }

@media (max-width: 768px) {
  #sidebar { display: none; }
  #main-content { margin-left: 0; padding: 1rem; }
  .form-row-2 { grid-template-columns: 1fr; }
}
