/* ============================================================
   App "Bastidores" — design inspirado no jw.org
   Paleta: azul JW #4a6da7 + brancos e cinzas claros (calmo, limpo)
   ============================================================ */
:root {
  --jw:        #4a6da7;   /* azul JW principal */
  --jw-dark:   #3c5a8c;   /* azul mais escuro (cabeçalho/hover) */
  --jw-2:      #5f80b6;   /* azul claro */
  --jw-tint:   #e6ecf5;   /* fundo azul bem claro */
  --jw-tint-2: #f0f4fa;
  --fundo:     #eef1f6;
  --branco:    #ffffff;
  --texto:     #2b2f36;   /* charcoal (não preto puro) */
  --texto-suave: #6b7280;
  --borda:     #e4e9f1;
  --linha:     #eef1f6;
  --ambar-bg:  #f6ead0;
  --ambar-tx:  #8a6a1e;
  --verde-wpp: #25a35a;   /* verde WhatsApp (um pouco mais sóbrio) */
  --sombra:    0 1px 2px rgba(35, 55, 90, 0.06), 0 1px 3px rgba(35, 55, 90, 0.05);
  --sombra-md: 0 4px 14px rgba(35, 55, 90, 0.10);
  --raio:      12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

.app { padding-bottom: 88px; min-height: 100dvh; }

/* ================= Ícones ================= */
.ic { width: 1.05em; height: 1.05em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
[data-icon] { display: inline-flex; align-items: center; }

/* ================= Cabeçalho (azul JW) ================= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, #4d70aa 0%, #43639a 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 2px 10px rgba(47, 71, 116, 0.25);
}
.topbar__label { display: block; font-size: 0.72rem; letter-spacing: 0.3px; color: rgba(255,255,255,0.82); }
.topbar__hello-row, .topbar__id { min-width: 0; }
.topbar__hello { display: block; font-size: 1.12rem; font-weight: 700; color: #fff; letter-spacing: 0.2px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.45); background: rgba(255,255,255,0.12);
  font-size: 1.15rem; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.iconbtn:active { transform: scale(0.94); }
.iconbtn.spin { animation: spin 0.6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn .ic { width: 20px; height: 20px; }
#edit-btn { background: #fff; color: var(--jw-dark); box-shadow: none; display: inline-flex; align-items: center; gap: 6px; }
#edit-btn .ic { width: 16px; height: 16px; }
#edit-btn:active { transform: scale(0.97); }

/* ================= Toggle de departamento ================= */
.dept-toggle {
  display: flex; gap: 6px; max-width: 900px; margin: 0 auto;
  padding: 14px 14px 0;
}
.dept-toggle__btn {
  flex: 1; padding: 11px; border: 1px solid var(--borda); background: #fff;
  border-radius: 999px; font-weight: 600; font-size: 0.92rem; color: var(--texto-suave); cursor: pointer;
}
.dept-toggle__btn:active { transform: scale(0.98); }
.dept-toggle__btn.is-active { background: var(--jw); color: #fff; border-color: var(--jw); }

/* ================= Seções ================= */
.tab { max-width: 900px; margin: 0 auto; padding: 16px 14px; }
.block { margin-bottom: 26px; }
.block__title {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--texto-suave); margin: 0 0 12px; padding: 0 2px;
  display: flex; align-items: center; gap: 7px;
}
.block__title .ic { width: 16px; height: 16px; color: var(--jw); }
.empty { color: var(--texto-suave); text-align: center; padding: 22px; font-size: 0.92rem; }

/* ================= Seletor de dias ================= */
.day-selector { display: flex; gap: 8px; margin-bottom: 20px; }
.day-btn {
  flex: 1; padding: 13px 6px; border: 1px solid var(--borda); background: #fff;
  border-radius: var(--raio); cursor: pointer; text-align: center; box-shadow: var(--sombra);
  transition: background .15s, border-color .15s;
}
.day-btn:active { transform: scale(0.98); }
.day-btn__d { display: block; font-weight: 700; font-size: 1rem; color: var(--texto); }
.day-btn__date { font-size: 0.74rem; color: var(--texto-suave); }
.day-btn.is-active { background: var(--jw); border-color: var(--jw); box-shadow: var(--sombra-md); }
.day-btn.is-active .day-btn__d, .day-btn.is-active .day-btn__date { color: #fff; }

/* ================= Timeline (cronograma) ================= */
.timeline { position: relative; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 12px; }
.tl-rail { position: relative; }
.tl-rail::before { content: ""; position: absolute; left: 9px; top: 0; bottom: -12px; width: 2px; background: #d5deec; }
.tl-item:last-child .tl-rail::before { display: none; }
.tl-dot {
  position: absolute; left: 2px; top: 17px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 4px solid var(--jw); box-shadow: 0 0 0 2px #fff;
}
.tl-card {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 13px 15px; margin-bottom: 12px; box-shadow: var(--sombra);
}
.tl-times { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--jw-dark); font-weight: 600; font-size: 0.96rem; }
.tl-arrow { color: var(--texto-suave); }
.tl-name { font-weight: 700; font-size: 1.1rem; margin-top: 5px; letter-spacing: 0.2px; }
.tl-sub { color: var(--texto-suave); font-size: 0.85rem; margin-top: 2px; }
.tl-check { margin-top: 7px; font-size: 0.82rem; color: var(--jw-dark); background: var(--jw-tint); display: inline-block; padding: 3px 10px; border-radius: 999px; }
.tl-check b { font-weight: 700; }

.badge {
  font-size: 0.7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge--alterada { background: var(--ambar-bg); color: var(--ambar-tx); }

/* ================= Coordenadores ================= */
.coord {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 13px 16px; box-shadow: var(--sombra); display: flex; align-items: center; gap: 13px; margin-bottom: 10px;
}
.coord__ava {
  width: 38px; height: 38px; border-radius: 50%; background: var(--jw);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 700; flex-shrink: 0;
}
.coord__name { font-weight: 600; flex: 1; min-width: 0; }
.coord__wpp {
  color: var(--verde-wpp); font-weight: 700; text-decoration: none; font-size: 0.9rem;
  border: 1px solid #bfe6cd; padding: 7px 13px; border-radius: 999px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.coord__wpp .ic { width: 15px; height: 15px; }
.coord__wpp.is-disabled { color: var(--texto-suave); border-color: var(--borda); }

/* ================= Anúncios / Orientações ================= */
.note {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 15px 16px; box-shadow: var(--sombra); margin-bottom: 12px;
  border-left: 4px solid var(--jw);
}
.note__title { font-weight: 700; margin: 0 0 5px; font-size: 1.02rem; }
.note__body { color: #444a52; font-size: 0.94rem; margin: 0; line-height: 1.55; white-space: pre-wrap; }
.note__date { color: var(--texto-suave); font-size: 0.76rem; margin-top: 8px; }

/* ================= Barra de abas inferior ================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--borda); display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(35, 55, 90, 0.05);
}
.tabbar__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  padding: 9px 4px; color: var(--texto-suave); font-size: 0.74rem; font-weight: 600;
}
.tabbar__ic { display: flex; }
.tabbar__btn .ic { width: 23px; height: 23px; }
.tabbar__btn.is-active { color: var(--jw); }

/* ================= Painel de edição ================= */
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--borda); background: #fff; border-radius: 999px;
  padding: 8px 15px; font-size: 0.85rem; white-space: nowrap; cursor: pointer; color: var(--texto-suave);
}
.chip.is-active { background: var(--jw); color: #fff; border-color: var(--jw); }
.admin-list { margin-top: 12px; }
.arow {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 13px 15px; margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.arow__info { min-width: 0; }
.arow__title { font-weight: 600; }
.arow__sub { color: var(--texto-suave); font-size: 0.82rem; margin-top: 2px; }
.arow__tools { display: flex; gap: 5px; flex-shrink: 0; }
.admin-group-dept { font-weight: 800; color: var(--jw-dark); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.5px; margin: 18px 2px 4px; }
.admin-group-day { font-weight: 600; color: var(--texto-suave); font-size: 0.8rem; margin: 10px 2px 6px; }

/* ================= Botões ================= */
.btn { border: none; border-radius: 10px; padding: 12px 18px; font-size: 0.92rem; font-weight: 600; cursor: pointer; }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--jw); color: #fff; }
.btn--primary:hover { background: var(--jw-dark); }
.btn--ghost { background: var(--jw-tint); color: var(--jw-dark); }
.btn--block { width: 100%; margin-top: 6px; }
.btn--sm { padding: 9px 14px; font-size: 0.85rem; }
.icon-btn {
  border: 1px solid var(--borda); background: #fff; border-radius: 9px;
  padding: 7px 9px; font-size: 0.82rem; cursor: pointer; color: var(--texto-suave);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn .ic { width: 16px; height: 16px; }
.icon-btn[disabled] { opacity: 0.3; cursor: default; }
.icon-btn--danger { color: #c0392b; border-color: #f0c9c2; }

/* ================= Campos / Modal ================= */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 0.82rem; font-weight: 600; color: var(--texto-suave); }
.field input, .field textarea, .field select {
  border: 1px solid var(--borda); border-radius: 10px; padding: 12px;
  font-size: 1rem; font-family: inherit; width: 100%; background: #fff; color: var(--texto);
}
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--jw-tint); border-color: var(--jw); }

.modal {
  position: fixed; inset: 0; background: rgba(30, 45, 75, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60;
}
.modal__box {
  background: #fff; border-radius: 16px; width: 100%; max-width: 440px;
  padding: 22px; box-shadow: 0 24px 60px rgba(20, 35, 70, 0.35); max-height: 90dvh; overflow-y: auto;
}
.modal__title { margin: 0 0 16px; font-size: 1.2rem; color: var(--jw-dark); }
.modal__body { display: flex; flex-direction: column; gap: 13px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ================= Toast ================= */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--texto); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 0.88rem; z-index: 80; box-shadow: var(--sombra-md);
}
.toast--erro { background: #c0392b; }
