:root {
  --bg: #17131d;
  --bg-2: #1e1926;
  --panel: #231d2d;
  --panel-2: #2c2438;
  --line: #3f3352;
  --line-soft: #352c45;
  --text: #ece8ef;
  --muted: #a096ad;
  --faint: #6f6579;
  --accent: #c32ec3;
  --accent-soft: rgba(195, 46, 195, .16);
  --rojo: #e0322a;
  --rojo-soft: rgba(224, 50, 42, .16);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .14);
  --danger: #f0665e;
  --danger-soft: rgba(240, 102, 94, .16);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #5b4a75; background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(190, 20, 190, .17), transparent 62%),
    radial-gradient(760px 480px at 94% 2%, rgba(224, 50, 42, .10), transparent 66%);
  pointer-events: none;
  z-index: 0;
}

/* Marca de agua del logo, presente en todas las pantallas. */
body.con-logo::after {
  content: "";
  position: fixed;
  right: -6vmin;
  bottom: -8vmin;
  width: min(62vmin, 620px);
  height: min(62vmin, 620px);
  background: url("/api/logo") center/contain no-repeat;
  opacity: .16;
  /* El logo es oscuro: sobre fondo oscuro hay que subirle el brillo para que se lea. */
  filter: brightness(1.9) saturate(1.5);
  pointer-events: none;
  z-index: 0;
}
body.con-logo.entrando::after {
  right: 50%;
  bottom: 50%;
  transform: translate(50%, 50%);
  width: min(125vmin, 1100px);
  height: min(125vmin, 1100px);
  opacity: .2;
}

#app { position: relative; z-index: 1; }
#app.booting { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }

/* ------------------------------------------------------------- controles */

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 76px; }
select { cursor: pointer; }
input[type="file"] { padding: 7px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--faint); }

