/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* ===== HEADER ===== */
header {
  background: linear-gradient(135deg, #1a73e8, #0d47a1);
  color: white;
  padding: 16px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.header-actions button {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.header-actions button:hover {
  background: rgba(255,255,255,0.35);
}

/* ===== CONFIG PANEL ===== */
.config-panel {
  background: white;
  max-width: 600px;
  margin: 20px auto;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.config-panel h3 {
  margin-bottom: 16px;
  color: #1a73e8;
}

.config-panel label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 10px 0 4px;
  color: #555;
}

.config-panel input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.config-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.config-actions button {
  padding: 9px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  background: #1a73e8;
  color: white;
  transition: background 0.2s;
}

.config-actions button:hover {
  background: #1558b0;
}

.sync-status {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  display: none;
}

.sync-status.success {
  background: #e8f5e9;
  color: #2e7d32;
  display: block;
}

.sync-status.error {
  background: #ffebee;
  color: #c62828;
  display: block;
}

.sync-status.loading {
  background: #e3f2fd;
  color: #1565c0;
  display: block;
}

/* ===== LEGENDA ===== */
.legend {
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #555;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot-perfex   { background: #1a73e8; }
.dot-manual   { background: #7b1fa2; }
.dot-expiring { background: #f57c00; }
.dot-expired  { background: #c62828; }

/* ===== NAVEGAÇÃO DO CALENDÁRIO ===== */
.calendar-nav {
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.calendar-nav button {
  background: white;
  border: 1px solid #ddd;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.calendar-nav button:hover {
  background: #1a73e8;
  color: white;
  border-color: #1a73e8;
}

.calendar-nav h2 {
  font-size: 1.3rem;
  min-width: 220px;
  text-align: center;
  color: #1a73e8;
}

/* ===== CALENDÁRIO ===== */
.calendar-wrapper {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 20px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.day-header {
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #888;
  padding: 8px 0;
  text-transform: uppercase;
}

.day-cell {
  min-height: 90px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.day-cell:hover {
  background: #f5f9ff;
}

.day-cell.today {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.day-cell.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.day-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 4px;
}

.day-cell.today .day-number {
  background: #1a73e8;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.event-chip {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  transition: opacity 0.15s;
}

.event-chip:hover {
  opacity: 0.85;
}

.chip-perfex {
  background: #d2e3fc;
  color: #1a73e8;
  border-left: 3px solid #1a73e8;
}

.chip-manual {
  background: #f3e5f5;
  color: #7b1fa2;
  border-left: 3px solid #7b1fa2;
}

.chip-expiring {
  background: #fff3e0;
  color: #e65100;
  border-left: 3px solid #f57c00;
}

.chip-expired {
  background: #ffebee;
  color: #c62828;
  border-left: 3px solid #c62828;
}

.more-events {
  font-size: 0.68rem;
  color: #888;
  margin-top: 2px;
}

/* ===== LISTA DE CONTRATOS ===== */
.contracts-list-section {
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.contracts-list-section h3 {
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 12px;
}

.contracts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.contract-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  border-left: 4px solid #1a73e8;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.contract-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.contract-card.manual { border-left-color: #7b1fa2; }
.contract-card.expiring { border-left-color: #f57c00; }
.contract-card.expired { border-left-color: #c62828; }

.contract-card h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: #222;
}

.contract-card p {
  font-size: 0.82rem;
  color: #666;
  margin: 2px 0;
}

.contract-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  margin-top: 6px;
}

.badge-perfex   { background: #d2e3fc; color: #1a73e8; }
.badge-manual   { background: #f3e5f5; color: #7b1fa2; }
.badge-expiring { background: #fff3e0; color: #e65100; }
.badge-expired  { background: #ffebee; color: #c62828; }

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #1a73e8;
  font-size: 1.15rem;
}

.modal-content label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin: 12px 0 4px;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.modal-content textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
  background: #1a73e8;
  color: white;
}

.modal-actions button:hover {
  background: #1558b0;
}

.btn-cancel {
  background: #f5f5f5 !important;
  color: #555 !important;
}

.btn-cancel:hover {
  background: #e0e0e0 !important;
}

.btn-danger {
  background: #c62828 !important;
}

.btn-danger:hover {
  background: #8d1515 !important;
}

/* ===== DETAIL MODAL ===== */
#detailContent {
  font-size: 0.92rem;
  line-height: 1.7;
}

#detailContent .detail-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
}

#detailContent .detail-label {
  font-weight: 600;
  color: #555;
  min-width: 130px;
}

#detailContent .detail-value {
  color: #222;
}

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}

/* ===== UTILITÁRIOS ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVO ===== */
@media (max-width: 700px) {
  .day-cell { min-height: 60px; }
  .event-chip { font-size: 0.62rem; }
  .calendar-nav h2 { font-size: 1rem; min-width: 160px; }
  .contracts-list { grid-template-columns: 1fr; }
}
/* ===== BARRA DE FILTROS ===== */
.filter-bar {
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
}

.filter-bar input[type="text"] {
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  width: 240px;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-bar input[type="text"]:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.filter-bar select {
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.filter-bar select:focus {
  outline: none;
  border-color: #1a73e8;
}

.btn-clear-filter {
  padding: 9px 16px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-clear-filter:hover {
  background: #ffebee;
  color: #c62828;
  border-color: #ef9a9a;
}

.filter-results {
  font-size: 0.85rem;
  color: #888;
  white-space: nowrap;
}

/* ===== BARRA DE EXPORTAÇÃO ===== */
.export-bar {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.export-bar button {
  padding: 8px 18px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #444;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: all 0.2s;
}

.export-bar button:hover {
  background: #1a73e8;
  color: white;
  border-color: #1a73e8;
  box-shadow: 0 2px 8px rgba(26,115,232,0.25);
}

/* ===== HIGHLIGHT DE FILTRO ===== */
.filter-highlight {
  background: #fff8e1 !important;
  border-color: #ffd54f !important;
}

@media (max-width: 700px) {
  .filter-bar input[type="text"] { width: 100%; }
  .filter-bar, .export-bar { flex-direction: column; align-items: stretch; }
  .export-bar button { text-align: center; }
}