/* ============================================================
   TELEMAIS — App Shell (Admin + Portal do Cliente)
   Reaproveita os tokens de /css/style.css — inclua os dois arquivos.
   ============================================================ */

body.app-body {
  background: var(--gray-bg);
  min-height: 100vh;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--navy);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease);
}
.sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) {
  .sidebar { position: sticky; transform: none; }
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar__logo { height: 26px; width: auto; }
.sidebar__close { margin-left: auto; color: rgba(255,255,255,0.6); }
@media (min-width: 1024px) { .sidebar__close { display: none; } }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.35);
  padding: 16px 12px 6px;
  text-transform: uppercase;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  transition: background 0.2s, color 0.2s;
  width: 100%;
  text-align: left;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav-link.is-active { background: rgba(47,128,183,0.18); color: var(--white); }
.nav-link.is-active .nav-link__icon { color: var(--gold); }
.nav-link__icon { display: flex; flex-shrink: 0; }

.sidebar__footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(11,31,51,0.5);
  z-index: 290;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sidebar-overlay.is-visible { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) { .sidebar-overlay { display: none; } }

/* ------------------------------------------------------------
   Main area / topbar
   ------------------------------------------------------------ */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar__menu-btn { color: var(--navy); display: flex; }
@media (min-width: 1024px) { .topbar__menu-btn { display: none; } }
.topbar__spacer { flex: 1; }
.topbar__icon-btn { position: relative; color: var(--gray-text); display: flex; padding: 8px; border-radius: 50%; transition: background 0.2s; }
.topbar__icon-btn:hover { background: var(--gray-bg); }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #C0392B; }
.topbar__user { display: flex; align-items: center; gap: 10px; }
.avatar-chip {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-accent);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.topbar__user-name { font-size: 14px; font-weight: 600; color: var(--navy); display: none; }
@media (min-width: 640px) { .topbar__user-name { display: inline; } }

.app-content { padding: 28px 20px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }
@media (min-width: 768px) { .app-content { padding: 32px 32px 70px; } }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 24px; }
.page-head p { color: var(--gray-text); font-size: 14.5px; margin-top: 4px; }
.breadcrumbs { font-size: 13px; color: var(--gray-text); margin-bottom: 10px; }
.breadcrumbs a { color: var(--blue-accent); }

/* ------------------------------------------------------------
   Notificações (painel)
   ------------------------------------------------------------ */
.notif-panel {
  position: fixed;
  top: 64px; right: 20px;
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 48px rgba(11,31,51,0.16);
  z-index: 250;
}
.notif-panel__head { padding: 14px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border-soft); color: var(--navy); }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.notif-item.is-unread { background: rgba(47,128,183,0.04); }
.notif-item strong { display: block; font-size: 13.5px; color: var(--navy); margin-bottom: 3px; }
.notif-item p { color: var(--gray-text); margin-bottom: 4px; }
.notif-item__time { font-size: 11.5px; color: #9AA5B1; }

/* ------------------------------------------------------------
   Stat cards
   ------------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
}
.stat-card__label { font-size: 12.5px; color: var(--gray-text); font-weight: 600; margin-bottom: 10px; }
.stat-card__value { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--navy); }
.stat-card__value.is-danger { color: #C0392B; }

/* ------------------------------------------------------------
   Panels / cards
   ------------------------------------------------------------ */
.panel {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 24px;
}
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.panel__head h2 { font-size: 16px; }
.panel__head .btn, .panel__head a.link-more { font-size: 13px; }
.link-more { color: var(--blue-accent); font-weight: 600; font-size: 13px; }

/* ------------------------------------------------------------
   Tabelas
   ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gray-text);
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px;
  font-size: 14px;
  color: var(--navy);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.is-clickable { cursor: pointer; transition: background 0.15s; }
.data-table tbody tr.is-clickable:hover { background: rgba(47,128,183,0.04); }
.cell-muted { color: var(--gray-text); }
.cell-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--gray-text);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--gray-bg); color: var(--navy); }

/* ------------------------------------------------------------
   Filtros / busca
   ------------------------------------------------------------ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.filter-pill {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-text);
  transition: all 0.2s;
}
.filter-pill.is-active { border-color: var(--blue-accent); background: rgba(47,128,183,0.06); color: var(--blue-accent); }
.search-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.search-input:focus { outline: none; border-color: var(--blue-accent); }

/* ------------------------------------------------------------
   Badges de status
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge--neutral { background: rgba(82,96,109,0.1); color: var(--gray-text); }
.badge--info { background: rgba(47,128,183,0.12); color: #1c6690; }
.badge--warning { background: rgba(201,164,92,0.16); color: #916b1f; }
.badge--success { background: rgba(37,177,88,0.14); color: #1b8a45; }
.badge--danger { background: rgba(192,57,43,0.12); color: #a5321f; }

/* ------------------------------------------------------------
   Kanban
   ------------------------------------------------------------ */
.kanban-wrap { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { flex: 0 0 270px; background: var(--gray-bg); border-radius: var(--radius-md); padding: 12px; }
.kanban-col__head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: 0.03em; padding: 6px 6px 12px; }
.kanban-col__count { background: rgba(11,31,51,0.08); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.kanban-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}
.kanban-card:hover { box-shadow: 0 8px 20px rgba(11,31,51,0.08); transform: translateY(-2px); }
.kanban-card__number { font-size: 11.5px; color: var(--gray-text); font-weight: 700; margin-bottom: 6px; }
.kanban-card__title { font-size: 13.5px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.kanban-card__meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--gray-text); }

