/* ============================================================
   TheCarv SSO — Design System
   Tema: Claro, moderno e profissional
   ============================================================ */

:root {
  --tc-primary:        #0a5e2a;
  --tc-primary-dark:   #084a21;
  --tc-primary-light:  #eaf4ec;
  --tc-secondary:      #ffc20f;
  --tc-accent:         #b88700;
  --tc-yellow:         #ffc20f;
  --tc-yellow-dark:    #e2ab00;
  --tc-yellow-soft:    #fff2c2;

  --tc-bg:             #f4f4f4;
  --tc-surface:        #ffffff;
  --tc-surface-2:      #e7e7e7;
  --tc-border:         #d0d0d0;
  --tc-border-light:   #e1e1e1;

  --tc-text:           #1f3528;
  --tc-text-muted:     #5f6b63;
  --tc-text-light:     #8a948e;

  --tc-success:        #16a34a;
  --tc-warning:        #d97706;
  --tc-danger:         #dc2626;

  --tc-sidebar-w:      270px;
  --tc-topbar-h:       64px;
  --tc-radius:         12px;
  --tc-radius-sm:      8px;
  --tc-shadow:         0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --tc-shadow-md:      0 4px 24px rgba(0,0,0,.10);

  --tc-font:           'Inter', system-ui, -apple-system, sans-serif;
  --tc-transition:     .18s ease;
}

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

body {
  font-family: var(--tc-font);
  background: var(--tc-bg);
  color: var(--tc-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--tc-primary); }
a:hover { color: var(--tc-primary-dark); }
code { font-size: .875em; background: var(--tc-surface-2); padding: .15em .4em; border-radius: 4px; }

/* ============================================================
   PÁGINA DE LOGIN
   ============================================================ */

.tc-login-page {
  display: flex;
  min-height: 100vh;
}

/* Branding esquerdo */
.tc-login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  background: linear-gradient(140deg, #0a5e2a 0%, #0f6d33 52%, #ffc20f 125%);
  color: #fff;
  width: 42%;
  position: relative;
  overflow: hidden;
}

.tc-login-brand::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}

.tc-login-brand::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.tc-brand-content { position: relative; z-index: 1; }

.tc-logo-mark {
  display: inline-flex;
  margin-bottom: 1.5rem;
}

.tc-logo-icon {
  width: 64px; height: 64px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  backdrop-filter: blur(8px);
}

.tc-brand-name {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: #fff;
  margin-bottom: .25rem;
}

.tc-brand-tagline {
  font-size: 1.05rem;
  opacity: .75;
  margin-bottom: 3rem;
}

.tc-brand-features { display: flex; flex-direction: column; gap: .875rem; }

.tc-feature-item {
  display: flex; align-items: center; gap: .75rem;
  font-size: .95rem;
  opacity: .9;
}

.tc-feature-item i {
  color: #86efac;
  font-size: 1rem;
  flex-shrink: 0;
}

.tc-brand-footer {
  position: relative; z-index: 1;
  font-size: .8rem;
  opacity: .5;
}

/* Área do formulário */
.tc-login-form-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--tc-bg);
}

.tc-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--tc-surface);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow-md);
  padding: 2.5rem;
  border: 1px solid var(--tc-border);
}

.tc-mobile-logo {
  display: none;
  align-items: center;
  gap: .5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--tc-primary);
  margin-bottom: 1.5rem;
}

.tc-mobile-logo i { font-size: 1.5rem; }

.tc-card-header { margin-bottom: 1.75rem; }
.tc-card-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--tc-text); margin-bottom: .25rem; }
.tc-card-header p { color: var(--tc-text-muted); font-size: .925rem; }

/* Indicador de etapas */
.tc-steps-indicator {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.tc-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  color: var(--tc-text-light);
}

.tc-step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--tc-surface-2);
  border: 2px solid var(--tc-border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  transition: var(--tc-transition);
}

.tc-step-active .tc-step-dot {
  background: var(--tc-primary);
  border-color: var(--tc-primary);
  color: #fff;
}

