* { box-sizing: border-box; }

:root {
  --blue-bg-1: #2f5fe0;
  --blue-bg-2: #1d3fb0;
  --panel: #ffffff;
  --panel-soft: rgba(255,255,255,0.14);
  --text-dark: #16213e;
  --text-light: #ffffff;
  --radius: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--blue-bg-1), var(--blue-bg-2));
  color: var(--text-light);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}
.brand {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}
.nav { display: flex; gap: 8px; }
.nav-btn {
  background: var(--panel-soft);
  border: none;
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, transform .15s ease;
}
.nav-btn:hover { background: rgba(255,255,255,0.28); transform: translateY(-1px); }
.nav-btn.active { background: #fff; color: var(--text-dark); }
.nav-link { display: inline-flex; align-items: center; text-decoration: none; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#search {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  outline: none;
  font-size: 14px;
  width: 200px;
}
#exportBtn, #importBtn {
  background: var(--panel-soft);
  border: none;
  color: var(--text-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
#exportBtn:hover, #importBtn:hover { background: rgba(255,255,255,0.28); }

main#app { padding: 32px 40px 80px; max-width: 1200px; margin: 0 auto; }

/* ---------- Dashboard ---------- */
.page-title { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.page-subtitle { opacity: .85; margin: 0 0 22px; font-size: 14px; }
.section-heading { font-size: 17px; font-weight: 800; margin: 26px 0 14px; }

/* ---------------- Overview panel ---------------- */
.overview-panel { margin-top: 30px; margin-bottom: 4px; }
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-chip {
  background: #eef1fa;
  color: var(--text-dark);
  font-weight: 800;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
}
.stat-chip.stat-danger { background: #fde3e3; color: #c33; }
.stat-chip.stat-info { background: #dbe6ff; color: #2a52c9; }

.overview-block { margin-top: 18px; }
.overview-subtitle { font-size: 14px; font-weight: 800; margin: 0 0 10px; opacity: .75; }
.overview-subtitle.danger { color: #c33; opacity: 1; }

.status-atrasado { background: #fde3e3; color: #c33; margin-left: auto; }

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 28px 20px;
}

.client-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
}

.folder-wrap {
  position: relative;
  width: 100%;
  max-width: 150px;
}

.folder-shape {
  width: 100%;
  aspect-ratio: 1.15 / 1;
  max-width: 150px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);
  transition: transform .15s ease, box-shadow .15s ease;
}

.overdue-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e04a4a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  border: 2px solid var(--blue-bg-2);
}
.client-card:hover .folder-shape { transform: translateY(-4px) scale(1.03); box-shadow: 0 14px 28px rgba(0,0,0,0.3); }

.folder-shape::before {
  content: "";
  position: absolute;
  top: 0; left: 14%;
  width: 40%;
  height: 14%;
  background: inherit;
  filter: brightness(1.15);
  border-radius: 0 0 10px 10px;
  transform: translateY(-55%);
}

.folder-front {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 44%;
  background: rgba(255,255,255,0.32);
  border-radius: 20px 20px 20px 20px;
}

.client-label {
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-card .folder-shape {
  background: rgba(255,255,255,0.12);
  border: 2px dashed rgba(255,255,255,0.5);
  align-items: center;
  justify-content: center;
}
.add-card .folder-shape::before { display: none; }
.add-card .folder-shape .plus { font-size: 40px; font-weight: 300; margin: 0; }

.empty-state {
  opacity: .85;
  padding: 40px 0;
  text-align: center;
}

/* ---------- Panels (white cards used everywhere) ---------- */
.panel {
  background: var(--panel);
  color: var(--text-dark);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

/* ---------- Client page ---------- */
.back-btn {
  background: var(--panel-soft);
  border: none;
  color: var(--text-light);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
.back-btn:hover { background: rgba(255,255,255,0.28); }

.client-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.client-header .client-color-chip {
  width: 64px; height: 64px;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.client-header h1 { margin: 0; font-size: 26px; }
.client-header-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  background: var(--panel-soft);
  border: none;
  color: var(--text-light);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: rgba(255,255,255,0.28); }
.icon-btn.danger:hover { background: #e04a4a; }

.quick-links {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.quick-link-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  color: var(--text-dark);
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
  transition: transform .15s ease;
}
.quick-link-btn:hover { transform: translateY(-2px); }
.quick-link-btn .qicon { font-size: 20px; }
.quick-link-btn.unset { opacity: .7; border: 2px dashed #ccc; box-shadow: none; }

section.block { margin-bottom: 28px; }
.block-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Captação list */
.captacao-form {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.captacao-form input {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 14px;
}
.captacao-form input#capDate {
  flex: 0 1 150px;
  min-width: 140px;
}
.btn-primary {
  background: var(--blue-bg-1);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.btn-primary:hover { background: var(--blue-bg-2); }

.captacao-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.captacao-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4f6fb;
  border-radius: 10px;
  padding: 10px 14px;
}
.captacao-list a { color: var(--blue-bg-1); font-weight: 600; text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.captacao-list a:hover { text-decoration: underline; }
.cap-date {
  font-size: 12px;
  font-weight: 700;
  color: #1a8a4a;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.row-del {
  background: transparent;
  border: none;
  color: #c33;
  cursor: pointer;
  font-size: 16px;
}

/* Calendar */
.cal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.cal-nav-btn {
  background: #f0f2f8;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}
.cal-month-label { font-weight: 700; font-size: 16px; min-width: 150px; text-transform: capitalize; }
.cal-header .btn-primary { margin-left: auto; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  opacity: .55;
  padding-bottom: 4px;
}
.cal-cell {
  min-height: 64px;
  border-radius: 10px;
  background: #f7f8fc;
  padding: 6px;
  font-size: 12px;
  position: relative;
}
.cal-cell.out { opacity: .35; }
.cal-cell.today { outline: 2px solid var(--blue-bg-1); }
.cal-cell .daynum { font-weight: 700; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; }

.agenda-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agenda-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f4f6fb;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
.agenda-date { font-weight: 800; font-size: 13px; min-width: 46px; }
.agenda-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.agenda-title { flex: 1; font-weight: 600; font-size: 14px; }
.agenda-meta { font-size: 12px; opacity: .65; }
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e5e9f4;
  white-space: nowrap;
}
.status-entregue { background: #d5f2e0; color: #1a8a4a; }
.status-agendado { background: #fdeccb; color: #b06a00; }
.status-producao { background: #dbe6ff; color: #2a52c9; }
.status-captacao { background: #dcfce7; color: #15803d; }

.client-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.client-tag .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,20,50,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-box {
  background: #fff;
  color: var(--text-dark);
  border-radius: 18px;
  padding: 26px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.modal-box h2 { margin: 0 0 18px; font-size: 19px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 14px;
}
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
}
.swatch.selected { border-color: var(--text-dark); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-ghost {
  background: #eee;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.btn-danger { background: #e04a4a; color: #fff; border: none; padding: 10px 18px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  #search { width: 130px; }
  main#app { padding: 22px 16px 60px; }
}
