/* ============================================================
   PortalTerceros.css — Portal Premium de Terceros
   Prefijo: .tp- (terceros-portal)
   Usa CSS Variables de iEnTop.css (data-theme)
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Base Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── Module Variables ── */
:root {
  --tp-glass-bg: rgba(255,255,255,0.03);
  --tp-glass-border: rgba(255,255,255,0.08);
  --tp-glass-blur: 12px;
  --tp-sidebar-width: 260px;
  --tp-sidebar-collapsed: 68px;
  --tp-header-height: 64px;
  --tp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   LOGIN VIEW
   ============================================================ */
.tp-login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  position: relative;
  overflow: hidden;
}

.tp-login-wrapper::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, 
    rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, 
    rgba(168,85,247,0.06) 0%, transparent 50%);
  animation: tp-aurora 20s ease-in-out infinite alternate;
}

@keyframes tp-aurora {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-5%, 3%) rotate(3deg); }
}

.tp-login-card {
  position: relative;
  z-index: 2;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  backdrop-filter: blur(var(--tp-glass-blur));
}

.tp-login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.tp-login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(99,102,241,0.3);
}

.tp-login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.tp-login-subtitle {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.tp-login-field {
  margin-bottom: 20px;
}

.tp-login-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.tp-login-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--tp-transition);
}

.tp-login-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.tp-login-input::placeholder {
  color: var(--color-text-muted);
}

.tp-login-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--tp-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}

.tp-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}

.tp-login-btn:active {
  transform: translateY(0);
}

.tp-login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.tp-login-footer a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}

.tp-login-sent {
  text-align: center;
  padding: 20px 0;
}

.tp-login-sent-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}

.tp-login-sent h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 8px;
}

.tp-login-sent p {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ============================================================
   APP SHELL — Sidebar + Header + Content
   ============================================================ */
.tp-app {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg-primary);
}

/* ── Sidebar ── */
.tp-sidebar {
  width: var(--tp-sidebar-width);
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.tp-sidebar.collapsed {
  width: var(--tp-sidebar-collapsed);
}

.tp-sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--tp-header-height);
  flex-shrink: 0;
}

.tp-sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.tp-sidebar-brand-text {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.tp-sidebar.collapsed .tp-sidebar-brand-text {
  opacity: 0;
  width: 0;
}

.tp-sidebar-brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.tp-sidebar-brand-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Sidebar Navigation ── */
.tp-sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.tp-sidebar-section {
  margin-bottom: 8px;
}

.tp-sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 8px 12px 4px;
  overflow: hidden;
  white-space: nowrap;
}

.tp-sidebar.collapsed .tp-sidebar-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
}

.tp-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--tp-transition);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.tp-nav-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.tp-nav-item.active {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-weight: 600;
}

.tp-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-accent);
}

.tp-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.tp-nav-item .tp-nav-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.tp-sidebar.collapsed .tp-nav-label {
  opacity: 0;
  width: 0;
}

.tp-nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--color-accent);
  color: #fff;
  min-width: 20px;
  text-align: center;
}

.tp-sidebar.collapsed .tp-nav-badge {
  display: none;
}

/* ── Sidebar Footer ── */
.tp-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.tp-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--tp-transition);
}

.tp-sidebar-user:hover {
  background: var(--color-bg-hover);
}

.tp-sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.tp-sidebar-user-info {
  overflow: hidden;
}

.tp-sidebar.collapsed .tp-sidebar-user-info {
  display: none;
}

.tp-sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-sidebar-user-role {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* ── Main Content Area ── */
.tp-main {
  flex: 1;
  margin-left: var(--tp-sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.tp-sidebar.collapsed ~ .tp-main {
  margin-left: var(--tp-sidebar-collapsed);
}

/* ── Header ── */
.tp-header {
  height: var(--tp-header-height);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(var(--tp-glass-blur));
}

.tp-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tp-header-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--tp-transition);
  font-size: 14px;
}

.tp-header-toggle:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.tp-header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.tp-header-breadcrumb span {
  color: var(--color-text-muted);
}

.tp-header-breadcrumb strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

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

.tp-header-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--tp-transition);
  font-size: 15px;
  position: relative;
}

.tp-header-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-accent);
}

.tp-header-btn .tp-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--color-bg-card);
}

