/* ==========================================================================
   Tree Combinator — Global Design System & Stylesheet
   ========================================================================== */

/* Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* CSS Variables */
:root {
  --bg-dark: #121612;          /* Deepest black-green background */
  --bg-main: #1f251e;          /* Main panel background */
  --bg-card: rgba(31, 37, 30, 0.65); /* Glassmorphic card base */
  --cream: #e6dfc6;            /* Warm cream text & primary elements */
  --cream-dim: rgba(230, 223, 198, 0.7);
  --gold: #b0ab83;             /* Sage-gold branding color */
  --gold-dim: rgba(176, 171, 131, 0.3);
  --gold-bright: #d9d5be;      /* Brighter highlight gold */
  
  /* Alert/State Neon Colors */
  --neon-green: #10b981;       /* Revenue, Done, Success */
  --neon-red: #f43f5e;         /* Payable, Critical, Error */
  --neon-blue: #06b6d4;        /* Info, Client, Backlog */
  --neon-orange: #f59e0b;      /* In Progress, Warning */

  /* Glassmorphism Borders */
  --border-glass: 1px solid rgba(176, 171, 131, 0.15);
  --border-active: 1px solid rgba(176, 171, 131, 0.45);
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-neon: 0 0 15px rgba(176, 171, 131, 0.2);

  /* Fonts */
  --font-serif: 'Playfair Display', serif;
  --font-sans: 'Montserrat', sans-serif;
  
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-width: 260px;
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--cream);
  overflow: hidden;
}

/* Subtle tech grain & glowing dots */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
}

/* Ambient glow blobs */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 171, 131, 0.04) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  pointer-events: none;
  z-index: 0;
  animation: floatAmbient 20s infinite alternate ease-in-out;
}

.ambient-glow-2 {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.02) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  pointer-events: none;
  z-index: 0;
  animation: floatAmbient 15s infinite alternate-reverse ease-in-out;
}

@keyframes floatAmbient {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(18, 22, 18, 0.5);
}
::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* Buttons & Interactive Elements */
button, .btn {
  font-family: var(--font-sans);
  background: transparent;
  color: var(--cream);
  border: var(--border-glass);
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

button:hover, .btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: #fff;
  box-shadow: var(--shadow-neon);
}

button:active, .btn:active {
  transform: scale(0.98);
}

button.primary, .btn-primary {
  background: var(--gold);
  color: var(--bg-dark);
  font-weight: 600;
  border: 1px solid var(--gold);
}

button.primary:hover, .btn-primary:hover {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--bg-dark);
  box-shadow: 0 0 15px rgba(230, 223, 198, 0.4);
}

button.danger, .btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--neon-red);
}
button.danger:hover, .btn-danger:hover {
  background: var(--neon-red);
  color: #fff;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

button.icon-only {
  padding: 0.5rem;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

/* Glassmorphism Card styling */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--border-glass);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--shadow-glow);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(176, 171, 131, 0.25);
}

/* Tech Fields & Forms */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(18, 22, 18, 0.7);
  border: var(--border-glass);
  border-radius: 6px;
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(18, 22, 18, 0.9);
  box-shadow: 0 0 10px rgba(176, 171, 131, 0.15);
}

input::placeholder, textarea::placeholder {
  color: rgba(230, 223, 198, 0.35);
}

.invalid-field {
  border-color: var(--neon-red) !important;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.2) !important;
}

.error-text {
  color: var(--neon-red);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

/* ==========================================================================
   TELA DE LOGIN & CADASTRO (AUTH VIEW)
   ========================================================================== */
.auth-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  text-align: center;
  position: relative;
  animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  margin-bottom: 2rem;
}

.auth-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(176, 171, 131, 0.4));
  animation: pulseLogo 4s infinite alternate ease-in-out;
}

@keyframes pulseLogo {
  0% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(176, 171, 131, 0.4)); }
  100% { transform: scale(1.05); filter: drop-shadow(0 0 16px rgba(176, 171, 131, 0.7)); }
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  letter-spacing: 0.1em;
  background: linear-gradient(to bottom, #fff 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* Tabs for Role Selection in Cadastro */
.auth-tabs {
  display: flex;
  background: rgba(18, 22, 18, 0.5);
  border: var(--border-glass);
  border-radius: 8px;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.6rem 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--cream-dim);
  border-radius: 6px;
}