.tc-step-done .tc-step-dot {
  background: var(--tc-success);
  border-color: var(--tc-success);
  color: #fff;
}

.tc-step-done, .tc-step-active { color: var(--tc-text); }

.tc-step-line {
  flex: 1;
  height: 2px;
  background: var(--tc-border);
  margin: 0 .5rem;
  margin-bottom: 1.1rem;
}

/* Formulário */
.tc-form { display: flex; flex-direction: column; gap: 1.125rem; }

.tc-field { display: flex; flex-direction: column; gap: .4rem; }

.tc-field label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--tc-text-muted);
  display: flex;
  align-items: center;
  gap: .375rem;
}

.tc-input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--tc-border);
  border-radius: var(--tc-radius-sm);
  font-size: .975rem;
  font-family: var(--tc-font);
  color: var(--tc-text);
  background: var(--tc-surface);
  outline: none;
  transition: border-color var(--tc-transition), box-shadow var(--tc-transition);
}

.tc-input:focus {
  border-color: var(--tc-primary);
  box-shadow: 0 0 0 3px rgba(10,94,42,.12);
}

.tc-input-error {
  border-color: var(--tc-danger);
}

.tc-input-error:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

.tc-input-sm { padding: .45rem .75rem; font-size: .875rem; }

.tc-input-group { position: relative; }
.tc-input-group .tc-input { padding-right: 2.75rem; }

.tc-toggle-password {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--tc-text-muted);
  cursor: pointer;
  padding: 0;
  font-size: .95rem;
  transition: color var(--tc-transition);
}

.tc-toggle-password:hover { color: var(--tc-text); }

.tc-field-error {
  font-size: .8rem;
  color: var(--tc-danger);
  display: flex;
  align-items: center;
  gap: .25rem;
}

.tc-form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--tc-radius-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--tc-danger);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Botões */
.tc-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  background: var(--tc-yellow);
  color: var(--tc-primary-dark);
  border: none;
  border-radius: var(--tc-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--tc-font);
  cursor: pointer;
  transition: background var(--tc-transition), transform var(--tc-transition), box-shadow var(--tc-transition);
  text-decoration: none;
  width: 100%;
}

.tc-btn-primary:hover {
  background: var(--tc-yellow-dark);
  color: var(--tc-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255,194,15,.35);
}

.tc-btn-primary:active { transform: none; }

.tc-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.2rem;
  background: transparent;
  color: var(--tc-primary);
  border: 1.5px solid var(--tc-primary);
  border-radius: var(--tc-radius-sm);
  font-size: .925rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tc-transition);
  font-family: var(--tc-font);
  text-decoration: none;
}

.tc-btn-outline:hover {
  background: var(--tc-primary-light);
  color: var(--tc-primary-dark);
}

/* 2FA helper */
.tc-2fa-icon {
  text-align: center;
  font-size: 2.5rem;
  color: var(--tc-primary);
  margin-bottom: .5rem;
}

.tc-2fa-hint {
  text-align: center;
  font-size: .875rem;
  color: var(--tc-text-muted);
  margin-bottom: .5rem;
}

.tc-input-otp {
  font-size: 1.5rem;
  letter-spacing: .75rem;
  text-align: center;
  font-weight: 700;
}

/* Links do card */
.tc-card-footer {
  margin-top: 1.25rem;
  text-align: center;
}

.tc-link-muted { color: var(--tc-text-muted); font-size: .875rem; }
.tc-link-muted:hover { color: var(--tc-primary); }

.tc-alt-action { text-align: center; margin-top: .75rem; font-size: .875rem; }

/* Alert */
.tc-alert {
  border-radius: var(--tc-radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
}

.tc-lockout-icon {
  text-align: center;
  font-size: 3rem;
  color: var(--tc-danger);
  margin: 1rem 0;
}

.tc-lockout-info {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--tc-radius-sm);
  padding: 1rem;
  text-align: center;
  font-size: .9rem;
  color: #7f1d1d;
  margin-bottom: 1.5rem;
}

/* ============================================================
   PORTAL — LAYOUT PRINCIPAL (sidebar + conteúdo)
   ============================================================ */

