/* ============================================================
   Miskatonic QR — CSS (mobile-first, ~200 líneas)
   Theme: uses CSS custom properties from /api/theme.css
   ============================================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       line-height: 1.6; color: var(--color-text); background: var(--color-bg); }
a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); }
a:visited { color: var(--color-link); }
a:active { color: var(--color-primary-hover); }
img { max-width: 100%; height: auto; }

/* ---- Layout ---- */
.header { background: var(--color-secondary); color: #fff; padding: 0.75rem 1rem; }
.header__inner { max-width: 48rem; margin: 0 auto; }
.header__logo { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.header__logo-img { height: auto; max-width: 100%; width: 360px; }

.main { max-width: 48rem; margin: 0 auto; padding: 1rem; }

.footer { text-align: center; padding: 2rem 1rem; color: var(--color-text-muted); font-size: 0.875rem; }

/* ---- Empty state ---- */

/* ---- Error card ---- */
.error-card { text-align: center; padding: 3rem 1rem; }
.error-card h1 { font-size: 1.5rem; color: var(--color-danger); margin-bottom: 0.5rem; }

/* ---- Admin ---- */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar { width: 220px; background: var(--color-secondary); color: #fff; padding: 1.5rem 0; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar__title { padding: 0 1.25rem; font-size: 1rem; margin-bottom: 1.5rem; }
.sidebar__nav { display: flex; flex-direction: column; }
.sidebar__link { padding: 0.6rem 1.25rem; color: var(--color-sidebar-link); font-size: 0.9rem; }
.sidebar__link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar__link--active { background: var(--color-sidebar-active-bg); color: #fff; border-left: 3px solid var(--color-primary); padding-left: calc(1.25rem - 3px); }

/* ---- Mockup Sidebar (Dashboard) ---- */
.dashboard-sidebar {
  width: 200px; background: var(--color-secondary);
  display: flex; flex-direction: column;
  padding-top: 1.5rem; flex-shrink: 0; z-index: 10;
}
.sidebar-logo { padding: 0 1.25rem; margin-bottom: 1.5rem; }
.sidebar-logo img { max-width: 100%; height: auto; }
.sidebar-menu { list-style: none; width: 100%; display: flex; flex-direction: column; flex: 1; gap: 1rem; }

/* Menu Antonio */

.sidebar-menu__item {
  width: 185px;
  height: 60px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--color-sidebar-link, rgba(255,255,255,0.7));
  font-size: 0.9rem;
  transition: color 0.3s ease;
  position: relative;
  border-radius: 30px 0 0 30px;
  gap: 0.5rem;
  margin: 0 0 0 1rem;
  padding: 0.6rem 2rem;
}

.sidebar-menu__item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-menu__item.active { background: var(--color-bg); color: var(--color-accent); }

/* Curva superior de transición */
.sidebar-menu__item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: -20px;
  width: 20px;
  height: 20px;
  background-color: transparent;
  border-radius: 0 0 20px 0;
  box-shadow: 10px 10px 0 10px var(--color-bg);
  pointer-events: none;
 }

 /* Curva inferior de transición */
 .sidebar-menu__item.active::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -20px;
  width: 20px;
  height: 20px;
  background-color: transparent;
  border-radius: 0 20px 0 0;
  box-shadow: 10px -10px 0 10px var(--color-bg);
  pointer-events: none;
}

.sidebar-menu__icon { font-size: 1.15rem; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-menu__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-bottom {  border-top: 1px solid rgba(255,255,255,0.1); padding: 1rem; }
.sidebar-bottom .sidebar-menu__item {  height: 50px; justify-content: top; background: color-mix(in srgb, var(--color-danger) 55%, transparent); color: #fff; border-radius: 30px; }
.sidebar-bottom .sidebar-menu__item:hover { background:var(--color-danger); }

.admin-main { flex: 1; padding: 1.5rem; }

/* ---- KPI Grid ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--color-surface); border-radius: 1.25rem; padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04); cursor: pointer;
  display: flex; align-items: center; gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.06); }
.kpi-icon { font-size: 1.75rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--color-bg); flex-shrink: 0; }
.kpi-info { display: flex; flex-direction: column; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--color-text); line-height: 1.2; }
.kpi-label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 500; }

/* ---- Detail Panel (accordion único) ---- */
.detail-panel {
  background: var(--color-surface); border-radius: 1.25rem;
  margin-bottom: 1.5rem; overflow: hidden;
  border-left: 4px solid var(--color-primary);
}
.detail-panel__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.detail-panel__title { font-size: 0.95rem; font-weight: 600; color: var(--color-text); }
.detail-panel__close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--color-text-muted); padding: 0.25rem; }
.detail-panel__close:hover { color: var(--color-text); }
.detail-panel__body { padding: 0.75rem 1.25rem; overflow-x: auto; }
.table-loading { text-align: center; padding: 1.5rem; color: var(--color-text-muted); font-size: 0.85rem; }

/* ---- Data Tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; padding: 0.5rem 0.75rem; font-weight: 600; color: var(--color-text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--color-border); }
.data-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); color: var(--color-text); }
.data-table tbody tr:hover { background: var(--color-link-hover); color: #fff; }
.data-table a { color: var(--color-primary); }
.data-table a:hover { text-decoration: underline; }
.data-table .empty-row { text-align: center; color: var(--color-text-muted); font-style: italic; padding: 1.5rem; }

/* ---- Badges (activity type) ---- */
.badge { display: inline-block; font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; text-transform: uppercase; }
.badge--product { background: #EBF8FF; color: #2B6CB0; }
.badge--pack { background: #FAF5FF; color: #6B46C1; }
.badge--user { background: #E6FFFA; color: #319795; }
.badge--asset { background: #FEFCBF; color: #B7791F; }

/* ---- Table ---- */
.table { width: 100%; border-collapse: collapse; background: var(--color-surface);
         border-radius: 0.5rem; overflow: hidden;
         box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-top: 1rem; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; font-size: 0.875rem; }
.table th { background: color-mix(in srgb, var(--color-surface) 85%, black); font-weight: 600; color: var(--color-text); }
.table tr:not(:last-child) td { border-bottom: 1px solid var(--color-surface); }
/* ---- Buttons ---- */
.btn { display: inline-block; padding: 0.5rem 1rem; border-radius: 0.375rem;
       font-size: 0.875rem; font-weight: 500; border: 1px solid transparent;
       cursor: pointer; text-decoration: none; }
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-hover); text-decoration: none; }
.btn--small { padding: 0.3rem 0.6rem; font-size: 0.8rem; background: var(--color-primary); color: #fff; }

.btn--danger { background: var(--color-danger); color: #fff; border: none; cursor: pointer; }
.btn--danger:hover { opacity: 0.85; }

.btn--reject { background: var(--color-danger); color: #fff; }
.btn--reject:visited {color: #fff; text-decoration: none; }
.btn--accept { background: var(--color-accent, #16a34a); color: #fff; }
.btn--accept:visited { color: #fff; text-decoration: none; }
.btn-group { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.btn--accent { background: var(--color-accent); color: #fff; }
.btn--accent:visited { color: #fff; text-decoration: none; }
.btn--accent:hover { background: var(--color-accent-hover); color: #333; text-decoration: none; }
.btn--accent:hover:visited { color: #333; text-decoration: none; }
.btn--muted { background: var(--color-primary-hover); color: #333; text-decoration: none;}
.btn--muted:visited { color: #333; text-decoration: none; }
.btn--muted:hover { background: var(--color-text-muted); color: #fff; text-decoration: none; }
.btn--muted:hover:visited { color: #fff; text-decoration: none; }
.btn--title { background: none; color: #fff; text-decoration: none; }
.btn--title:hover { color: var(--color-primary); }

/* ---- Badge ---- */
.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 999px;
         font-size: 0.75rem; font-weight: 600; }
.badge--active { background: color-mix(in srgb, var(--color-accent) 50%, transparent); color: var(--color-accent); }
.badge--pending { background: #fde401; color: #999 ; }
.badge--inactive { background: color-mix(in srgb, var(--color-danger) 50%, transparent); color: var(--color-danger); }
.badge--admin { background: color-mix(in srgb, var(--color-primary) 50%, transparent); color: var(--color-primary); }
.badge--viewer { background: color-mix(in srgb, var(--color-primary) 25%, transparent); color: var(--color-primary); }
.badge--edi { background: color-mix(in srgb, #a855f7 50%, transparent); color: #a855f7; }

/* ---- Login ---- */
.login-page { display: flex; align-items: center; justify-content: center;
              min-height: 100vh; background: var(--color-secondary); padding: 1rem; }
.login-card { background: var(--color-surface); border-radius: 0.5rem; padding: 2rem;
              width: 100%; max-width: 360px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.login-card__title { text-align: center; font-size: 1.25rem; color: var(--color-text); }
.login-card__subtitle { text-align: center; color: var(--color-text-muted); font-size: 0.875rem; margin-bottom: 1rem; }

/* ---- Progress Bar (Register) ---- */
.progress-bar { display: flex; gap: 0.5rem; margin: 1rem 0 1.5rem; }
.progress-bar__step { flex: 1; height: 6px; background: var(--color-border); border-radius: 999px; transition: background 0.3s ease; }
.progress-bar__step--active { background: var(--color-primary); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--color-text); margin-bottom: 0.25rem; }
.form-group input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--color-border);
                    border-radius: 0.375rem; font-size: 1rem; background: var(--color-surface); color: var(--color-text); }
.form-group input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: transparent; }
.form-control { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: 0.375rem; background: var(--color-bg); color: var(--color-text); font-size: 0.875rem; }
.form-control:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: transparent; }
.form-hint { display: block; font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.form-error { color: var(--color-danger); font-size: 0.875rem; text-align: center; margin-bottom: 1rem; }
.btn--block { width: 100%; text-align: center; }
.login-debug { margin-top: 1rem; text-align: left; }
.login-debug__title { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 0.5rem; }
.login-debug__pre { background: #1f2937; color: #e5e7eb; padding: 0.75rem; border-radius: 0.375rem;
                    font-size: 0.75rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.login-links { display: flex; justify-content: space-between; margin-top: 1rem; font-size: 0.875rem; }
.login-links a { color: var(--color-primary); }

/* ---- Home Page ---- */
.home-page { min-height: 100vh; display: flex; flex-direction: column;
             background: linear-gradient(135deg, var(--color-secondary) 0%, #0f172a 100%); color: #fff; }
.home-header { text-align: center; padding: 3rem 1rem 2rem; }
.home-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.home-header p { color: #cbd5e1; font-size: 1.1rem; }
.home-main { flex: 1; max-width: 48rem; margin: 0 auto; padding: 2rem 1rem; width: 100%; }
.home-section { background: rgba(255,255,255,0.05); border-radius: 0.5rem; padding: 2rem; margin-bottom: 1.5rem; backdrop-filter: blur(10px); }
.home-section h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.home-section p { color: #cbd5e1; line-height: 1.8; }
.home-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.home-actions .btn { flex: 1; text-align: center; padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn--secondary { background: #666; color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.btn--secondary:hover { background: #333; text-decoration: none; }
.home-footer { text-align: center; padding: 2rem 1rem; color: #cbd5e1; font-size: 0.875rem; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
         padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-size: 0.875rem;
         font-weight: 500; color: #fff; z-index: 9999;
         box-shadow: 0 4px 12px rgba(0,0,0,0.2); transition: opacity 0.3s ease; }
.toast--success { background: var(--color-accent); }
.toast--error { background: var(--color-danger); }
.toast--info { background: var(--color-primary); }

/* ---- Confirm Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5);
                 display: flex; align-items: center; justify-content: center;
                 z-index: 9998; }
.modal { background: var(--color-surface); border-radius: 0.5rem; padding: 1.5rem;
         max-width: 360px; width: 90%; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.modal__message { margin-bottom: 1.25rem; font-size: 0.95rem; color: var(--color-text); }
.modal__actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ---- Activity Accordion ---- */
.activity-section { margin-bottom: 1.5rem; }
.section-header { margin-bottom: 0.75rem; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--color-text); }
.accordion-card {
  background: var(--color-surface); border-radius: 1.25rem; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.accordion-trigger {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 1.25rem; background: none; border: none;
  font-size: 0.85rem; color: var(--color-text); cursor: pointer;
  font-weight: 500; transition: background 0.15s;
}
.accordion-trigger:hover { background: var(--color-link-hover); }
.accordion-arrow { transition: transform 0.2s; font-size: 0.8rem; }
.accordion-trigger[aria-expanded="true"] .accordion-arrow { transform: rotate(180deg); }
.accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.accordion-body--open { max-height: 2000px; }

/* ---- Asset Modal ---- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.asset-modal {
  background: var(--color-surface); border-radius: 1.25rem;
  max-width: 700px; width: 95%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.asset-modal__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.asset-modal__header h3 { font-size: 1rem; font-weight: 600; color: var(--color-text); }
.asset-modal__close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--color-text-muted); }
.asset-modal__close:hover { color: var(--color-text); }
.asset-modal__body { padding: 1.25rem; text-align: center; }
.asset-modal__body img { max-width: 100%; max-height: 60vh; border-radius: 0.5rem; }
.asset-modal__body embed, .asset-modal__body iframe { width: 100%; height: 60vh; border: none; border-radius: 0.5rem; }
.asset-modal__footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ---- Breakdowns ---- */
.breakdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.breakdown-card {
  background: var(--color-surface); border-radius: 1rem;
  padding: 1rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.breakdown-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text); margin-bottom: 0.75rem; }
.breakdown-bars { display: flex; flex-direction: column; gap: 0.5rem; }
.breakdown-bar { display: flex; align-items: center; gap: 0.5rem; }
.breakdown-bar__label { font-size: 0.75rem; color: var(--color-text-muted); min-width: 80px; text-align: right; }
.breakdown-bar__track { flex: 1; height: 8px; background: var(--color-bg); border-radius: 999px; overflow: hidden; }
.breakdown-bar__fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover)); border-radius: 999px; transition: width 0.3s ease; }
.breakdown-bar__count { font-size: 0.75rem; font-weight: 600; color: var(--color-text); min-width: 24px; }
.breakdown-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.breakdown-tag {
  font-size: 0.75rem; padding: 0.3rem 0.6rem;
  background: var(--color-bg); border-radius: 999px;
  color: var(--color-text-muted); white-space: nowrap;
}
.breakdown-tag--client { background: var(--color-bg); }

/* Purge Banner */
.purge-banner {
  background: var(--color-warning); color: #000;
  padding: 0.75rem 1rem; border-radius: 0.75rem;
  margin-bottom: 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.9rem;
}
.purge-banner__btn {
  background: #000; color: var(--color-warning);
  border: none; font-weight: 600; white-space: nowrap;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .dashboard-sidebar { width: 100%; flex-direction: row; padding: 0; align-items: stretch; }
  .sidebar-menu, .sidebar-bottom { flex-direction: row; padding: 0; gap: 0; align-items: stretch; }
  .sidebar-logo { display: none; }
  .sidebar-menu__item { width: auto; height: auto; padding: 0.6rem 0.5rem; margin: 0; font-size: 0.8rem; justify-content: center; flex-direction: column; gap: 0.2rem; flex: 1; }
  .sidebar-menu__item.active { background: rgba(255,255,255,0.1); color: #fff; }
  .sidebar-menu__item.active::before,
  .sidebar-menu__item.active::after { display: none; }
  .sidebar-menu__label { display: block; font-size: 0.6rem; text-align: center; }
  .sidebar-menu__icon { font-size: 1.1rem; width: auto; }
  .sidebar-bottom { border-top: none; }
  .admin-main { padding: 1rem; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .kpi-card { padding: 0.85rem; border-radius: 1rem; }
  .kpi-icon { width: 36px; height: 36px; font-size: 1.25rem; }
  .kpi-value { font-size: 1.15rem; }
  .breakdown-grid { grid-template-columns: 1fr; }

  /* ── Mobile: hide columns in tables ── */
  .data-table th:nth-child(4),
  .data-table td:nth-child(4),
  .data-table th:nth-child(5),
  .data-table td:nth-child(5) { display: none; }
  /* Assets: hide Tipo and Almacenamiento (cols 2 & 3) */
  .assets-table th:nth-child(2),
  .assets-table td:nth-child(2),
  .assets-table th:nth-child(3),
  .assets-table td:nth-child(3) { display: none; }
  /* Activity: hide Fecha and Creado por (cols 3 & 4) */
  .activity-table th:nth-child(3),
  .activity-table td:nth-child(3),
  .activity-table th:nth-child(4),
  .activity-table td:nth-child(4) { display: none; }
  /* Users: hide cols 2-4 (email, phone, empresa) */
  .users-table th:nth-child(2),
  .users-table td:nth-child(2),
  .users-table th:nth-child(3),
  .users-table td:nth-child(3),
  .users-table th:nth-child(4),
  .users-table td:nth-child(4) { display: none; }
  /* Users: show pointer cursor */
  .users-table tbody tr { cursor: pointer; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .kpi-card { padding: 0.7rem; }
}
@media (max-width: 640px) {
  .table { font-size: 0.8rem; }
  .table th, .table td { padding: 0.5rem; }
  .home-header h1 { font-size: 1.75rem; }
  .home-actions { flex-direction: column; }
  .header__logo-img { width: 100%; max-width: 280px; }
  .info-card__row { grid-template-columns: 1fr 1fr; font-size: 0.7rem; }
  .tech-hero__title { font-size: 0.8rem; }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Card ---- */
.card { background: var(--color-surface); border-radius: 0.5rem; padding: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        display: flex; flex-direction: column; gap: 0.5rem; }

/* ---- File/Asset list rows ---- */
.file-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0;
            border-bottom: 1px solid var(--color-surface); }
.file-row:last-child { border-bottom: none; }

/* ---- Breadcrumbs ---- */
.breadcrumbs { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 0.75rem; }
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); text-decoration: none; }
.breadcrumbs__sep { margin: 0 0.35rem; }

/* ---- Pack Info Grid ---- */
.pack-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.pack-info__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-surface);
  align-items: baseline;
}
.pack-info__row:last-child {
  border-bottom: none;
}
.pack-info__row--full {
  grid-template-columns: 1fr;
  gap: 0.25rem;
}
.pack-info__row dt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pack-info__row dd {
  font-size: 0.95rem;
  color: var(--color-text);
}
.pack-info__row--full dt {
  margin-top: 0.5rem;
}
.pack-info__row--full dd {
  line-height: 1.6;
}

/* ---- Pack Products Table (3 cols: thumb | name | qty) ---- */
.pack-products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.pack-products-table thead {
  background: color-mix(in srgb, var(--color-bg) 50%, transparent);
}
.pack-products-table th {
  padding: 0.5rem 0.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
}
.pack-products-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.pack-products-table tbody tr:last-child td {
  border-bottom: none;
}

.pack-products-table__row {
  cursor: pointer;
}
.pack-products-table__row:hover {
  background: color-mix(in srgb, var(--color-primary) 4%, transparent);
}
.pack-products-table__row[data-state="expanded"] {
  background: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

.pack-products-table__qty-col {
  text-align: right;
  width: 3rem;
}

.pack-products-table__thumb {
  width: 50px;
  height: 50px;
  border-radius: 0.375rem;
  object-fit: cover;
  display: block;
  border: 1px solid var(--color-border);
  cursor: pointer;
}
.pack-products-table__thumb--empty {
  width: 50px;
  height: 50px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border);
}

.pack-products-table__name-cell {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.pack-products-table__detail-body {
  padding: 1rem 1rem 1rem calc(50px + 1.5rem);
  background: color-mix(in srgb, var(--color-bg) 40%, transparent);
  border-top: 1px solid var(--color-border);
}

.pack-products-table__doc-link {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin: 0.15rem 0.15rem 0.15rem 0;
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  color: var(--color-text);
  text-decoration: none;
}
.pack-products-table__doc-link:hover {
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
}

@media (max-width: 640px) {
  .pack-products-table th,
  .pack-products-table td {
    padding: 0.4rem 0.35rem;
    font-size: 0.75rem;
  }
  .pack-products-table__thumb,
  .pack-products-table__thumb--empty {
    width: 40px;
    height: 40px;
  }
  .pack-products-table__name-cell {
    font-size: 0.78rem;
  }
  .pack-products-table__detail-body {
    padding: 0.6rem;
  }
}

/* ---- Product List (public tech_detail) ---- */
.product-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.product-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.product-list__item:last-child {
  border-bottom: none;
}
.product-list__check {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 0.8rem;
}

/* ---- Tech Detail (Public QR View / Mobile-First) ---- */

/* ---- Tech Hero ---- */
.tech-hero {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}
.tech-hero__thumb {
  width: 80px;
  height: 80px;
  border-radius: 0.375rem;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--color-border);
}
.tech-hero__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tech-hero__label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tech-hero__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}
.tech-hero__code {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.7rem;
  color: var(--color-primary);
}

/* ---- Status Badge ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.5625rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid;
  text-transform: uppercase;
  width: fit-content;
}
.status-badge--active {
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.status-badge--warning {
  background: color-mix(in srgb, var(--color-warning) 15%, transparent);
  border-color: var(--color-warning);
  color: var(--color-warning);
}
.status-badge--expired {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.status-badge--muted {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

/* ---- Info Card ---- */
.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}
.info-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.info-card__body {
  padding: 0.25rem 1rem;
}
.info-card__row {
  display: grid;
  grid-template-columns: 40% 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.info-card__row:last-child {
  border-bottom: none;
}
.info-card__row:nth-child(even) {
  background: color-mix(in srgb, var(--color-bg) 30%, transparent);
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
.info-card__label {
  color: var(--color-text-muted);
  font-weight: 500;
}
.info-card__value {
  color: var(--color-text);
  font-weight: 600;
}

/* ---- Accordion ---- */
.accordion {
  margin-bottom: 0.75rem;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.accordion__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  min-height: 48px;
  text-align: left;
  transition: background 0.15s;
}
.accordion__header:hover {
  filter: brightness(1.1);
}
.accordion__header .accordion__arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.accordion__header[aria-expanded="true"] .accordion__arrow {
  transform: rotate(90deg);
}
.accordion__title {
  flex: 1;
}
.accordion__meta {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  font-weight: 400;
  text-transform: none;
}
.accordion__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  background: var(--color-bg);
}
.accordion__body--open {
  max-height: 2000px;
}
.accordion__content {
  padding: 0.75rem 1rem;
}

/* ---- Download Button ---- */
.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-secondary);
  border: 1px solid var(--color-primary);
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 48px;
  transition: background 0.15s;
}
.download-btn:hover {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

/* ---- Photo Grid (within accordion) ---- */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.photo-grid__item {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.375rem;
  cursor: pointer;
  border: 1px solid var(--color-border);
}

/* ---- Warranty Card (inside accordion) ---- */
.warranty-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.warranty-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}
.warranty-card__label {
  color: var(--color-text-muted);
}
.warranty-card__value {
  color: var(--color-text);
  font-weight: 600;
}

/* ---- Empty state ---- */
.empty { color: var(--color-text-muted); text-align: center; padding: 2rem 0; font-style: italic; font-size: 0.8rem; }

/* ---- Product Groups (pack selector) ---- */
.product-group {
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  overflow: hidden;
}
.product-group__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-border);
}
.product-group__count {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-primary);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.product-group__list {
  max-height: 400px;
  overflow-y: auto;
}
.product-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-surface);
  transition: background 0.1s;
}
.product-item:last-child {
  border-bottom: none;
}
.product-item:hover {
  background: color-mix(in srgb, var(--color-primary) 4%, transparent);
}
.product-item__check input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.product-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.product-preview__info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.product-preview__name {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-preview__code {
  font-size: 0.7rem;
  color: var(--color-primary);
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  background: var(--color-border);
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
  width: fit-content;
}
.product-preview__meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .product-item {
    flex-wrap: wrap;
  }
  .product-preview__name {
    font-size: 0.8rem;
  }
  .product-group__list {
    max-height: 300px;
  }
}

/* ---- Responsive: Teclado / Landscape ---- */
@media (min-width: 640px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .tech-hero__title {
    font-size: 1rem;
  }
}

/* ---- Gallery Drag & Drop ---- */
.gallery-card { cursor: grab; transition: opacity 0.15s, box-shadow 0.15s; }
.gallery-card:active { cursor: grabbing; }
.gallery-card.dragging { opacity: 0.35; }
.gallery-card.drag-over { outline: 2px dashed var(--color-accent, #16a34a); outline-offset: 2px; }
.gallery-drag-handle {
  cursor: grab; user-select: none; font-size: 1rem; line-height: 1;
  padding: 0.2rem 0.35rem; color: #fff;
  position: absolute; top: 0.35rem; left: 0.35rem; z-index: 2;
  background: rgba(0,0,0,0.45); border-radius: 0.25rem;
  opacity: 0.7; transition: opacity 0.15s;
}
.gallery-card:hover .gallery-drag-handle { opacity: 1; }

/* ---- Fallback overlay (when theme.css hasn't loaded yet) ---- */
:root { --color-overlay: rgba(0, 0, 0, 0.85); }