.auth-tab:hover {
  color: var(--cream);
  background: rgba(230, 223, 198, 0.03);
  box-shadow: none;
}

.auth-tab.active {
  background: var(--gold);
  color: var(--bg-dark);
}

.auth-tab.active:hover {
  background: var(--gold);
  color: var(--bg-dark);
  box-shadow: var(--shadow-neon);
}

.auth-footer {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--cream-dim);
}

.auth-footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.auth-footer a:hover {
  color: var(--cream);
  text-shadow: 0 0 5px rgba(230, 223, 198, 0.5);
}

/* ==========================================================================
   Cinematic Split-Screen Login
   ========================================================================== */
.auth-container.auth-split {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  min-height: 100vh;
}

/* --- Left: immersive brand panel --- */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background:
    radial-gradient(120% 90% at 25% 20%, rgba(16, 185, 129, 0.10) 0%, transparent 55%),
    radial-gradient(110% 100% at 80% 90%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
    linear-gradient(155deg, #161c16 0%, #0d110d 100%);
  border-right: 1px solid rgba(176, 171, 131, 0.12);
}

/* Soft vignette + top sheen to add depth over the canvas */
.auth-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 120% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  z-index: 2;
}

#auth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
}

.auth-brand-content {
  position: relative;
  z-index: 3;
  text-align: center;
  max-width: 420px;
  animation: fadeInScale 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-logo-hero {
  width: 120px;
  height: 120px;
  margin-bottom: 1.5rem;
}

.auth-brand-title {
  font-family: var(--font-serif);
  font-size: 4rem;
  line-height: 0.95;
  letter-spacing: 0.12em;
  background: linear-gradient(to bottom, #fff 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand-sub {
  font-size: 1rem;
  letter-spacing: 0.55em;
  color: var(--gold);
  text-transform: uppercase;
  margin: 0.35rem 0 1.75rem;
  padding-left: 0.55em; /* optically center the tracked text */
}

.auth-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--cream);
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
}

.auth-tagline::after {
  content: '';
  display: block;
  width: 64px;
  height: 2px;
  margin: 1rem auto 0;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

.auth-features {
  list-style: none;
  text-align: left;
  display: inline-flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-features li {
  position: relative;
  padding-left: 1.75rem;
  font-size: 0.9rem;
  color: var(--cream-dim);
  letter-spacing: 0.02em;
}

.auth-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

/* --- Right: clean form panel --- */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--bg-dark);
  overflow-y: auto;
}

.auth-form-inner {
  width: 100%;
  max-width: 380px;
  animation: fadeInScale 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-form-head {
  margin-bottom: 2rem;
}

/* Compact wordmark — only surfaces when the brand panel collapses */
.auth-form-brand {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}

.auth-logo-compact {
  width: 38px;
  height: 38px;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(176, 171, 131, 0.45));
}

.auth-form-brand-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  letter-spacing: 0.12em;
  color: var(--cream);
}

.auth-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--gold);
  text-transform: uppercase;
}

.auth-welcome {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--cream);
  margin: 0.5rem 0 0.35rem;
}

.auth-lead {
  font-size: 0.9rem;
  color: var(--cream-dim);
}

/* --- Responsive: collapse to single column, hide heavy brand panel --- */
@media (max-width: 880px) {
  .auth-container.auth-split {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
  .auth-form-panel {
    min-height: 100vh;
  }
  .auth-form-inner {
    max-width: 420px;
  }
  .auth-form-brand {
    display: flex;
  }
}

/* CEP loading indicator within form */
.cep-input-wrapper {
  position: relative;
  display: flex;
}

.cep-loader {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* ==========================================================================
   APP MAIN LAYOUT SHELL (SIDEBAR & WORKSPACE)
   ========================================================================== */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 10;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  background: rgba(18, 22, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  flex-shrink: 0;
  transition: var(--transition-smooth);
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.1);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  color: var(--gold);
}

.sidebar-brand-name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
}

.sidebar-brand-sub {
  font-size: 0.6rem;
  letter-spacing: 0.35em;
  color: var(--gold);
  margin-top: 0.15rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  color: var(--cream-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  transition: var(--transition-smooth);
}

.nav-item:hover, .nav-item.active {
  background: var(--gold-dim);
  color: #fff;
  border-color: rgba(176, 171, 131, 0.25);
}

.nav-item.active svg {
  color: var(--gold);
  filter: drop-shadow(0 0 5px rgba(176, 171, 131, 0.5));
}

.sidebar-user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(176, 171, 131, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--cream);
  font-size: 0.9rem;
}

