/* ================== CSS - VARIÁVEIS E BASE ================== */
* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:root {
  --brand: #1a4a5c; --brand-light: #e8f3f7; --brand-mid: #255f77;
  --accent: #e8845a; --accent-soft: #fdf1eb;
  --green: #1a7a3a; --green-bg: #e8f7ed; --green-mid: #22a34e;
  --red: #c0392b; --red-bg: #fdecea;
  --yellow: #f59e0b; --yellow-bg: #fef3c7;
  --orange: #f97316; --orange-bg: #fff7ed;
  --gray: #6b7280; --gray-bg: #f3f4f6; --gray-light: #f9fafb;
  --text-primary: #111827; --text-secondary: #374151; --text-muted: #9ca3af;
  --border: #e5e7eb; --border-light: #f0f2f5; --border-mid: #d1d5db;
  --radius: 10px; --radius-sm: 6px;
}

/* Custom Scrollbars Minimalistas */
::-webkit-scrollbar { width: 5px; height: 5px; display: none; }
#content-scroll::-webkit-scrollbar { display: block; }
.info-sidebar::-webkit-scrollbar { display: block; }
.action-content::-webkit-scrollbar { display: block; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(26, 74, 92, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(26, 74, 92, 0.3); }

html, body {
  height: 100%; overflow: hidden;
  background: #f0f4f8;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; color: var(--text-primary);
  text-rendering: optimizeLegibility;
}
#app { display: flex; flex-direction: column; height: 100vh; }

/* ================== CSS - LAYOUT E HEADER ================== */
#header {
  flex-shrink:0; z-index:20;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  display: flex;
  align-items: flex-end;
  padding: 16px 16px 14px 16px;
  gap: 16px;
  overflow: visible; 
}
.header-top { 
  display:flex; 
  align-items:flex-end; 
  gap:8px; 
  flex-shrink:0; 
  overflow: visible;
}

.date-tabs-separator {
  width: 1px; height: 34px; background: var(--border-mid); flex-shrink: 0;
  margin-bottom: 2px;
}

.date-tabs-wrap {
  display: flex; align-items: center; gap: 6px;
  overflow-x: visible;
  flex: 1; padding-bottom: 3px;
}

/* Pílulas de Data */
.date-tab {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; height: 28px;
  border: 1px solid transparent; border-radius: 14px;
  background: transparent; cursor: pointer; font-family: inherit; color: var(--text-secondary);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1); white-space: nowrap;
}
.date-tab:hover { background: var(--gray-bg); transform: translateY(-1px); }
.date-tab.today { color: var(--brand); font-weight: 700; }
.date-tab.active {
  background: #ffffff;
  border: 1px solid var(--border-mid);
  box-shadow: 0 2px 8px rgba(26, 74, 92, 0.08);
  color: var(--brand); font-weight: 700;
}
.tab-date { font-size: 0.85rem; }
.tab-weekday { font-size: 0.7rem; opacity: 0.8; }
.tab-count { font-size: 0.7rem; background: var(--gray-bg); color: var(--text-secondary); padding: 2px 6px; border-radius: 99px; font-weight: 700; }
.date-tab.active .tab-count { background: var(--brand-light); color: var(--brand); }

#content-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; width: 100%; padding: 16px; box-sizing: border-box; }
#content { padding-top: 0 !important; margin-top: 0 !important; }

/* ================== CSS - SEÇÕES (DATAS) NO DASHBOARD ================== */
.section { margin-bottom: 15px; margin-top: 0; }
.section:first-child { margin-top: 0 !important; }

