/* ==========================================================================
   SHOWFLOW • MINIMALIST MONOCHROME DESIGN SYSTEM
   High-density, professional, senior-grade interface (inspired by Linear & Vercel)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Strict Monochrome Palette */
  --bg-app: #09090B;
  --bg-surface: #121215;
  --bg-surface-subtle: #18181B;
  --bg-surface-hover: #222226;
  --bg-input: #121215;

  --border-app: #27272A;
  --border-subtle: #1F1F23;
  --border-strong: #3F3F46;
  --border-focus: #FFFFFF;

  --text-main: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --text-dim: #52525B;

  /* Subtle Data Accents (Only for vital status indicators) */
  --accent-white: #FFFFFF;
  --accent-black: #000000;
  --status-emerald: #10B981;
  --status-emerald-bg: rgba(16, 185, 129, 0.08);
  --status-emerald-border: rgba(16, 185, 129, 0.2);

  --status-amber: #F59E0B;
  --status-amber-bg: rgba(245, 158, 11, 0.08);
  --status-amber-border: rgba(245, 158, 11, 0.2);

  --status-rose: #EF4444;
  --status-rose-bg: rgba(239, 68, 68, 0.08);
  --status-rose-border: rgba(239, 68, 68, 0.2);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-app);
}

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

html {
  font-size: 14px;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

body {
  background: var(--bg-app);
  min-height: 100vh;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

/* Icons */
.icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-lg {
  width: 18px;
  height: 18px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-app);
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-img {
  height: 40px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}

.brand-logo-img:hover {
  transform: scale(1.02);
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border-app);
}

.brand-logo-badge {
  width: 32px;
  height: 32px;
  background: #FAFAFA;
  color: #09090B;
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.05em;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-app);
  color: var(--text-secondary);
}

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

.header-center-selector {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
}

.period-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.period-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  padding-right: 1.25rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23FAFAFA' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  transition: opacity 0.2s ease;
}

.period-select:hover {
  opacity: 0.8;
}

.period-select option {
  background: #18181B;
  color: #FAFAFA;
  font-size: 0.82rem;
  padding: 0.4rem;
}

.artist-pill {
  font-size: 0.78rem;
  color: var(--text-secondary);
  border-left: 1px solid var(--border-app);
  padding-left: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

/* Senior Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.48rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #FAFAFA;
  color: #09090B;
  border-color: #FAFAFA;
  font-weight: 600;
}

.btn-primary:hover {
  background: #E4E4E7;
  border-color: #E4E4E7;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-app);
}

.btn-secondary:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-danger {
  background: transparent;
  color: var(--status-rose);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--status-rose-bg);
  border-color: var(--status-rose);
}

.btn-icon-only {
  padding: 0.45rem;
  width: 32px;
  height: 32px;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

/* Nav Tabs */
.nav-tabs-bar {
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-app);
  position: sticky;
  top: 55px;
  z-index: 40;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs-bar::-webkit-scrollbar {
  display: none;
}

.nav-tabs-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.tab-btn.active {
  color: #FAFAFA;
  font-weight: 600;
  border-bottom-color: #FAFAFA;
}

.tab-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-app);
  color: var(--text-muted);
}

.tab-btn.active .tab-badge {
  background: #27272A;
  color: #FAFAFA;
}

/* Main Container */
.main-wrapper {
  max-width: 1360px;
  margin: 1.5rem auto 3rem auto;
  padding: 0 1.5rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* KPI Cards Grid */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
  .metrics-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

.card-kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease;
  min-width: 0;
}

.card-kpi:hover {
  border-color: var(--border-strong);
}

.card-kpi .kpi-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-kpi .kpi-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.03em;
  margin: 0.35rem 0 0.2rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-kpi .kpi-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kpi-indicator {
  font-weight: 600;
}

.kpi-indicator.positive { color: var(--status-emerald); }
.kpi-indicator.neutral { color: var(--text-secondary); }

/* Dashboard Two Columns */
.dash-columns {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 992px) {
  .dash-columns {
    grid-template-columns: 1fr;
  }
}

/* Senior Card / Panel */
.section-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.panel-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.75rem;
}

.panel-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Minimalist Bars Chart */
.chart-box {
  width: 100%;
  padding-top: 0.5rem;
}

.bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  height: 170px;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar-cluster {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
  height: 140px;
  justify-content: center;
}

