/* ============================================================
   Haciendax — Admin panel design tokens & base styles
   85% white/neutral · navy identity (~10%) · coral actions (<5%)
   Photos carry the color.
   ============================================================ */

:root {
  /* — Identity: sober navy — */
  --navy:        #16335B;
  --navy-700:    #1E3F6E;
  --navy-600:    #2A4F82;
  --navy-50:     #EEF2F8;
  --navy-100:    #DCE5F0;

  /* — Action: coral (buttons only) — */
  --coral:       #F26B5B;
  --coral-600:   #E45846;
  --coral-50:    #FDEEEC;

  /* — Status (content, not chrome) — */
  --ok:          #1F8A5B;   /* disponible  */
  --ok-bg:       #E6F4EC;
  --warn:        #B9791A;   /* reservado   */
  --warn-bg:     #FBF1DF;
  --muted:       #7C8696;   /* vendido/alquilado */
  --muted-bg:    #EEF0F3;

  /* — Neutrals — */
  --bg:          #FFFFFF;
  --surface:     #FFFFFF;
  --surface-2:   #F6F7F9;
  --surface-3:   #EFF1F4;
  --line:        #E5E8EC;
  --line-strong: #D6DAE0;

  /* — Ink — */
  --ink:         #18212E;
  --ink-2:       #515B6B;
  --ink-3:       #8A93A1;

  /* — Type — */
  --serif: "Spectral", Georgia, serif;
  --sans:  "Manrope", system-ui, -apple-system, sans-serif;

  /* — Radius / shadow — */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-card: 0 1px 2px rgba(24,33,46,.05), 0 6px 18px rgba(24,33,46,.06);
  --shadow-pop:  0 8px 28px rgba(24,33,46,.16), 0 2px 6px rgba(24,33,46,.10);
  --shadow-nav:  0 -1px 0 var(--line), 0 -8px 24px rgba(24,33,46,.05);

  /* — Layout — */
  --maxw: 468px;
  --header-h: 56px;
  --nav-h: 64px;

  /* — Density (driven by Tweaks) — */
  --pad: 16px;
  --gap: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: #DFE3E8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.45;
}

/* On desktop, present as a centered mobile column */
.app-frame {
  width: 100%;
  max-width: var(--maxw);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(24,33,46,.06), 0 24px 60px rgba(24,33,46,.14);
  overflow: hidden;
}
@media (min-width: 520px) {
  body { padding: 0; }
  .app-frame { min-height: 100dvh; border-radius: 0; }
}

/* Type */
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.serif { font-family: var(--serif); }
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.02em;
  font-feature-settings: "ss01";
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* Utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grow { flex: 1; }
.muted-text { color: var(--ink-2); }
.tiny { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Focus — visible AA */
:where(button, a, input, select, textarea, [tabindex], .focusable):focus-visible {
  outline: 2.5px solid var(--navy-600);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 44px; padding: 0 18px;
  border-radius: var(--r); border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; line-height: 1;
  transition: background .14s ease, border-color .14s, transform .06s, box-shadow .14s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 14px rgba(242,107,91,.30); }
.btn-coral:hover { background: var(--coral-600); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-700); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--navy); height: 40px; padding: 0 10px; }
.btn-quiet:hover { background: var(--navy-50); }
.btn-sm { height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2);
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Chips / segmented filters */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: all .13s;
}
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip:hover:not([aria-pressed="true"]) { border-color: var(--navy-600); color: var(--navy); }

/* Status pill */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px 4px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  backdrop-filter: saturate(1.2);
}
.status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-disponible { color: var(--ok); background: var(--ok-bg); }
.status-reservado  { color: var(--warn); background: var(--warn-bg); }
.status-vendido, .status-alquilado { color: var(--muted); background: var(--muted-bg); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  transition: border-color .13s, box-shadow .13s;
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 80px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(42,79,130,.16);
}
.input::placeholder { color: var(--ink-3); }
.select { appearance: none; background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%237C8696' stroke-width='2' stroke-linecap='round'><path d='M5 8l5 5 5-5'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 36px;
}

/* Price */
.price-usd { font-family: var(--sans); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.price-bs {
  display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Scroll area */
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { width: 0; }

/* Skeleton shimmer */
.sk { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  transform: translateX(-100%); animation: shimmer 1.25s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Spinner */
.spinner { width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--navy-100); border-top-color: var(--navy);
  animation: spin .7s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Toast */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 14px); display: flex; justify-content: center; z-index: 80; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-pop);
  animation: toastin .26s cubic-bezier(.2,.8,.2,1);
  max-width: calc(var(--maxw) - 32px);
}
.toast .tdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } }

/* Sheet / modal */
.scrim { position: absolute; inset: 0; background: rgba(18,26,38,.46); z-index: 60;
  animation: fade .18s ease; backdrop-filter: blur(1.5px); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--bg); border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-pop); max-height: 94%; display: flex; flex-direction: column;
  animation: sheetup .3s cubic-bezier(.2,.85,.25,1);
}
@keyframes sheetup { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 9px auto 2px; }

.modal {
  position: absolute; inset: 0; z-index: 61; display: grid; place-items: center; padding: 22px;
}
.modal-card { background: var(--bg); border-radius: 18px; box-shadow: var(--shadow-pop);
  width: 100%; max-width: 380px; animation: pop .22s cubic-bezier(.2,.85,.25,1); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* fade/slide for screen transitions */
@keyframes screenin { from { opacity: 0; transform: translateY(6px); } }
.screen-in { animation: screenin .22s ease; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; }
}

/* ============================================================
   DESKTOP — sidebar izquierdo + app a PANTALLA COMPLETA.
   El mobile (≤899px) queda exactamente como estaba.
   ============================================================ */
.hx-app { display: flex; flex-direction: column; height: 100dvh; }
.hx-body { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.hx-sidebar { display: none; }            /* sidebar: solo desktop */
.cards-grid { display: flex; flex-direction: column; gap: 12px; }  /* listas: 1 col en mobile */

@media (min-width: 900px) {
  /* app a pantalla completa — sin barras grises a los costados */
  body { background: var(--bg); }
  .app-frame { max-width: none; border-radius: 0; box-shadow: none; }
  .login-body { max-width: 460px; margin-inline: auto; width: 100%; }

  /* layout en fila: [ sidebar | contenido ] */
  .hx-app { flex-direction: row; }
  .hx-header, .mobile-nav { display: none !important; }   /* chrome mobile oculto */

  /* sin bottom-nav: el offset inferior del FAB/toast se baja */
  :root { --nav-h: 18px; }

  /* SIDEBAR */
  .hx-sidebar {
    display: flex; flex-direction: column; width: 248px; flex-shrink: 0;
    background: var(--navy); color: #fff; padding: 18px 14px; overflow-y: auto;
  }
  .hx-sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
  .hx-sb-logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--navy); display: grid; place-items: center; flex-shrink: 0; }
  .hx-sb-logo .wordmark { font-size: 21px; line-height: 1; }
  .hx-sb-name { font-size: 22px; color: #fff; }
  .hx-sb-nav { display: flex; flex-direction: column; gap: 4px; }
  .hx-sb-item {
    display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 14px; border-radius: 10px;
    border: none; background: transparent; color: rgba(255,255,255,.72); font-weight: 600; font-size: 14.5px;
    cursor: pointer; text-align: left; transition: background .13s, color .13s;
  }
  .hx-sb-item:hover { background: rgba(255,255,255,.08); color: #fff; }
  .hx-sb-item[data-active="true"] { background: rgba(255,255,255,.16); color: #fff; font-weight: 700; }
  .hx-sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
  .hx-sb-user { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
  .hx-sb-avatar { width: 34px; height: 34px; border-radius: 99px; background: rgba(255,255,255,.14); border: 1.5px solid rgba(255,255,255,.3); display: grid; place-items: center; font-weight: 800; font-size: 12.5px; flex-shrink: 0; }
  .hx-sb-uname { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hx-sb-urole { font-size: 11px; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hx-sb-logout { display: flex; align-items: center; justify-content: center; gap: 8px; height: 38px; border-radius: 9px; border: 1px solid rgba(255,255,255,.18); background: transparent; color: rgba(255,255,255,.85); font-weight: 700; font-size: 13px; cursor: pointer; transition: background .13s; }
  .hx-sb-logout:hover { background: rgba(255,255,255,.08); }

  /* tarjetas que LLENAN el ancho disponible (sin cap, sin vacío) */
  .cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px; align-items: start; width: 100%;
  }

  /* formularios con ancho cómodo (no el board del pipeline ni las grillas) */
  .hx-screen .scroll:not(.board) > .screen-in { max-width: 920px; }

  /* sheets (editores/filtros) -> modal centrado y capado */
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%, -50%);
    width: min(620px, 92%); max-height: 88%; border-radius: 18px;
    animation: pop .22s cubic-bezier(.2,.85,.25,1);
  }
  .sheet-grip { display: none; }
}