.section-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 24px;
  background: #ffffff;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 16px 16px 0 0; cursor: pointer; user-select: none;
  transition: all 0.15s; width: 100%; box-sizing: border-box; color: var(--brand);
}
.section-header:hover { background: var(--gray-light); }
.section-header.highlighted {
  background: var(--brand);
  color: white; border: 1px solid var(--brand);
  box-shadow: 0 4px 15px rgba(26, 74, 92, 0.15);
}
.section-header.highlighted .section-count { background: rgba(255,255,255,0.2); color: white; }
.section-header.highlighted .section-collapse { color: rgba(255,255,255,0.8); }
.section-title { font-size: 1rem; font-weight: 700; flex: 1; }
.section-count { font-size: 0.75rem; background: var(--brand-light); color: var(--brand); padding: 4px 12px; border-radius: 99px; font-weight: 700; }
.section-collapse { font-size: 0.7rem; color: inherit; opacity: 0.7; }
.section.collapsed .section-collapse { transform: rotate(-90deg); }
.section.collapsed .section-header { border-radius: 16px; }
.section.collapsed .section-body { display: none; }

.section-body {
  background: transparent;
  border: none;
  border-radius: 0 0 16px 16px; padding: 12px 0;
}
.vazio { padding: 32px; text-align: center; color: var(--text-secondary); font-style: italic; font-size: 0.95rem; font-weight: 600; }

/* ================== CSS - SLEEK FLEX LIST ================== */
.sleek-list { display: flex; flex-direction: column; gap: 8px; }
.sleek-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border); border-radius: 16px;
  padding: 12px 16px; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); cursor: pointer;
  position: relative; box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  overflow: hidden;
  transform: translateZ(0);
}
.sleek-row:hover {
  border-color: var(--border-mid);
  box-shadow: 0 10px 24px rgba(31, 38, 135, 0.08);
  transform: translateY(-2px) translateZ(0);
  z-index: 10;
}
.sleek-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; transition: background 0.2s, width 0.2s; border-radius: 16px 0 0 16px; }
.sleek-row.status-alert::before { background: var(--yellow); }
.sleek-row.status-error::before { background: var(--red); }
.sleek-row.status-ok::before { background: var(--green-mid); }
.sleek-row:hover::before { width: 6px; }

.s-left { display: flex; align-items: center; gap: 14px; width: 280px; flex-shrink: 0; }
.s-time { font-size: 1.3rem; font-weight: 700; color: var(--brand); width: 54px; flex-shrink: 0; text-align: center; }
.s-info { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0; width: 100%; }
.s-apto-wrapper { position: relative; display: inline-flex; align-items: baseline; justify-content: flex-start; max-width: 100%; }
.s-apto { font-weight: 700; font-size: 1.1rem; color: var(--text-primary); white-space: normal; line-height: 1.2; word-break: break-word; }
.s-code { position: absolute; left: 100%; bottom: 2px; padding-left: 6px; font-size: 0.7rem; color: var(--text-muted); font-weight: 700; white-space: nowrap; }
.s-guest { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; max-width: 100%; }

.s-obs-col { width: 180px; flex-shrink: 0; padding: 0 16px; display: flex; align-items: center; border-left: 1px solid var(--border-light); }
.s-obs {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    -webkit-line-clamp: unset !important; /* Remove limite de linhas, se houver */
    display: block !important;
    max-height: none !important;
    font-size: 12px !important;
  }

.s-mid { display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0 16px; border-left: 1px solid var(--border-light); }
.s-dots-container { background: var(--gray-light); padding: 6px 12px; border-radius: 99px; display: flex; gap: 6px; border: 1px solid var(--border); }
.sdot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sdot-ok { background: var(--green-mid); }
.sdot-bad { background: var(--red); }
.sdot-alert { background: var(--yellow); }
.sdot-gray { background: var(--border-mid); }

.s-chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 220px; padding: 0 16px; align-items: center; justify-content: flex-start; }
.s-chip { display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: 8px; white-space: nowrap; line-height: 1.4; border: 1px solid var(--border); color: var(--brand-mid); background: #ffffff; }

.s-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; justify-content: flex-end; }
.avatar-group { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: help; }
.avatar-lbl { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); line-height: 1; letter-spacing: 0.5px; }