/* ------------------------------------------------------------
   Timeline de processo
   ------------------------------------------------------------ */
.process-timeline { display: flex; flex-direction: column; gap: 0; }
.process-timeline__item { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.process-timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 11px; top: 24px; bottom: 0;
  width: 2px;
  background: var(--border-soft);
}
.process-timeline__dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  background: var(--gray-bg);
  color: var(--gray-text);
  border: 2px solid var(--border-soft);
}
.process-timeline__item.is-done .process-timeline__dot { background: var(--blue-accent); border-color: var(--blue-accent); color: var(--white); }
.process-timeline__item.is-active .process-timeline__dot { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.process-timeline__label { font-size: 14px; font-weight: 700; color: var(--navy); }
.process-timeline__desc { font-size: 12.5px; color: var(--gray-text); margin-top: 2px; }

/* progress bar (portal do cliente) */
.progress-bar { height: 8px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--blue-accent); border-radius: 999px; transition: width 0.4s var(--ease); }

/* ------------------------------------------------------------
   Abas (tabs)
   ------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { padding: 12px 16px; font-size: 13.5px; font-weight: 700; color: var(--gray-text); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn.is-active { color: var(--blue-accent); border-color: var(--blue-accent); }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11,31,51,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.25s;
}
.modal-overlay.is-visible { opacity: 1; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 28px;
  max-width: 520px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.25s;
}
.modal-overlay.is-visible .modal-box { transform: translateY(0); }
.modal-box h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 500; }
.toast {
  background: var(--navy);
  color: var(--white);
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(11,31,51,0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 320px;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { background: #1b8a45; }
.toast--error { background: #a5321f; }

/* ------------------------------------------------------------
   Empty / skeleton / erro
   ------------------------------------------------------------ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-text); }
.empty-state p { margin-bottom: 16px; font-size: 14.5px; }
.empty-state--compact { padding: 24px 16px; }

.skeleton-block { display: flex; flex-direction: column; gap: 10px; }
.skeleton-line { height: 44px; border-radius: var(--radius-sm); background: linear-gradient(90deg, #eef1f4 25%, #f6f7f9 37%, #eef1f4 63%); background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.error-state { text-align: center; padding: 60px 20px; }
.error-state h2 { font-size: 20px; margin-bottom: 10px; }
.error-state p { color: var(--gray-text); margin-bottom: 20px; }

/* ------------------------------------------------------------
   Formulários dentro do app
   ------------------------------------------------------------ */
.app-form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .app-form-grid.two-col { grid-template-columns: 1fr 1fr; } }
.app-field { display: flex; flex-direction: column; gap: 6px; }
.app-field label { font-size: 13px; font-weight: 700; color: var(--navy); }
.app-field input, .app-field select, .app-field textarea {
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--font-body);
  width: 100%;
}
.app-field input:focus, .app-field select:focus, .app-field textarea:focus { outline: none; border-color: var(--blue-accent); }

/* Upload dropzone */
.dropzone {
  border: 1.5px dashed var(--border-soft);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--gray-text);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--blue-accent); background: rgba(47,128,183,0.03); }

/* Calendário simples (prazos) */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-day-name { font-size: 11px; font-weight: 700; color: var(--gray-text); text-align: center; padding-bottom: 6px; text-transform: uppercase; }
.calendar-cell { min-height: 74px; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); padding: 6px; font-size: 12px; color: var(--gray-text); }
.calendar-cell.is-today { border-color: var(--blue-accent); background: rgba(47,128,183,0.04); }
.calendar-cell__num { font-weight: 700; color: var(--navy); font-size: 12.5px; }
.calendar-event { margin-top: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 5px; border-radius: 3px; background: rgba(201,164,92,0.18); color: #916b1f; display: block; }

/* Login */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 24px;
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 40px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.auth-card img { height: 40px; margin: 0 auto 24px; }
.auth-card h1 { font-size: 20px; margin-bottom: 24px; }
.auth-card .app-field { text-align: left; margin-bottom: 16px; }
.auth-card__links { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.auth-card__links a { color: var(--blue-accent); font-weight: 600; }

/* Chat de mensagens */
.chat-thread { display: flex; flex-direction: column; gap: 14px; max-height: 460px; overflow-y: auto; padding: 4px; }
.chat-bubble { max-width: 78%; padding: 12px 14px; border-radius: var(--radius-md); font-size: 13.5px; }
.chat-bubble__meta { font-size: 11px; opacity: 0.65; margin-top: 6px; }
.chat-bubble--admin { background: var(--gray-bg); color: var(--navy); align-self: flex-start; border-bottom-left-radius: 2px; }
.chat-bubble--client { background: var(--blue-accent); color: var(--white); align-self: flex-end; border-bottom-right-radius: 2px; }
.chat-input-row { display: flex; gap: 10px; margin-top: 16px; }
.chat-input-row input { flex: 1; }
