/* ============================================================
   RC Gestor — estilos base (consumen variables de tema)
   ============================================================ */
* { box-sizing: border-box; }

:root {
  --sidebar-w: 264px;
  --topbar-h: 60px;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
}

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

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}
.sidebar__brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.1rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sidebar__brand i { color: var(--primary); font-size: 1.35rem; }
.sidebar__nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.sidebar__section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: .8rem .7rem .35rem;
}
.nav-link-rc {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .75rem;
  border-radius: 9px;
  color: var(--sidebar-text);
  margin-bottom: 2px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link-rc i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.nav-link-rc:hover { background: var(--surface-2); color: var(--text); }
.nav-link-rc.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}
.nav-link-rc.active i { color: var(--sidebar-active-text); }

/* Agrupadores (dropdown) */
.nav-group {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
}
.nav-group__caret { margin-left: auto; font-size: .8rem; transition: transform .2s; }
.nav-group[aria-expanded="true"] .nav-group__caret { transform: rotate(180deg); }
.nav-group[aria-expanded="true"] { color: var(--text); }

/* Sub-opciones dentro de un agrupador */
.nav-link-rc.nav-sub {
  padding-left: 2.6rem;
  font-weight: 500;
  font-size: .9rem;
}
.nav-link-rc.nav-sub i { font-size: .95rem; }

/* ---------- Main area ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar__left { display: flex; align-items: center; gap: .8rem; }
.topbar__title { font-weight: 600; }
.topbar__toggle {
  display: none;
  background: none; border: none;
  color: var(--topbar-text);
  font-size: 1.4rem; cursor: pointer;
}
.user-chip {
  display: flex; align-items: center; gap: .55rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .3rem .6rem .3rem .35rem;
  border-radius: 30px;
  color: var(--text);
  cursor: pointer;
}
.user-chip img, .user-chip .avatar-fallback {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-text);
  font-weight: 700; font-size: .8rem;
}
.user-chip__name { font-weight: 600; font-size: .85rem; }

.content { padding: 1.5rem; flex: 1; }

/* ---------- Cards / surfaces ---------- */
.rc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.rc-card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.rc-card__body { padding: 1.25rem; }

.page-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.4rem; margin: 0; font-weight: 700; }
.page-head .subtitle { color: var(--text-muted); margin: .15rem 0 0; }

/* Stat tiles */
.stat-tile { display:flex; align-items:center; gap:1rem; }
.stat-tile .ico {
  width: 52px; height: 52px; border-radius: 12px;
  display:flex; align-items:center; justify-content:center;
  font-size: 1.5rem; background: var(--surface-2); color: var(--primary);
}
.stat-tile .num { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-tile .lbl { color: var(--text-muted); font-size: .85rem; }

/* module launcher cards */
.module-card {
  display:flex; flex-direction:column; gap:.6rem;
  height: 100%;
  transition: transform .12s, box-shadow .12s;
  text-decoration: none; color: var(--text);
}
.module-card:hover { transform: translateY(-3px); color: var(--text); box-shadow: 0 6px 18px rgba(16,24,40,.12); }
.module-card .ico {
  width: 48px; height: 48px; border-radius: 12px;
  display:flex; align-items:center; justify-content:center;
  font-size: 1.5rem; background: var(--primary); color: var(--primary-text);
}
.module-card h3 { font-size: 1.05rem; margin: 0; }
.module-card p { color: var(--text-muted); margin: 0; font-size: .85rem; }

/* Bootstrap overrides to honor theme */
.btn-rc-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-rc-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }

.table { color: var(--text); }
.form-control, .form-select {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.form-control:focus, .form-select:focus {
  background: var(--surface); color: var(--text);
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 25%, transparent);
}
.form-text, .text-muted { color: var(--text-muted) !important; }
.dropdown-menu {
  background: var(--surface); border-color: var(--border);
}
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
hr { border-color: var(--border); }

/* Drag & drop (RIS) */
.rc-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, color .15s;
}
.rc-dropzone:hover { border-color: var(--primary); color: var(--text); }
.rc-dropzone i { font-size: 1.8rem; color: var(--primary); }
.rc-dropzone__text { font-size: .85rem; }
.rc-dropzone.dragover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); color: var(--text); }
.rc-dropzone.has-file { border-style: solid; border-color: var(--success); }
.rc-dropzone__file { font-weight: 600; color: var(--text); word-break: break-all; }

/* Exportaciones: galería de canvas */
#posts-wrapper { display: flex; flex-direction: column; gap: 1.5rem; }
.exp-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.exp-pair:last-child { border-bottom: 0; }
.exp-canvas-block { display: flex; flex-direction: column; align-items: center; flex: 1 1 300px; max-width: 420px; }
.exp-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1035;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .topbar__toggle { display: inline-flex; align-items: center; }
}