.tc-portal {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.tc-sidebar {
  width: var(--tc-sidebar-w);
  background: var(--tc-surface);
  border-right: 1px solid var(--tc-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--tc-transition);
}

.tc-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 0;
}

/* Logo sidebar */
.tc-sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--tc-border-light);
}

.tc-sidebar-logo-icon {
  width: 40px; height: 40px;
  background: var(--tc-yellow);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--tc-primary-dark);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tc-sidebar-logo-name {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tc-text);
  line-height: 1.2;
}

.tc-sidebar-logo-sub {
  display: block;
  font-size: .7rem;
  color: var(--tc-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 500;
}

/* Usuário sidebar */
.tc-sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--tc-surface-2);
  border-bottom: 1px solid var(--tc-border);
}

.tc-user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--tc-yellow);
  display: flex; align-items: center; justify-content: center;
  color: var(--tc-primary-dark);
  font-size: .9rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.tc-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.tc-user-info { min-width: 0; }
.tc-user-info strong { display: block; font-size: .875rem; font-weight: 600; color: var(--tc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-user-info small { font-size: .75rem; color: var(--tc-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Navegação */
.tc-sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .125rem;
}

.tc-nav-section-title {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--tc-text-light);
  padding: .75rem .5rem .25rem;
}

.tc-nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: var(--tc-radius-sm);
  color: var(--tc-text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--tc-transition);
  position: relative;
}

.tc-nav-item:hover {
  background: var(--tc-surface-2);
  color: var(--tc-text);
  text-decoration: none;
}

.tc-nav-item.active {
  background: var(--tc-yellow-soft);
  color: var(--tc-primary);
  font-weight: 600;
}

.tc-nav-item.active i { color: var(--tc-primary); }

.tc-nav-item i { font-size: 1rem; width: 18px; text-align: center; }

.tc-nav-ext { margin-left: auto; font-size: .7rem; opacity: .5; }

.tc-sidebar-bottom {
  padding: .75rem;
  border-top: 1px solid var(--tc-border);
}

.tc-nav-logout {
  color: var(--tc-danger) !important;
}

.tc-nav-logout:hover {
  background: #fef2f2 !important;
  color: var(--tc-danger) !important;
}

/* ── Área principal ────────────────────────────────────── */
.tc-main {
  margin-left: var(--tc-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.tc-topbar {
  height: var(--tc-topbar-h);
  background: linear-gradient(180deg, #fff8da 0%, #fff 100%);
  border-bottom: 1px solid #f1d271;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.tc-topbar-left { display: flex; align-items: center; gap: 1rem; }

.tc-sidebar-toggle {
  background: none;
  border: none;
  color: var(--tc-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: .4rem;
  border-radius: 6px;
  display: none;
  transition: color var(--tc-transition);
}

.tc-sidebar-toggle:hover { color: var(--tc-text); }

.tc-sidebar-toggle:hover { background: var(--tc-yellow-soft); }

.tc-breadcrumb {
  font-size: .9rem;
  color: var(--tc-text-muted);
  display: flex;
  align-items: center;
  gap: .375rem;
}

.tc-breadcrumb-link { color: var(--tc-text-muted); }
.tc-breadcrumb-link:hover { color: var(--tc-primary); }
.tc-breadcrumb-sep { font-size: .65rem; opacity: .5; }

.tc-topbar-right { display: flex; align-items: center; gap: 1rem; }

.tc-topbar-user { display: flex; align-items: center; gap: .625rem; }

.tc-topbar-avatar {
  width: 34px; height: 34px;
  background: var(--tc-yellow);
  color: var(--tc-primary-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
}

.tc-topbar-name { font-size: .875rem; font-weight: 500; color: var(--tc-text); }

/* Conteúdo */
.tc-content {
  padding: 2rem 1.75rem;
  flex: 1;
}

/* Cabeçalho de página */
.tc-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.tc-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tc-text);
  margin-bottom: .25rem;
}

.tc-page-subtitle {
  font-size: .95rem;
  color: var(--tc-text-muted);
}

/* Stats */
.tc-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.tc-stat-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--tc-shadow);
}

.tc-stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tc-stat-info { min-width: 0; }
.tc-stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--tc-text); line-height: 1.2; }
.tc-stat-label { display: block; font-size: .78rem; color: var(--tc-text-muted); font-weight: 500; }

/* Seção */
.tc-section { margin-bottom: 2rem; }

.tc-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--tc-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.tc-section-title i { color: var(--tc-text-muted); font-size: .9rem; }

/* ── Cards de sistema ──────────────────────────────────── */
.tc-systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.tc-system-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow);
  cursor: pointer;
  transition: transform var(--tc-transition), box-shadow var(--tc-transition), border-color var(--tc-transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  padding-top: calc(1.5rem + 4px);
}