.user-details {
  flex-grow: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--cream-dim);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.logout-btn:hover {
  color: var(--neon-red);
  background: rgba(244, 63, 94, 0.1);
}

/* Main Workspace */
.app-workspace {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.app-header {
  height: 70px;
  border-bottom: var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(18, 22, 18, 0.3);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.header-title-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--cream);
  font-size: 1.25rem;
  cursor: pointer;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* View Wrapper */
.view-content {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

/* ==========================================================================
   DASHBOARD / HOME VIEW
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.metric-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(176, 171, 131, 0.08);
  border: 1px solid rgba(176, 171, 131, 0.2);
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 700;
}

.metric-icon-box.green {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--neon-green);
}

.metric-icon-box.red {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--neon-red);
}

.metric-icon-box.blue {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.2);
  color: var(--neon-blue);
}

.metric-data {
  flex-grow: 1;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--cream-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-serif);
  margin-top: 0.15rem;
}

/* Dashboard dynamic panels */
.dashboard-section-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1024px) {
  .dashboard-section-row {
    grid-template-columns: 1fr;
  }
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.1);
}

.section-card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Custom Visual Chart components using pure CSS */
.ledger-meter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ledger-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.ledger-meter-bar-container {
  height: 10px;
  background: rgba(18, 22, 18, 0.8);
  border-radius: 5px;
  overflow: hidden;
  border: var(--border-glass);
}

.ledger-meter-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-red) 0%, var(--neon-green) 100%);
  width: 50%;
  transition: width 1s ease-out;
}

/* Quick List formatting */
.quick-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quick-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(18, 22, 18, 0.3);
  border: var(--border-glass);
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.quick-list-item:hover {
  border-color: rgba(176, 171, 131, 0.25);
  background: rgba(18, 22, 18, 0.5);
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.item-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.item-subtitle {
  font-size: 0.75rem;
  color: var(--cream-dim);
}

.item-value {
  font-size: 0.85rem;
  font-weight: 700;
}

.item-value.positive { color: var(--neon-green); }
.item-value.negative { color: var(--neon-red); }

/* ==========================================================================
   CLIENTS / MEMBERS VIEW
   ========================================================================== */
.view-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-wrapper input {
  padding-left: 2.25rem;
}

.search-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--cream-dim);
}

/* Clients Grid / Cards */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.client-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.client-badge-role {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
}

.client-badge-role.colaborador {
  color: var(--neon-orange);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.client-badge-role.cliente {
  color: var(--neon-blue);
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}

.client-badge-role.parceiro {
  color: var(--neon-green);
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.client-card-title {
  font-size: 1.15rem;
  font-family: var(--font-serif);
  font-weight: 600;
  margin-top: 0.5rem;
  padding-right: 4.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--cream-dim);
}

.client-detail-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.client-detail-row svg {
  width: 14px;
  height: 14px;
  color: var(--gold);
  flex-shrink: 0;
}

.client-detail-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(176, 171, 131, 0.1);
}

/* View toggle (Cartões / Tabela) */
.view-toggle {
  display: inline-flex;
  background: rgba(18, 22, 18, 0.5);
  border: var(--border-glass);
  border-radius: 8px;
  padding: 0.2rem;
  gap: 0.2rem;
}

.view-toggle-btn {
  background: transparent;
  border: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cream-dim);
  border-radius: 6px;
}

.view-toggle-btn:hover {
  color: var(--cream);
  background: rgba(230, 223, 198, 0.04);
  box-shadow: none;
}

.view-toggle-btn.active {
  background: var(--gold);
  color: var(--bg-dark);
}

/* Contacts table (grid) view */
.contacts-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

/* In the table view the role badge must flow inline, not float in a corner */
.contacts-table .client-badge-role {
  position: static;
  display: inline-block;
}

/* ==========================================================================
   FINANCIAL MODULE VIEW
   ========================================================================== */
.finance-accounts-section {
  margin-bottom: 2rem;
}

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.account-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  cursor: pointer;
  border: var(--border-glass);
  position: relative;
  overflow: hidden;
}

.account-card.active {
  border-color: var(--gold);
  background: var(--gold-dim);
  box-shadow: var(--shadow-neon);
}

