:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #1c2430;
  --muted: #5f6b7a;
  --accent: #2f6fdf;
  --accent-text: #ffffff;
  --ok: #1a7f4b;
  --ok-bg: #e3f4ea;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --neutral-bg: #eceff3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2028;
    --surface-2: #222a34;
    --border: #2f3946;
    --text: #e6ebf1;
    --muted: #9aa6b4;
    --accent: #6b9bff;
    --accent-text: #0d1420;
    --ok: #5fd39a;
    --ok-bg: #173527;
    --warn: #f3c56b;
    --warn-bg: #3a2e14;
    --bad: #ff8a80;
    --bad-bg: #3d1d1b;
    --neutral-bg: #2a323d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: .4rem 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.boot { padding: 2rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* barra superior */
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; display: flex; align-items: center; gap: .5rem; color: var(--text); }
.brand::before { content: ""; width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .35rem .7rem; border-radius: 7px; color: var(--muted); }
.nav a.active, .nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar .spacer { flex: 1; }
.who { color: var(--muted); font-size: .9rem; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .spacer { flex: 1; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.1rem; font-weight: 600; margin-top: .15rem; }

/* tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

/* insignias */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--neutral-bg); color: var(--muted); }

/* botones y formularios */
button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: .45rem .9rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
label { display: block; font-size: .88rem; color: var(--muted); margin: .6rem 0 .25rem; }
input, select {
  font: inherit; width: 100%; padding: .45rem .6rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
input[type=checkbox] { width: auto; margin-right: .4rem; }
.check { display: flex; align-items: center; color: var(--text); }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hint { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.error { color: var(--bad); margin: .5rem 0; }

/* pestañas */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: .55rem .8rem; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* credenciales */
.secret { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; padding: .7rem .8rem; margin: .4rem 0; }
.kv { display: grid; grid-template-columns: max-content 1fr auto; gap: .35rem .8rem; align-items: center; }
.kv .k { color: var(--muted); font-size: .88rem; }
.kv .v { word-break: break-all; }
.notice { border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.info { background: var(--surface-2); color: var(--text); }

/* acceso */
.login { max-width: 380px; margin: 9vh auto; }
.login .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 1rem; }

/* ventana modal */
.backdrop { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem; z-index: 10; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; max-width: 560px; width: 100%; padding: 1.2rem 1.3rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 860px; }
.modal .actions { justify-content: flex-end; margin-top: 1rem; }

#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 20; }
#toast div { background: var(--text); color: var(--bg); padding: .55rem .9rem; border-radius: 8px; margin-top: .4rem; box-shadow: var(--shadow); }

/* emparejamiento OTA */
.ota-room { border: 1px solid var(--border); border-radius: 8px; margin: .6rem 0; }
.ota-room > .head { background: var(--surface-2); padding: .5rem .7rem; font-weight: 600; border-radius: 8px 8px 0 0; }
.ota-room table td { vertical-align: middle; }


@media (max-width: 640px) {
  .topbar { padding: .6rem 1rem; }
  main { padding: 1rem 1rem 2rem; }
  .kv { grid-template-columns: 1fr; }
}