.tc-system-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tc-shadow-md);
  border-color: var(--tc-primary);
}

.tc-system-card-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

.tc-system-card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.tc-system-card-body { flex: 1; }

.tc-system-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}

.tc-system-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tc-text);
  margin: 0;
}

.tc-system-badges {
  display: flex;
  gap: .375rem;
  flex-wrap: wrap;
}

.tc-system-desc {
  font-size: .855rem;
  color: var(--tc-text-muted);
  line-height: 1.5;
  margin-bottom: .75rem;
}

.tc-system-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border-top: 1px solid var(--tc-border-light);
  padding-top: .875rem;
  margin-top: .875rem;
}

.tc-system-url {
  font-size: .78rem;
  color: var(--tc-text-light);
  display: flex;
  align-items: center;
  gap: .375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.tc-system-open {
  font-size: .8rem;
  font-weight: 600;
  color: var(--tc-primary);
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--tc-transition);
}

.tc-system-card:hover .tc-system-open { opacity: 1; }

/* Badges */
.tc-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.tc-badge-admin { background: #fefce8; color: #92400e; }
.tc-badge-2fa   { background: #f0fdf4; color: #15803d; }

/* Estado vazio */
.tc-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--tc-text-muted);
}

.tc-empty-icon {
  font-size: 3.5rem;
  color: var(--tc-text-light);
  margin-bottom: 1rem;
}

.tc-empty-state h3 { font-size: 1.25rem; font-weight: 600; color: var(--tc-text); margin-bottom: .5rem; }
.tc-empty-state p { font-size: .95rem; }

/* ── DB Explorer ───────────────────────────────────────── */
.tc-table-filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tc-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.tc-search-wrap i {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tc-text-muted);
  font-size: .875rem;
}

.tc-search-wrap .tc-input { padding-left: 2.5rem; }

.tc-table-grid {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.tc-table-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-sm);
  transition: all var(--tc-transition);
  color: var(--tc-text);
  box-shadow: var(--tc-shadow);
}

.tc-table-card:hover {
  border-color: var(--tc-primary);
  color: var(--tc-text);
  text-decoration: none;
  box-shadow: var(--tc-shadow-md);
  transform: translateX(3px);
}

.tc-table-card-icon {
  width: 38px; height: 38px;
  background: var(--tc-primary-light);
  color: var(--tc-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}

.tc-table-card-info { flex: 1; min-width: 0; }
.tc-table-name { font-size: .95rem; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-table-meta { display: flex; gap: 1rem; font-size: .78rem; color: var(--tc-text-muted); margin-top: .15rem; }
.tc-table-meta span { display: flex; align-items: center; gap: .25rem; }

.tc-table-card-arrow { color: var(--tc-text-light); font-size: .8rem; flex-shrink: 0; }

/* ── Tabela de dados ────────────────────────────────────── */
.tc-data-table-wrap {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}

.tc-data-table-scroll { overflow-x: auto; }

.tc-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.tc-data-table thead {
  background: var(--tc-surface-2);
  border-bottom: 2px solid var(--tc-border);
}

.tc-data-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--tc-text-muted);
  white-space: nowrap;
}