/* ── Content Host ── */
.tp-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Section View ── */
.tp-view {
  display: none;
  animation: tp-fadeSlideIn 0.35s ease;
}

.tp-view.active {
  display: block;
}

@keyframes tp-fadeSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Section Header ── */
.tp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.tp-section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
}

.tp-section-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ============================================================
   KPI CARDS (Dashboard)
   ============================================================ */
.tp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.tp-kpi-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--tp-transition);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.tp-kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--kpi-color, var(--color-accent)), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tp-kpi-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.tp-kpi-card:hover::after { opacity: 1; }

.tp-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.tp-kpi-icon.blue    { background: rgba(59,130,246,0.12); color: #3b82f6; }
.tp-kpi-icon.green   { background: rgba(34,197,94,0.12);  color: #22c55e; }
.tp-kpi-icon.amber   { background: rgba(245,158,11,0.12); color: #f59e0b; }
.tp-kpi-icon.purple  { background: rgba(168,85,247,0.12); color: #a855f7; }
.tp-kpi-icon.red     { background: rgba(239,68,68,0.12);  color: #ef4444; }
.tp-kpi-icon.cyan    { background: rgba(6,182,212,0.12);  color: #06b6d4; }

.tp-kpi-body { flex: 1; }

.tp-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.tp-kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.tp-kpi-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.tp-kpi-sub.positive { color: #22c55e; }
.tp-kpi-sub.negative { color: #ef4444; }

/* ============================================================
   CARDS GENERIC
   ============================================================ */
.tp-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--tp-transition);
}

.tp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
}

.tp-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.tp-card-body {
  padding: 22px;
}

/* ============================================================
   TABLE (Mis Documentos)
   ============================================================ */
.tp-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  flex-wrap: wrap;
}

.tp-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 8px 14px;
  width: 280px;
  max-width: 100%;
  transition: var(--tp-transition);
}

.tp-search-box:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.tp-search-box i { color: var(--color-text-muted); font-size: 13px; }

.tp-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: var(--color-text-primary);
  width: 100%;
  font-family: inherit;
}

.tp-search-box input::placeholder { color: var(--color-text-muted); }

.tp-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 22px 14px;
}

.tp-filter-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--tp-transition);
}

.tp-filter-pill:hover { background: var(--color-bg-hover); }

.tp-filter-pill.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

table.tp-table {
  width: 100%;
  border-collapse: collapse;
}

table.tp-table thead th {
  padding: 10px 18px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

table.tp-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: var(--tp-transition);
}

table.tp-table tbody tr:hover { background: var(--color-bg-hover); }
table.tp-table tbody tr:last-child { border-bottom: none; }

table.tp-table tbody td {
  padding: 14px 18px;
  font-size: 0.86rem;
  color: var(--color-text-primary);
  vertical-align: middle;
}

