/* ============================================================
   RentaTech Inventory — Estilos
   Estética: utilitarian-técnico, limpio, denso pero legible
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --font-ui:   'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --bg:        #F7F6F3;
  --surface:   #FFFFFF;
  --surface2:  #F0EFE9;
  --border:    rgba(0,0,0,0.10);
  --border2:   rgba(0,0,0,0.18);

  --text:      #1A1917;
  --text2:     #5C5B57;
  --text3:     #9B9A95;

  --blue:      #1A5FB4;
  --blue-bg:   #EBF2FC;
  --blue-text: #1A5FB4;

  --green:     #2D6A2D;
  --green-bg:  #E8F5E8;
  --green-text:#2D6A2D;

  --amber:     #8A5A00;
  --amber-bg:  #FFF8E6;
  --amber-text:#8A5A00;

  --red:       #A32020;
  --red-bg:    #FBE9E9;
  --red-text:  #A32020;

  --purple-bg: #EEEDF8;
  --purple-text:#4A3F9F;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --sidebar-w: 230px;
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── UTILITIES ───────────────────────────────────────── */
.hidden { display: none !important; }
.w-full { width: 100%; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BUTTONS ─────────────────────────────────────────── */
button { font-family: var(--font-ui); cursor: pointer; font-size: 13px; border: none; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-md);
  background: var(--blue); color: #fff; font-weight: 500;
}
.btn-primary:hover { background: #154d98; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border2); font-weight: 400;
}
.btn-outline:hover { background: var(--surface2); }

.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 0; background: none; color: var(--text2); font-size: 13px;
}
.btn-back:hover { color: var(--text); }

.btn-icon {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: none; color: var(--text2); border-radius: var(--radius-sm);
  font-size: 18px;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }

.btn-logout {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: none; color: var(--text3); border-radius: var(--radius-md); font-size: 18px;
  border: 1px solid var(--border);
}
.btn-logout:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

/* ── FORMS ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text2); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); background: var(--surface);
  color: var(--text); font-family: var(--font-ui); font-size: 13px;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,95,180,0.12); }
.form-group textarea { resize: vertical; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.check-group { flex-direction: row !important; align-items: center; }
.check-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); }
.check-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* ── LOGIN ───────────────────────────────────────────── */
.login-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 380px; background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 36px; display: flex; flex-direction: column; gap: 16px;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-logo .ti { font-size: 28px; color: var(--blue); }
.login-brand { font-size: 18px; font-weight: 600; }
.login-sub { font-size: 12px; color: var(--text3); }
.btn-login {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; background: var(--blue); color: #fff; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; margin-top: 4px;
}
.btn-login:hover { background: #154d98; }
.login-error {
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px;
}

/* ── APP LAYOUT ──────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo .ti { font-size: 22px; color: var(--blue); }
.logo-name { font-size: 14px; font-weight: 600; }
.logo-sub { font-size: 11px; color: var(--text3); }

.sidebar-search {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  position: relative;
}
.sidebar-search .ti {
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--text3);
}
.sidebar-search input {
  width: 100%; padding: 7px 10px 7px 28px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--bg); font-size: 13px; color: var(--text); outline: none;
}
.sidebar-search input:focus { border-color: var(--blue); background: var(--surface); }

.client-list { flex: 1; overflow-y: auto; padding: 6px 8px; }
.loading-msg { padding: 20px; text-align: center; color: var(--text3); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; }

.client-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer; margin-bottom: 2px;
}
.client-item:hover { background: var(--surface2); }
.client-item.active { background: var(--blue-bg); }

.client-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.c-item-info .c-name { font-size: 13px; font-weight: 500; }
.c-item-info .c-meta { font-size: 11px; color: var(--text3); }
.client-item.active .c-name { color: var(--blue); }

.c-badge {
  margin-left: auto; font-size: 10px; padding: 1px 6px;
  background: var(--surface2); color: var(--text3); border-radius: 10px;
}
.client-item.active .c-badge { background: rgba(26,95,180,0.12); color: var(--blue); }

.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
}
.sidebar-footer .btn-outline { flex: 1; justify-content: center; }

/* ── MAIN ────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.empty-main {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--text3); gap: 12px;
}
.empty-main .ti { font-size: 48px; }
.empty-main p { font-size: 14px; }

.main-header {
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.client-title { font-size: 17px; font-weight: 600; }
.client-meta  { font-size: 12px; color: var(--text2); margin-top: 2px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.stats-bar {
  display: flex; gap: 16px; padding: 10px 20px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-n { font-size: 20px; font-weight: 600; font-family: var(--font-mono); }
.stat-l { font-size: 11px; color: var(--text3); }
.stat-div { width: 1px; background: var(--border); }

.tabs-row {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.tabs { display: flex; gap: 0; }
.tab {
  padding: 10px 14px; font-size: 13px; color: var(--text2); background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }
.tab:hover:not(.active) { color: var(--text); }

/* ── FILTER BAR ──────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding: 8px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.filter-search-wrap { position: relative; flex-shrink: 0; }
.filter-search-wrap .ti {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--text3); pointer-events: none;
}
.filter-search-wrap input {
  padding: 6px 10px 6px 26px; border: 1px solid var(--border2);
  border-radius: var(--radius-sm); background: var(--bg);
  font-size: 12px; color: var(--text); outline: none; width: 200px;
}
.filter-search-wrap input:focus { border-color: var(--blue); background: var(--surface); }

.filter-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.filter-chips { display: flex; gap: 5px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px;
  border: 1px solid var(--border2); background: var(--surface);
  color: var(--text2); cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.chip .ti { font-size: 13px; }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); font-weight: 500; }
.chip-count { font-size: 10px; background: rgba(0,0,0,0.07); border-radius: 8px; padding: 1px 5px; }
.chip.active .chip-count { background: rgba(26,95,180,0.15); }
.results-count { margin-left: auto; font-size: 11px; color: var(--text3); white-space: nowrap; flex-shrink: 0; font-family: var(--font-mono); }

/* ── TAB CONTENT ─────────────────────────────────────── */
.tab-content { display: none; flex: 1; overflow-y: auto; padding: 16px 20px; }
.tab-content.active { display: block; }

/* ── EQUIP GRID ──────────────────────────────────────── */
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }

.equip-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.equip-card:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(26,95,180,0.08); }

.equip-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.equip-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.equip-label { font-size: 13px; font-weight: 600; line-height: 1.3; }
.equip-modelo { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: var(--font-mono); }

.equip-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.ef-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; }
.ef-value { font-size: 12px; font-family: var(--font-mono); color: var(--text); }

.equip-card-foot {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.loc-tag { font-size: 11px; color: var(--text2); display: flex; align-items: center; gap: 4px; }
.loc-tag .ti { font-size: 13px; }
.pills { display: flex; gap: 4px; }

.pill {
  font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 500;
}
.pill-rent   { background: var(--blue-bg);   color: var(--blue-text); }
.pill-client { background: var(--surface2);  color: var(--text3); }
.pill-ok     { background: var(--green-bg);  color: var(--green-text); }
.pill-warn   { background: var(--amber-bg);  color: var(--amber-text); }
.pill-no-gar { background: var(--red-bg);    color: var(--red-text); }

.empty-state {
  grid-column: 1/-1; text-align: center; padding: 48px 20px;
  color: var(--text3); display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-state .ti { font-size: 36px; }

/* ── DETALLE DE EQUIPO ───────────────────────────────── */
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.detail-body { flex: 1; overflow-y: auto; padding: 20px; }

.detail-equip-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.detail-equip-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0;
}
.detail-equip-name { font-size: 18px; font-weight: 600; }
.detail-equip-desc { font-size: 13px; color: var(--text2); margin-top: 3px; }
.detail-pills { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px;
}
.card-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); font-weight: 500; margin-bottom: 10px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--border); }
.field-row:last-child { border-bottom: none; }
.field-row .fl { font-size: 12px; color: var(--text2); }
.field-row .fv { font-size: 12px; font-family: var(--font-mono); text-align: right; }

.photo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.photo-drop {
  border: 2px dashed var(--border2); border-radius: var(--radius-md);
  min-height: 120px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: var(--text3); font-size: 13px; cursor: pointer; transition: all .15s;
}
.photo-drop:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }
.photo-drop .ti { font-size: 30px; }
.photo-img { width: 100%; border-radius: var(--radius-sm); object-fit: contain; max-height: 200px; }
#photoInput { display: none; }

/* ── FICHA DEL CLIENTE ───────────────────────────────── */
.ficha-layout { display: flex; flex-direction: column; gap: 14px; }
.ficha-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ficha-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.ficha-stat .fn { font-size: 24px; font-weight: 600; font-family: var(--font-mono); }
.ficha-stat .fl { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── MODAL ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 520px;
  max-height: 90vh; display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.modal-wide { width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 15px; font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text3); font-weight: 500; margin-top: 6px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ── DETALLE — panel completo ────────────────────────── */
#equipoDetail { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#clientPanel  { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