.tc-data-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--tc-border-light);
  color: var(--tc-text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-data-table tbody tr:hover { background: var(--tc-surface-2); }
.tc-data-table tbody tr:last-child td { border-bottom: none; }

.tc-null { color: var(--tc-text-light); font-style: italic; font-size: .8rem; }

.tc-table-empty {
  text-align: center;
  padding: 3rem;
  color: var(--tc-text-muted);
}

.tc-table-empty i { display: block; font-size: 2rem; margin-bottom: .5rem; }

/* Paginação */
.tc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .75rem 0;
}

.tc-pagination-info { font-size: .85rem; color: var(--tc-text-muted); }

.tc-pagination-controls { display: flex; gap: .375rem; }

.tc-page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid var(--tc-border);
  background: var(--tc-surface);
  color: var(--tc-text);
  transition: all var(--tc-transition);
  text-decoration: none;
}

.tc-page-btn:hover { border-color: var(--tc-primary); color: var(--tc-primary); }
.tc-page-btn-active { background: var(--tc-primary); border-color: var(--tc-primary); color: #fff; font-weight: 600; }
.tc-page-btn-active:hover { color: #fff; }
.tc-page-btn-disabled { opacity: .4; cursor: not-allowed; }

/* ── Perfil ────────────────────────────────────────────── */
.tc-profile-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.tc-profile-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow);
  padding: 2rem 1.5rem;
  text-align: center;
}

.tc-profile-avatar-wrap { margin-bottom: 1rem; }

.tc-profile-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--tc-primary);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  overflow: hidden;
}

.tc-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.tc-profile-name { font-size: 1.2rem; font-weight: 700; margin-bottom: .25rem; }
.tc-profile-email { font-size: .875rem; color: var(--tc-text-muted); margin-bottom: .25rem; }
.tc-profile-role { font-size: .825rem; color: var(--tc-text-light); margin-bottom: 1rem; }

.tc-profile-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .375rem; margin-bottom: 1.5rem; }

.tc-2fa-status {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem;
  background: var(--tc-surface-2);
  border-radius: var(--tc-radius-sm);
  text-align: left;
  font-size: .875rem;
}

.tc-2fa-status-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tc-2fa-on { background: #f0fdf4; color: var(--tc-success); }
.tc-2fa-off { background: #fff7ed; color: var(--tc-warning); }

/* Info grid */
.tc-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tc-info-item { display: flex; flex-direction: column; gap: .2rem; }
.tc-info-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--tc-text-muted); }
.tc-info-value { font-size: .925rem; color: var(--tc-text); }

/* Action list */
.tc-action-list { display: flex; flex-direction: column; gap: .5rem; }
.tc-action-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-sm);
  transition: all var(--tc-transition);
  color: var(--tc-text);
  font-size: .9rem;
}

.tc-action-item:hover { border-color: var(--tc-primary); background: var(--tc-primary-light); text-decoration: none; color: var(--tc-text); }
.tc-action-item > i:first-child { font-size: 1.25rem; flex-shrink: 0; }
.tc-action-item > div { flex: 1; }
.tc-action-item > div strong { display: block; font-weight: 600; }
.tc-action-item > div small { color: var(--tc-text-muted); font-size: .8rem; }
.tc-action-item > i:last-child { color: var(--tc-text-light); font-size: .8rem; }

/* Erro 403 / Error page */
.tc-error-page { text-align: center; padding: 5rem 2rem; }
.tc-error-icon { font-size: 4rem; margin-bottom: 1rem; }
.tc-error-page h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.tc-error-page p { color: var(--tc-text-muted); margin-bottom: 1.5rem; }

/* Alert inline */
.tc-alert-inline { margin-bottom: 1.5rem; }

/* Overlay mobile */
.tc-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

.tc-overlay-visible { display: block; }

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 1024px) {
  .tc-sidebar {
    transform: translateX(calc(-1 * var(--tc-sidebar-w)));
  }

  .tc-sidebar.tc-sidebar-open {
    transform: translateX(0);
    box-shadow: var(--tc-shadow-md);
  }

  .tc-main { margin-left: 0; }
  .tc-sidebar-toggle { display: flex; }
  .tc-topbar-name { display: none; }
}