.chart-bar-item {
  width: 14px;
  border-radius: 2px 2px 0 0;
  transition: height 0.3s ease;
  position: relative;
}

.chart-bar-item.rev { background: #52525B; }
.chart-bar-item.cost { background: #27272A; }
.chart-bar-item.profit { background: #FAFAFA; }

.chart-bar-item:hover {
  filter: brightness(1.25);
}

.chart-bar-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #18181B;
  color: #FAFAFA;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border-app);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.chart-axis-label {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chart-legend-minimal {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.legend-key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  margin-right: 0.35rem;
}

/* Weekly Table Rows (Dashboard List) */
.dash-weeks-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
}

.week-row-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr auto;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.week-row-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-app);
}

.week-head-col h5 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.week-head-col span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.week-metric-col {
  display: flex;
  flex-direction: column;
}

.week-metric-col .m-title {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.week-metric-col .m-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Split Ratio Card */
.split-bar-wrap {
  height: 8px;
  background: #27272A;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  margin: 1rem 0;
}

.split-seg-artist {
  background: #FAFAFA;
  height: 100%;
  transition: width 0.3s ease;
}

.split-seg-office {
  background: #52525B;
  height: 100%;
  transition: width 0.3s ease;
}

.split-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.split-col-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.split-col-box .title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.split-col-box .val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.split-col-box .sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Controls & Subtabs Bar */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

.pill-segmented {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  gap: 0.2rem;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.pill-item {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.pill-item:hover {
  color: var(--text-main);
}

.pill-item.active {
  background: #27272A;
  color: #FAFAFA;
  font-weight: 600;
}

.search-field-wrap {
  position: relative;
  min-width: 220px;
}

.search-field {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-main);
  outline: none;
}

.search-field:focus {
  border-color: var(--border-focus);
}

.search-field-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.filter-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-select-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1.85rem 0.45rem 2rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.filter-select:hover {
  border-color: var(--border-strong);
}

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

/* Senior Data Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-app);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}

.data-tbl {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
  white-space: nowrap;
}

.data-tbl th {
  background: #151518;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-app);
}

.data-tbl td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.data-tbl tbody tr:hover td {
  background: var(--bg-surface-subtle);
}

.data-tbl td.numeric, .data-tbl th.numeric {
  text-align: right;
  font-family: var(--font-mono);
}

.data-tbl tfoot td {
  background: #151518;
  font-weight: 600;
  border-top: 1px solid var(--border-app);
  border-bottom: none;
}

/* Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-app);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
}

.badge-status .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-status.pago {
  border-color: var(--status-emerald-border);
  background: var(--status-emerald-bg);
  color: var(--status-emerald);
}

.badge-status.sinal {
  border-color: var(--status-amber-border);
  background: var(--status-amber-bg);
  color: var(--status-amber);
}

.badge-status.aberto {
  border-color: var(--border-app);
  color: var(--text-muted);
}

/* Mobile Responsive Cards for Table Rows */
.mobile-card-item {
  display: none;
}

/* Mobile Menu Trigger & Drawer (Hidden on Desktop) */
.btn-mobile-menu {
  display: none !important;
}
.mobile-header-right {
  display: none !important;
}
.btn-mobile-logout {
  display: none !important;
}
.mobile-drawer-backdrop {
  display: none !important;
}
.mobile-drawer {
  display: none !important;
}

@media (max-width: 768px) {
  .app-header {
    padding: 0.65rem 0.85rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(9, 9, 11, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-app);
  }
  .header-container {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    width: 100%;
    min-height: 44px;
    flex-wrap: nowrap;
    gap: 0;
  }
  
  /* Botão 3 Tracinhos no Canto Esquerdo (sem quadrado em volta, 100% limpo) */
  .btn-mobile-menu {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    transition: opacity 0.15s, transform 0.1s;
    box-sizing: border-box;
  }
  .btn-mobile-menu:active {
    transform: scale(0.92);
    opacity: 0.6;
  }
  .hamburger-line {
    width: 22px;
    height: 2px;
    background-color: #FAFAFA;
    border-radius: 2px;
    display: block;
  }

  /* Logotipo no Centro Exato do Topo */
  .brand-section {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    z-index: 5;
    pointer-events: auto;
  }
  .brand-logo-img {
    height: 32px;
    max-width: 130px;
    object-fit: contain;
  }

  /* Canto Direito Mobile: Botão Sair da Conta */
  .mobile-header-right {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    width: 38px;
    height: 38px;
    z-index: 10;
  }
  .btn-mobile-logout {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #EF4444;
    width: 38px;
    height: 38px;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.15s, transform 0.1s;
  }
  .btn-mobile-logout svg {
    width: 21px;
    height: 21px;
    stroke-width: 2.2;
  }
  .btn-mobile-logout:active {
    opacity: 0.6;
    transform: scale(0.92);
  }

  /* Oculta os seletores e botões desnecessários do topo no mobile (pois agora estão no menu 3 tracinhos) */
  .header-center-selector {
    display: none !important;
  }
  .header-actions {
    display: none !important;
  }
  .nav-tabs-bar {
    display: none !important;
  }

  /* ==========================================================================
     MOBILE DRAWER (SLIDE-OVER MENU)
     ========================================================================== */
  .mobile-drawer-backdrop {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s;
  }
  .mobile-drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  .mobile-drawer {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 84vw;
    max-width: 320px;
    height: 100vh;
    background: #0D0D11;
    border-right: 1px solid var(--border-app);
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.85);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem 1.15rem;
    box-sizing: border-box;
  }
  .mobile-drawer.active {
    transform: translateX(0);
  }

  .drawer-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border-app);
    margin-bottom: 1rem;
  }
  .drawer-logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
  }
  .btn-close-drawer {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-app);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
  }
  .btn-close-drawer:active {
    color: #FFF;
    background: rgba(255, 255, 255, 0.12);
  }

  /* Perfil do Usuário */
  .drawer-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-app);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    margin-bottom: 1.1rem;
  }
  .drawer-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--brand-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .drawer-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .drawer-user-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .drawer-user-role-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-emerald);
    margin-top: 2px;
  }

  /* Blocos do Drawer */
  .drawer-block {
    margin-bottom: 1.15rem;
  }
  .drawer-block-title {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
    text-transform: uppercase;
  }
  .drawer-period-select-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-app);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.8rem;
    gap: 0.6rem;
  }
  .drawer-period-select-wrap svg {
    width: 16px;
    height: 16px;
    color: var(--brand-accent);
    flex-shrink: 0;
  }
  .drawer-period-select {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
  }
  .drawer-period-select option {
    background: #18181B;
    color: #FAFAFA;
  }

  /* Lista de Navegação */
  .drawer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
  .drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
  }
  .drawer-nav-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color 0.15s ease;
  }
  .drawer-nav-item:hover, .drawer-nav-item:active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
  }
  .drawer-nav-item.active {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.35);
    color: #FFFFFF;
    font-weight: 700;
  }
  .drawer-nav-item.active svg {
    color: var(--brand-accent);
  }
  .drawer-nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
  }
  .drawer-nav-item.active .drawer-nav-badge {
    background: var(--brand-accent);
    color: #000;
  }

  /* Ações Rápidas */
  .drawer-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .drawer-quick-grid .btn {
    justify-content: center;
    font-size: 0.75rem;
    padding: 0.55rem 0.4rem;
  }

  /* Rodapé do Menu (Sair) */
  .drawer-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-app);
  }
  .drawer-btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.7rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #EF4444;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
  }
  .drawer-btn-logout:active {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(0.98);
  }
  .main-wrapper {
    padding: 0 0.75rem;
    margin: 1rem auto 2.5rem auto;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .section-panel {
    padding: 0.85rem;
    box-sizing: border-box;
    max-width: 100%;
  }
  .week-row-card {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    padding: 0.75rem;
  }
  .week-head-col {
    grid-column: span 2;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.35rem;
    margin-bottom: 0.15rem;
  }
  .week-row-card > div:last-child {
    display: none;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
  }
  .pill-segmented {
    width: 100%;
    min-width: 0;
  }
  .search-field-wrap, .filter-select-wrap {
    width: 100%;
    min-width: 0;
  }
  .filter-select {
    width: 100%;
  }
  .table-desktop-view {
    display: none;
  }
  .mobile-card-item {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    background: var(--bg-surface);
    border: 1px solid var(--border-app);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.65rem;
    overflow: hidden;
  }
  .mobile-card-item .top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
  }
  .mobile-card-item .mid-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin: 0.5rem 0;
  }
  .mobile-card-item .bottom-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
  }
  .split-grid-two {
    grid-template-columns: 1fr;
  }
}