@keyframes slidePop { 0% { opacity: 1; transform: scale(1); } 30% { transform: scale(1.02); } 100% { opacity: 0; transform: scale(0.95) translateX(50px); } }
.sleek-row.popping { animation: slidePop 0.25s ease-in-out forwards; pointer-events: none; }

@media (max-width: 768px) {
  .sleek-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .s-left { width: 100%; }
  .s-obs-col { width: 100%; border-left: none; padding: 0; }
  .s-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .s-mid { padding: 0; border-left: none; }
  .s-chips-wrap { justify-content: flex-start; padding: 0; }
}

/* ================== CSS - MODAL CENTRAL E DOCK DE MINIMIZADOS ================== */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 23, 42, 0.6); overflow: hidden;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }

.minimized-dock {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column-reverse;
  gap: 12px; z-index: 90; pointer-events: none;
}

.modal-pill {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #ffffff;
  border: 1px solid var(--border-mid); border-radius: 40px;
  cursor: pointer; gap: 12px;
  box-shadow: 0 8px 24px rgba(31,38,135,0.12);
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.2s;
}
.modal-pill:hover {
  border-color: var(--brand-mid); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(26, 74, 92, 0.15);
}
@keyframes popIn { 0% { transform: scale(0.9) translateY(20px); opacity: 0; } 100% { transform: none; opacity: 1; } }

.pill-icon { width: 14px; height: 14px; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none; transition: 0.2s; }
.modal-pill:hover .pill-icon { transform: scale(1.1); }
.pill-text { font-weight: 700; color: var(--brand); font-size: 0.95rem; }
.pill-close {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-light); border: none; cursor: pointer;
  color: var(--text-muted); transition: 0.2s; font-weight: 700; font-size: 0.8rem;
}
.pill-close:hover { background: var(--red-bg); color: var(--red); }

/* Modal Sólido */
.modal {
  background: #f4f7fb; border: 3px solid #164e63;
  border-radius: 20px; width: 100%; max-width: 950px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: slideUpGlass 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateZ(0);
}

.modal-header { padding: 20px 28px; background: #ffffff; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; }
.modal-header-info { flex: 1; min-width: 0; }
.modal-title { font-size: 1.45rem; font-weight: 700; color: var(--brand); letter-spacing: -0.5px; margin-bottom: 2px; }
.modal-close, .modal-minimize { width: 32px; height: 32px; border-radius: 99px; border: 1px solid var(--border); background: var(--gray-light); color: var(--text-secondary); font-size: 1rem; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.2s; font-weight: 700; }
.modal-close:hover, .modal-minimize:hover { background: var(--border); transform: scale(1.05); color: var(--text-primary); }
.modal-minimize { padding-bottom: 8px; margin-right: 8px; }

.modal-body { display: grid; grid-template-columns: 290px 1fr; gap: 0; flex: 1; min-height: 0; overflow: hidden;}

.info-sidebar {
  padding: 24px; background: #ffffff;
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto; min-height: 0;
}
.info-sidebar .info-card { margin-bottom: 10px; }
.info-card { background: var(--gray-light); padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); transition: transform 0.2s; }
.info-card:hover { transform: translateY(-2px); }
.info-card .label { font-size: 0.65rem; font-weight: 700; color: var(--brand-mid); text-transform: uppercase; margin-bottom: 3px; display: block; opacity: 0.85; }
.info-card .value { font-size: 0.95rem; font-weight: 700; color: var(--brand); word-break: break-all; line-height: 1.2; }

.action-content {
  padding: 24px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; background: transparent;
}

.input-group { display: flex; flex-direction: column; gap: 4px; }

/* Fixa o rodapé de forma absoluta no canto inferior da tela do modal */
.modal-footer {
  display: flex;
  justify-content: space-between;
  background-color: transparent;
  align-items: center;
  padding: 16px 20px 20px 20px;
  border-top: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}
.modal-footer .icon-btn-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
  padding-bottom: 0; 
}

.modal-right {
  display: flex;
  flex-direction: column;
  height: 100%; /* Força a coluna a acompanhar a altura máxima */
}

