:root {
  --primary-color: #db2777; /* Pink 600 - Feminino e sofisticado */
  --primary-glow: rgba(219, 39, 119, 0.2);
  --success-color: #059669; /* Emerald Escuro */
  --warning-color: #d97706; /* Amber */
  --danger-color: #e11d48; /* Rose 600 */
  
  /* Fundos Femininos (Nude / Off-white Premium) */
  --bg-color: #faf9f9; /* Off-white super leve */
  --surface-color: #ffffff; /* Cartões brancos limpos */
  --border-color: rgba(0, 0, 0, 0.06); /* Borda muito sutil */
  
  --text-main: #3f3f46; /* Zinc 700 - Escuro mas suave */
  --text-muted: #71717a; /* Zinc 500 */
  
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--surface-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  max-width: 100%;
  min-width: 0; /* EVITA QUE O GRID ITEM ESTIQUE ALÉM DO ESPAÇO DISPONÍVEL */
}

/* -------------------------------------------
   TABLES
------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  width: 100%;
  min-width: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
th, td {
  padding: 12px 14px; /* Mais compacto para não estourar a tela */
  text-align: left;
  vertical-align: top; /* Alinha a primeira linha de todas as colunas */
  border-bottom: 1px solid var(--border-color);
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.5; /* Mais fácil de ler */
  font-size: 0.9rem;
}
th {
  background-color: rgba(0, 0, 0, 0.02);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
/* Tabela de Agenda */
#tab-agenda table { table-layout: auto; width: 100%; }

/* Tabela de Visão Geral (Próximos Clientes) */
#tab-visao-geral table { 
  table-layout: auto; 
  width: 100%; 
}
#tab-visao-geral table th {
  white-space: nowrap;
}
#tab-visao-geral table td span {
  white-space: nowrap;
}
#tab-visao-geral table td:nth-child(5) { text-align: right; }

/* Tabela de Catálogo */
#tab-catalogo table { table-layout: auto; width: 100%; }

/* Tabela de Clientes */
#tab-clientes table { table-layout: fixed; width: 100%; }

/* Beautiful Action Controls */
.action-select {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  min-width: 120px;
}
.action-select:hover, .action-select:focus {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--border-color);
}
/* Beautiful Custom Dropdown */
.custom-dropdown {
    position: relative;
    display: inline-block;
    min-width: 160px;
    font-size: 0.85rem;
    font-weight: 500;
    user-select: none;
    text-align: left;
    white-space: nowrap;
}
.dropdown-selected {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}
.dropdown-selected::after {
    content: "▼";
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-left: 8px;
    transition: transform 0.2s ease;
}
.dropdown-selected:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--border-color);
}
.custom-dropdown.active .dropdown-selected::after {
    transform: rotate(180deg);
}
.custom-dropdown.active .dropdown-options {
    display: block;
    animation: fadeIn 0.15s ease-out;
}
.dropdown-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 100%;
    width: max-content;
    white-space: nowrap;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 100;
    overflow: hidden;
}

@media (max-width: 768px) {
    .dropdown-options {
        right: auto;
        left: 0;
    }
}
.dropdown-option {
    padding: 10px 12px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dropdown-option:hover {
    background: rgba(219, 39, 119, 0.1);
}
.dropdown-option.concluido:hover {
    background: rgba(5, 150, 105, 0.1);
}
.dropdown-option.falta:hover {
    background: rgba(225, 29, 72, 0.1);
}

.action-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(219, 39, 119, 0.1);
  border: 1px solid rgba(219, 39, 119, 0.2);
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}
.action-btn-icon:hover {
  background: rgba(219, 39, 119, 0.2);
  transform: translateY(-2px);
}
.action-btn-icon.danger {
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.2);
  color: var(--danger-color);
}
.action-btn-icon.danger:hover {
  background: rgba(225, 29, 72, 0.2);
}

tbody tr {
  transition: all 0.2s ease;
}

/* -------------------------------------------
   LOGIN VIEW
------------------------------------------- */
#login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
}

.login-box h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  background: linear-gradient(to right, #3f3f46, #71717a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-box p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.input-group input, .input-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: #f4f4f5;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group textarea {
  resize: vertical;
  min-height: 80px;
}

.input-group input:focus, .input-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

#login-error {
  color: var(--danger-color);
  font-size: 0.85rem;
  margin-top: 16px;
  display: none;
}