.calc-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.calc-line .k {
  color: var(--text-secondary);
  word-break: break-word;
}

.calc-line .v {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  margin-left: 0.5rem;
}

.calc-line.total {
  border-bottom: none;
  border-top: 1px solid var(--border-strong);
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  font-weight: 700;
}

.calc-line.total .v {
  font-size: 1.1rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: #141417;
  border: 1px solid var(--border-app);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
}

.modal-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-app);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-xs);
  display: flex;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-content {
  padding: 1.25rem;
}

.form-field {
  margin-bottom: 1rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-input {
  width: 100%;
  background: #0D0D10;
  border: 1px solid var(--border-app);
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.field-input:focus {
  border-color: var(--border-focus);
}

.modal-foot {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-app);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: #111114;
}

/* Toast */
.toast-shelf {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toast-msg {
  background: #18181B;
  border: 1px solid var(--border-app);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastFadeIn 0.15s ease;
}

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

/* Printable Report */
.print-paper {
  background: #FFFFFF;
  color: #09090B;
  border-radius: var(--radius-sm);
  padding: 2.5rem;
  max-width: 960px;
  margin: 0 auto;
  border: 1px solid #E4E4E7;
}

.print-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid #09090B;
  margin-bottom: 1.5rem;
}

.print-head h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.print-tbl {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}

.print-tbl th {
  background: #F4F4F5;
  color: #52525B;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.55rem 0.65rem;
  border: 1px solid #E4E4E7;
}

.print-tbl td {
  padding: 0.55rem 0.65rem;
  border: 1px solid #E4E4E7;
  color: #18181B;
}

@media print {
  body {
    background: #FFF !important;
    color: #000 !important;
  }
  .app-header, .nav-tabs-bar, .controls-bar, .btn, .toast-shelf {
    display: none !important;
  }
  .main-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .tab-pane {
    display: none !important;
  }
  #tab-report {
    display: block !important;
  }
  .print-paper {
    box-shadow: none !important;
    padding: 0 !important;
    border: none !important;
  }
}

