/* ============================================================================
   TailAdmin v4 Design System — Portal del Contador CPC (Dark / Light)
   ============================================================================ */
:root,
html[data-theme="dark"] {
  --brand-50: #ecf3ff;
  --brand-100: #dde9ff;
  --brand-200: #c2d6ff;
  --brand-400: #7592ff;
  --brand-500: #465fff;
  --brand-600: #3641f5;
  --brand-950: #161950;

  --bg-dark: #101828;
  --bg-sidebar: #111927;
  --bg-topbar: rgba(16, 24, 40, 0.92);
  --bg-card: #171f2f;
  --bg-card-subtle: #111827;
  --bg-card-hover: #1d2939;
  --bg-input: #101828;
  --border: #263244;
  --border-light: #344054;
  --text-main: #f9fafb;
  --text-secondary: #d0d5dd;
  --text-muted: #98a2b3;
  --text-faint: #667085;
  --primary: #465fff;
  --primary-hover: #3641f5;
  --primary-glow: rgba(70, 95, 255, 0.25);
  --emerald: #12b76a;
  --emerald-bg: rgba(18, 183, 106, 0.12);
  --amber: #f79009;
  --amber-bg: rgba(247, 144, 9, 0.12);
  --rose: #f04438;
  --rose-bg: rgba(240, 68, 56, 0.12);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.28);
  --font-sans: 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-theme="light"] {
  --bg-dark: #f9fafb;
  --bg-sidebar: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.92);
  --bg-card: #ffffff;
  --bg-card-subtle: #f2f4f7;
  --bg-card-hover: #f9fafb;
  --bg-input: #ffffff;
  --border: #e4e7ec;
  --border-light: #d0d5dd;
  --text-main: #101828;
  --text-secondary: #344054;
  --text-muted: #667085;
  --text-faint: #667085;
  --primary: #465fff;
  --primary-hover: #3641f5;
  --primary-glow: rgba(70, 95, 255, 0.18);
  --emerald-bg: #ecfdf3;
  --amber-bg: #fffaeb;
  --rose-bg: #fef3f2;
  --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TailAdmin Shell (Sidebar + Topbar + Main)
   ========================================================================== */
.ta-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.ta-sidebar {
  width: 268px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  transition: width 0.2s ease, transform 0.22s ease;
}

.ta-shell.sidebar-collapsed .ta-sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: none;
  overflow: hidden;
}

.ta-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  backdrop-filter: blur(3px);
  z-index: 35;
}

.ta-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ta-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  height: auto;
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.ta-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 240px;
}

.ta-sidebar-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ta-sidebar-toggle:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.ta-nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 10px 6px;
}

.ta-side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.ta-side-link {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  text-decoration: none;
  transition: all 0.15s;
}

.ta-side-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.ta-side-link.active {
  background: rgba(70, 95, 255, 0.14);
  color: var(--brand-400);
  border-color: rgba(70, 95, 255, 0.28);
}

html[data-theme="light"] .ta-side-link.active {
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: var(--brand-200);
}

.ta-sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
}

.ta-theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.ta-theme-btn:hover {
  border-color: var(--primary);
}

/* ==========================================================================
   TailAdmin Split-Screen Auth (login.html)
   ========================================================================== */
.ta-auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg-dark);
}

@media (min-width: 960px) {
  .ta-auth-page {
    grid-template-columns: 1fr 1fr;
  }
}

.ta-auth-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  position: relative;
}

.ta-auth-card {
  width: 100%;
  max-width: 450px;
}

.ta-auth-hero {
  display: none;
  background-color: #161950;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  padding: 48px;
  align-items: center;
  justify-content: center;
}

@media (min-width: 960px) {
  .ta-auth-hero {
    display: flex;
  }
}

.ta-auth-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.ta-auth-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 420px;
  text-align: center;
}

.ta-auth-hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--brand-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 12px 30px rgba(70, 95, 255, 0.4);
}

.ta-auth-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.ta-auth-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e0e7ff;
}

/* PANTALLA DE LOGIN */
.login-body {
  display: block;
  min-height: 100vh;
}