.account-card-name {
  font-size: 0.85rem;
  color: var(--cream-dim);
  font-weight: 500;
}

.account-card-balance {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.4rem;
  font-family: var(--font-serif);
}

/* Financial Ledger Table styling */
.ledger-wrapper {
  margin-top: 1.5rem;
  overflow-x: auto;
  border: var(--border-glass);
  border-radius: 8px;
  background: rgba(18, 22, 18, 0.4);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
  min-width: 700px;
}

.ledger-table th {
  background: rgba(18, 22, 18, 0.8);
  padding: 1rem;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: var(--border-glass);
}

.ledger-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.08);
  color: var(--cream);
}

.ledger-table tr:hover td {
  background: rgba(230, 223, 198, 0.02);
}

.badge-finance {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-finance.receita {
  color: var(--neon-green);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-finance.despesa {
  color: var(--neon-red);
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

/* Banner de Notas Fiscais a emitir (Painel Geral) */
.nf-banner {
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--neon-orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.nf-banner-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.nf-banner-icon { font-size: 1.5rem; }
.nf-banner-sub {
  display: block;
  font-size: 0.82rem;
  color: var(--cream-dim);
  margin-top: 0.2rem;
}

/* Banner de simulação de acesso (admin "ver como") */
.sim-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.6rem 2rem;
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--cream);
  font-size: 0.85rem;
}
.sim-banner .btn {
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--neon-orange);
}

/* Destaque do usuário logado no grid */
.user-row-me td { background: rgba(176, 171, 131, 0.06); }
.me-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--bg-dark);
  background: var(--gold);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  vertical-align: middle;
}
.access-count {
  cursor: pointer;
  font-weight: 700;
  color: var(--gold);
  border-bottom: 1px dotted var(--gold-dim);
}
.access-count:hover { color: var(--gold-bright); }

/* Grade de permissões no modal de usuário */
.perms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1rem;
  margin: 0.5rem 0;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--cream);
  cursor: pointer;
}
.perm-item input {
  width: auto;
  margin: 0;
}
@media (max-width: 540px) {
  .perms-grid { grid-template-columns: 1fr; }
  .sim-banner { padding: 0.6rem 1rem; }
}

/* Badge de Nota Fiscal (parcelas de proposta liquidadas) */
.nf-badge {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
}
.nf-badge.pending {
  color: var(--neon-orange);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  cursor: pointer;
}
.nf-badge.pending:hover {
  background: rgba(245, 158, 11, 0.22);
}
.nf-badge.sent {
  color: var(--neon-green);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Category badge (shown in the ledger "Categoria" column) */
.cat-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(176, 171, 131, 0.1);
  border: 1px solid rgba(176, 171, 131, 0.25);
  color: var(--gold-bright);
}

.cat-badge.receita { border-left: 3px solid var(--neon-green); }
.cat-badge.despesa { border-left: 3px solid var(--neon-red); }

/* Recurrence / installment inline tags next to the description */
.tx-tag {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--neon-blue);
  vertical-align: middle;
  white-space: nowrap;
}

/* Category filter dropdown in the ledger action bar */
.category-filter {
  width: auto;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

/* Inline helper text under installment / recurrence fields */
.field-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--cream-dim);
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.status-badge.pago {
  color: var(--neon-green);
  background: rgba(16, 185, 129, 0.1);
}

.status-badge.pendente {
  color: var(--neon-orange);
  background: rgba(245, 158, 11, 0.1);
}

/* ==========================================================================
   PROJECTS VIEW & DETAILS
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.project-client-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--neon-blue);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.project-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: -0.25rem;
  color: var(--cream);
}

.project-financial-summary {
  background: rgba(18, 22, 18, 0.4);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
  border: var(--border-glass);
}

/* Cada linha: rótulo à esquerda, valor à direita — não estoura com valores longos */
.project-financial-stat {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.project-financial-stat > span:first-child {
  color: var(--cream-dim);
}

.project-financial-val {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: right;
}

.project-progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.project-progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--cream-dim);
}

.project-progress-bar-bg {
  height: 6px;
  background: rgba(18, 22, 18, 0.8);
  border-radius: 3px;
  overflow: hidden;
}

.project-progress-bar-fill {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 1s ease-out;
}

.project-card-members {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.project-member-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--cream);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: -8px;
  transition: var(--transition-smooth);
}

.project-member-bubble:hover {
  transform: translateY(-3px);
  z-index: 10;
}