/* ==========================================================================
   AUTHENTICATION & FULL LOGIN PAGE
   ========================================================================== */

body.not-authenticated {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: #09090B !important;
}

body.not-authenticated .app-header,
body.not-authenticated .nav-tabs-bar,
body.not-authenticated .main-wrapper,
body.not-authenticated .viewer-banner,
body.not-authenticated .mobile-drawer,
body.not-authenticated .mobile-drawer-backdrop {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #09090B;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 999999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(6, 182, 212, 0.08);
  animation: modalEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.8rem;
}

.login-logo-img {
  height: 48px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  margin: 0 auto 1rem auto;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.login-brand h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.login-brand p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  font-size: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.login-alert.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.quick-access-box {
  margin-top: 1.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.quick-access-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.quick-access-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.quick-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.6rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.quick-btn:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.quick-btn.admin:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.quick-btn.viewer:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.1);
}

.quick-btn-role {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.quick-btn-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.login-foot-note {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

/* User Session Header Chip */
.user-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-app);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
}

.user-session-chip.hidden {
  display: none;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
}

.user-role-badge.admin {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-emerald);
  border: 1px solid var(--status-emerald-border);
}

.user-role-badge.viewer {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan-border);
}

.user-email-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Viewer Banner */
.viewer-banner {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.12), rgba(14, 165, 233, 0.06));
  border-bottom: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.65rem 1.5rem;
}

.viewer-banner.hidden {
  display: none;
}

.viewer-banner-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: #E0F2FE;
}

.viewer-banner-content svg {
  flex-shrink: 0;
  stroke: var(--accent-cyan);
}

/* Role-based UI restrictions (Viewer: Somente Leitura) */
body.role-viewer #btn-open-modal-show,
body.role-viewer #btn-open-modal-expense,
body.role-viewer #btn-new-show-in-tab,
body.role-viewer #btn-new-expense-in-tab,
body.role-viewer #btn-new-team-member,
body.role-viewer #btn-open-backup,
body.role-viewer .action-btn,
body.role-viewer .actions-cell,
body.role-viewer .actions-row,
body.role-viewer .bottom-row,
body.role-viewer #btn-reset-data,
body.role-viewer th:last-child,
body.role-viewer td:last-child {
  display: none !important;
}

body.role-viewer #split-range-slider {
  pointer-events: none;
  opacity: 0.7;
}
