/* Housekeep v2 · los colores vienen del tema elegido por cada usuario (core.js → applyAppearance) */
:root {
  --bg: #f5f6f8; --surface: #fff; --surface2: #f8f9fb; --text: #20314a; --muted: #69778b; --border: #e5e9ee;
  --accent: #294f83; --accent-text: #fff; --tint: #edf2f9; --sidebar: #15283f; --side-text: #bbc8d8; --side-active: #fff; --side-tint: #2a3d54;
  --ui-font: 18px; --radius: 14px; --danger: #b8434b; --ok: #2f7d58; --warn: #a2651c;
}
* { box-sizing: border-box; }
html { font-size: var(--ui-font); }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .9rem; line-height: 1.45; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; } h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: .85rem; color: var(--muted); font-weight: 600; margin-top: .8rem; }
a { color: var(--accent); }
.muted, small.muted { color: var(--muted); } small { font-size: .78rem; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-height: 2.3rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
input.saving, select.saving { border-color: var(--accent); background: var(--tint); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .9rem; min-height: 2.3rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--accent); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; } .btn.small { padding: .3rem .6rem; min-height: 2rem; font-size: .8rem; } .btn.big { min-height: 2.8rem; width: 100%; font-size: 1rem; }
.btn.wa { color: #fff; background: #1f9d55; border-color: #1f9d55; }
.icon-btn { display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 1.2rem; }
.icon-btn.danger { color: var(--danger); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); margin-bottom: .6rem; }
.seg button, .seg label { border: 0; background: transparent; padding: .45rem .9rem; cursor: pointer; display: flex; gap: .3rem; align-items: center; }
.seg button.on { background: var(--accent); color: var(--accent-text); } .seg.small button { padding: .3rem .6rem; font-size: .8rem; }
.seg input { width: auto; min-height: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .3rem .75rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.dot { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; background: var(--c, #ccc); border: 1px solid rgba(0,0,0,.15); }

/* Estructura */
#sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--sidebar); color: var(--side-text); display: flex; flex-direction: column; padding: 1rem .8rem; z-index: 20; }
.brand { display: flex; gap: .6rem; align-items: center; color: var(--side-active); text-decoration: none; font-weight: 700; font-size: 1.05rem; margin-bottom: 1rem; }
.brand small { display: block; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; opacity: .7; font-weight: 500; }
.brand.dark { color: var(--text); }
.brandmark { width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--side-tint); color: #fff; display: grid; place-items: center; font-family: Georgia, serif; font-size: 1.3rem; }
.brand.dark .brandmark { background: var(--sidebar); }
.brandmark span { color: #d4b37b; }
.hotel-name { padding: .6rem .7rem; border-radius: 10px; background: var(--side-tint); color: var(--side-active); font-weight: 600; margin-bottom: 1rem; }
#sidebar nav { display: grid; gap: .2rem; }
#sidebar nav a { display: flex; gap: .7rem; align-items: center; padding: .6rem .7rem; border-radius: 10px; color: var(--side-text); text-decoration: none; }
#sidebar nav a:hover { background: var(--side-tint); } #sidebar nav a.active { background: var(--side-tint); color: var(--side-active); font-weight: 600; }
.sidebar-bottom { margin-top: auto; display: grid; gap: .6rem; }
.me { display: flex; gap: .6rem; align-items: center; color: var(--side-active); } .me small { display: block; color: var(--side-text); }
.avatar { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.side-btn { color: var(--side-text); border-color: var(--side-tint); justify-content: flex-start; }
.workspace { margin-left: 250px; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .8rem; padding: .7rem 1.2rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.page-title { margin: 0; font-size: 1.15rem; flex: 1; }
#menuBtn { display: none; }
.sync { display: inline-flex; gap: .3rem; align-items: center; font-size: .75rem; color: var(--ok); } .sync.off { color: var(--danger); }
.font-controls { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.font-controls button { border: 0; background: var(--surface); padding: .35rem .6rem; cursor: pointer; font-weight: 700; }
main { padding: 1.2rem; max-width: 1400px; }
#overlay { display: none; }

/* Paneles y formularios */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.stack { display: grid; gap: .7rem; } .stack.narrow { max-width: 360px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; } .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.field { display: grid; gap: .25rem; font-weight: 600; font-size: .82rem; border: 0; padding: 0; margin: 0; } .field small { font-weight: 400; color: var(--muted); }
.field legend { margin-bottom: .3rem; }
.form-error { color: var(--danger); font-weight: 600; min-height: 1em; font-size: .82rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem; font-weight: 400; }
.checks label, .check { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
.checks input, .check input { width: auto; min-height: 0; }
.suffix { display: flex; align-items: center; gap: .3rem; } .suffix span { color: var(--muted); font-weight: 400; }
.center-card { max-width: 430px; margin: 8vh auto; padding: 1.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 20px 50px rgba(20, 35, 60, .08); }
.center-card.wide { max-width: 620px; }
.center-card #langPick { width: auto; }
.loading { margin: 20vh auto; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Habitaciones */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.toolbar-right { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; } .toolbar-right select, .toolbar-right input { width: auto; } .toolbar-right .seg { margin: 0; }
.floor { margin-bottom: 1.2rem; } .floor h2 small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: .55rem; }
.tile { border: 0; border-radius: 12px; padding: .65rem .5rem; cursor: pointer; display: grid; gap: .1rem; text-align: center; min-height: 5.4rem; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.tile strong { font-size: 1.25rem; } .tile span { font-size: .75rem; font-weight: 600; } .tile small { font-size: .68rem; opacity: .85; }
.tile.prio { box-shadow: inset 0 0 0 3px #b8434b; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.room-card, .hotel-card { display: grid; gap: .3rem; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; cursor: pointer; }
.hotel-card { cursor: default; } .hotel-card h3 { color: var(--text); font-size: 1rem; margin: 0; } .hotel-card p { margin: .2rem 0; }
.room-card-head { display: flex; justify-content: space-between; align-items: center; } .room-card-head strong { font-size: 1.2rem; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: color-mix(in srgb, var(--c, var(--accent)) 35%, var(--surface)); }
.status-active { --c: #3aa36c; } .status-invited { --c: #e1b24b; } .status-disabled, .status-suspended { --c: #c7646b; } .status-draft { --c: #9aa7b8; }
.warn { color: var(--warn); font-weight: 600; } .prio-tag { color: var(--danger); font-weight: 700; font-size: .75rem; }

/* Diálogo y ficha */
dialog { border: 0; border-radius: 18px; padding: 1.2rem; width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 30px); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 20, 35, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; } .dialog-head h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; } .dialog-actions.wrap { flex-wrap: wrap; justify-content: flex-start; }
.state-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .45rem; }
.state-btn { display: flex; align-items: center; gap: .45rem; padding: .55rem .7rem; border-radius: 10px; border: 2px solid var(--c); background: var(--surface); cursor: pointer; font-weight: 600; }
.state-btn.on { background: color-mix(in srgb, var(--c) 30%, var(--surface)); } .state-btn:disabled { opacity: .4; cursor: not-allowed; }
.dates p { margin: 0; font-weight: 600; } .helper { color: var(--muted); font-size: .78rem; }
.linen { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); margin: .8rem 0; }
.linen.due { border-color: var(--warn); } .linen h3 { margin: 0; } .linen p { margin: .2rem 0 0; }
details summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
.history ol { padding-left: 1.1rem; margin: 0; display: grid; gap: .45rem; font-size: .8rem; } .history time { color: var(--muted); }
.invite-text { font-size: .85rem; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; } th, td { padding: .45rem .4rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table.quick input, table.quick select { min-height: 2.1rem; padding: .3rem .45rem; font-size: .82rem; }
.w-num { max-width: 5.5rem; } .w-xs { max-width: 4.5rem; } .w-type { min-width: 6rem; max-width: 9rem; }
table.quick select[data-f=state_id], table.quick select[data-f=assigned_user_id] { min-width: 9rem; } table.quick select[data-f=floor_id] { min-width: 3.8rem; } table.quick input[type=date] { width: 9.5rem; }
tr.dim { opacity: .55; } td.actions { white-space: nowrap; display: flex; gap: .35rem; align-items: center; }
.wa-link { display: inline-flex; gap: .3rem; align-items: center; color: #1f9d55; text-decoration: none; }
.states-list { display: grid; gap: .45rem; }
.state-row { display: grid; grid-template-columns: 4.2rem 1fr 2.6rem 8rem auto; gap: .35rem; align-items: center; }
.state-row input[type=color] { padding: .1rem; height: 2.3rem; } .state-row .form-error { grid-column: 1 / -1; min-height: 0; }

/* Perfil */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; }
.theme { border: 2px solid var(--border); border-radius: 12px; padding: .5rem; background: var(--surface); cursor: pointer; display: grid; gap: .4rem; text-align: left; font-weight: 600; }
.theme.on { border-color: var(--accent); } .swatch { height: 2.4rem; border-radius: 8px; }
.font-row { display: flex; align-items: center; gap: .6rem; } .font-row output { min-width: 3.5rem; text-align: center; font-weight: 700; }

/* Avisos */
#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 200%); visibility: hidden; background: var(--sidebar); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; transition: transform .25s; z-index: 50; max-width: calc(100% - 2rem); }
#toast.visible { transform: translate(-50%, 0); visibility: visible; } #toast.error { background: var(--danger); }

/* Celular y tablet */
@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); transition: transform .2s; }
  .nav-open #sidebar { transform: none; }
  .nav-open #overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; }
  .workspace { margin-left: 0; } #menuBtn { display: inline-grid; }
  main { padding: .8rem; } .grid2, .grid3 { grid-template-columns: 1fr; }
  .toolbar-right { width: 100%; } .toolbar-right input { flex: 1; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); }
  input, select, textarea { font-size: 16px; } /* evita el zoom automático en iPhone */
  .linen { flex-wrap: wrap; } .linen .btn { width: 100%; }
  .state-row { grid-template-columns: 4rem 1fr 2.6rem; } .state-row select, .state-row .btn { grid-column: span 1; }
}

.secret { font-size: 2rem; font-weight: 800; letter-spacing: .25em; text-align: center; padding: .6rem; border-radius: 12px; background: var(--tint); margin: .8rem 0 .3rem; font-family: ui-monospace, monospace; }