/* Project Detail Layout (Dashboard and Kanban board inside) */
.project-detail-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.project-detail-financial-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Kanban Board Layout */
.kanban-board-container {
  margin-top: 2rem;
}

.kanban-board-title {
  font-size: 1.1rem;
  text-transform: uppercase;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: rgba(18, 22, 18, 0.45);
  border: var(--border-glass);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 400px;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.10);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kanban-column-header.todo { color: var(--cream); }
.kanban-column-header.inprogress { color: var(--neon-orange); }
.kanban-column-header.review { color: var(--neon-blue); }
.kanban-column-header.done { color: var(--neon-green); }

.kanban-cards-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 350px;
}

.kanban-card {
  background: var(--bg-card);
  border: var(--border-glass);
  border-radius: 6px;
  padding: 0.85rem;
  cursor: grab;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card:hover {
  border-color: rgba(176, 171, 131, 0.35);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.kanban-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--cream-dim);
}

.kanban-card-actions {
  display: flex;
  gap: 0.35rem;
}

.kanban-card-actions button {
  padding: 0.25rem;
  font-size: 0.75rem;
  border-radius: 3px;
  width: auto;
  height: auto;
}

/* Modals & Dialogs (Tech styling overlays) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 18, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modalSlide {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.1);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--gold);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--cream-dim);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: var(--neon-red);
}

.modal-body {
  text-align: left;
}

.modal-footer {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(176, 171, 131, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Confirmation dialog */
.confirm-modal {
  max-width: 440px;
}

.confirm-message {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--cream);
}

.confirm-audit-note {
  margin-top: 0.85rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--cream-dim);
  background: rgba(6, 182, 212, 0.07);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 8px;
}

/* ==========================================================================
   Comprovantes (anexos & visualizador)
   ========================================================================== */

/* Action / document button clusters inside the ledger table */
.row-actions,
.row-docs {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
}

.icon-only.has-doc {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.icon-only.no-doc {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* Upload section inside the transaction modal */
.doc-section {
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px dashed rgba(176, 171, 131, 0.25);
  border-radius: 10px;
  background: rgba(18, 22, 18, 0.35);
}

.doc-section-title {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.85rem;
}

.doc-slot {
  margin-top: 0.35rem;
}

.doc-attach-btn {
  width: 100%;
  font-size: 0.8rem;
  border-style: dashed;
}

.doc-attached {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
}

.doc-attached .doc-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-attached .btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
}

/* Document viewer modal */
.doc-viewer-content {
  max-width: 820px;
}

.doc-viewer-body {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 70vh;
  overflow: auto;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 0.5rem;
}

.doc-viewer-img {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 6px;
}

.doc-viewer-frame {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: 6px;
  background: #fff;
}

/* Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(176, 171, 131, 0.2);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  color: var(--cream);
  font-size: 0.85rem;
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}
.toast.success::before {
  content: '✓';
  color: var(--neon-green);
  font-weight: bold;
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.3);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.1);
}
.toast.error::before {
  content: '✕';
  color: var(--neon-red);
  font-weight: bold;
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   MOBILE & RESPONSIVE FIXES
   ========================================================================== */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    bottom: 0;
    height: 100%;
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
  }

  .app-sidebar.active {
    left: 0;
  }

  .mobile-toggle {
    display: block;
  }

  .view-content {
    padding: 1rem;
  }

  .app-header {
    padding: 0 1rem;
  }

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

  .project-detail-financial-panel {
    grid-template-columns: 1fr;
  }

  .view-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .search-wrapper {
    max-width: none;
  }
}

/* ==========================================================================
   Auditoria (Trilha de Registros Excluídos)
   ========================================================================== */
.audit-section {
  margin-bottom: 1.5rem;
}

.audit-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(176, 171, 131, 0.12);
  border: 1px solid rgba(176, 171, 131, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.audit-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bg-dark);
  background: var(--gold);
  min-width: 24px;
  text-align: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.audit-empty {
  padding: 1.5rem 0.5rem;
  text-align: center;
  color: var(--cream-dim);
  font-size: 0.9rem;
}

.btn-restore {
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--neon-green);
}

.btn-restore:hover {
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   Relatórios Gerenciais
   ========================================================================== */
.report-bars {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.report-bar-label {
  font-size: 0.85rem;
  color: var(--cream);
}

.report-bar-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cream-dim);
}