/* Garante que a tooltip apareça acima do botão quando houver hover no wrapper */
.modal-footer .icon-btn-wrapper:hover .tooltip {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Estabiliza a tooltip para não ser afetada pela rotação do fundo (BG) do botão */
.modal-footer .tooltip {
    bottom: 125%; /* Um pouco mais alto para não encostar no quadrado girando */
    pointer-events: none;
}

.edit-input, .edit-textarea { font-size: 0.85rem; color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #ffffff; box-shadow: inset 0 1px 3px rgba(0,0,0,0.02); font-family: inherit; width: 100%; transition: all 0.2s; resize: vertical;}
.edit-input:focus, .edit-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26, 74, 92, 0.1); resize: vertical;}
.edit-textarea { resize: vertical; }

/* Botões de Ação na Sidebar (Ficha / Self) */
.btns { 
  display: flex; 
  flex-direction: row; 
  gap: 24px; 
  margin-top: auto; 
  justify-content: center;
  align-items: center;
}

.icon-btn-wrapper { 
  position: relative; 
  display: inline-flex; 
  justify-content: center; 
  align-items: center; 
}

.icon-btn-wrapper a { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: none; 
  border: none; 
  cursor: pointer; 
  padding: 4px; 
  color: inherit; 
  text-decoration: none; 
}

.action-icon { 
  width: 32px; 
  height: 32px; 
  stroke: var(--text-secondary); 
  transition: all 0.2s ease-in-out; 
}

/* Hover no Ícone: Cresce e muda de cor */
.icon-btn-wrapper:hover .action-icon { 
  transform: scale(1.25); 
}
.icon-btn-wrapper.ficha:hover .action-icon { stroke: var(--brand); }
.icon-btn-wrapper.self:hover .action-icon { stroke: var(--accent); }

/* A Bolha de Dica (Tooltip) */
.tooltip {
  position: absolute; 
  bottom: 100%; 
  left: 50%; 
  transform: translateX(-50%) scale(0);
  transform-origin: bottom center; 
  z-index: 20; 
  padding: 6px 12px; 
  border-radius: 8px;
  border: 1px solid var(--border); 
  background: #ffffff; 
  color: var(--text-primary);
  font-size: 0.8rem; 
  font-weight: 700; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.2s ease-in-out; 
  pointer-events: none; 
  white-space: nowrap; 
  margin-bottom: 8px;
}

/* Exibe a Bolha no Hover */
.icon-btn-wrapper:hover .tooltip { 
  transform: translateX(-50%) scale(1); 
}

/* * NOVO BOTÃO DE SALVAR (Quadrado Animado Mapê) */
.Btn {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: transparent;
  position: relative;
  border-radius: 10px;
  cursor: pointer;
  transition: all .3s;
  z-index: 1; /* A MÁGICA: Cria uma camada própria, impedindo o BG de vazar pra trás do rodapé */
}

.svgContainer {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  backdrop-filter: blur(0px);
  letter-spacing: 0.8px;
  border-radius: 10px;
  transition: all .3s;
  border: 1px solid rgba(26, 74, 92, 0.2);
  position: relative;
  z-index: 2; /* Fica acima do BG */
}

.BG {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background: var(--brand); /* Azul Mapê */
  z-index: 1; /* Alterado de -1 para não sumir atrás do branco */
  border-radius: 10px;
  pointer-events: none;
  transition: all .3s;
  box-shadow: 0 4px 12px rgba(26, 74, 92, 0.3);
}

.Btn:hover .BG {
  transform: rotate(35deg);
  transform-origin: bottom;
  background: var(--accent); /* Salmão no hover */
  box-shadow: 0 4px 12px rgba(232, 132, 90, 0.4);
}

.Btn:hover .svgContainer {
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
}

.modal-footer .Btn .svgContainer svg {
  fill: #FFFEF1;
  transition: fill 0.2s;
}
.modal-footer .Btn:hover .svgContainer svg {
  fill: #1E4C61;
}

