/* DGM Social · Sistema — mismos tokens que el sitio (design-system/dgm-social/MASTER.md) */
:root {
  --navy: #0F172A; --navy-2: #13233f; --ink: #020617;
  --accent: #0369A1; --accent-h: #075985; --accent-bright: #38BDF8; --accent-soft: #E0F2FE;
  --bg: #F4F7FA; --card: #FFFFFF; --border: #E2E8F0; --muted: #475569; --muted-2: #64748B;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -16px rgba(15,23,42,.25);
  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --bs-primary: #0369A1; --bs-primary-rgb: 3,105,161;
  --bs-body-font-family: var(--font);
  --bs-body-color: #0F172A;
  --bs-link-color: #0369A1; --bs-link-color-rgb: 3,105,161; --bs-link-hover-color: #075985;
}
body { font-family: var(--font); background: var(--bg); color: #0F172A; font-size: .95rem; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .25rem; }
h2 { font-size: 1.05rem; font-weight: 700; }
a { text-underline-offset: 3px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -4px; }
.icon-sm { width: 16px; height: 16px; vertical-align: -3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 3000; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; color: #fff; }
.text-muted-2 { color: var(--muted) !important; }
.num, .folio, .mono { font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .85em; }
.folio { font-family: var(--mono); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.folio-lg { font-family: var(--mono); font-weight: 500; color: var(--accent); }
.req { color: #DC2626; }
.pre { white-space: pre-line; }

/* Botones (Bootstrap ajustado a la marca) */
.btn { border-radius: 10px; font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 34px; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-h); --bs-btn-hover-border-color: var(--accent-h); --bs-btn-active-bg: var(--accent-h); --bs-btn-disabled-bg: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent-h); }
.btn-light { --bs-btn-bg: #F1F5F9; --bs-btn-border-color: #E2E8F0; --bs-btn-hover-bg: #E2E8F0; }
.btn-icon { background: transparent; border: 0; width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; color: inherit; }
.btn-icon:hover { background: rgba(148,163,184,.15); }
.form-control, .form-select { border-radius: 10px; border-color: #CBD5E1; min-height: 42px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(3,105,161,.15); }
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, var(--navy), var(--ink)); color: #CBD5E1; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040; transition: transform .25s cubic-bezier(.22,1,.36,1); }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 20px 18px; color: #fff; font-weight: 700; }
.brand-mark { font-family: var(--mono); font-size: .78rem; font-weight: 500; padding: 5px 8px; border-radius: 8px; color: #fff; background: linear-gradient(135deg, #0369A1, #0EA5E9); }
.side-nav { list-style: none; margin: 0; padding: 6px 12px; display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: 10px 12px; border-radius: 10px; color: #CBD5E1; text-decoration: none; font-weight: 500; min-height: 44px; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(56,189,248,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent-bright); }
.side-nav a.active .icon { color: var(--accent-bright); }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: .5rem; }
.side-user { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; flex: 1; min-width: 0; }
.side-user strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #94A3B8; font-size: .78rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(56,189,248,.18); color: #BAE6FD; font-weight: 700; flex-shrink: 0; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: 12px 28px; background: rgba(244,247,250,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid #CBD5E1; border-radius: 10px; padding: 0 12px; min-height: 42px; color: var(--muted-2); }
.top-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(3,105,161,.15); }
.top-search input { border: 0; outline: 0; flex: 1; background: transparent; min-width: 0; color: #0F172A; }
.topbar-link { margin-left: auto; color: var(--muted); font-size: .88rem; }
.content { padding: 28px; max-width: 1400px; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(2,6,23,.5); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.45); z-index: 1030; }
  .main { margin-left: 0; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px 16px; }
}

/* Encabezado de página */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: .3rem; font-size: .88rem; color: var(--muted); text-decoration: none; margin-bottom: .35rem; }
.back:hover { color: var(--accent); }

/* Tarjetas */
.card-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-panel.p-0 { overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: .88rem; font-weight: 600; text-decoration: none; }
.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.count { font-family: var(--mono); font-size: .75rem; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; vertical-align: 2px; margin-left: 4px; }
.empty { color: var(--muted-2); padding: 20px; text-align: center; margin: 0; }
.filters { margin-bottom: 16px; padding: 16px; }
.form-panel { margin-bottom: 20px; }
.form-stack .card-panel { margin-bottom: 20px; }
.form-actions { display: flex; gap: .5rem; margin-top: 8px; padding-top: 16px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 20px 0 16px; z-index: 5; }

/* Estadísticas */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 24px; }
.stat { display: grid; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .2s, border-color .2s; }
.stat:hover { transform: translateY(-2px); border-color: #BAE6FD; color: inherit; }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 500; }
.stat-value { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted-2); font-size: .8rem; }