.report-bar-track {
  height: 8px;
  background: rgba(18, 22, 18, 0.6);
  border-radius: 999px;
  overflow: hidden;
}

.report-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-pending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.report-pending-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  background: rgba(18, 22, 18, 0.4);
  border: var(--border-glass);
  border-radius: 10px;
}

.report-pending-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cream-dim);
}

.report-pending-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-serif);
}

/* ==========================================================================
   Impressão de relatórios
   ========================================================================== */
@media print {
  .app-sidebar,
  .app-header,
  #btn-print-report,
  .toast-container {
    display: none !important;
  }
  .app-workspace,
  .view-content {
    overflow: visible !important;
    height: auto !important;
  }
  body, html {
    background: #fff !important;
    color: #000 !important;
    overflow: visible !important;
  }
  .glass-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}

/* ==========================================================================
   Sidebar recolhível (desktop) + botão de toggle
   ========================================================================== */
.sidebar-collapse-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--cream-dim);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  display: inline-flex;
  transition: var(--transition-smooth);
}

.sidebar-collapse-btn:hover {
  color: var(--gold);
  background: rgba(176, 171, 131, 0.08);
}

/* O botão de recolher só faz sentido no desktop; no mobile usa-se o hambúrguer */
@media (max-width: 768px) {
  .sidebar-collapse-btn { display: none; }
}

@media (min-width: 769px) {
  .app-container.sidebar-collapsed .app-sidebar {
    width: 80px;
    padding: 1.5rem 0.75rem;
  }
  .app-container.sidebar-collapsed .sidebar-brand-text,
  .app-container.sidebar-collapsed .sidebar-logo,
  .app-container.sidebar-collapsed .nav-item span,
  .app-container.sidebar-collapsed .user-details {
    display: none;
  }
  .app-container.sidebar-collapsed .sidebar-header {
    justify-content: center;
    margin-bottom: 1.5rem;
  }
  .app-container.sidebar-collapsed .sidebar-collapse-btn {
    margin-left: 0;
  }
  .app-container.sidebar-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }
  .app-container.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.8rem;
  }
  .app-container.sidebar-collapsed .sidebar-user {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Ajustes finos de mobile
   ========================================================================== */
@media (max-width: 768px) {
  /* Mantém o cabeçalho de seções e ações empilhado e legível */
  .view-actions .view-toggle,
  .view-actions .auth-tabs {
    width: 100%;
  }
  .view-actions .auth-tab,
  .view-toggle-btn {
    flex: 1;
  }
  /* Botões de ação ocupam a largura disponível sem espremer */
  .view-actions > div {
    width: 100%;
    flex-wrap: wrap;
  }
  /* No financeiro, o filtro de categoria ocupa a linha inteira no mobile */
  .category-filter {
    width: 100%;
    min-width: 0;
  }
  .modal-content {
    max-height: 88vh;
  }
  /* KPIs e métricas em coluna única já vêm de .dashboard-grid; garante respiro */
  .metric-card {
    width: 100%;
  }
}

/* Telas bem estreitas: reduz o respiro lateral das tabelas roláveis */
@media (max-width: 480px) {
  .view-content {
    padding: 0.75rem;
  }
  .report-pending-value {
    font-size: 1.2rem;
  }
}

/* ==========================================================================
   Avatares (foto de perfil ou iniciais)
   ========================================================================== */
.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gold-dim);
  color: var(--cream);
  font-weight: 700;
  border: 1px solid rgba(176, 171, 131, 0.3);
  vertical-align: middle;
}

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

.avatar-initials {
  background: linear-gradient(135deg, rgba(176,171,131,0.35), rgba(16,185,129,0.2));
  color: var(--cream);
}

/* Foto dentro dos elementos já existentes */
.user-avatar img,
.project-member-bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-avatar,
.project-member-bubble {
  overflow: hidden;
}

.kanban-assignee {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.client-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Upload de foto de perfil (modal de contato)
   ========================================================================== */
.photo-upload {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(176, 171, 131, 0.1);
}

.photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 22, 18, 0.5);
  border: 1px solid rgba(176, 171, 131, 0.25);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  font-size: 1.5rem;
  opacity: 0.5;
}

.photo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   Banner de aniversariantes do mês
   ========================================================================== */
.birthday-banner {
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--neon-orange);
}

.birthday-banner-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.birthday-icon {
  font-size: 1.4rem;
}