.Btn:active { transform: scale(0.95); }

/* Estados Pós-clique (Salvando, Salvo, Erro) */
.Btn.saving .BG { background: var(--text-muted); transform: rotate(0deg); box-shadow: none; }
.Btn.saving .svgContainer svg { display: none; }
.Btn.saving .svgContainer::after { content: '...'; color: white; font-weight: 800; font-size: 1.2rem; letter-spacing: 2px; margin-bottom: 5px; }

.Btn.saved .BG { background: var(--green); transform: rotate(0deg); box-shadow: 0 4px 12px rgba(34,163,78,0.3); }
.Btn.saved .svgContainer svg { display: none; }
.Btn.saved .svgContainer::after { content: '✓'; color: white; font-weight: 800; font-size: 1.5rem; }

.Btn.error .BG { background: var(--red); transform: rotate(0deg); }
.Btn.error .svgContainer svg { display: none; }
.Btn.error .svgContainer::after { content: '✕'; color: white; font-weight: 800; font-size: 1.5rem; }

/* Checkboxes Flat Toggle */
.glass-toggle { flex: 1; cursor: pointer; user-select: none; }
.glass-toggle input { display: none; }
.gt-text {
  display: flex; align-items: center; justify-content: center; width: 100%; padding: 12px 10px;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: 10px; font-weight: 700; font-size: 0.8rem; color: var(--text-secondary);
  transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.glass-toggle:hover .gt-text { background: var(--gray-light); transform: translateY(-1px); }
.glass-toggle input:checked + .gt-text {
  background: var(--brand); color: white; border-color: var(--brand);
  transform: translateY(1px); box-shadow: none;
}

/* ================== CSS - CHIPS E BADGES ================== */
.chip-green { background: var(--green-bg); color: var(--green); border-color: var(--green-bg); }
.chip-red { background: var(--red-bg); color: var(--red); border-color: var(--red-bg); }
.chip-blue { background: var(--brand-light); color: var(--brand); border-color: var(--brand-light); }
.chip-orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-bg); }
.chip-gray { background: var(--gray-bg); color: var(--gray); border-color: var(--gray-bg); }
.chip-yellow { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }
.chip-cyan { background: #06b6d4; color: #fff; border-color: #06b6d4; }
.chip-teal { background: #0891b2; color: #fff; border-color: #0891b2; }
.chip-darkteal { background: #164e63; color: #fff; border-color: #164e63; }

.ficha-type-badge { display: inline-block; font-weight: 600; border: 1px solid transparent; border-radius: 4px; font-size: 0.6rem; padding: 1px 4px; margin-top: 2px; }
.ftype-green { background: #e6f7ee; color: #166534; border-color: #bbf7d0; }
.ftype-blue { background: var(--brand-light); color: var(--brand); border-color: #bae6fd; }
.ftype-orange { background: var(--orange-bg); color: var(--orange); border-color: #fed7aa; }
.ftype-purple { background: #f3e8ff; color: #7c3aed; border-color: #e9d5ff; }
.ftype-gray { background: var(--gray-bg); color: var(--gray); border-color: rgba(0,0,0,0.1); }

/* ================== CSS - FILTROS E DROPDOWNS ================== */
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); padding-left: 4px; text-align: center; }

.fsel, .upicker, .csel {
  position: relative; cursor: pointer; border: 1px solid var(--border); border-radius: 8px;
  background: #ffffff; user-select: none; transition: all 0.2s; box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.fsel:hover, .upicker:hover, .csel:hover { background: var(--gray-light); }
/* Eleva o campo aberto para a camada mais alta, impedindo que a linha de baixo o fure */
.fsel.open, .upicker.open, .csel.open { 
  border-color: var(--brand); 
  box-shadow: 0 0 0 3px rgba(26, 74, 92, 0.1); 
  z-index: 999 !important; 
}
.fsel-face, .upicker-face, .csel-face { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; min-height: 34px; }
.csel-face, .upicker-face { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }

.fsel-dropdown, .upicker-dropdown, .csel-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--border); border-radius: 12px; z-index: 9999;
  box-shadow: 0 16px 40px rgba(0,0,0,0.15); overflow: hidden;
}
.fsel-list, .upicker-list, .csel-list { max-height: 240px; overflow-y: auto; }
.fsel-item, .upicker-item, .csel-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.1s;
  display: flex; /* Adicionado para alinhar horizontalmente */
  align-items: center; /* Centraliza a foto e o texto na mesma linha */
  gap: 10px; /* Adiciona espaço entre a foto e o nome */
}
.fsel-item:hover, .upicker-item:hover, .csel-item:hover { background: var(--brand-light); color: var(--brand); }
.upicker-search, .fsel-search { width: 100%; padding: 10px 14px; border: none; border-bottom: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; font-family: inherit; outline: none; background: var(--gray-light); }
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 4px; /* Espaço entre o título e o campo de input */
}
.input-group label { 
  font-size: 0.65rem; 
  font-weight: 700; 
  color: var(--text-secondary); 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  cursor: default; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
  margin: 0; 
}


.tags-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag-btn { font-size: 0.75rem; font-weight: 500; padding: 4px 14px; border-radius: 99px; border: 1px solid var(--border); cursor: pointer; background: #ffffff; color: var(--text-muted); font-family: inherit; transition: all 0.2s; }
.tag-btn.active-self { background: var(--brand); color: white; border-color: var(--brand); font-weight: 700; }
.tag-btn.active-early { background: var(--accent); color: white; border-color: var(--accent); font-weight: 700; }
.tag-btn.active-late { background: #555; color: white; border-color: #555; font-weight: 700; }

.clear-btn { padding: 5px 12px; border-radius: var(--radius-sm); border: 1.5px solid #fdd; background: #ffffff; font-size: 0.75rem; font-weight: 700; color: #ccc; cursor: pointer; font-family: inherit; transition: all 0.15s; display: none; align-self: flex-end; height: 32px; }
.clear-btn.visible { display: block; color: var(--accent); border-color: var(--accent); }
.clear-btn.visible:hover { background: var(--red-bg); transform: translateY(-1px); }
.loading { font-size: 1rem; color: var(--brand); font-weight: 600; text-align: center; padding: 60px 0; }

/* Botão de Engrenagem */
.gear-btn {
  background: transparent; 
  border: none; 
  cursor: pointer;
  font-size: 0.85rem; 
  opacity: 0.3; 
  padding: 0;
  line-height: 1;
  display: flex;
  transition: opacity 0.2s;
}
.gear-btn:hover { 
  opacity: 0.8; 
}

/* Mini-Modal de Opções */
.opts-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,0.95);
  backdrop-filter: blur(4px); z-index: 50; display: none;
  flex-direction: column; padding: 24px; border-radius: 20px;
}
.opts-overlay.open { display: flex; animation: fadeIn 0.2s; }
.opts-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.opts-title { font-size: 1.1rem; font-weight: 700; color: var(--brand); }
.opts-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; margin-bottom: 16px; padding-right: 4px; }
.opt-row { display: flex; gap: 8px; }
.opt-input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; font-family: inherit; }
.opt-input:focus { outline: none; border-color: var(--brand); }
.opt-del { background: var(--red-bg); color: var(--red); border: none; border-radius: 8px; width: 34px; cursor: pointer; font-weight: 700; transition: 0.2s; }
.opt-del:hover { background: var(--red); color: white; }
.opts-footer { display: flex; gap: 12px; justify-content: flex-end; }
.btn-outline { background: white; border: 1px solid var(--border-mid); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text-secondary); }
.btn-outline:hover { background: var(--gray-light); }
.btn-primary { background: var(--brand); border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; color: white; transition: 0.2s;}
.btn-primary:hover { background: var(--brand-mid); }
.btn-add { width: 100%; background: var(--gray-light); border: 1px dashed var(--border-mid); padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text-secondary); margin-top: 4px; }
.btn-add:hover { background: var(--brand-light); color: var(--brand); border-color: var(--brand); }