.tp-doc-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tp-doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.tp-doc-icon.factura  { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.tp-doc-icon.presu   { background: rgba(168,85,247,0.12); color: #a855f7; }
.tp-doc-icon.pedido  { background: rgba(34,197,94,0.12);  color: #22c55e; }
.tp-doc-icon.albaran { background: rgba(245,158,11,0.12); color: #f59e0b; }
.tp-doc-icon.pdf     { background: rgba(239,68,68,0.12);  color: #ef4444; }

.tp-doc-name {
  font-weight: 600;
  color: var(--color-text-primary);
}

.tp-doc-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.tp-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Badges ── */
.tp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.tp-badge.emitida    { background: rgba(34,197,94,0.12);   color: #22c55e; }
.tp-badge.pendiente  { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.tp-badge.vencida    { background: rgba(239,68,68,0.12);   color: #ef4444; }
.tp-badge.borrador   { background: rgba(148,163,184,0.12); color: #94a3b8; }
.tp-badge.pagada     { background: rgba(6,182,212,0.12);   color: #06b6d4; }
.tp-badge.aceptado   { background: rgba(34,197,94,0.12);   color: #22c55e; }
.tp-badge.firmado    { background: rgba(34,197,94,0.12);   color: #22c55e; }
.tp-badge.en-firma   { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.tp-badge.rechazado  { background: rgba(239,68,68,0.12);   color: #ef4444; }
.tp-badge.expirado   { background: rgba(168,85,247,0.12);  color: #a855f7; }

.tp-badge i { font-size: 9px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.tp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--tp-transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.tp-btn-primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

.tp-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

.tp-btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.tp-btn-secondary:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
}

.tp-btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  padding: 8px 12px;
}

.tp-btn-ghost:hover {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.tp-btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ============================================================
   TIMELINE (Dashboard)
   ============================================================ */
.tp-timeline {
  position: relative;
  padding-left: 24px;
}

.tp-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.tp-timeline-item {
  position: relative;
  padding-bottom: 20px;
  padding-left: 20px;
}

.tp-timeline-item:last-child { padding-bottom: 0; }

.tp-timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--color-bg-card);
  z-index: 1;
}

.tp-timeline-dot.blue   { background: #3b82f6; }
.tp-timeline-dot.green  { background: #22c55e; }
.tp-timeline-dot.amber  { background: #f59e0b; }
.tp-timeline-dot.purple { background: #a855f7; }
.tp-timeline-dot.red    { background: #ef4444; }

.tp-timeline-text {
  font-size: 0.85rem;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.tp-timeline-time {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ============================================================
   PROFILE FORM
   ============================================================ */
.tp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tp-form-group {
  margin-bottom: 16px;
}

.tp-form-group.full { grid-column: 1 / -1; }

.tp-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tp-form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--tp-transition);
}

.tp-form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.tp-form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================================
   DOCUMENT GRID (Base Documental)
   ============================================================ */
.tp-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.tp-doc-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--tp-transition);
}

.tp-doc-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.tp-doc-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}

.tp-doc-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-doc-card-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.tp-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: 16px;
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--tp-transition);
}

.tp-upload-zone:hover,
.tp-upload-zone.dragover {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.tp-upload-zone i {
  font-size: 40px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  display: block;
}

.tp-upload-zone .tp-upload-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.tp-upload-zone .tp-upload-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.tp-upload-zone .tp-upload-link {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: underline;
}

/* ============================================================
   CATEGORY TABS
   ============================================================ */
.tp-cat-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.tp-cat-tabs::-webkit-scrollbar { display: none; }

.tp-cat-tab {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--tp-transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tp-cat-tab:hover { background: var(--color-bg-hover); }

.tp-cat-tab.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.tp-cat-count {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
}

.tp-cat-tab:not(.active) .tp-cat-count {
  background: var(--color-bg-hover);
  color: var(--color-text-muted);
}

/* ============================================================
   THEME SELECTOR (Profile)
   ============================================================ */
.tp-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.tp-theme-item {
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--color-border);
  cursor: pointer;
  transition: var(--tp-transition);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.tp-theme-item:hover { border-color: var(--color-accent); }

.tp-theme-item.active {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-weight: 700;
}

.tp-theme-swatch {
  width: 100%;
  height: 24px;
  border-radius: 6px;
  margin-bottom: 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .tp-sidebar {
    width: var(--tp-sidebar-collapsed);
  }
  .tp-sidebar .tp-nav-label,
  .tp-sidebar .tp-sidebar-brand-text,
  .tp-sidebar .tp-sidebar-section-label,
  .tp-sidebar .tp-nav-badge,
  .tp-sidebar .tp-sidebar-user-info {
    display: none;
  }
  .tp-main {
    margin-left: var(--tp-sidebar-collapsed);
  }
  .tp-content { padding: 16px; }
  .tp-kpi-grid { grid-template-columns: 1fr 1fr; }
  .tp-form-grid { grid-template-columns: 1fr; }
  .tp-table-toolbar { flex-direction: column; align-items: stretch; }
  .tp-search-box { width: 100%; }
}

@media (max-width: 480px) {
  .tp-kpi-grid { grid-template-columns: 1fr; }
  .tp-doc-grid { grid-template-columns: 1fr 1fr; }
  .tp-sidebar { display: none; }
  .tp-main { margin-left: 0; }
}

/* ────────────────────────────────────────────────────────────
   Modales auth (2FA, forgot password, forced change)
   ──────────────────────────────────────────────────────────── */
.tp-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.78);              /* overlay opaco — oculta lo de detrás */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.tp-modal-card {
  width: 100%; max-width: 440px;
  /* Color sólido (no var) para garantizar opacidad en cualquier tema */
  background: #1f2937;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 26px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  position: relative;
  z-index: 10000;
}
.tp-modal-card h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.05rem; font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}
.tp-modal-card h3 i { color: #6366f1; }