/* Tablas */
.table-app { margin: 0; --bs-table-bg: transparent; }
.table-app th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); font-weight: 600; border-bottom-color: var(--border); padding: 12px 16px; white-space: nowrap; background: #F8FAFC; }
.table-app td { padding: 12px 16px; vertical-align: middle; border-color: #EEF2F6; }
.table-app tbody tr:hover { background: #F8FAFC; }
.cell-sub { color: var(--muted-2); font-size: .8rem; margin-top: 2px; }
.row-muted td { opacity: .6; }
.list-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 14px 4px; font-size: .88rem; flex-wrap: wrap; }
.page-link { color: var(--accent); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* Insignias */
.badge { font-weight: 600; border-radius: 999px; padding: .35em .7em; }
.badge-soft-secondary { background: #F1F5F9; color: #475569; }
.badge-soft-info { background: #E0F2FE; color: #075985; }
.badge-soft-success { background: #DCFCE7; color: #166534; }
.badge-soft-danger { background: #FEE2E2; color: #991B1B; }
.badge-soft-warning { background: #FEF3C7; color: #92400E; }
.type-chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.type-soporte { background: #E0F2FE; color: #075985; }
.type-impresora { background: #EDE9FE; color: #5B21B6; }
.type-peritaje { background: #FEF3C7; color: #92400E; }
.role { font-size: .8rem; font-weight: 600; }
.role-admin { color: #991B1B; } .role-tecnico { color: #075985; } .role-cliente { color: #166534; }

/* Listas de definición */
.dl-app { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; font-size: .9rem; }
.dl-app dt { color: var(--muted-2); font-weight: 500; }
.dl-app dd { margin: 0; word-break: break-word; }
@media (min-width: 768px) { .dl-cols { grid-template-columns: 130px 1fr 130px 1fr; } }

/* Ítems y totales */
.items-table th { font-size: .75rem; text-transform: uppercase; color: var(--muted-2); font-weight: 600; border-bottom-color: var(--border); }
.items-table td { border: 0; padding: 6px 6px 6px 0; }
.totals { display: grid; gap: 6px; margin-left: auto; max-width: 340px; padding: 12px 0 0; }
.totals > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; }
.totals > div input { max-width: 140px; }
.totals .total { border-top: 2px solid var(--navy); padding-top: 8px; font-size: 1.1rem; }
.totals strong { font-variant-numeric: tabular-nums; }
.totals-static { padding: 16px 20px; }

/* Selector de tipo de informe */
.type-picker { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-card { display: grid; gap: 2px; padding: 16px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; height: 100%; }
.type-card .icon { color: var(--accent); width: 24px; height: 24px; margin-bottom: 6px; }
.type-card small { color: var(--muted-2); }
.type-option input:checked + .type-card { border-color: var(--accent); background: #F0F9FF; }
.type-option input:focus-visible + .type-card { outline: 3px solid var(--accent); outline-offset: 2px; }
[data-show-for].is-hidden { display: none !important; }

/* Actividad y resultados */
.activity, .result-list { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; justify-content: space-between; gap: 1rem; padding: 9px 0; border-bottom: 1px solid #EEF2F6; font-size: .86rem; }
.act-when { color: var(--muted-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-list li { padding: 10px 0; border-bottom: 1px solid #EEF2F6; }
.result-list li:last-child, .activity li:last-child { border-bottom: 0; }
.result-list a { text-decoration: none; }
.result-list .cell-sub { display: block; }

/* Login y errores */
.auth-body { min-height: 100vh; background: radial-gradient(120% 80% at 50% 0%, var(--navy-2) 0%, var(--navy) 55%, var(--ink) 100%); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.auth-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; margin-bottom: 20px; }
.auth-alert { width: 100%; max-width: 420px; margin: 0; }
.auth-foot { margin: 18px 0 0; font-size: .85rem; color: var(--muted); text-align: center; }
.error-code { font-family: var(--mono); font-size: 3rem; font-weight: 500; color: var(--accent); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
@media print { .sidebar, .topbar, .page-actions, .form-actions { display: none !important; } .main { margin: 0; } }

/* Opiniones de clientes */
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #F59E0B; color: #1F2937; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.seg-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-tabs a { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--muted); font-weight: 600; text-decoration: none; }
.seg-tabs a.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.seg-tabs a.active .count { background: rgba(255,255,255,.15); color: #fff; }
.review-admin-list { display: grid; gap: 16px; }
.review-admin.is-featured { border-color: #7DD3FC; }
.ra-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ra-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gems { display: inline-flex; gap: 1px; }
.gem { color: #CBD5E1; }
.gem.on { color: #0EA5E9; fill: rgba(56,189,248,.35); }
.ra-reply summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--accent); }
.ra-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid #EEF2F6; }
.ra-actions form { margin: 0; }