/* Botão de Expandir Texto */
.expand-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 1rem; opacity: 0.3; padding: 0; line-height: 1;
  display: flex; transition: opacity 0.2s; margin-left: 8px;
}
.expand-btn:hover { opacity: 0.9; color: var(--brand); }

/* Força a alça de redimensionamento a aparecer e impede cortes */
.input-group {
    overflow: visible !important;
}

textarea.edit-input {
    min-height: 80px !important;
}


/* Estado expandido do input-group */
.input-group.is-expanded {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: #ffffff; /* Fundo branco para cobrir os outros campos */
  display: flex !important;
  flex-direction: column;
  padding: 16px; /* Ajuste se quiser alinhado com a borda do seu modal */
  margin: 0 !important;
  border-radius: 8px;
}

.input-group.is-expanded textarea {
  flex-grow: 1; /* Faz o campo de texto ocupar todo o espaço restante */
  height: 100% !important;
  resize: none !important; /* Remove a alça de redimensionamento na tela cheia */
}

/* Garante que o botão X fique visível */
.input-group.is-expanded .expand-btn {
  opacity: 1;
  color: var(--brand);
  font-size: 1.2rem;
}

/* Força a alça a aparecer e desenha um marcador no canto inferior direito */
textarea.forca-resize {
    resize: vertical !important;
    overflow-y: auto !important;
    min-height: 120px !important;
    display: block !important;
    position: relative !important;
}