.login-wrapper {
  width: 100%;
  max-width: 480px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-icon {
  font-size: 22px;
  background: var(--primary);
  color: #ffffff;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-title span {
  color: var(--brand-400);
}

html[data-theme="light"] .brand-title span {
  color: var(--brand-600);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.legal-pill {
  display: inline-block;
  background: rgba(70, 95, 255, 0.1);
  border: 1px solid rgba(70, 95, 255, 0.25);
  color: var(--brand-400);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}

html[data-theme="light"] .legal-pill {
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: var(--brand-200);
}

.login-intro { margin-bottom: 22px; }
.login-intro h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.login-intro p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-form .form-group { margin-bottom: 18px; }
.login-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  color: var(--text-faint);
  pointer-events: none;
}

.input-icon-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px 11px 42px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

.input-icon-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-primary-block {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease;
  margin-top: 8px;
}

.btn-primary-block:hover { background: var(--primary-hover); }
.btn-primary-block:disabled { opacity: 0.6; cursor: not-allowed; }

.demo-box {
  margin-top: 22px;
  background: var(--bg-card);
  border: 1px dashed var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 8px;
}

.btn-demo-pill {
  background: var(--amber-bg);
  border: 1px solid rgba(247, 144, 9, 0.35);
  color: var(--amber);
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.demo-creds {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.demo-creds code {
  font-family: var(--font-mono);
  color: var(--text-main);
  background: var(--bg-card-subtle);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.login-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.alert-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 18px;
}

.alert-error {
  background: var(--rose-bg);
  border: 1px solid rgba(240, 68, 56, 0.35);
  color: #f97066;
}

html[data-theme="light"] .alert-error { color: #b42318; }

.hidden { display: none !important; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* DASHBOARD CONTADOR */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 36px;
  width: 100%;
}

.app-header {
  display: none;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.accountant-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}

.accountant-avatar { font-size: 18px; }
.accountant-name { font-size: 12.5px; font-weight: 700; color: var(--text-main); }
.accountant-cpc { font-size: 10.5px; font-weight: 600; color: var(--brand-400); font-family: var(--font-mono); }

.btn-logout {
  background: var(--rose-bg);
  border: 1px solid rgba(240, 68, 56, 0.3);
  color: #f97066;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

html[data-theme="light"] .btn-logout { color: #b42318; }

/* STATS CARDS TAILADMIN */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.stat-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* CARTERA */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.merchants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.merchant-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.merchant-card:hover {
  border-color: var(--brand-400);
  transform: translateY(-2px);
}

.merchant-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.merchant-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.merchant-rif {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--brand-400);
}

html[data-theme="light"] .merchant-rif { color: var(--brand-600); }

.badge-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.badge-online { background: var(--emerald-bg); color: #32d583; border: 1px solid rgba(18, 183, 106, 0.3); }
.badge-offline { background: var(--amber-bg); color: #fdb022; border: 1px solid rgba(247, 144, 9, 0.3); }
html[data-theme="light"] .badge-online { color: #027a48; }
html[data-theme="light"] .badge-offline { color: #b54708; }

.merchant-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
}

.meta-item { display: flex; flex-direction: column; }
.meta-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.meta-val { font-size: 12px; font-weight: 600; color: var(--text-main); }

.btn-audit {
  width: 100%;
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.btn-audit:hover { background: var(--primary-hover); }

/* WORKSPACE AUDITORIA */
.audit-workspace {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.workspace-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn-back {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-back:hover { border-color: var(--primary); }

.workspace-selector-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.client-select-dropdown {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
}

.client-select-dropdown:focus { outline: none; border-color: var(--primary); }

.module-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover { background: var(--bg-card-hover); color: var(--text-main); }
.tab-btn.active { background: var(--primary); color: #ffffff; }

.tab-content-panel { display: none; }
.tab-content-panel.active { display: block; }

.audit-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}

.audit-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.audit-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }

.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.btn-tool {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-tool:hover { border-color: var(--brand-400); background: var(--bg-card-hover); }
.btn-tool.primary { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.btn-tool.primary:hover { background: var(--primary-hover); }
.btn-tool.emerald { background: var(--emerald-bg); border-color: rgba(18, 183, 106, 0.35); color: #32d583; }
html[data-theme="light"] .btn-tool.emerald { color: #027a48; }
.btn-tool:disabled { opacity: 0.45; cursor: not-allowed; }

.policy-banner {
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  border: 1px solid var(--border);
}

.policy-banner.gracia { background: var(--amber-bg); border-color: rgba(247, 144, 9, 0.35); color: #fdb022; }
.policy-banner.activo { background: var(--emerald-bg); border-color: rgba(18, 183, 106, 0.35); color: #32d583; }
.policy-banner.vencido { background: var(--rose-bg); border-color: rgba(240, 68, 56, 0.35); color: #f97066; }

html[data-theme="light"] .policy-banner.gracia { color: #b54708; }
html[data-theme="light"] .policy-banner.activo { color: #027a48; }
html[data-theme="light"] .policy-banner.vencido { color: #b42318; }

.kpi-grid-compact { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-mini { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.kpi-mini-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.kpi-mini-val { font-size: 18px; font-weight: 700; color: var(--text-main); margin-top: 4px; font-family: var(--font-mono); }
.kpi-mini-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.audit-finding {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-card); margin-bottom: 8px; font-size: 12px;
}
.audit-finding.critico { border-color: rgba(240, 68, 56, 0.45); background: var(--rose-bg); }
.audit-finding.advertencia { border-color: rgba(247, 144, 9, 0.45); background: var(--amber-bg); }

.pill-vencido { background: var(--rose-bg); border: 1px solid rgba(240, 68, 56, 0.35); color: #f97066; }
.pill-gracia { background: var(--amber-bg); border: 1px solid rgba(247, 144, 9, 0.35); color: #fdb022; }
html[data-theme="light"] .pill-vencido { color: #b42318; }
html[data-theme="light"] .pill-gracia { color: #b54708; }

/* Tablas generadas en reportes */
.data-table, table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, table th {
  background: var(--bg-card); color: var(--text-muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left;
}
.data-table td, table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }

/* Responsive Sidebar Mobile */
@media (max-width: 1024px) {
  .ta-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  .ta-shell.sidebar-open .ta-sidebar {
    transform: translateX(0);
    width: 268px;
  }
  .ta-shell.sidebar-open .ta-sidebar-overlay {
    display: block;
  }
  .app-container {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .merchants-grid {
    grid-template-columns: 1fr;
  }
  .ta-topbar {
    position: relative;
    padding: 10px 14px;
    gap: 8px;
  }
  .ta-topbar-left {
    flex: 1 1 100%;
  }
  .ta-topbar-left span {
    display: none;
  }
  .ta-topbar-sub {
    display: none;
  }
  .app-header-right {
    width: 100%;
    justify-content: space-between;
  }
  .app-header-right .btn-tool,
  .app-header-right .btn-logout {
    padding: 7px 10px;
    font-size: 11.5px;
  }
  .accountant-badge {
    padding: 4px 10px;
  }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }
  .audit-card,
  .merchant-card {
    padding: 16px;
  }
  .action-bar {
    flex-direction: column;
  }
  .action-bar .btn-tool {
    width: 100%;
    justify-content: center;
  }
  .data-table,
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  #modal-plan-profesional div[style*="grid-template-columns"],
  #modal-contador-2fa div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  #modal-plan-profesional div[style*="display:flex"],
  #modal-contador-2fa div[style*="display:flex"] {
    flex-wrap: wrap;
  }
}


/* ============================================================================
   SANDBOX CONTABLE MULTI-EMPRESA, FLUJO GUIADO & PANEL DE REPORTES
   ============================================================================ */

.guide-hero {
  background: linear-gradient(135deg, rgba(70, 95, 255, 0.14), rgba(18, 183, 106, 0.08));
  border: 1px solid rgba(70, 95, 255, 0.28);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 22px;
}

.guide-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.guide-hero-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.guide-hero-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.guide-step-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.guide-step-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-step-text strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-main);
  margin-bottom: 2px;
}

.guide-step-text span {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.sandbox-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.sandbox-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.sandbox-progress-wrap {
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}

.sandbox-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.sandbox-progress-track {
  height: 9px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.sandbox-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--emerald));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.sandbox-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.sandbox-card.is-disabled {
  opacity: 0.72;
  border-style: dashed;
}

.sandbox-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}

.sbx-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
}

.sbx-pill.ok { background: var(--emerald-bg); border-color: rgba(18, 183, 106, 0.35); color: #32d583; }
.sbx-pill.warn { background: var(--amber-bg); border-color: rgba(247, 144, 9, 0.35); color: #fdb022; }
.sbx-pill.crit { background: var(--rose-bg); border-color: rgba(240, 68, 56, 0.35); color: #f97066; }
.sbx-pill.info { background: rgba(70, 95, 255, 0.14); border-color: rgba(70, 95, 255, 0.35); color: #9cb9ff; }

html[data-theme="light"] .sbx-pill.ok { color: #027a48; }
html[data-theme="light"] .sbx-pill.warn { color: #b54708; }
html[data-theme="light"] .sbx-pill.crit { color: #b42318; }
html[data-theme="light"] .sbx-pill.info { color: #3538cd; }

.workflow-stepper {
  background: var(--bg-card-subtle);
  border: 1px solid rgba(70, 95, 255, 0.32);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.workflow-steps-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.wf-step-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.wf-step-btn:hover { border-color: var(--primary); color: var(--text-main); }
.wf-step-btn.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.diag-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.diag-col h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.finding-ok {
  border-color: rgba(18, 183, 106, 0.32);
  background: var(--emerald-bg);
}

.asiento-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.asiento-card.descuadrado {
  border-color: rgba(240, 68, 56, 0.55);
  background: var(--rose-bg);
}

.asiento-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.sbx-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sbx-modal-overlay.hidden { display: none !important; }

.sbx-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.sbx-modal-box.wide { max-width: 860px; }

.sbx-form-row { margin-bottom: 12px; }
.sbx-form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.sbx-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
}

.sbx-input:focus { outline: none; border-color: var(--primary); }

.sbx-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  max-width: 420px;
}

.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-pill-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* ============================================================================
   PULIDO ESTÉTICO, RESPONSIVE Y LAYOUT (AUDITORÍA UI/UX PORTAL CONTADOR)
   ============================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

.ta-sidebar-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ta-sidebar-close {
  display: none;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ta-sidebar .brand-badge {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.ta-sidebar .brand-title {
  font-size: 15.5px;
  line-height: 1.2;
}

.ta-sidebar .brand-sub {
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.ta-topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.ta-topbar-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-select-dropdown,
.sbx-input,
#modal-plan-profesional select,
#modal-plan-profesional input,
#modal-contador-2fa input,
#modal-corregir-doc input,
#modal-corregir-doc select,
#modal-editar-asiento input,
#modal-editar-asiento select,
#modal-procesar-periodo input {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.prof-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.sbx-modal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.sbx-modal-grid-2 > * {
  min-width: 0;
  width: 100%;
}

.sbx-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.25;
  vertical-align: middle;
}

.merchants-grid {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

.kpi-grid-compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.module-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
  gap: 6px;
  padding-bottom: 12px;
}

.tab-btn {
  padding: 8px 13px;
  font-size: 12px;
}

.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table td, .data-table th {
  vertical-align: middle;
}

.asiento-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(88px, 0.85fr) minmax(88px, 0.85fr) auto;
  gap: 8px;
  align-items: center;
}

.asiento-edit-field label.mob-lbl {
  display: none;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}

@media (max-width: 1100px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .ta-sidebar-close {
    display: inline-flex;
  }
}

@media (max-width: 768px) {
  .ta-topbar {
    position: sticky;
    top: 0;
    padding: 8px 12px;
    gap: 6px;
  }
  .ta-topbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }
  .ta-topbar-title {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ta-topbar-left span {
    display: inline;
  }
  .app-header-right {
    width: 100%;
    gap: 6px;
    justify-content: space-between;
  }
  .accountant-badge {
    padding: 4px 8px;
    gap: 6px;
    min-width: 0;
  }
  .accountant-name {
    font-size: 11.5px;
    max-width: 135px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #btn-abrir-plan-profesional {
    display: none;
  }
  .module-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .asiento-edit-row {
    grid-template-columns: 1fr 1fr auto;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
  }
  .asiento-edit-row .col-cta,
  .asiento-edit-row .col-glosa {
    grid-column: 1 / -1;
  }
  .asiento-edit-field label.mob-lbl {
    display: block;
  }
}

@media (max-width: 640px) {
  .sbx-modal-grid-2 {
    grid-template-columns: 1fr;
  }
  .kpi-grid-4,
  .kpi-grid-compact {
    grid-template-columns: 1fr;
  }
}

@media print {
  .ta-sidebar, .ta-topbar, .workflow-stepper, .module-tabs, .action-bar, .no-print {
    display: none !important;
  }
  .ta-main, .app-container {
    margin: 0 !important;
    padding: 0 !important;
  }
  .audit-card, .sandbox-panel {
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }
}