/* -------------------------------------------
   DASHBOARD VIEW
------------------------------------------- */
#dashboard-view {
  display: none; /* Hidden by default */
  width: 100%;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  height: 100vh;
  border-right: 1px solid var(--border-color);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
}

.brand {
  margin-bottom: 48px;
}

.brand h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand span {
  color: var(--primary-color);
}

.nav-links {
  list-style: none;
  flex-grow: 1;
}

.nav-links li {
  margin-bottom: 8px;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-icon {
  margin-right: 12px;
  font-size: 1.2rem;
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(219, 39, 119, 0.05);
  color: var(--primary-color);
}

.nav-links a.active {
  border-left: 3px solid var(--primary-color);
  background: linear-gradient(90deg, var(--primary-glow) 0%, transparent 100%);
}

.user-profile {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile div {
  font-size: 0.9rem;
}

.user-profile .logout-btn {
  background: transparent;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.main-content {
  flex: 1;
  min-width: 0;
  height: 100vh; /* ALTURA FIXA DA TELA PARA ATIVAR O SCROLL VERTICAL */
  padding: 24px 32px;
  overflow-y: auto !important; /* Permitir rolagem vertical */
  overflow-x: hidden; /* Corta qualquer vazamento extra */
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 16px;
}

.header h2 {
  font-size: 1.8rem;
  font-weight: 600;
}

.header p {
  color: var(--text-muted);
  margin-top: 4px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.metric-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0,0.04);
}

.metric-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.metric-trend {
  font-size: 0.85rem;
  font-weight: 500;
}

.trend-up { color: var(--success-color); }
.trend-down { color: var(--danger-color); }
.trend-neutral { color: var(--text-muted); }

/* Upcoming List */
.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
}

/* Utilities for Privacy Toggle */
.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.icon-btn:hover {
  opacity: 1;
}

.blur-value {
  filter: blur(8px);
  opacity: 0.5;
  user-select: none;
}

.mobile-only-sort {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .mobile-only-sort {
    display: block !important;
  }

  #dashboard-view {
    flex-direction: column;
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
  }
  
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 85px;
    padding: 0;
    padding-bottom: 15px;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1000;
    border-radius: 0;
    transform: none;
  }

  .brand { display: none; }
  
  .nav-links {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 8px;
    gap: 0;
  }
  
  .nav-links li {
    margin: 0;
    flex: 1;
    display: flex;
    align-items: stretch;
  }
  
  .nav-links a {
    display: flex;
    flex-direction: column;
    padding: 4px;
    font-size: 10px;
    font-weight: 500;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: transparent !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    touch-action: manipulation;
    gap: 4px;
  }

  .nav-icon {
    margin: 0;
    font-size: 24px;
  }

  .nav-links a.active {
    color: var(--primary-color);
    border: none !important;
    background: transparent !important;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-top: 16px;
  }
  
  #btn-novo-servico, #btn-nova-reserva {
    width: 100% !important;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
  .metric-card { padding: 12px; }
  .metric-value { font-size: 1.2rem; }
  .metric-title { font-size: 0.75rem; margin-bottom: 4px; }
  
  /* User Profile */
  .sidebar .user-profile {
    display: none;
  }

  /* Responsive Table using Flexbox Card Design (Fix iOS Height Bug) */
  #tab-clientes table, #tab-clientes tbody, 
  #tab-agenda table, #tab-agenda tbody,
  #tab-catalogo table, #tab-catalogo tbody,
  #tab-equipe table, #tab-equipe tbody,
  #dashboard-view table, #dashboard-view tbody,
  #modal-historico-cliente table, #modal-historico-cliente tbody {
    display: block !important;
    width: 100%;
    height: auto !important;
    min-height: min-content;
  }
  #tab-clientes thead, #tab-clientes th, #tab-clientes td, #tab-clientes tr,
  #tab-agenda thead, #tab-agenda th, #tab-agenda td, #tab-agenda tr,
  #tab-catalogo thead, #tab-catalogo th, #tab-catalogo td, #tab-catalogo tr,
  #tab-equipe thead, #tab-equipe th, #tab-equipe td, #tab-equipe tr,
  #dashboard-view thead, #dashboard-view th, #dashboard-view td, #dashboard-view tr,
  #modal-historico-cliente thead, #modal-historico-cliente th, #modal-historico-cliente td, #modal-historico-cliente tr {
    display: block;
  }
  
  #tab-clientes tbody tr, #tab-agenda tbody tr, #tab-catalogo tbody tr, #tab-equipe tbody tr, #dashboard-view tbody tr, #modal-historico-cliente tbody tr { 
    border: 1px solid rgba(0, 0, 0,0.1); 
    margin-bottom: 16px; 
    border-radius: var(--radius-lg); 
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 12px;
    row-gap: 8px;
  }
  
  /* Reset th/td */
  #tab-clientes thead, #tab-agenda thead, #tab-catalogo thead, #tab-equipe thead, #dashboard-view thead, #modal-historico-cliente thead { display: none !important; }
  #tab-clientes td, #tab-agenda td, #tab-catalogo td, #tab-equipe td, #dashboard-view td, #modal-historico-cliente td {
    border: none !important;
    padding: 0 !important;
    text-align: left !important;
    width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
  }
  
  /* =========================================================
     NOVO DESIGN: VISÃO GERAL E FALLBACK (MOBILE CARDS)
     ========================================================= */
  /* Linha 1: Tempo / Titulo Principal */
  #tab-visao-geral td:nth-of-type(1), #tab-catalogo td:nth-of-type(1) {
    width: 100% !important;
    font-size: 1.15rem !important;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(0, 0, 0,0.08) !important;
    padding-bottom: 12px !important;
    margin-bottom: 4px !important;
  }
  /* Linha 2: Coluna Esquerda */
  #tab-visao-geral td:nth-of-type(2), #tab-catalogo td:nth-of-type(2) {
    width: 55% !important;
    font-size: 1.1rem !important;
    font-weight: 600;
    color: var(--text-main);
  }
  /* Linha 2: Coluna Direita */
  #tab-visao-geral td:nth-of-type(3), #tab-catalogo td:nth-of-type(3) {
    width: calc(45% - 12px) !important;
    font-size: 0.95rem !important;
    color: var(--text-muted);
    text-align: right !important;
  }
  /* Linha 3: Profissional */
  #tab-visao-geral td:nth-of-type(4) {
    width: 100% !important;
    font-size: 0.9rem !important;
    color: var(--text-muted);
  }
  #tab-visao-geral td:nth-of-type(4)::before,
  #tab-agenda td:nth-of-type(4)::before {
    content: "👤 ";
  }
  /* Linha 4: Status / Ações (Apenas Visão) */
  #tab-visao-geral td:nth-of-type(5), #tab-catalogo td:nth-of-type(4) {
    width: 100% !important;
    text-align: right !important;
    margin-top: 8px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(0, 0, 0,0.08) !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
  }

  /* =========================================================
     NOVO DESIGN: CLIENTES (MOBILE CARDS)
     ========================================================= */
  #tab-clientes td:nth-of-type(1) {
    width: 100% !important;
    font-size: 1.1rem !important;
    font-weight: 700;
    color: var(--text-main);
  }
  #tab-clientes td:nth-of-type(1)::before {
    content: "👤 ";
  }
  #tab-clientes td:nth-of-type(2) {
    width: 100% !important;
    font-size: 0.95rem !important;
    color: var(--text-muted);
    margin-bottom: 8px !important;
    border-bottom: 1px solid rgba(0, 0, 0,0.08) !important;
    padding-bottom: 12px !important;
  }
  #tab-clientes td:nth-of-type(2)::before {
    content: "📱 ";
  }
  #tab-clientes td:nth-of-type(3) {
    width: 33% !important;
    font-size: 0.85rem !important;
    color: var(--text-muted);
  }
  #tab-clientes td:nth-of-type(3)::before {
    content: "Última: ";
    font-weight: 600;
  }
  #tab-clientes td:nth-of-type(4) {
    width: 33% !important;
    font-size: 0.85rem !important;
    color: var(--text-muted);
  }
  #tab-clientes td:nth-of-type(4)::before {
    content: "Visitas: ";
    font-weight: 600;
  }
  #tab-clientes td:nth-of-type(5) {
    width: 33% !important;
    font-size: 0.85rem !important;
    color: var(--text-muted);
  }
  #tab-clientes td:nth-of-type(5)::before {
    content: "Gasto: R$ ";
    font-weight: 600;
  }
  #tab-clientes td:nth-of-type(6) {
    width: 50% !important;
    font-size: 0.95rem !important;
    font-weight: 600;
    color: var(--success-color);
  }
  #tab-clientes td:nth-of-type(6)::before {
    content: "Saldo: R$ ";
  }
  #tab-clientes td:nth-of-type(7) {
    display: none !important; /* Esconder "Total Resgatado" no mobile para limpar a tela */
  }
  #tab-clientes td:nth-of-type(8) {
    width: 100% !important;
    text-align: right !important;
    margin-top: 8px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(0, 0, 0,0.08) !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
  }

  /* =========================================================
     NOVO DESIGN: HISTÓRICO DO CLIENTE (MOBILE CARDS)
     ========================================================= */
  #modal-historico-cliente td:nth-of-type(1) { /* Data/Hora */
    width: 100% !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid rgba(0, 0, 0,0.08) !important;
    padding-bottom: 8px !important;
    margin-bottom: 4px !important;
  }
  #modal-historico-cliente td:nth-of-type(2) { /* Serviços */
    width: 100% !important;
    font-size: 0.95rem !important;
    color: var(--text-muted);
    margin-bottom: 8px !important;
  }
  #modal-historico-cliente td:nth-of-type(3) { /* Valor */
    width: 50% !important;
    text-align: left !important;
  }
  #modal-historico-cliente td:nth-of-type(4) { /* Status */
    width: 50% !important;
    text-align: right !important;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }


  /* =========================================================
     NOVO DESIGN: AGENDA DO DIA (MOBILE CARDS)
     ========================================================= */
  #tab-agenda td:nth-of-type(1) {
    /* Horário */
    width: 100% !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: var(--primary-color) !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 2px !important;
  }
  #tab-agenda td:nth-of-type(2) {
    /* Cliente */
    width: 100% !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid rgba(0, 0, 0,0.08) !important;
    padding-bottom: 12px !important;
    margin-bottom: 12px !important;
  }
  #tab-agenda td:nth-of-type(3) {
    /* Serviço e Valor */
    width: 100% !important;
    text-align: left !important;
    font-size: 1rem !important;
    color: var(--text-muted) !important;
    line-height: 1.5 !important;
  }
  #tab-agenda td:nth-of-type(4) {
    /* Profissional */
    display: none !important; /* Esconde equipe no celular para limpar o card */
  }
  #tab-agenda td:nth-of-type(5) {
    /* Ações e Status */
    width: 100% !important;
    margin-top: 12px !important;
    padding-top: 16px !important;
    border-top: 1px solid rgba(0, 0, 0,0.08) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  #tab-agenda td:nth-of-type(5) > div {
    width: 100%;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
  }
  #tab-agenda .custom-dropdown {
    min-width: 130px;
  }
  #tab-agenda .action-btn-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: var(--radius-md);
  }

  /* Exceção: Ações do Catálogo (que é a coluna 4) */
  #tab-catalogo td:nth-of-type(4) {
    text-align: right !important;
    margin-top: 8px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(0, 0, 0,0.08) !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
  }

  /* Exceção para a linha de Horário Livre (colspan="4") */
  td[colspan="4"] {
    width: 100% !important;
    padding-top: 8px !important;
    font-size: 1.1rem !important;
    color: var(--success-color) !important;
  }
  
  .main-content {
    padding: 16px;
    padding-bottom: 120px !important;
    overflow: visible !important;
    height: auto !important;
  }
  .table-container {
    overflow: visible !important;
    height: auto !important;
  }
  .table-wrapper-panel {
    min-height: auto;
    flex: none;
    padding: 16px !important;
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-lg) !important;
    margin-top: 24px;
  }
  .tab-pane.active {
    height: auto;
    min-height: 0;
  }
}