@media (max-width: 768px) {
  .tc-login-page { flex-direction: column; }
  .tc-login-brand { width: 100%; min-height: 220px; padding: 2rem; }
  .tc-brand-features { display: none; }
  .tc-brand-name { font-size: 2rem; }
  .tc-brand-tagline { margin-bottom: 0; }
  .tc-mobile-logo { display: flex; }
  .tc-login-card { padding: 1.75rem 1.25rem; }

  .tc-content { padding: 1.25rem 1rem; }
  .tc-page-title { font-size: 1.3rem; }
  .tc-systems-grid { grid-template-columns: 1fr; }
  .tc-stats-row { grid-template-columns: 1fr 1fr; }
  .tc-profile-layout { grid-template-columns: 1fr; }
  .tc-info-grid { grid-template-columns: 1fr; }
  .tc-pagination { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .tc-stats-row { grid-template-columns: 1fr; }
}

/* ============================================================
   ROLE BADGES — função do utilizador na sidebar
   ============================================================ */

.tc-role-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  margin-top: .25rem;
  letter-spacing: .2px;
}

.tc-role-admin     { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.tc-role-rh        { background: #eef7ef; color: #0a5e2a; border: 1px solid #c8dccb; }
.tc-role-marketing { background: #fff4cc; color: #7a5a00; border: 1px solid #f0d57d; }
.tc-role-gerente   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.tc-role-formador  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.tc-role-funcionario { background: var(--tc-surface-2); color: var(--tc-text-muted); border: 1px solid var(--tc-border); }

/* ============================================================
   DASHBOARD — Ações rápidas
   ============================================================ */

.tc-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .875rem;
}

.tc-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .625rem;
  padding: 1.25rem 1rem;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  text-align: center;
  color: var(--tc-text);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--tc-transition);
  box-shadow: var(--tc-shadow);
  text-decoration: none;
}

.tc-quick-action:hover {
  border-color: var(--tc-primary);
  transform: translateY(-2px);
  box-shadow: var(--tc-shadow-md);
  color: var(--tc-text);
  text-decoration: none;
}

.tc-quick-action i {
  font-size: 1.5rem;
}

/* ============================================================
   DB EXPLORER — Categorias
   ============================================================ */

.tc-db-category { margin-bottom: 2rem; }

.tc-db-category-title {
  display: flex;
  align-items: center;
  gap: .625rem;
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--tc-text-muted);
  margin-bottom: .875rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--tc-border-light);
}

.tc-db-category-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tc-db-category-count {
  margin-left: auto;
  background: var(--tc-surface-2);
  border: 1px solid var(--tc-border);
  border-radius: 20px;
  padding: .1rem .55rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--tc-text-muted);
}

.tc-table-badge-rows {
  background: var(--tc-surface-2);
  border: 1px solid var(--tc-border);
  border-radius: 20px;
  padding: .1rem .55rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--tc-text-muted);
  flex-shrink: 0;
}

.tc-table-card-right {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-shrink: 0;
}

/* ============================================================
   DB TABLE — Header icon + botões melhorados
   ============================================================ */

.tc-table-header-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.tc-btn-sm {
  padding: .45rem 1rem;
  font-size: .875rem;
}

/* ── Inline CRUD buttons ──────────────────────────────────── */

.tc-btn-icon {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  transition: all var(--tc-transition);
}

