:root {
  /* Design Tokens: Dark Corporate Palette */
  --bg-main: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(24, 33, 53, 0.9);
  --bg-surface: #111827;
  --bg-input: #151d30;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);

  --transition-fast: 0.18s ease;
  --transition-smooth: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TEMA CLARO (Light Mode)
   ========================================================================== */
[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: #ffffff;
  --bg-surface: #ffffff;
  --bg-input: #f8fafc;
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.15);
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
}

.glow-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #0284c7, transparent 70%);
  top: -100px;
  left: 10%;
}

.glow-2 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: 40%;
  right: -50px;
}

.glow-3 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #0ea5e9, transparent 70%);
  bottom: -100px;
  left: 20%;
}

/* ==========================================================================
   TELA DE AUTENTICAÇÃO (Login / Registro)
   ========================================================================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 10;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(2, 132, 199, 0.2);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeInAuth 0.35s ease;
}

@keyframes fadeInAuth {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-header .logo-box {
  width: 56px;
  height: 56px;
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
}

.demo-login-box {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.demo-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-demo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-demo:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(4px);
}

.demo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e293b;
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.demo-info {
  display: flex;
  flex-direction: column;
}

.demo-info strong {
  font-size: 0.84rem;
  color: #fff;
}

.demo-info small {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ==========================================================================
   TELA PRINCIPAL DO COFRE
   ========================================================================== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Top Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

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

.logo-box {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  transition: all var(--transition-smooth);
  cursor: pointer;
  flex-shrink: 0;
}

.logo-box:hover {
  background: rgba(2, 132, 199, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.3);
}

.logo-icon-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition-smooth);
}

.logo-box:hover .logo-icon-svg {
  transform: rotate(15deg) scale(1.08);
}

.app-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Perfil do Usuário Logado */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px 6px 6px;
  border-radius: 40px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.user-email {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  margin-left: 4px;
}

