/* ==========================================================================
   Onet TV · Panel de administración
   Un único tema oscuro con acento naranja. Todo el color pasa por tokens
   para que un cambio de marca sea una sola edición.
   ========================================================================== */

:root {
  --or: #f97316;
  --or-hi: #fb923c;
  --or-dim: rgba(249, 115, 22, 0.12);
  --or-line: rgba(249, 115, 22, 0.42);

  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --sky: #38bdf8;
  --violet: #a78bfa;
  --blue: #60a5fa;

  --bg: #08090b;
  --panel: #0c0e11;
  --panel-2: #0f1115;
  --panel-3: #14171c;
  --line: #1a1d22;
  --line-2: #24272e;
  --line-3: #2f333b;

  --txt: #e7e9ee;
  --txt-hi: #ffffff;
  --dim: #8b919b;
  --dim-2: #6b717b;

  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;

  --shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --side-w: 262px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scrollbar-color: var(--line-3) transparent; }

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--txt);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(249, 115, 22, 0.35); color: #fff; }

a { color: var(--or); text-decoration: none; }
a:hover { color: var(--or-hi); }

svg { flex: none; }

:focus-visible {
  outline: 2px solid var(--or);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================== Estructura ============================== */

.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 40;
}

.brand { display: flex; align-items: center; padding: 0 8px; }
.brand img { width: 150px; height: auto; display: block; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border-left: 3px solid transparent;
  color: #9aa0aa;
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav a svg { width: 18px; height: 18px; }
.nav a:hover { background: var(--panel-3); color: var(--txt); }
.nav a.active {
  color: #fff;
  font-weight: 600;
  border-left-color: var(--or);
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.16), rgba(249, 115, 22, 0.02));
}
.nav a.active svg { stroke: var(--or); }

.side-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity .meta { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.identity .name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--txt-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-3);
  background: var(--panel-3);
  font-size: 17px;
  font-weight: 600;
  color: var(--txt);
}
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }

.logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: #9aa0aa;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.logout:hover { border-color: var(--or); color: var(--txt-hi); }
.logout svg { width: 16px; height: 16px; }

.main {
  flex: 1;
  min-width: 0;
  max-width: 1560px;
  padding: 26px 34px 60px;
}

/* Botón que abre la barra lateral en móvil. */
.side-toggle {
  display: none;
  width: 42px;
  height: 42px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--txt);
  cursor: pointer;
}
.side-toggle svg { width: 19px; height: 19px; }
.scrim { display: none; }

/* ================================ Topbar ================================ */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.topbar .tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }

h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #fff;
}
h1::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 11px;
  border-radius: 2px;
  background: var(--or);
}
h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--txt-hi);
  margin-bottom: 16px;
}
h2 .dot { color: var(--or); }
h3 { font-size: 15px; font-weight: 600; color: var(--txt-hi); }

.muted { color: var(--dim); }
.lead { font-size: 14.5px; line-height: 1.7; color: var(--dim); }
.small { font-size: 13px; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 280px;
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  background: var(--panel-2);
  transition: border-color 0.15s var(--ease);
}
.searchbox:focus-within { border-color: var(--or); }
.searchbox svg { width: 16px; height: 16px; stroke: var(--dim-2); }
.searchbox input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--txt);
  font: inherit;
  font-size: 14.5px;
}
.searchbox kbd {
  flex: none;
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  color: var(--dim-2);
  font-family: var(--font);
  font-size: 11px;
}
.searchbox .icon-btn { border: 0; background: none; padding: 0; display: flex; cursor: pointer; color: var(--dim-2); }
.searchbox .icon-btn:hover { color: var(--or); }

/* Campana y menú de cuenta: ambos son "popovers" con la misma mecánica. */
.pop { position: relative; }
.pop-trigger {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--panel-2);
  color: #c9ced6;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.pop-trigger:hover { border-color: var(--line-3); color: var(--txt-hi); }
.pop-trigger svg { width: 19px; height: 19px; }
.pop-trigger.avatar { font-size: 16px; }
.pop-trigger[aria-expanded="true"] { border-color: var(--or); color: var(--or); }

.badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: none;
  place-items: center;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg);
}
.badge.on { display: grid; }

.pop-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 460px;
  display: none;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
}
.pop-panel.open { display: flex; animation: pop 0.16s var(--ease) both; }
.pop-panel.narrow { width: 250px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }

.pop-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.pop-head strong { font-size: 14px; font-weight: 600; color: var(--txt-hi); }
.pop-head .link {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--or);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pop-head .link:disabled { color: var(--dim-2); cursor: default; }

.pop-list { overflow-y: auto; }
.pop-item {
  display: flex;
  gap: 13px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--txt);
  transition: background 0.15s var(--ease);
}
.pop-item:last-child { border-bottom: 0; }
.pop-item:hover { background: var(--panel-3); color: var(--txt); }
.pop-item .ic {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-3);
  color: var(--or);
}
.pop-item .ic svg { width: 16px; height: 16px; }
.pop-item .tx { min-width: 0; }
.pop-item .tt { font-size: 14px; font-weight: 600; color: var(--txt-hi); }
.pop-item .sb { margin-top: 3px; font-size: 12.5px; color: var(--dim); }
.pop-item.unread { background: rgba(249, 115, 22, 0.05); }
.pop-item.unread .tt::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--or);
  vertical-align: middle;
}
.pop-empty { padding: 34px 18px; text-align: center; color: var(--dim); font-size: 14px; }

.pop-menu { padding: 8px; }
.pop-menu a, .pop-menu button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--txt);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.pop-menu a:hover, .pop-menu button:hover { background: var(--panel-3); color: var(--txt-hi); }
.pop-menu svg { width: 16px; height: 16px; }
.pop-menu .sep { height: 1px; margin: 7px 4px; background: var(--line); }
.pop-menu .who { padding: 12px 13px 14px; }
.pop-menu .who .nm { font-size: 14.5px; font-weight: 600; color: var(--txt-hi); }
.pop-menu .who .em { margin-top: 3px; font-size: 12.5px; color: var(--dim); word-break: break-all; }

/* ================================ Tarjetas ================================ */

.card {
  padding: 24px 26px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  animation: rise 0.4s var(--ease) both;
}
.card.tight { padding: 18px 20px; }
.card:nth-of-type(2) { animation-delay: 0.05s; }
.card:nth-of-type(3) { animation-delay: 0.1s; }
.card:nth-of-type(4) { animation-delay: 0.15s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.cardhead {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.cardhead .right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.hr { height: 1px; margin: 20px 0; background: var(--line); }

/* ================================== KPIs ================================== */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: 22px 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
  animation: rise 0.4s var(--ease) both;
}
.kpi:hover { transform: translateY(-3px); border-color: var(--line-3); }
.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  width: 3px;
  height: 32px;
  background: var(--kc, var(--or));
}
.kpi .ic {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: var(--r-md);
  background: var(--kbg, var(--or-dim));
}
.kpi .ic svg { width: 20px; height: 20px; stroke: var(--kc, var(--or)); }
.kpi .n { font-size: 36px; font-weight: 600; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.kpi .l { margin-top: 10px; font-size: 14px; color: var(--dim); }

/* ================================= Tablas ================================= */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 14.5px;
  border-bottom: 1px solid var(--line);
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  color: var(--dim-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
tbody tr { transition: background 0.14s var(--ease); }
tbody tr:hover { background: rgba(255, 255, 255, 0.017); }
tbody tr:last-child td { border-bottom: 0; }
td strong { font-weight: 600; color: var(--txt-hi); }
td.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.tfoot {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 18px;
  font-size: 13.5px;
  color: var(--dim);
}

.rank { font-size: 14.5px; font-weight: 700; color: var(--dim-2); font-variant-numeric: tabular-nums; }
tbody tr:first-child .rank { color: var(--or); }

.bar-track { height: 8px; border-radius: 99px; background: #1b1e23; overflow: hidden; }
.bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--or), var(--or-hi));
  transform-origin: left;
  animation: grow 0.7s var(--ease) both 0.15s;
}
@keyframes grow { from { transform: scaleX(0); } }

