/* ============================================================
   Web Check-in - design system (Opcion A)
   Tema claro/oscuro via CSS vars + html[data-theme="dark"]
   ============================================================ */

:root {
    --bg: #F6F7F8;
    --header: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #FAFBFC;
    --border: #E3E7EB;
    --inbd: #D8DEE4;
    --inbg: #FFFFFF;
    --text: #1B2733;
    --muted: #5C6B7A;
    --faint: #7C8A98;
    --accent: oklch(0.45 0.10 230);
    --accentbg: oklch(0.95 0.02 230);
    --accentbd: oklch(0.88 0.04 230);
    --grbg: #E3F4E8;
    --grfg: #1E7A3C;
    --rdbg: #FBE7E6;
    --rdfg: #B3322D;
    --orbg: #FCEFDC;
    --orfg: #9C6312;
    --pribg: #1B2733;
    --prifg: #FFFFFF;
    --hov: #F0F3F5;
    --urlbg: #FAFBFC;
    --radius: 12px;

    /* alias legados */
    --primary: var(--accent);
    --primary-dark: var(--accent);
    --green: var(--grfg);
    --green-bg: var(--grbg);
    --red: var(--rdfg);
    --red-bg: var(--rdbg);
    --yellow: var(--orfg);
    --yellow-bg: var(--orbg);
    --blue-bg: var(--accentbg);
    --gray-bg: var(--hov);
}

html[data-theme="dark"] {
    --bg: #13181E;
    --header: #1A212A;
    --surface: #1C242E;
    --surface-2: #161D24;
    --border: #2B3540;
    --inbd: #36414D;
    --inbg: #161D24;
    --text: #ECF0F4;
    --muted: #A7B3BF;
    --faint: #7E8B98;
    --accent: oklch(0.74 0.09 230);
    --accentbg: oklch(0.32 0.04 230);
    --accentbd: oklch(0.42 0.06 230);
    --grbg: #173526;
    --grfg: #74D69A;
    --rdbg: #3A1F1E;
    --rdfg: #F09590;
    --orbg: #3A2D17;
    --orfg: #E8B563;
    --pribg: #ECF0F4;
    --prifg: #1B2733;
    --hov: #242E38;
    --urlbg: #161D24;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background .25s, color .25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Cabecera ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    background: var(--header);
    border-bottom: 1px solid var(--border);
    transition: background .25s, border-color .25s;
}
.topbar-inner {
    max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 64px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
    width: 36px; height: 36px; border-radius: 10px;
    background: oklch(0.45 0.10 230); color: #fff;
    display: grid; place-items: center;
    font-size: 15px; font-weight: 800; letter-spacing: .02em;
}
.brand-txt { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--faint); }

.top-right { display: flex; align-items: center; gap: 14px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
    font-size: 15px; font-weight: 700; color: var(--muted);
    padding: 9px 14px; border-radius: 9px;
    display: flex; align-items: center; gap: 8px;
}
.nav a:hover { background: var(--hov); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accentbg); font-weight: 800; }
.nav .count {
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: #E4524D; color: #fff;
    font-size: 12px; font-weight: 800;
    display: grid; place-items: center;
}
.top-sep { width: 1px; height: 24px; background: var(--border); }
.theme-toggle {
    width: 36px; height: 36px; border-radius: 999px;
    border: 1px solid var(--inbd); background: var(--surface);
    cursor: pointer; display: grid; place-items: center; padding: 0;
}
.theme-toggle:hover { background: var(--hov); }
.theme-toggle .moon { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset -4.5px -3px 0 0 var(--muted); }
.theme-toggle .sun { width: 12px; height: 12px; border-radius: 50%; background: #F5C84C; box-shadow: 0 0 0 3px rgba(245, 200, 76, .30); display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 36px 24px 56px; }

/* ---------- Tipografia ---------- */
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 800; margin: 0 0 12px; }
.subtitle { color: var(--faint); font-size: 14.5px; font-weight: 600; margin: 0 0 24px; }

/* ---------- Tarjetas dashboard ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: background .25s, border-color .25s;
}
.card .num { font-size: 30px; font-weight: 800; }
.card .label { color: var(--faint); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Paneles ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    transition: background .25s, border-color .25s;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.panel-body { padding: 20px 22px; }
.panel-title { font-size: 16px; font-weight: 800; margin: 0 0 14px; }

/* ---------- Tablas ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
.table-scroll table { min-width: 760px; }

/* Fila completa clickeable */
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--hov); }