.birthday-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.birthday-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(18, 22, 18, 0.4);
  border: var(--border-glass);
  border-radius: 10px;
}

.birthday-item.is-today {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

.birthday-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.birthday-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.birthday-day {
  font-size: 0.78rem;
  color: var(--gold);
}

/* ==========================================================================
   Extrato financeiro do contato (modal) — evita estouro de layout
   ========================================================================== */
.stmt-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stmt-summary > div {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem;
  background: rgba(18, 22, 18, 0.4);
  border: var(--border-glass);
  border-radius: 10px;
  min-width: 0;
}

.stmt-summary-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A tabela do extrato cabe na largura do modal (sem rolagem horizontal):
   anula o min-width grande herdado da .ledger-table e compacta as células. */
.stmt-table {
  min-width: 0;
  width: 100%;
  font-size: 0.8rem;
}

.stmt-table th,
.stmt-table td {
  padding: 0.6rem 0.5rem;
}

/* Valor e vencimento ficam sempre em uma linha; a descrição pode quebrar */
.stmt-nowrap {
  white-space: nowrap;
}

/* Em telas pequenas, os 3 totais empilham para não comprimir os números */
@media (max-width: 540px) {
  .stmt-summary {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Funil de Vendas (Propostas)
   ========================================================================== */
.stage-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(18, 22, 18, 0.4);
}

.funnel-empty {
  text-align: center;
  color: var(--cream-dim);
  opacity: 0.5;
  padding: 1rem 0;
}

.funnel-code {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold);
  background: rgba(176, 171, 131, 0.12);
  border: 1px solid rgba(176, 171, 131, 0.25);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-bottom: 0.35rem;
}

/* Código clicável para copiar */
.funnel-code[data-copy] {
  cursor: pointer;
  transition: var(--transition-smooth);
}
.funnel-code[data-copy]:hover {
  background: rgba(176, 171, 131, 0.25);
  color: var(--gold-bright);
}

.funnel-card-owner {
  font-size: 0.75rem;
  color: var(--gold);
  margin-top: 0.2rem;
}

.funnel-prob {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
}

.funnel-card-client {
  font-size: 0.8rem;
  color: var(--cream-dim);
  margin-top: 0.15rem;
}

.funnel-card-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cream);
  margin-top: 0.35rem;
}

.funnel-card-meta {
  font-size: 0.72rem;
  color: var(--cream-dim);
  margin-top: 0.25rem;
}

.funnel-card-tag {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--neon-green);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-top: 0.4rem;
}

.funnel-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(176, 171, 131, 0.1);
}

.funnel-card-actions .icon-only {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 0.75rem;
}

.funnel-card-actions .btn-restore {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
}

/* Timeline de histórico de etapas */
.stage-history {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stage-history li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}

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

.stage-history-label {
  font-weight: 600;
  color: var(--cream);
}

.stage-history-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--cream-dim);
}

/* Badge de proposta vencida */
.expired-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--neon-red);
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.3rem;
}

/* Diário da negociação */
.neg-add {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.4rem 0 0.85rem;
}
.neg-add textarea {
  flex: 1;
  resize: vertical;
}
.neg-add .btn {
  white-space: nowrap;
  padding: 0.5rem 0.7rem;
  font-size: 0.78rem;
}

.neg-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 240px;
  overflow-y: auto;
}
.neg-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.neg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex-shrink: 0;
}
.neg-item.note .neg-dot {
  background: var(--cream-dim) !important;
}
.neg-text {
  font-size: 0.85rem;
  color: var(--cream);
  line-height: 1.35;
}
.neg-meta {
  font-size: 0.72rem;
  color: var(--cream-dim);
  margin-top: 0.1rem;
}
.neg-empty {
  color: var(--cream-dim);
  font-size: 0.85rem;
  list-style: none;
}

/* Editor de itens da proposta */
.pp-item-row {
  display: grid;
  grid-template-columns: 1fr 70px 110px 32px;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.pp-item-row .icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
}

.pp-total {
  text-align: right;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  color: var(--cream);
}

.pp-total strong {
  font-family: var(--font-serif);
  color: var(--gold-bright);
}

@media (max-width: 540px) {
  .pp-item-row {
    grid-template-columns: 1fr 1fr;
  }
  .pp-item-row .pp-i-desc {
    grid-column: 1 / -1;
  }
}