/* ============================== Paginación ============================== */

.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg {
  min-width: 40px;
  height: 40px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.pg:hover { border-color: var(--line-3); color: var(--txt); }
.pg.on { border-color: var(--or); background: var(--or-dim); color: var(--or); }
.pg.off { opacity: 0.4; pointer-events: none; }
.pg svg { width: 15px; height: 15px; }

/* =============================== Formularios =============================== */

label {
  display: block;
  margin: 0 0 8px 2px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim-2);
}

input, select, textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--txt);
  font: inherit;
  font-size: 14.5px;
  transition: border-color 0.15s var(--ease);
}
input::placeholder { color: var(--dim-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--or); }
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }

select {
  appearance: none;
  cursor: pointer;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23f97316' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
select option { background: var(--panel-3); color: #fff; }

input[type="file"] { padding: 9px; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 11px;
  padding: 8px 13px;
  border: 1px solid var(--or);
  border-radius: 8px;
  background: var(--or-dim);
  color: var(--or);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: rgba(249, 115, 22, 0.2); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; }
.field-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 180px; }
.field-row > .fit { flex: 0 0 auto; min-width: 0; }

/* ================================= Botones ================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 22px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--or);
  color: #fff;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), transform 0.12s var(--ease), opacity 0.15s var(--ease);
}
.btn:hover { background: var(--or-hi); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.sm { padding: 9px 15px; font-size: 13px; border-radius: var(--r-sm); }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }

.btn.ghost {
  background: var(--panel-3);
  border: 1px solid var(--line-3);
  color: var(--txt);
  font-weight: 600;
}
.btn.ghost:hover { background: var(--panel-3); border-color: var(--or); color: var(--or); }

.btn.outline { background: var(--or-dim); border: 1px solid var(--or-line); color: var(--or); }
.btn.outline:hover { background: rgba(249, 115, 22, 0.18); color: var(--or); }

.btn.danger { background: var(--red-soft); border: 1px solid rgba(239, 68, 68, 0.4); color: #f87171; font-weight: 600; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* Estado "guardando…": el botón se bloquea y muestra un spinner. */
.btn.is-busy { pointer-events: none; opacity: 0.75; }
.btn.is-busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-btn:hover { color: var(--or); border-color: var(--or-line); }
.icon-btn.danger:hover { color: #f87171; border-color: rgba(239, 68, 68, 0.45); }
.icon-btn svg { width: 16px; height: 16px; }

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.seg { display: inline-flex; gap: 5px; padding: 4px; border: 1px solid var(--line-2); border-radius: 99px; }
.seg a {
  padding: 8px 17px;
  border: 1px solid transparent;
  border-radius: 99px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.seg a:hover { color: var(--txt); }
.seg a.on { border-color: var(--or-line); background: var(--or-dim); color: var(--or); font-weight: 700; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 17px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: #9aa0aa;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.chip:hover { border-color: var(--or-line); color: var(--txt); }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip .box {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.6px solid var(--line-3);
  border-radius: 5px;
}
.chip:has(input:checked) { border-color: var(--or-line); background: var(--or-dim); color: var(--or); font-weight: 600; }
.chip:has(input:checked) .box { border-color: var(--or); background: var(--or); }
.chip:has(input:checked) .box::after {
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* =============================== Indicadores =============================== */

.pill {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.pill.admin { background: rgba(96, 165, 250, 0.18); color: #93c5fd; }
.pill.supervisor { background: rgba(167, 139, 250, 0.18); color: #c4b5fd; }
.pill.viewer { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.pill.count { background: var(--panel-3); color: var(--dim); letter-spacing: 0.04em; }

.state { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.state.on { color: #c9ced6; }
.state.on::before { background: var(--green); box-shadow: 0 0 9px rgba(34, 197, 94, 0.6); }
.state.off { color: var(--dim); }
.state.off::before { background: #64748b; }

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--or);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: opacity 0.3s var(--ease);
}
.live-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--or);
  box-shadow: 0 0 9px var(--or);
  animation: pulse 2s ease infinite;
}
.live-tag.stale { opacity: 0.4; }
@keyframes pulse { 50% { opacity: 0.35; } }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #34d399;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #34d399; }

.status { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status.saving { color: var(--dim); }
.status.ok { color: #6ee7b7; }
.status.err { color: #fca5a5; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--dim);
}
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; stroke: var(--line-3); }
.empty p { font-size: 14.5px; }

/* ================================= Media ================================= */

.thumb {
  width: 54px;
  height: 54px;
  padding: 5px;
  object-fit: contain;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #05070c;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}
.thumb:hover { transform: scale(1.7); border-color: var(--or); position: relative; z-index: 5; }

.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 18px; }
.slide {
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel-2);
  overflow: hidden;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.slide:hover { transform: translateY(-3px); border-color: var(--or-line); }
.slide img {
  display: block;
  width: 100%;
  height: 146px;
  object-fit: cover;
  background: linear-gradient(135deg, #1a1d22, #101216);
}
.slide .body { padding: 14px 15px; display: flex; flex-direction: column; gap: 11px; }
.slide[draggable="true"] { cursor: grab; }
.slide.dragging { opacity: 0.4; cursor: grabbing; }
.slide.over { border-color: var(--or); }

.handle { display: flex; color: #4a4f57; cursor: grab; }
.handle svg { width: 16px; height: 16px; }
tr.dragging { opacity: 0.45; }
tr.over td { box-shadow: inset 0 2px 0 var(--or); }

/* ================================= Toasts ================================= */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 370px;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.5;
  animation: toast-in 0.22s var(--ease) both;
}
.toast.out { animation: toast-out 0.2s var(--ease) forwards; }
.toast.ok { border-color: rgba(34, 197, 94, 0.4); background: linear-gradient(var(--green-soft), var(--green-soft)), var(--panel-2); color: #a7f3d0; }
.toast.err { border-color: rgba(239, 68, 68, 0.45); background: linear-gradient(var(--red-soft), var(--red-soft)), var(--panel-2); color: #fecaca; }
.toast svg { width: 18px; height: 18px; margin-top: 1px; }
.toast .x { margin-left: auto; border: 0; background: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 15px; line-height: 1; }
.toast .x:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ================================= Modal ================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.72);
  backdrop-filter: blur(3px);
}
.modal.open { display: flex; animation: fade 0.16s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }

.modal-box {
  width: 440px;
  max-width: 100%;
  padding: 26px 28px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  animation: rise 0.22s var(--ease) both;
}
.modal-box h3 { margin-bottom: 10px; font-size: 18px; }
.modal-box p { font-size: 14.5px; line-height: 1.65; color: var(--dim); }
.modal-box .field { margin-top: 18px; }
.modal-box .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-box .hint { margin-top: 9px; font-size: 12.5px; color: var(--dim-2); }

/* ================================= Login ================================= */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-box {
  width: 420px;
  max-width: 100%;
  animation: rise 0.45s var(--ease) both;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand img { width: 210px; height: auto; animation: float 5.5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.login-brand .sub {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--or);
}
.login-box .card { margin: 0; }
.login-box .fields { display: flex; flex-direction: column; gap: 16px; }

/* =============================== Responsive =============================== */

@media (max-width: 1080px) {
  .main { padding: 22px 22px 50px; }
}

@media (max-width: 900px) {
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow);
  }
  .side.open { transform: none; }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(4, 5, 7, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
  }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .side-toggle { display: flex; }
  .main { padding: 18px 16px 48px; }
  h1 { font-size: 25px; }
  .searchbox { width: 100%; order: 3; }
  .searchbox kbd { display: none; }
  .topbar .tools { width: 100%; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .kpi { padding: 18px 18px 20px; }
  .kpi .n { font-size: 29px; }
  .card { padding: 18px 16px; }
  th, td { padding: 12px 9px; font-size: 14px; }
  .toasts { right: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .side, .topbar .tools, .side-toggle, .toasts, .row-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ddd; background: #fff; }
}