label.field { display: block; }
label.field > span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 560;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: #362c44; border-color: #52436a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #cf3ccf, #96069a);
  border-color: #96069a;
  color: #fff;
}
.btn.primary:hover { background: linear-gradient(180deg, #dc4fdc, #ab12af); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { color: var(--danger); border-color: rgba(248, 113, 113, .35); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 6px 9px; }

/* ------------------------------------------------------------- login */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 30px;
}
.auth-card .brand { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.auth-card h1 { font-size: 21px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth-card form { display: grid; gap: 14px; }
.auth-alt {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ok-box {
  background: var(--ok-soft);
  border: 1px solid rgba(52, 211, 153, .3);
  color: #9ff0d0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.person.pendiente { border-color: rgba(251, 191, 36, .55); }

.lista-mas { display: grid; gap: 8px; }
.fila-mas {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 13px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: 12px; color: inherit; cursor: pointer; text-align: left;
  font: inherit;
}
.fila-mas:hover { border-color: var(--accent); }
.fila-mas .ic { font-size: 20px; }
.fila-mas .txt { flex: 1; display: grid; }
.fila-mas .txt small { color: var(--faint); font-size: 12px; }
.auth-card .btn { width: 100%; justify-content: center; }

.logo-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, #a800a8, #4d004d);
  font-size: 19px;
  box-shadow: 0 6px 18px rgba(168, 0, 168, .35);
  overflow: hidden;
  flex: 0 0 40px;
}
.logo-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-mark.plain { background: none; box-shadow: none; border-radius: 0; }
.auth-card .logo-mark { width: 72px; height: 72px; flex-basis: 72px; border-radius: 16px; }

/* ------------------------------------------------------------- layout */

.shell { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(30, 25, 38, .72);
  backdrop-filter: blur(6px);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 2px 4px 0;
}
.sidebar .brand .logo-mark {
  width: 100%;
  max-width: 270px;
  height: auto;
  flex-basis: auto;
  border-radius: 22px;
}
.sidebar .brand .logo-mark:not(.plain) { aspect-ratio: 1; }
.sidebar .brand .logo-mark img { height: auto; display: block; }
.sidebar .brand strong { font-size: 22px; letter-spacing: -.01em; }
.sidebar .brand small { display: block; color: var(--faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.nav { display: grid; gap: 3px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-weight: 540;
}
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button.active { background: var(--accent-soft); color: #eb92eb; }
.nav button .ic { width: 18px; text-align: center; }
.nav .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.side-foot { margin-top: auto; display: grid; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 7px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
}
.user-chip .meta { min-width: 0; }
.user-chip .meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .meta span { font-size: 11px; color: var(--faint); }

.avatar {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: linear-gradient(140deg, #3a4351, #262c37);
  border: 1px solid var(--line);
  color: #cfd6e2;
}
.avatar.lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; }
.avatar.con-foto { background: var(--bg-2); padding: 0; overflow: hidden; }
.avatar.con-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 96px; height: 96px; flex-basis: 96px; font-size: 30px; }

.main { padding: 26px 30px 60px; min-width: 0; }

.userbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -8px 0 14px;
}
.userbar .user-chip {
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.userbar .user-chip:hover { border-color: var(--accent); }

/* cabecera y barra inferior, solo en movil */
.topbar, .tabbar { display: none; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h2 { font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ------------------------------------------------------------- tarjetas */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card > h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card > h3 .tag { margin-left: auto; }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
}
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .value { font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--faint); margin-top: 2px; }
.kpi.accent .value { color: #e07de0; }

.kpi.pulsable {
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.kpi.pulsable:hover { border-color: var(--warn); transform: translateY(-2px); }
.kpi.pulsable.on { border-color: var(--warn); background: var(--warn-soft); }
.kpi.ok .value { color: var(--ok); }
.kpi.info .value { color: var(--info); }
.kpi.warn .value { color: var(--warn); }

.two-col { grid-template-columns: 1.35fr 1fr; align-items: start; }
@media (max-width: 1080px) { .two-col { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- tablas */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 650;
  padding: 0 10px 9px;
  border-bottom: 1px solid var(--line);
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .03); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
/* Sin esto, una tabla ancha estira su tarjeta y desborda la pagina en movil. */
.table-wrap { overflow-x: auto; max-width: 100%; }
.card, .grid > *, .kpi, .film, .person { min-width: 0; }

/* ------------------------------------------------------------- etiquetas */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: #e07de0; border-color: transparent; }
.tag.rojo { background: var(--rojo-soft); color: #ff8078; border-color: transparent; }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 4px; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}
.empty .big { font-size: 26px; display: block; margin-bottom: 8px; opacity: .7; }

/* ------------------------------------------------------------- personal */

.people { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.person {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.person.out { border-color: rgba(195, 46, 195, .42); }
.person .top { display: flex; gap: 12px; align-items: flex-start; }
.person .top .meta { min-width: 0; flex: 1; }
.person .top b { display: block; font-size: 15px; }
.person .top span { font-size: 12.5px; color: var(--muted); }
.person .where {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 13px;
  display: grid;
  gap: 5px;
}
.person .where .line { display: flex; gap: 8px; }
.person .where .line .k { color: var(--faint); min-width: 74px; }
.person .where .line .v { color: var(--text); }

/* --------------------------------------------------------- haz tu lista */

.familias {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.familia {
  display: grid;
  gap: 3px;
  padding: 14px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
}
.familia:hover { border-color: var(--accent); transform: translateY(-2px); }
.familia.on { background: var(--accent-soft); border-color: transparent; }
.familia .ic { font-size: 24px; line-height: 1.2; }
.familia b { font-size: 13px; line-height: 1.3; }
.familia small { color: var(--faint); font-size: 11.5px; }
.familia.on b { color: #eb92eb; }

.elige { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.elige-item {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  padding: 12px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.elige-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.elige-item:active { transform: scale(.98); }
.elige-item.puesto { border-color: var(--accent); background: var(--accent-soft); }
.elige-item .cab { display: flex; align-items: center; justify-content: space-between; }
.elige-item .cab .ic { font-size: 20px; }
.elige-item .libre { font-size: 11px; color: var(--ok); font-weight: 650; }
.elige-item .libre.agotado { color: var(--danger); }
.elige-item b { font-size: 13px; line-height: 1.35; }
.elige-item small { color: var(--faint); font-size: 11.5px; }
.elige-item .anadir { font-size: 11px; color: var(--faint); margin-top: 4px; }

.pasos {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  cursor: default;
}
.pasos b { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.pasos .btn { min-width: 34px; justify-content: center; font-size: 16px; line-height: 1; }

.lista-actual { border-color: rgba(195, 46, 195, .4); }
.lista-items { display: grid; gap: 8px; }
.lista-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
}
.lista-item .ic { font-size: 19px; }
.lista-item .txt { flex: 1; min-width: 0; display: grid; }
.lista-item .txt b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-item .txt small { color: var(--faint); font-size: 11.5px; }
.lista-item .pasos { margin: 0; }

/* ------------------------------------------------------------- timeline */

.solo-estrecho { display: none; }

.cal-lista { display: grid; gap: 12px; }
.cal-persona {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.cal-salidas { display: grid; gap: 7px; }
.cal-salida {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--panel);
  border-left: 3px solid var(--line);
  font-size: 13px;
}
.cal-salida b { flex: 1; min-width: 130px; }
.cal-salida span { color: var(--muted); }
.cal-salida.ahora { border-left-color: var(--accent); }
.cal-salida.pasada { opacity: .55; }

.timeline { display: grid; gap: 7px; }
.tl-head { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.tl-scale { position: relative; height: 16px; font-size: 10.5px; color: var(--faint); }
.tl-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.tl-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track {
  position: relative;
  height: 26px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}
.tl-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 4px;
  background: linear-gradient(180deg, #cf3ccf, #8f0b93);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  display: flex;
  align-items: center;
  padding: 0 7px;
  overflow: hidden;
  white-space: nowrap;
  cursor: default;
}
.tl-bar.b1 { background: linear-gradient(180deg, #6ba9ff, #3d7ede); color: #06121f; }
.tl-bar.b2 { background: linear-gradient(180deg, #46e0ac, #1fae7f); color: #04180f; }
.tl-bar.b3 { background: linear-gradient(180deg, #ff7a72, #d8342c); color: #1f0605; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, .5); z-index: 2; }

/* ------------------------------------------------------------- peliculas */

.films { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.film {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  display: grid;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.film:hover { border-color: #3c4553; transform: translateY(-2px); box-shadow: var(--shadow); }
.film h4 { font-size: 16.5px; }
.film .client { font-size: 13px; color: var(--muted); }
.film .facts { display: grid; gap: 6px; font-size: 13px; }
.film .facts .line { display: flex; gap: 8px; color: var(--muted); }
.film .facts .line .k { min-width: 82px; color: var(--faint); }
.film .facts .line .v { color: var(--text); }
.film .foot { display: flex; gap: 7px; flex-wrap: wrap; padding-top: 3px; border-top: 1px solid var(--line-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.cat {
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip.cat b { font-variant-numeric: tabular-nums; opacity: .7; font-weight: 700; }
.chip.cat:hover { border-color: var(--accent); color: var(--text); }
.chip.cat.on {
  background: var(--accent-soft);
  border-color: transparent;
  color: #eb92eb;
}
.chip.cat.on b { opacity: 1; }

.cat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  cursor: pointer;
  user-select: none;
}
.cat-head h3 { font-size: 14.5px; letter-spacing: .01em; }
.cat-head .caret { color: var(--faint); width: 12px; font-size: 11px; }
.cat-head:hover h3 { color: #eb92eb; }
.cat-block { padding-top: 14px; }
.chip {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* ------------------------------------------------------------- archivos */

.file-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.file-tabs button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 560;
}
.file-tabs button.active { background: var(--accent-soft); color: #eb92eb; border-color: transparent; }

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: #eb92eb; }
.dropzone .big { display: block; font-size: 24px; margin-bottom: 6px; }

.files { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.file-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid;
  grid-template-rows: 118px auto;
}
.file-card .thumb {
  background: #171320 center/cover no-repeat;
  display: grid;
  place-items: center;
  font-size: 30px;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
}
.file-card .info { padding: 9px 10px; display: grid; gap: 5px; }
.file-card .info b {
  font-size: 12.5px;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-card .info .sub { font-size: 11px; color: var(--faint); }
.file-card .info .acts { display: flex; gap: 6px; margin-top: 2px; }

/* ------------------------------------------------------------- modal */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 11, .72);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: start center;
  padding: 42px 18px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  width: min(660px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.modal.wide { width: min(880px, 100%); }
.modal header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line);
}
.modal header h3 { font-size: 17px; }
.modal .body { padding: 20px; display: grid; gap: 15px; }
.modal footer {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 15px 20px; border-top: 1px solid var(--line);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.picker {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.picker .opt {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft);
}
.picker .opt:last-child { border-bottom: 0; }
.picker .opt input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
.picker .opt .name { flex: 1; min-width: 0; font-size: 13.5px; }
.picker .opt .name small { display: block; color: var(--faint); font-size: 11.5px; }
.picker .opt input[type="number"] { width: 74px; padding: 5px 7px; }

.err {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, .3);
  color: #ffb4b4;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}

/* ------------------------------------------------------------- toasts */

#toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 9px;
  z-index: 90;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: pop .18s ease-out;
  max-width: 340px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------- responsive */

/* En movil y tablet el fondo va en negro, que es donde mejor entra el logo. */
@media (max-width: 1100px) {
  :root {
    --bg: #000000;
    --bg-2: #0a090c;
    --panel: #121016;
    --panel-2: #1b1822;
    --line: #2f2740;
    --line-soft: #241e30;
  }
  .sidebar { background: rgba(10, 9, 12, .88); }
  .auth-card .logo-mark { width: 130px; height: 130px; flex-basis: 130px; border-radius: 22px; }
  .auth-card .brand { flex-direction: column; align-items: flex-start; gap: 10px; }
  .auth-card h1 { font-size: 23px; }
}

@media (max-width: 1100px) and (min-width: 861px) {
  .shell { grid-template-columns: 280px 1fr; }
  .sidebar { padding: 14px 14px; }
  .sidebar .brand .logo-mark { max-width: 230px; border-radius: 20px; }
  .sidebar .brand strong { font-size: 20px; }
  .main { padding: 22px 20px 50px; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .solo-ancho { display: none; }
  .solo-estrecho { display: block; }

  table.responsiva thead { display: none; }
  table.responsiva, table.responsiva tbody, table.responsiva tr, table.responsiva td { display: block; width: 100%; }
  table.responsiva tr {
    background: var(--bg-2);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  table.responsiva tr:hover td { background: none; }
  table.responsiva td {
    border: 0;
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    text-align: right;
  }
  table.responsiva td::before {
    content: attr(data-l);
    color: var(--faint);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 650;
    text-align: left;
    flex: 0 0 auto;
  }
  table.responsiva td:empty { display: none; }
  table.responsiva td.actions { justify-content: flex-end; flex-wrap: wrap; padding-top: 9px; }
  table.responsiva td.actions::before { display: none; }
  table.responsiva td .stack, table.responsiva td .row { align-items: flex-end; }
  .table-wrap { overflow-x: visible; }

  .sidebar { display: none; }
  .userbar { display: none; }

  .topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    background: rgba(10, 9, 12, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
    z-index: 40;
  }
  .tb-logo {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 10px;
  }
  .tb-logo:active { transform: scale(.92); }
  .topbar .logo-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 9px; }
  .topbar .logo-mark:not(.plain) { aspect-ratio: 1; }
  .topbar b { font-size: 17px; letter-spacing: -.01em; flex: 1; }
  .tb-avatar { background: none; border: 0; padding: 0; cursor: pointer; }
  .tb-avatar .avatar { width: 36px; height: 36px; flex-basis: 36px; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(10, 9, 12, .94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-soft);
    z-index: 40;
  }
  .tabbar { padding: 5px 2px calc(5px + env(safe-area-inset-bottom)); }
  .tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: 0;
    padding: 6px 1px;
    border-radius: 10px;
    color: var(--faint);
    font-size: 9.5px;
    font-weight: 600;
    cursor: pointer;
    min-width: 0;
  }
  .tabbar button .ic { font-size: 18px; line-height: 1; }
  .tabbar button span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tabbar button.active { color: #eb92eb; background: var(--accent-soft); }
  .tabbar button:active { transform: scale(.94); }

  .main {
    padding: calc(72px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom));
  }

  /* toques mas grandes y menos apretado */
  .btn { padding: 11px 15px; }
  .btn.sm { padding: 8px 12px; }
  .card { padding: 16px; border-radius: 16px; }
  .kpi { border-radius: 16px; }
  #toasts { bottom: calc(86px + env(safe-area-inset-bottom)); left: 14px; right: 14px; }
  .toast { max-width: none; }
  .modal-back { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .familias { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .familia { padding: 12px 11px; border-radius: 16px; }
  .familia .ic { font-size: 26px; }
  .elige { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pasos .btn { min-width: 42px; padding: 9px 10px; font-size: 18px; }

  .lista-mas { display: grid; gap: 8px; }
  .fila-mas {
    display: flex; align-items: center; gap: 13px;
    width: 100%; padding: 14px;
    background: var(--bg-2); border: 1px solid var(--line-soft);
    border-radius: 14px; color: inherit; cursor: pointer; text-align: left;
  }
  .fila-mas .ic { font-size: 21px; }
  .fila-mas .txt { flex: 1; display: grid; }
  .fila-mas .txt small { color: var(--faint); font-size: 12px; }

  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    overflow-y: visible;
    overflow-x: visible;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 10px; padding: 0; }
  .sidebar .brand small { display: none; }
  .sidebar .brand strong { font-size: 18px; }
  .sidebar .brand .logo-mark {
    width: 88px; max-width: 88px; height: 88px; flex-basis: 88px; border-radius: 18px;
  }
  .sidebar .brand .logo-mark:not(.plain) { aspect-ratio: 1; }
  .nav {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }
  .nav button { width: auto; padding: 8px 11px; font-size: 13.5px; border: 1px solid var(--line-soft); }
  .nav button.active { border-color: transparent; }
  .nav .count { display: none; }
  .side-foot { margin-top: 0; margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .side-foot .user-chip { padding: 6px 9px; }
  .side-foot .user-chip .meta { display: none; }
  .page-head h2 { font-size: 21px; }
  .head-actions { width: 100%; }
  .head-actions input { width: 100% !important; }
  .modal-back { padding: 16px 10px; }
  .kpi .value { font-size: 26px; }
}
