/* Señal · Panel de administración */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #18202e;
  --ink-2: #4f5b6d;
  --ink-3: #7b8696;
  --line: #dbe1e9;
  --line-2: #e8ecf1;
  --accent: #0b6e69;
  --accent-2: #095955;
  --accent-soft: #e2f1ef;
  --accent-ink: #ffffff;
  --accent-text: #0b6e69;
  --marker: #f5b400;
  --led: #f5b400;
  --ok: #17915a;
  --ok-soft: #e1f4ea;
  --warn: #a8650a;
  --warn-soft: #fdf0d9;
  --bad: #c0362c;
  --bad-soft: #fbe5e3;
  --side: #18202e;
  --side-2: #222c3d;
  --bezel: #1d2431;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(24, 32, 46, 0.06), 0 4px 14px rgba(24, 32, 46, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--side);
  color: #d6dce6;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 17px; }
.brand-mark { width: 26px; height: 18px; border: 2.5px solid var(--led); border-radius: 4px; position: relative; flex: none; }
.brand-mark::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 2.5px; margin-left: -5px;
  background: var(--led); border-radius: 2px;
}
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: #8f9bb0; margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: #c9d1dd;
  font-weight: 500;
  text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: var(--side-2); color: #fff; }
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--marker);
}
.nav .badge {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--led); color: #2a1f00;
  font-size: 11.5px; font-weight: 700; text-align: center; line-height: 20px;
}
.nav-sep { height: 1px; background: #2c3648; margin: 10px 6px; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #2c3648; }
.side-user { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-role { font-size: 12px; color: #8f9bb0; margin-bottom: 8px; }
.side-foot button {
  background: none; border: 0; padding: 0; color: #c9d1dd; font: inherit; cursor: pointer; font-size: 13px;
}
.side-foot button:hover { color: #fff; text-decoration: underline; }
.btn.menu-btn { display: none; }

.main { min-width: 0; padding: 28px 32px 60px; }
.view { max-width: 1240px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #efc2bd; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ok { color: var(--ok); }
.btn.ok:hover { background: var(--ok-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(24, 32, 46, 0.06); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.btn.icon.sm { width: 28px; height: 28px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: 13px; }
.hint { font-size: 12.5px; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="time"],
input[type="date"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
input[type="color"] { width: 44px; height: 36px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-weight: 500; }
.check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check .hint { display: block; font-weight: 400; }
.form-error { display: none; padding: 9px 12px; border-radius: var(--radius); background: var(--bad-soft); color: var(--bad); font-weight: 500; margin-bottom: 14px; }
.form-error.show { display: block; }
.color-row { display: flex; gap: 14px; }
.color-row .field { flex: 1; }
.color-pick { display: flex; align-items: center; gap: 8px; }
.color-pick span { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

/* Selector segmentado */
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: #e3e8ef; gap: 2px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; padding: 5px 12px; border-radius: 7px; font-weight: 550; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 32, 46, 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Días de la semana */
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { position: relative; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span {
  display: grid; place-items: center; width: 38px; height: 34px; border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 600; cursor: pointer; background: var(--surface); color: var(--ink-2);
}
.days input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.days input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Paneles, chips, tablas ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head p { color: var(--ink-2); margin-top: 2px; font-size: 13px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols > * + .panel { margin-top: 0; }
.stack > * + * { margin-top: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 600; background: #e7ebf1; color: var(--ink-2); white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip svg { width: 13px; height: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(23, 145, 90, 0.18); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; }
.facts dt { color: var(--ink-2); font-size: 13px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 460px; margin: 0 auto 16px; }
.code-box {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-2); font-family: var(--mono); font-size: 13.5px; color: var(--ink);
}

.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); margin-bottom: 18px; }
.notice.warn { background: var(--warn-soft); color: #7a4a06; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar input[type="search"] { max-width: 260px; }

/* ---------- Pantallas (mosaico de monitores) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 26px 22px; }
.group-title { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.group-title h2 { font-size: 15px; }
.group-block + .group-block { margin-top: 30px; }
.tile { display: block; color: inherit; text-decoration: none; }
.tile:hover { text-decoration: none; }
.bezel {
  position: relative; padding: 9px 9px 18px; border-radius: 12px; background: var(--bezel);
  box-shadow: 0 10px 22px -12px rgba(24, 32, 46, 0.55);
  transition: transform 0.15s ease;
}
.tile:hover .bezel { transform: translateY(-2px); }
.glass { position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: #0e131b; }
.glass.portrait { aspect-ratio: 9 / 16; max-height: 300px; margin: 0 auto; }
.glass img, .glass video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.glass .glass-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; color: #fff; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.glass .glass-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #8f9bb0; font-size: 13px; padding: 10px; text-align: center; }
.tile.offline .glass img, .tile.offline .glass video { filter: grayscale(1) brightness(0.45); }
.tile.offline .glass-label { color: #cfd5de; }
.led {
  position: absolute; left: 50%; bottom: 6px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: #4a5465;
}
.tile.online .led { background: #3ee08a; box-shadow: 0 0 8px 2px rgba(62, 224, 138, 0.55); }
.tile-info { padding: 11px 2px 0; }
.tile-name { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; }
.tile-meta { color: var(--ink-2); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-wall { margin-left: auto; }

.preview-frame { background: var(--bezel); border-radius: 12px; padding: 10px 10px 20px; position: relative; }
.preview-frame .glass { aspect-ratio: auto; }
.preview-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.preview-frame .led { bottom: 7px; }
.preview-frame.online .led { background: #3ee08a; box-shadow: 0 0 8px 2px rgba(62, 224, 138, 0.55); }

/* ---------- Biblioteca ---------- */
.dropzone {
  border: 1.5px dashed #b8c2cf; border-radius: var(--radius-lg); padding: 22px; text-align: center; background: var(--surface);
  color: var(--ink-2); margin-bottom: 18px;
}
.dropzone strong { color: var(--ink); }
.drop-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(11, 110, 105, 0.12);
  border: 3px dashed var(--accent); pointer-events: none; font-size: 22px; font-weight: 700; color: var(--accent);
}
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.mthumb { position: relative; aspect-ratio: 16 / 10; background: #0e131b; cursor: zoom-in; border: 0; padding: 0; width: 100%; display: block; overflow: hidden; }
.mthumb img, .mthumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mthumb .chip { position: absolute; left: 8px; top: 8px; }
.mthumb .dur {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); color: #fff;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.mthumb .kind { position: absolute; left: 8px; bottom: 8px; color: #fff; width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.mbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.mname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmeta { font-size: 12.5px; color: var(--ink-2); }
.mreason { font-size: 12.5px; color: var(--bad); }
.mactions { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.mactions .spacer { flex: 1; }
.uploads { position: fixed; right: 20px; bottom: 20px; width: 320px; z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px; }
.uploads h3 { margin-bottom: 10px; }
.up-item { margin-bottom: 10px; font-size: 13px; }
.up-item:last-child { margin-bottom: 0; }
.up-name { display: flex; justify-content: space-between; gap: 8px; }
.up-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }
.up-item.error .bar i { background: var(--bad); }
.up-item.error .up-msg { color: var(--bad); }
.up-item.done .bar i { background: var(--ok); }

/* ---------- Listas ---------- */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); color: inherit; text-decoration: none;
}
.row-card:hover { border-color: #c3ccd8; text-decoration: none; }
.row-thumb { position: relative; width: 96px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #0e131b; flex: none; }
.row-thumb img, .row-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; font-size: 15px; }
.row-meta { color: var(--ink-2); font-size: 13px; }

.items { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.item {
  display: grid; grid-template-columns: 20px 22px 80px minmax(0, 1fr) 96px auto; align-items: center; gap: 12px;
  padding: 8px 8px 8px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.item.dragging { opacity: 0.4; }
.item.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.item.drop-after { box-shadow: 0 3px 0 var(--accent); }
.handle { cursor: grab; color: var(--ink-3); display: grid; place-items: center; }
.handle svg { width: 18px; height: 18px; }
.item-n { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.item-thumb { position: relative; width: 80px; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; background: #0e131b; }
.item-thumb img, .item-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-dur { display: flex; align-items: center; gap: 6px; }
.item-dur input { width: 66px; height: 32px; }
.item-btns { display: flex; gap: 2px; }
.total-line { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--ink-2); }

.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; max-height: 52vh; overflow: auto; padding: 2px; }
.pick { position: relative; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.pick input { position: absolute; left: 8px; top: 8px; width: 18px; height: 18px; accent-color: var(--accent); z-index: 1; }
.pick .pthumb { position: relative; aspect-ratio: 16 / 10; background: #0e131b; overflow: hidden; }
.pick .pthumb img, .pick .pthumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick .pname { padding: 6px 8px; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick:has(input:checked) { border-color: var(--accent); }

/* ---------- Diseños ---------- */
.zmap { position: relative; aspect-ratio: 16 / 9; background: #0e131b; border-radius: 6px; overflow: hidden; }
.zbox {
  position: absolute; border: 1.5px solid rgba(255, 255, 255, 0.85); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; padding: 6px; text-align: center; color: #fff; cursor: pointer; overflow: hidden;
  font: inherit; background: #2a3445;
}
.zbox:hover { filter: brightness(1.12); }
.zbox.selected { outline: 3px solid var(--led); outline-offset: -3px; z-index: 1; }
.zbox .zname { font-weight: 700; font-size: 13px; }
.zbox .zwhat { font-size: 12px; opacity: 0.85; }
.zbox.t-playlist { background: #0b6e69; }
.zbox.t-clock { background: #3d4a8f; }
.zbox.t-weather { background: #1f5f8b; }
.zbox.t-ticker { background: #9c3a2f; }
.zbox.t-text { background: #5a4a7a; }
.zbox.t-webpage { background: #5c6472; }
.zbox.t-empty { background: #2a3445; border-style: dashed; }
.mini { position: relative; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; background: #0e131b; }
.mini i { position: absolute; border: 1px solid #0e131b; background: #3a4558; }
.mini i.t-playlist { background: #0b6e69; }
.mini i.t-clock { background: #3d4a8f; }
.mini i.t-weather { background: #1f5f8b; }
.mini i.t-ticker { background: #9c3a2f; }
.mini i.t-text { background: #5a4a7a; }
.mini i.t-webpage { background: #5c6472; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tpl { border: 2px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; background: var(--surface); }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl .mini { margin-bottom: 6px; }
.tpl span { font-size: 12.5px; font-weight: 600; }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tpl:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.layout-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px; color: inherit; text-decoration: none; }
.layout-card:hover { border-color: #c3ccd8; text-decoration: none; }
.layout-card .row-title { margin-top: 10px; }
.kind-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 16px; }
.kind-list label { position: relative; }
.kind-list input { position: absolute; opacity: 0; pointer-events: none; }
.kind-list span {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 550; font-size: 13px; cursor: pointer; background: var(--surface);
}
.kind-list span svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.kind-list input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.kind-list input:checked + span svg { color: var(--accent-text); }
.kind-list input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.geo-results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.geo-results button { text-align: left; }

/* ---------- Usuarios ---------- */
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-card { position: relative; display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 10px 36px; cursor: pointer; }
.role-card input { position: absolute; left: 12px; top: 13px; accent-color: var(--accent); }
.role-card strong { display: block; font-size: 13.5px; }
.role-card span { font-size: 12.5px; color: var(--ink-2); }
.role-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.roles-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.roles-legend div { font-size: 13px; color: var(--ink-2); }
.roles-legend strong { display: block; color: var(--ink); margin-bottom: 3px; font-size: 13.5px; }
.group-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }

/* ---------- Actividad ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-day { font-weight: 650; font-size: 13px; color: var(--ink-2); margin: 18px 0 6px; }
.feed-day:first-child { margin-top: 0; }
.feed li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 13px; }
.feed .who { font-weight: 600; }

/* ---------- Ventanas y avisos ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 80; background: rgba(16, 21, 31, 0.5); display: flex; align-items: flex-start;
  justify-content: center; padding: 6vh 16px 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 520px; background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px -12px rgba(16, 21, 31, 0.45);
  display: flex; flex-direction: column; max-height: 88vh;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 6px; }
.modal-body { padding: 10px 20px 6px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line-2); margin-top: 8px; }
.modal-foot .left { margin-right: auto; }
.viewer { background: #0e131b; border-radius: 8px; overflow: hidden; }
.viewer img, .viewer video { max-height: 60vh; margin: 0 auto; }

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 550; box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
}
.toast.error { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Inicio de sesión ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--side); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 28px; }
.login-card .brand { color: var(--ink); padding: 0 0 18px; }
.login-card h1 { font-size: 21px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-2); margin-bottom: 20px; }
.login-card .btn { width: 100%; height: 40px; }

.loading { padding: 60px 0; text-align: center; color: var(--ink-2); }

/* ---------- Adaptación a pantallas pequeñas ---------- */
@media (max-width: 1080px) {
  .cols { grid-template-columns: 1fr; }
  .roles-legend { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; z-index: 40; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; }
  .brand { padding: 4px 0; }
  .btn.menu-btn { display: inline-flex; margin-left: auto; color: #fff; border-color: #3a4558; background: transparent; }
  .btn.menu-btn:hover { background: var(--side-2); }
  .nav, .side-foot, .nav-sep { display: none; }
  .side.open .nav { display: flex; width: 100%; margin-top: 10px; }
  .side.open .side-foot { display: block; width: 100%; }
  .nav a.active::before { display: none; }
  .main { padding: 20px 16px 60px; }
  .item { grid-template-columns: 22px 64px minmax(0, 1fr) auto; }
  .item-n { display: none; }
  .item-thumb { width: 64px; }
  .item-dur { grid-column: 3 / 4; }
}
@media (max-width: 600px) {
  .grid2, .grid3, .grid4, .role-cards, .roles-legend { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .uploads { left: 16px; right: 16px; width: auto; }
  .toolbar input[type="search"] { max-width: none; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Pantallas verticales en el mosaico: el marco se ajusta a la imagen. */
.bezel:has(.glass.portrait) { width: fit-content; }
.glass.portrait { height: 300px; max-height: none; width: auto; margin: 0; }

/* ---------- Marca ---------- */
.side-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: contain; flex: none; }
.brand .side-logo + div { line-height: 1.2; }
.login-logo { display: block; width: 168px; max-width: 70%; height: auto; margin: 0 auto 18px; }
.login-card.wide { max-width: 560px; }
.login-card .linkish, .linkish { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; text-decoration: underline; cursor: pointer; }
.setup-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.setup-head .side-logo { width: 44px; height: 44px; }
.rules { margin: 0 0 16px; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.rules li + li { margin-top: 4px; }
.steps { margin: 0; padding-left: 20px; }
.steps > li { margin-bottom: 16px; }
.qr-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.qr { width: 184px; height: 184px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-alt { min-width: 0; }
.secret { display: inline-block; font-family: var(--mono); font-size: 14px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-width: 360px; }
.codes code { font-family: var(--mono); font-size: 15px; padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; text-align: center; }

/* ---------- Carpetas ---------- */
.folder-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.folder-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.folder-crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.folder-crumbs a.here { color: var(--ink); }
.folder-crumbs svg { width: 16px; height: 16px; }
.folder-crumbs span[aria-hidden] { color: var(--ink-3); }
.folder-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 18px; }
.folder-tile {
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: inherit;
}
.folder-tile:hover { border-color: #c3ccd8; text-decoration: none; }
.folder-ico { grid-row: 1 / 3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.folder-ico svg { width: 20px; height: 20px; }
.folder-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-meta { font-size: 12.5px; color: var(--ink-2); }
.folder-tile .chip { grid-column: 1 / 3; justify-self: start; margin-top: 8px; }
.chip svg { width: 12px; height: 12px; }

/* ---------- Espacio ---------- */
.storage { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 16px; font-size: 13px; }
.storage svg { width: 18px; height: 18px; color: var(--ink-2); }
.storage .bar { flex: 1; min-width: 120px; height: 7px; margin: 0; }
.storage.warn .bar i { background: var(--warn); }
.storage.bad .bar i { background: var(--bad); }
.mthumb .badges { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; flex-wrap: wrap; right: 8px; }
.mthumb .badges .chip { position: static; }
.mcard.selected { outline: 2px solid var(--accent); outline-offset: -1px; }
.mselect { position: absolute; right: 8px; top: 8px; width: 20px; height: 20px; accent-color: var(--accent); z-index: 1; }
.selbar { position: sticky; top: 0; z-index: 30; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; background: var(--ink); color: #fff; border-radius: var(--radius-lg); }
.selbar .btn { height: 32px; }
.selbar .grow { flex: 1; }
.upload-cta { display: none; }

@media (max-width: 900px) {
  .dropzone { display: none; }
  .upload-cta { display: flex; gap: 10px; margin-bottom: 16px; }
  .upload-cta .btn { flex: 1; height: 48px; font-size: 15px; }
  .page-actions .btn-upload-desktop { display: none; }
  .mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mbody { padding: 8px 10px 10px; }
  .toolbar .seg { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .uploads { bottom: 12px; }
  .qr-wrap { flex-direction: column; align-items: flex-start; }
}

/* ---------- Marca en Ajustes ---------- */
.brand-preview { display: grid; place-items: center; height: 120px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.brand-preview img { width: auto; height: 100px; max-width: 100%; object-fit: contain; }
.brand-preview.icon img { width: 96px; height: 96px; }
.seg span { white-space: nowrap; }
.mactions { flex-wrap: wrap; }
.mthumb .badges { right: 36px; }

/* Entrar con Google */
.login-or { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; margin: 16px 0; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--line, #ddd); }
.login-card .google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.login-card .google-btn:hover { background: #f7f8f8; }
details.howto { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
details.howto summary { cursor: pointer; font-weight: 600; }
details.howto .code-box { word-break: break-all; }
.seg-choice { display: grid; gap: 10px; margin-top: 4px; }
/* Acceso remoto */
.shot { display: block; margin-bottom: 12px; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.shot img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.remote-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Diseño personalizado (pixeles) */
.mini-wrap { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; background: #0e131b; border-radius: 5px; overflow: hidden; }
.mini-wrap .mini { border-radius: 0; background: #1a2230; }
.custom-mini { display: flex; align-items: center; justify-content: center; gap: 4px; color: #fff; width: 100%; }
.custom-mini b { font-size: 14px; }
.canvas-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.res-row { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(90px, 1fr) minmax(90px, 1fr); gap: 10px; }
.res-row .field { margin-bottom: 0; }
.canvas-tools { display: flex; gap: 8px; }
.zmap.custom { touch-action: none; user-select: none; }
.zbox.movable { cursor: move; }
.zbox .zsize { font-size: 11px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.zbox.selected { outline-offset: -2px; }
.zh { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent, #2563eb); border-radius: 2px; z-index: 2; }
.zh-nw { left: -1px; top: -1px; cursor: nwse-resize; }
.zh-n { left: calc(50% - 6px); top: -1px; cursor: ns-resize; }
.zh-ne { right: -1px; top: -1px; cursor: nesw-resize; }
.zh-e { right: -1px; top: calc(50% - 6px); cursor: ew-resize; }
.zh-se { right: -1px; bottom: -1px; cursor: nwse-resize; }
.zh-s { left: calc(50% - 6px); bottom: -1px; cursor: ns-resize; }
.zh-sw { left: -1px; bottom: -1px; cursor: nesw-resize; }
.zh-w { left: -1px; top: calc(50% - 6px); cursor: ew-resize; }
.geo-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.geo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.geo-grid .field { margin-bottom: 8px; }
.geo-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.audio-row { margin: 14px 0 0; max-width: 420px; }
@media (max-width: 640px) {
  .res-row { grid-template-columns: 1fr 1fr; }
  .res-row .field:first-child { grid-column: 1 / -1; }
  .geo-grid { grid-template-columns: 1fr 1fr; }
  .zh { width: 16px; height: 16px; }
}
.kit-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
