:root {
  --bg: #16121c; --card: #1f1a27; --card2: #28212f; --line: #342b3d;
  --text: #f1e9de; --muted: #a99fae; --accent: #f46a1f; --accent2: #fdb43a; --red: #e0394a;
  --ok: #3fbf74; --warn: #f2a93b; --grad: linear-gradient(90deg, #d7263d, #f46a1f 55%, #fdb43a);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace; --r: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f2ec; --card: #ffffff; --card2: #f3ede6; --line: #e5ddd3;
    --text: #1b1622; --muted: #6f6575; --accent: #d9530e; --accent2: #c98a10; --red: #c62839;
    --ok: #23935a; --warn: #b9770f; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .9rem; margin-top: 1.2em; color: var(--muted); }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
code { font-family: var(--mono); }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* botones y campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; border: 0; border-radius: 10px;
  padding: .6em 1.05em; font: inherit; font-weight: 600; cursor: pointer; color: #fff; background: var(--accent);
  transition: filter .15s, transform .05s; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); } .btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ok { background: var(--ok); } .btn.warn { background: var(--warn); color: #1b1622; } .btn.danger { background: var(--red); }
.btn.mini { padding: .35em .7em; font-size: .8rem; border-radius: 8px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: .55em .8em; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.icon-btn { border: 0; background: var(--card2); color: var(--muted); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 1rem; }
.icon-btn:hover { color: var(--text); }
.row { display: flex; gap: .6rem; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.center { justify-content: center; } .row.end { justify-content: flex-end; }
.row > input { flex: 1; }
.seg { display: inline-flex; background: var(--card2); border-radius: 10px; padding: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: .85rem; padding: .35em .8em; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px #0003; font-weight: 600; }
.link { color: var(--accent); font-weight: 600; }

/* entrada */
.gate { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 28px; text-align: center; box-shadow: 0 20px 60px #0004; }
.gate-card p { margin: .4em 0 1.2em; }
.gate-icon { width: 84px; height: 84px; image-rendering: pixelated; border-radius: 16px; margin-bottom: 12px; }
.btn.google { width: 100%; background: #fff; color: #1f1f1f; box-shadow: inset 0 0 0 1px #dadce0; padding: .8em; margin-bottom: 1em; }

/* barra superior */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad); opacity: .8; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; border-radius: 8px; image-rendering: pixelated; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; } .brand small { color: var(--muted); font-size: .75rem; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.tabs a:hover { color: var(--text); background: var(--card); }
.tabs a.on { color: var(--text); background: var(--card2); }
.tabs a.on svg { fill: var(--accent); }
.me { position: relative; display: flex; align-items: center; gap: 10px; }
.pill { font-size: .78rem; font-weight: 700; padding: .3em .7em; border-radius: 99px; background: var(--card2); color: var(--muted); }
.pill.on { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.pill.mid { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--card2); display: block; }
.avatar.big { width: 72px; height: 72px; margin: 0 auto 12px; }
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.menu { position: absolute; right: 0; top: 46px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 6px; min-width: 230px; box-shadow: 0 12px 40px #0005; }
.role { align-self: flex-start; font-size: .75rem; font-weight: 700; padding: .2em .6em; border-radius: 6px; background: var(--grad); color: #fff; margin-bottom: 6px; }

/* contenido */
main { width: min(1200px, 100%); margin: 0 auto; padding: 20px; flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; min-width: 0; }
.grid { display: grid; gap: 16px; } .grid > .card { margin-bottom: 0; }
.grid.two { grid-template-columns: 1.3fr 1fr; margin-bottom: 16px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.section-head h3 { margin: 0; } .section-head.inline { margin: 0 0 12px; }
.notice { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 15%, transparent);
  color: var(--text); font-size: .9rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.status-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.status-head h2 { margin: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.off { background: var(--red); } .dot.mid { background: var(--warn); }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kv div { background: var(--card2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.kv span { font-size: .75rem; color: var(--muted); } .kv b { font-size: 1.15rem; }
.addr { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.addr div { display: flex; align-items: center; gap: 10px; background: var(--card2); padding: 6px 6px 6px 10px; border-radius: 10px; }
.addr code { flex: 1; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: .72rem; font-weight: 700; padding: .25em .55em; border-radius: 6px; background: var(--line); color: var(--muted); white-space: nowrap; }
.tag.java { background: #e7623033; color: #f0874f; } .tag.bedrock { background: #3fbf7433; color: var(--ok); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 8px; cursor: pointer;
  text-align: left; color: inherit; font: inherit; transition: border-color .15s; }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile .t-label { font-size: .78rem; color: var(--muted); display: block; }
.tile .t-val { font-size: 1.35rem; font-weight: 700; display: block; }
.tile .t-sub { font-size: .75rem; color: var(--muted); display: block; min-height: 1.1em; }
.tile canvas { width: 100%; height: 38px; display: block; margin-top: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 3px; }
.chart-card canvas { width: 100%; height: 220px; display: block; }
.chart-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }

.console { margin: 0; background: #0f0c13; color: #e6dfd6; font: 12.5px/1.5 var(--mono); padding: 12px; border-radius: 10px;
  height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.console.tall { height: 460px; }
.console .w { color: #f2c14e; } .console .e { color: #ff6b6b; } .console .c { color: #8fd18f; } .console .m { color: #8a8291; }
.cmd { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cmd span { font-family: var(--mono); color: var(--muted); } .cmd input { flex: 1; font-family: var(--mono); }
.console-card p { margin: 8px 0 0; }

.shortcuts { margin-top: 26px; }
.shortcut { display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .15s; }
.shortcut:hover { transform: translateY(-2px); border-color: var(--accent); }
.shortcut svg { width: 28px; height: 28px; fill: var(--accent); margin-bottom: 6px; }

/* listas */
.people, .files, .audit { list-style: none; margin: 0; padding: 0; }
.people li, .files li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); }
.people li:first-child, .files li:first-child { border-top: 0; }
.people .grow, .files .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.people .grow small, .files .grow small { display: block; color: var(--muted); font-size: .78rem; }
.head { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: #fff; flex: none; }
.empty { color: var(--muted); padding: 10px 4px; }
.search { max-width: 200px; }
.files li { cursor: pointer; } .files li:hover { background: var(--card2); }
.files .ico { width: 22px; text-align: center; color: var(--muted); }
.files .ico.d { color: var(--accent2); }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-weight: 600; }
.crumbs a { color: var(--accent); } .crumbs span { color: var(--muted); }
.editor textarea { width: 100%; height: 60vh; font: 13px/1.5 var(--mono); resize: vertical; tab-size: 2; white-space: pre; }
.audit li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .88rem; display: flex; gap: 10px; flex-wrap: wrap; }
.audit time { color: var(--muted); min-width: 120px; font-variant-numeric: tabular-nums; }
.audit b { font-weight: 600; }
.audit .d { color: var(--muted); word-break: break-all; }

/* pie: el logo de Social Studio solo va aquí */
.foot { text-align: center; padding: 28px 16px 36px; border-top: 1px solid var(--line); margin-top: 20px; }
.ss-logo { width: min(260px, 70vw); height: auto; opacity: .92; }
.foot p { margin: 6px 0 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 12px; font-weight: 600; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 8px 30px #0006; }
.toast.err { background: var(--red); color: #fff; }
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: #0008; }
dialog input { width: 100%; margin-bottom: 14px; }

/* tablet */
@media (max-width: 960px) {
  .grid.two { grid-template-columns: 1fr; }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .tabs a { padding: 8px 10px; }
}
/* celular: pestañas abajo */
@media (max-width: 720px) {
  /* sin backdrop-filter: si no, la barra fija de abajo queda atrapada dentro del encabezado */
  .top { padding: 10px 16px; backdrop-filter: none; background: var(--bg); }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; justify-content: space-around; gap: 0;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabs a { flex-direction: column; gap: 2px; font-size: .7rem; padding: 6px 8px; flex: 1; text-align: center; }
  .tabs a.on { background: none; color: var(--accent); }
  body { padding-bottom: 70px; }
  main { padding: 16px; }
  .grid.three { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .brand small { display: none; }
  .me { margin-left: auto; }
  .search { max-width: none; width: 100%; }
  .console { height: 220px; }
  #wl-form { flex-wrap: wrap; } #wl-form input { flex-basis: 100%; }
}


/* ---------- consola completa ---------- */
.term-card { background: #0f0c13; border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column;
  height: calc(100vh - 150px); min-height: 420px; overflow: hidden; }
.term-card.full { position: fixed; inset: 0; z-index: 60; height: 100vh; border-radius: 0; }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #18131f; border-bottom: 1px solid #2a2232; flex-wrap: wrap; }
.term-bar .grow, .files-bar .grow, .nube-head .grow { flex: 1; }
.term-bar .icon-btn { background: #241d2c; color: #cfc4d6; }
.term-filter { background: #241d2c; border-color: #2f2639; color: #eee; padding: .35em .7em; font-size: .85rem; width: 180px; }
.term-check { font-size: .78rem; color: #a99fae; display: flex; align-items: center; gap: 4px; }
.term-power { display: flex; gap: 6px; }
.term-wrap { position: relative; flex: 1; min-height: 0; }
.term { position: absolute; inset: 0; margin: 0; overflow: auto; padding: 10px 12px; color: #e6dfd6;
  font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word; outline: none; }
.term .ln { padding: 0 2px; border-radius: 3px; }
.term .ln:hover { background: #1c1622; }
.term .ts { color: #6f6678; }
.term .lv { font-weight: 700; }
.term .warn { color: #f2c14e; } .term .error { color: #ff7b7b; }
.term .panel { color: #7fd6ff; } .term .sys { color: #c39bff; }
.term-new { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); border: 0; border-radius: 99px; padding: .45em 1em;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px #0008; }
.term-input { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #18131f; border-top: 1px solid #2a2232; }
.term-input .prompt { font-family: ui-monospace, Consolas, monospace; color: var(--accent); font-weight: 700; }
.term-input input { flex: 1; background: #241d2c; border-color: #2f2639; color: #fff; font-family: ui-monospace, Consolas, monospace; }
.term-quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px 10px; background: #18131f; }
.term-quick button { border: 1px solid #2f2639; background: #241d2c; color: #cfc4d6; border-radius: 8px; padding: .25em .7em;
  font: 12px ui-monospace, Consolas, monospace; cursor: pointer; }
.term-quick button:hover { color: #fff; border-color: var(--accent); }
.term-note { padding: 8px 12px; margin: 0; background: #18131f; }

/* ---------- archivos ---------- */
.files-card { position: relative; }
.files-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 4px 10px; border-bottom: 1px solid var(--line); }
.check-all { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; padding: 0; }
.files li.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.row-actions { display: flex; gap: 4px; }
.drop { position: absolute; inset: 0; border-radius: var(--r); background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 3px dashed var(--accent); display: grid; place-items: center; z-index: 5; backdrop-filter: blur(2px); pointer-events: none; }
.drop div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 3rem; color: var(--accent); }
.drop b { font-size: 1.2rem; color: var(--text); } .drop span { font-size: .9rem; color: var(--muted); }

/* nube de subidas */
.nube { position: fixed; right: 20px; bottom: 20px; width: min(360px, calc(100% - 32px)); z-index: 55; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 50px #0007; overflow: hidden; }
.nube-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.nube-ico { font-size: 1.4rem; color: var(--accent); }
.nube-total { height: 4px; background: var(--card2); } .nube-total i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.nube-list { list-style: none; margin: 0; padding: 6px 12px 10px; max-height: 260px; overflow: auto; }
.nube-list li { padding: 7px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.nube-list li:first-child { border-top: 0; }
.nube-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nube-pbar { height: 6px; border-radius: 3px; background: var(--card2); margin: 5px 0 3px; overflow: hidden; }
.nube-pbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.nube-list li.ok .nube-pbar i { background: var(--ok); } .nube-list li.err .nube-pbar i { background: var(--red); }
.nube-list li small { color: var(--muted); } .nube-list li.err small { color: var(--red); }
.nube.min .nube-list { display: none; }

@media (max-width: 720px) {
  .term-card { height: calc(100vh - 180px); }
  .term-filter { width: 100%; order: 5; }
  .term-power { order: 6; width: 100%; } .term-power .btn { flex: 1; }
  .files-bar .small { display: none; }
  .nube { right: 16px; bottom: 84px; }
}


/* ---------- v3: botón Web, consola con encendido, respaldos USB ---------- */
.web-btn { color: var(--accent); }
.term-power select { background: #241d2c; border-color: #2f2639; color: #eee; padding: .3em .5em; font-size: .8rem; border-radius: 8px; }
.term-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 12px; background: #18131f; border-bottom: 1px solid #2a2232; color: #a99fae; }
.term-info .notice { margin: 0; flex: 1 1 100%; }
.term-info .btn.ghost { color: #cfc4d6; box-shadow: inset 0 0 0 1px #2f2639; }
.bk-col { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.bk-col h4 { margin: 0; color: var(--text); font-size: 1rem; }
.usb-line { font-weight: 600; font-size: .9rem; padding: 8px 12px; border-radius: 10px; background: var(--card2); margin: 8px 0; }
.usb-line.on { color: var(--ok); } .usb-line.off { color: var(--warn); }
@media (max-width: 960px) { .grid.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .grid.four { grid-template-columns: 1fr; }
  .web-btn { padding: .35em .6em; }
  .term-power select { flex: 1 1 100%; }
}