/* -------------------------------------------
   TABS AND MODALS (CATÁLOGO)
------------------------------------------- */
.tab-pane {
  display: none;
  flex-direction: column;
  animation: fadeIn 0.3s ease-out;
  min-width: 0;
  max-width: 100%;
}
.tab-pane.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  width: 90%;
  max-width: 400px;
  padding: 24px; max-height: 90vh; overflow-y: auto; box-sizing: border-box;
}
.modal-content h3 {
  margin-top: 0;
  margin-bottom: 16px;
}
.btn-secondary {
  background: rgba(0,0,0,0.05);
  color: var(--text-main);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: capitalize;
}
.status-badge::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-badge.agendado { background: rgba(108, 117, 125, 0.1); color: #6c757d; }
.status-badge.agendado::before { background: #6c757d; box-shadow: 0 0 6px rgba(108, 117, 125, 0.4); }

.status-badge.confirmado { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.status-badge.confirmado::before { background: #28a745; box-shadow: 0 0 6px rgba(40, 167, 69, 0.4); }

.status-badge.concluido { background: rgba(0, 123, 255, 0.1); color: #007bff; }
.status-badge.concluido::before { background: #007bff; box-shadow: 0 0 6px rgba(0, 123, 255, 0.4); }

.status-badge.falta { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.status-badge.falta::before { background: #dc3545; box-shadow: 0 0 6px rgba(220, 53, 69, 0.4); }
  font-weight: 600;
}
.btn-secondary:hover {
  background: rgba(0,0,0,0.1);
}
.btn-danger {
  background: transparent;
  color: var(--danger-color);
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.btn-danger:hover {
  text-decoration: underline;
}

/* Define esquema claro nativo */
input[type="date"], 
input[type="time"],
select {
    color-scheme: light;
}

/* Row responsiva para formulários */
.form-row {
    display: flex;
    gap: 16px;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        display: block !important;
    }
    .form-row .input-group {
        width: 100% !important;
        margin-bottom: 16px;
    }
}

input[type="date"], 
input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    width: 100%;
}

/* Native calendar icon */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); border-radius: 4px; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
.modal-content::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

/* Tabela */
.table-wrapper-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* Important for flex child to be scrollable */
}

.table-container {
  overflow-x: auto;
  flex: 1;
  border-radius: var(--radius-md);
  /* Firefox Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

.table-container::-webkit-scrollbar { width: 8px; height: 8px;}
.table-container::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

/* Responsividade Extra para Celulares */
@media (max-width: 768px) {
  body, html {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    display: block !important;
    height: auto !important;
  }
  .layout {
    display: block !important;
    height: auto !important;
  }
  .table-container {
    overflow-x: auto;
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important; /* THE TRUE CULPRIT: 65vh limit */
    flex: none !important;
    display: block !important; /* FIX IOS SAFARI BUG */
  }
  .table-wrapper-panel {
    min-height: auto;
    flex: none;
    padding: 0;
    margin-top: 24px;
    height: auto !important;
  }
  .tab-pane.active {
    height: auto;
    display: block;
  }
  .modal-content {
    width: 95%;
    max-height: 90vh;
    padding: 16px;
    overflow-y: auto;
  }
  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px;
    padding-bottom: 90px;
    overflow-y: visible !important;
    height: auto !important;
    display: block !important;
  }
  .nav-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
  }
}

/* =========================================================
   TOGGLE SWITCH (Para Dias da Semana)
   ========================================================= */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.1);
  transition: .4s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background-color: var(--primary-color);
}
input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.horario-row {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  background: rgba(0, 0, 0, 0.03);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}
.horario-row:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.2);
}
.horario-row input[type="time"] {
  width: 100%;
  padding: 8px;
  background: #f4f4f5;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-main);
  font-size: 0.9rem;
}
.horario-row input[type="time"]:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.dia-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Responsive Grid for Ajustes Premium */
.ajustes-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  max-width: 1200px;
}
.ajustes-grid > div {
  min-width: 0; /* Fixes CSS grid blowout */
}
@media (max-width: 768px) {
  .ajustes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  
  /* Mobile Cards para Horários */
  .horarios-header {
    display: none !important;
  }
  .horario-row {
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
    padding: 16px;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.08) !important;
  }
  .horario-row > .dia-label {
    width: 100%;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 600;
  }
  .horario-row > div:not(.dia-label) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .horario-row > div:not(.dia-label) input[type="time"] {
    width: 140px !important;
    padding: 8px 12px;
  }
  .horario-row > div:nth-child(2)::before { content: "Abertura:"; font-weight: 500; font-size: 0.95rem; color: var(--text-muted); }
  .horario-row > div:nth-child(3)::before { content: "Início Pausa:"; font-weight: 500; font-size: 0.95rem; color: var(--text-muted); }
  .horario-row > div:nth-child(4)::before { content: "Fim Pausa:"; font-weight: 500; font-size: 0.95rem; color: var(--text-muted); }
  .horario-row > div:nth-child(5)::before { content: "Fechamento:"; font-weight: 500; font-size: 0.95rem; color: var(--text-muted); }
}

@media (max-width: 768px) {
  #dashboard-view, .tab-pane.active {
    padding-bottom: 120px !important;
  }
}


@media (max-width: 768px) {
  .data-table tbody tr.cliente-row-mobile td {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }
  .data-table tbody tr.cliente-row-mobile td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .data-table tbody tr.cliente-row-mobile td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 12px;
  }
}