textarea.forca-resize::-webkit-resizer {
    display: block !important;
    background: transparent;
    border-bottom: 3px solid var(--brand); /* Pinta a alça com a cor do seu tema */
    border-right: 3px solid var(--brand);
}

.modal-minimizing {
    animation: minimizeModal 0.2s ease-in forwards !important;
    pointer-events: none; /* Prevents clicks while it's closing */
}

@keyframes minimizeModal {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(0.95) translateY(10px);
        opacity: 0;
    }
}

/* ============ BOTÃO CI-BTN — VERSÃO CORRIGIDA ============ */
.ci-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  background: #1E4C61;
  color: #ffffff;
  padding: 0.6em 1.4em 0.6em 1em;
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
  width: fit-content;
}
.ci-btn span {
  display: block;
  margin-left: 0.3em;
  transition: all 0.3s ease-in-out;
  white-space: nowrap;
}
.ci-btn svg {
  display: block;
  transform-origin: center center;
  transition: transform 0.3s ease-in-out;
  color: #F5A58E;
  flex-shrink: 0;
}
.ci-btn:hover { background: #1E4C61; }
.ci-btn:hover .svg-wrapper {
  animation: ci-fly 0.6s ease-in-out infinite alternate;
}
.ci-btn:hover svg {
  transform: translateX(2.35em) rotate(45deg) scale(1.1);
}
.ci-btn:hover span {
  transform: translateX(5em);
  opacity: 0;
}
.ci-btn:active { transform: scale(0.95); }
.ci-btn:disabled { opacity: 0.7; cursor: not-allowed; }
@keyframes ci-fly {
  from { transform: translateY(0.1em); }
  to   { transform: translateY(-0.1em); }
}

.filter-done-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-mid);
  background: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
  height: 32px;
}
.filter-done-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.filter-done-btn:hover {
  transform: translateY(-1px);
}

.sleek-row.checkin-done {
  opacity: 0.5;
  background: var(--gray-bg);
  border-color: var(--border-light);
}
.sleek-row.checkin-done::before {
  background: var(--border-mid) !important;
}

.ci-done {
  font-family: inherit;
  font-size: 0.9rem;
  background: #1E4C61;
  color: #F5A58E;
  padding: 0.6em 1.4em 0.6em 1em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  font-weight: 600;
  width: fit-content;
}