.btn-logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-only:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.btn-text:hover {
  background: rgba(56, 189, 248, 0.1);
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-toggle .chevron-icon {
  font-size: 0.75rem;
  transition: transform var(--transition-fast);
}

.dropdown.open .chevron-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 100;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  width: 100%;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.icon-green { color: #22c55e; }
.icon-red { color: #f43f5e; }
.icon-blue { color: #38bdf8; }

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.icon-cyan {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.icon-blue-accent {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.icon-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.icon-purple {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Main Card */
.main-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Abas de Escopo: Todas / Privadas / Compartilhadas */
.scope-tabs-bar {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
  overflow-x: auto;
}

.scope-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.scope-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.scope-tab.active {
  background: rgba(2, 132, 199, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.95rem;
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 38px 10px 40px;
  color: var(--text-main);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.btn-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.btn-clear:hover {
  color: var(--text-main);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.control-group select {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.control-group select:focus {
  border-color: var(--border-focus);
}

.view-toggles {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 34px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.view-btn:hover {
  color: var(--text-main);
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Sub toolbar */
.sub-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Grid View: Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.credential-card {
  background: rgba(18, 25, 41, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.credential-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.12);
}

.credential-card.card-shared::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(135deg, #a855f7 0%, #38bdf8 100%);
  opacity: 0.9;
}

.credential-card.card-private::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0.9;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #38bdf8;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
}

.person-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
}

.person-tags-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.person-user-tag {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-card-action {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.btn-card-action:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.btn-card-action.danger:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

/* Badges de Compartilhamento */
.badge-share {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.badge-share.shared {
  background: rgba(168, 85, 247, 0.14);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.28);
}

.badge-share.private {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Card Body Details */
.card-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

.detail-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  flex-shrink: 0;
}

.detail-val-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  max-width: 65%;
}

.detail-value {
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.86rem;
}

.btn-copy-mini {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  transition: all var(--transition-fast);
}

.btn-copy-mini:hover {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
}

/* Tags / Badges */
.badge-device {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-device.badge-mobile {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.25);
}

.badge-device.badge-both {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

/* Password Box in Card */
.card-password-box {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-password-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.password-label-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.password-display-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: #fff;
  user-select: all;
  transition: all var(--transition-fast);
}

.password-display-text.revealed {
  letter-spacing: 0.05em;
  color: #38bdf8;
  font-weight: 700;
}

.card-password-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-pass-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.btn-pass-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.card-notes {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.card-author-info {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Table View */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table th.th-actions {
  text-align: right;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table .td-name-col {
  display: flex;
  flex-direction: column;
}

.data-table .td-name {
  font-weight: 600;
  color: #fff;
}

.data-table .td-notes {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.data-table .password-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: #fff;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 12px;
}

/* Modal Backdrop & Window */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(2, 132, 199, 0.2);
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-backdrop.open .modal-window {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Modal Form */
.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Toggle Switch de Compartilhamento */
.share-box-toggle {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #a855f7;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.share-text-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 0.9rem;
}

.badge-share-status {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-weight: 600;
}

.badge-share-status.is-shared {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.share-text-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.col-span-2 {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.req {
  color: #f43f5e;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition-fast);
}

.btn-link:hover {
  text-decoration: underline;
  color: #7dd3fc;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-base);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.password-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-group input {
  padding-right: 44px;
}

.btn-input-addon {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.btn-input-addon:hover {
  color: #fff;
}

/* Strength Meter */
.strength-meter {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.strength-bar {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-text {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
  text-align: right;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #fff;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideToast 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-success {
  border-left: 4px solid #10b981;
}

.toast.toast-info {
  border-left: 4px solid #0284c7;
}

.toast.toast-error {
  border-left: 4px solid #ef4444;
}

@keyframes slideToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding-top: 12px;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    padding: 16px 14px 40px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .col-span-2 {
    grid-column: span 1;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .toolbar-controls {
    justify-content: space-between;
  }

  .user-profile-badge {
    order: -1;
    width: 100%;
    justify-content: space-between;
  }
}

/* Indicador de Status do Banco de Dados */
.db-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #34d399;
  transition: all var(--transition-fast);
}

.db-status-badge.disconnected {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

.db-status-badge.disconnected .db-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Dica de campo corporativo */
.field-hint {
  font-size: 0.74rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

/* ==========================================================================
   BOTÃO DE ALTERNÂNCIA DE TEMA & REGRAS DO MODO CLARO
   ========================================================================== */
.theme-toggle-btn {
  color: var(--text-muted);
  font-size: 1.05rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  color: var(--accent-amber);
  transform: rotate(15deg);
}

.auth-card-top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -10px;
}

/* Adaptações Visuais para Tema Claro */
[data-theme="light"] body {
  background-color: var(--bg-main);
  color: var(--text-main);
}

[data-theme="light"] .bg-decoration .glow {
  opacity: 0.08;
  filter: blur(140px);
}

[data-theme="light"] .auth-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .app-title {
  color: #0f172a;
}

[data-theme="light"] .main-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: var(--shadow-lg);
}

[data-theme="light"] .metric-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .metric-value {
  color: #0f172a;
}

[data-theme="light"] .credential-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .credential-card:hover {
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.12), 0 0 16px rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.35);
}

[data-theme="light"] .person-name {
  color: #0f172a;
}

[data-theme="light"] .card-details {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .detail-value {
  color: #1e293b;
}

[data-theme="light"] .avatar-circle {
  background: #e2e8f0;
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.3);
}

[data-theme="light"] .card-password-box {
  background: rgba(2, 132, 199, 0.06);
  border: 1px solid rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .password-display-text {
  color: #0f172a;
}

[data-theme="light"] .password-display-text.revealed {
  color: #0284c7;
}

[data-theme="light"] .btn-pass-action {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

[data-theme="light"] .btn-pass-action:hover {
  background: #f1f5f9;
  border-color: rgba(2, 132, 199, 0.3);
}

[data-theme="light"] .user-profile-badge {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .user-name {
  color: #0f172a;
}

[data-theme="light"] .dropdown-menu {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .dropdown-item {
  color: #1e293b;
}

[data-theme="light"] .dropdown-item:hover {
  background: #f1f5f9;
  color: #0284c7;
}

[data-theme="light"] .modal-window {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .modal-header h2 {
  color: #0f172a;
}

[data-theme="light"] .modal-header {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .modal-footer {
  border-top-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .share-box-toggle {
  background: rgba(168, 85, 247, 0.05);
  border-color: rgba(168, 85, 247, 0.2);
}

[data-theme="light"] .share-title-row {
  color: #0f172a;
}

[data-theme="light"] .data-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .data-table td {
  border-bottom-color: rgba(15, 23, 42, 0.06);
  color: #1e293b;
}

[data-theme="light"] .data-table .td-name {
  color: #0f172a;
}

[data-theme="light"] .data-table tbody tr:hover {
  background: rgba(2, 132, 199, 0.03);
}

[data-theme="light"] .search-box input {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .control-group select {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .form-group select {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .auth-tabs {
  background: #e2e8f0;
}

[data-theme="light"] .btn-demo {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .btn-demo:hover {
  background: #f1f5f9;
  border-color: rgba(2, 132, 199, 0.3);
}

[data-theme="light"] .btn-demo .demo-info strong {
  color: #0f172a;
}

[data-theme="light"] .demo-avatar {
  background: #e2e8f0;
  color: #0284c7;
}

[data-theme="light"] .empty-state h3 {
  color: #0f172a;
}

/* Badge de Administrador Master (TI) */
.badge-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 6px;
  text-transform: uppercase;
  vertical-align: middle;
}

[data-theme="light"] .badge-admin {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.4);
}

[data-theme="light"] .logo-box {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(37, 99, 235, 0.18) 100%);
  border-color: rgba(2, 132, 199, 0.3);
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.15);
}