/* Columna de accion "Abrir" siempre visible (fijada a la derecha) */
.res-table th.col-accion,
.res-table td.col-accion {
    position: sticky;
    right: 0;
    background: var(--surface);
    text-align: right;
    box-shadow: -8px 0 8px -8px rgba(0, 0, 0, .18);
}
.res-table tr.row-link:hover td.col-accion { background: var(--hov); }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--faint); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .4px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hov); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.badge-green { background: var(--grbg); color: var(--grfg); }
.badge-red { background: var(--rdbg); color: var(--rdfg); }
.badge-yellow { background: var(--orbg); color: var(--orfg); }
.badge-orange { background: var(--orbg); color: var(--orfg); }
.badge-blue { background: var(--accentbg); color: var(--accent); }
.badge-gray { background: var(--hov); color: var(--muted); }

/* ---------- Indicadores Check-in / Artax / FNRH ---------- */
.ind { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 14px; font-weight: 700; color: var(--muted); }
.ind-t { font-size: 14px; font-weight: 700; color: var(--muted); }
.inds { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }

/* ---------- Botones ---------- */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: 9px;
    border: 1px solid var(--accent);
    background: var(--accent); color: #fff;
    font-family: inherit; font-size: 14.5px; font-weight: 800; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost {
    background: var(--surface); color: var(--muted);
    border-color: var(--inbd); font-weight: 700;
}
.btn-ghost:hover { background: var(--hov); filter: none; }
.btn-success { background: #1E7A3C; border-color: #1E7A3C; color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-dark { background: var(--pribg); border-color: var(--pribg); color: var(--prifg); }
.btn-soft { background: var(--accentbg); border-color: var(--accentbd); color: var(--accent); font-weight: 700; }
.btn-soft:hover { filter: brightness(.98); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---------- Formularios ---------- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--faint); font-weight: 700; }
.field input, .field select {
    font-family: inherit; font-size: 14.5px; font-weight: 600;
    color: var(--text); background: var(--inbg);
    border: 1px solid var(--inbd); border-radius: 9px;
    padding: 10px 12px; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accentbd); outline-offset: 0; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.alert-error { background: var(--rdbg); color: var(--rdfg); border: 1px solid var(--rdfg); }
.alert-success { background: var(--grbg); color: var(--grfg); border: 1px solid var(--grfg); }
.alert-warn { background: var(--orbg); color: var(--orfg); border: 1px solid var(--orfg); }

/* ---------- Cabecera de reserva ---------- */
.res-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.res-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.res-title h1 { margin: 0; }
.room-badge { padding: 5px 12px; font-size: 13.5px; }
.res-sub { font-size: 14.5px; font-weight: 600; color: var(--faint); margin: 7px 0 0; }
.res-inds { margin-top: 10px; }
.res-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---------- Enlace de check-in ---------- */
.linkrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.urlbox {
    flex: 1; min-width: 260px;
    border: 1px solid var(--inbd); border-radius: 9px;
    padding: 10px 14px; font-size: 13.5px; font-weight: 600;
    color: var(--muted); background: var(--urlbg);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-meta { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; margin-bottom: 14px; }
.link-meta strong { color: var(--text); }

/* ---------- Ocupacion ---------- */
.occ-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.occ-row .field input { width: 110px; font-weight: 700; }
.occ-help { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.occ-help strong { color: var(--text); }

/* ---------- Huespedes ---------- */
.guest-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px; margin-bottom: 24px;
    transition: background .25s, border-color .25s;
}
.guest-card.has-error { border-color: var(--rdfg); }
.guest-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.guest-head h2 { margin: 0; font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.guest-head .meta { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; }
.guest-head input[type="radio"] { accent-color: oklch(0.45 0.10 230); width: 16px; height: 16px; margin: 0; }
.guest-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 16px; }
@media (max-width: 1000px) { .guest-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .guest-grid { grid-template-columns: 1fr; } }
.msg-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; font-weight: 600; }
.msg-list li.err { color: var(--rdfg); }
.msg-list li.warn { color: var(--orfg); }

/* ---------- Varios ---------- */
.meta { color: var(--muted); font-size: 13.5px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.empty { padding: 40px; text-align: center; color: var(--faint); font-weight: 600; }
code.k { background: var(--hov); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

.footer {
    max-width: 1080px; margin: 0 auto; padding: 18px 24px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    color: var(--faint); font-size: 12.5px; font-weight: 600; flex-wrap: wrap;
}