.tc-btn-edit   { background: #eaf4ec; color: #0a5e2a; }
.tc-btn-edit:hover { background: #0a5e2a; color: #fff; }

.tc-btn-delete { background: #fef2f2; color: #dc2626; }
.tc-btn-delete:hover { background: #dc2626; color: #fff; }

.tc-btn-save   { background: #f0fdf4; color: #16a34a; }
.tc-btn-save:hover { background: #16a34a; color: #fff; }

.tc-btn-cancel { background: var(--tc-surface-2); color: var(--tc-text-muted); }
.tc-btn-cancel:hover { background: var(--tc-border); color: var(--tc-text); }

.tc-actions-cell {
  display: flex;
  gap: .375rem;
  align-items: center;
  white-space: nowrap;
}

/* ── Editing row ──────────────────────────────────────────── */

.tc-row-editing {
  background: #fffbeb !important;
}

.tc-row-editing td {
  border-bottom: 1px solid #fde68a !important;
  vertical-align: middle;
}

.tc-input-inline {
  width: 100%;
  min-width: 80px;
  max-width: 220px;
  padding: .3rem .5rem;
  font-size: .8rem;
  border: 1.5px solid var(--tc-border);
  border-radius: 4px;
  outline: none;
  font-family: var(--tc-font);
  transition: border-color var(--tc-transition);
}

.tc-input-inline:focus { border-color: var(--tc-primary); }

.tc-input-select { cursor: pointer; }

.tc-input-textarea {
  resize: vertical;
  min-height: 42px;
}

/* ── PK / cell helpers ────────────────────────────────────── */

.tc-pk-value {
  font-weight: 700;
  color: var(--tc-text-muted);
  font-size: .8rem;
}

.tc-cell-long { cursor: help; }

.tc-cell-bool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: .7rem;
}

.tc-cell-bool-yes { background: #dcfce7; color: #16a34a; }
.tc-cell-bool-no  { background: #fee2e2; color: #dc2626; }

/* ============================================================
   DB PANEL — Drawer lateral de edição / criação
   ============================================================ */

.tc-db-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 440px;
  max-width: 96vw;
  background: var(--tc-surface);
  border-left: 1px solid var(--tc-border);
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.tc-db-panel.tc-panel-open {
  transform: translateX(0);
}

.tc-db-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 199;
  backdrop-filter: blur(2px);
}

.tc-db-panel-overlay.tc-panel-overlay-visible {
  display: block;
}

/* Panel inner — scrollable body */
.tc-db-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header */
.tc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--tc-border);
  flex-shrink: 0;
  background: var(--tc-surface);
}

.tc-panel-header-left {
  display: flex;
  align-items: center;
  gap: .875rem;
}

.tc-panel-header-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--tc-primary-light);
  color: var(--tc-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.tc-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tc-text);
  margin: 0 0 .1rem;
}

.tc-panel-subtitle {
  font-size: .78rem;
  color: var(--tc-text-muted);
  margin: 0;
}

.tc-panel-close {
  width: 34px; height: 34px;
  border: none;
  background: var(--tc-surface-2);
  border-radius: 8px;
  color: var(--tc-text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  transition: all var(--tc-transition);
  flex-shrink: 0;
}

.tc-panel-close:hover {
  background: #fee2e2;
  color: var(--tc-danger);
}

/* Body (scrollável) */
.tc-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Field no painel */
.tc-panel-body .tc-field { gap: .35rem; }

.tc-field-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--tc-text-muted);
  display: flex;
  align-items: center;
  gap: .3rem;
}

.tc-field-readonly {
  padding: .55rem .875rem;
  background: var(--tc-surface-2);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-sm);
  font-size: .875rem;
  color: var(--tc-text);
  font-weight: 600;
}

.tc-field-readonly-muted {
  color: var(--tc-text-muted);
  font-style: italic;
  font-weight: 400;
}

.tc-input-textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
}

.tc-input-mono {
  font-family: 'Courier New', monospace;
  font-size: .82rem;
}

/* Toggle switch */
.tc-field-toggle-wrap {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 0;
}

.tc-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.tc-toggle input { opacity: 0; width: 0; height: 0; }

.tc-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--tc-border);
  border-radius: 24px;
  cursor: pointer;
  transition: .2s;
}

.tc-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.tc-toggle input:checked + .tc-toggle-slider { background: var(--tc-primary); }
.tc-toggle input:checked + .tc-toggle-slider::before { transform: translateX(20px); }

.tc-toggle-label {
  font-size: .875rem;
  color: var(--tc-text-muted);
}

/* Footer */
.tc-panel-footer {
  display: flex;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--tc-border);
  flex-shrink: 0;
  background: var(--tc-surface);
}

.tc-panel-footer .tc-btn-primary { flex: 1; justify-content: center; }
.tc-panel-footer .tc-btn-outline  { flex-shrink: 0; }

@media (max-width: 540px) {
  .tc-db-panel { width: 100vw; }
}

