/* ==========================================================================
   Reestruturação do painel — design system
   Carregado por último: styles.css e home-refresh.css usam !important no shell,
   então as regras de shell aqui também usam. As classes novas (.ds-*, .ov-*)
   não precisam disso.
   ========================================================================== */

:root {
  --ds-bg: #f5f7fb;
  --ds-card: #fff;
  --ds-line: #e9edf4;
  --ds-line-soft: #f0f3f8;
  --ds-text: #0f172a;
  --ds-body: #475069;
  --ds-muted: #6b7280;
  --ds-faint: #8b93a7;
  --ds-blue: #2d6bff;
  --ds-violet: #7b4dff;
  --ds-green: #16a36a;
  --ds-amber: #f59e0b;
  --ds-teal: #0f8c95;
  --ds-red: #e5484d;
  --ds-gold: #c5a46a;
  --ds-radius: 14px;
  --ds-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px rgba(15, 23, 42, .05);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Shell ---------- */

body { background: var(--ds-bg) !important; }
body[data-active-tab] .app-shell {
  background: var(--ds-bg) !important;
  grid-template-columns: 232px minmax(0, 1fr) !important;
}
body[data-active-tab].sidebar-is-collapsed .app-shell { grid-template-columns: 68px minmax(0, 1fr) !important; }

body[data-active-tab] .sidebar,
body[data-active-tab="demandas"] .sidebar,
body[data-active-tab="ia-producoes"] .sidebar {
  margin: 0 !important;
  height: 100vh !important;
  position: sticky !important;
  top: 0 !important;
  padding: 20px 14px 16px !important;
  gap: 0 !important;
  border: 0 !important;
  border-right: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 0 !important;
  background: linear-gradient(180deg, #0d1430 0%, #111f44 100%) !important;
  color: rgba(255,255,255,.76) !important;
  box-shadow: none !important;
  overflow-y: auto;
}

.brand-row { align-items: flex-start; }
body[data-active-tab] .brand { gap: 10px; padding: 0 4px; }
body[data-active-tab] .brand strong {
  display: block;
  font-size: 18.5px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: #fff;
}
/* "Captus" em grafite, "Edu" no azul da marca — como no logotipo. */
body[data-active-tab] .brand .brand-name em { font-style: normal; color: #9db8ff; }
body[data-active-tab] .brand small {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.56) !important;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .01em;
}
body[data-active-tab] .brand .mark,
body[data-active-tab] .brand .brand-logo,
body[data-active-tab] .brand .mark.brand-logo {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: #fff !important;
  object-fit: cover !important;
  box-shadow: 0 0 0 1px var(--ds-line) !important;
}

/* Régua dourada abaixo da marca. */
body[data-active-tab] .sidebar-content { position: relative; gap: 0 !important; }
body[data-active-tab] .sidebar-content::before {
  content: "";
  display: block;
  height: 2px;
  margin: 16px 4px 14px;
  border-radius: 2px;
  background: var(--ds-gold);
}

body[data-active-tab] .sidebar-toggle {
  border: 0 !important;
  background: transparent !important;
  color: rgba(255,255,255,.58) !important;
  font-size: 17px;
  line-height: 1;
  padding: 4px 6px !important;
}
body[data-active-tab] .sidebar-toggle:hover { color: #fff !important; }

body[data-active-tab] .tabs { gap: 2px !important; }
body[data-active-tab] .tab {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 11px !important;
  background: transparent !important;
  color: rgba(255,255,255,.72) !important;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.25;
  transition: background .14s ease, color .14s ease;
}
/* Os glifos de texto do styles.css dão lugar aos ícones reais do HTML. */
body[data-active-tab] .tab::before { content: none !important; display: none !important; }
body[data-active-tab] .tab .tab-icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: rgba(255,255,255,.52);
  transition: color .14s ease;
}
body[data-active-tab] .tab[data-tab="demandas"] .tab-icon { fill: currentColor; stroke: none; }
body[data-active-tab] .tab:hover {
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
}
body[data-active-tab] .tab:hover .tab-icon { color: rgba(255,255,255,.85); }
body[data-active-tab] .tab.active,
body[data-active-tab] .tab.active:hover {
  background: var(--ds-blue) !important;
  color: #fff !important;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(45,107,255,.28) !important;
}
body[data-active-tab] .tab.active .tab-icon { color: #fff; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 4px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0f2044;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
}
.sidebar-user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-caret { flex: none; width: 14px; height: 14px; fill: none; stroke: rgba(255,255,255,.52); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

body[data-active-tab] .sidebar-meta {
  margin-top: 0 !important;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255,255,255,.56) !important;
  font-size: 12px;
}
body[data-active-tab] #refreshButton {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,.08) !important;
  color: rgba(255,255,255,.78) !important;
  font-size: 0;
  overflow: hidden;
}
body[data-active-tab] #refreshButton::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 10a7 7 0 1 1-2.1-5'/%3E%3Cpath d='M17.3 2.6v4.2h-4.2'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 10a7 7 0 1 1-2.1-5'/%3E%3Cpath d='M17.3 2.6v4.2h-4.2'/%3E%3C/svg%3E") center/contain no-repeat;
}
body[data-active-tab] #refreshButton:hover { color: #fff !important; border-color: rgba(255,255,255,.34) !important; }
body[data-active-tab] #refreshButton:disabled { opacity: .5; }

/* Recolhida: só o símbolo da marca e o botão de expandir. */
body[data-active-tab].sidebar-is-collapsed .sidebar-user,
body[data-active-tab].sidebar-is-collapsed .sidebar-content { display: none; }
body[data-active-tab].sidebar-is-collapsed .sidebar { padding: 16px 10px !important; align-items: center; }
body[data-active-tab].sidebar-is-collapsed .brand-row { flex-direction: column; align-items: center; gap: 12px; width: 100%; }
body[data-active-tab].sidebar-is-collapsed .brand { padding: 0; }
body[data-active-tab].sidebar-is-collapsed .brand > div { display: none; }

/* ---------- Cabeçalho da página ---------- */

body[data-active-tab] main { padding: 26px 30px 34px !important; }
body[data-active-tab] .topbar { align-items: flex-start; margin-bottom: 20px; }
body[data-active-tab] .topbar > div:first-child { display: flex; flex-direction: column; min-width: 0; }
body[data-active-tab] #pageTitle {
  order: 1;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.022em;
  color: var(--ds-text);
}
body[data-active-tab] #pageEyebrow,
body[data-active-tab="demandas"] .eyebrow {
  order: 2;
  width: auto !important;
  margin: 6px 0 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  color: var(--ds-muted) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* Busca e filtros globais não pertencem às telas reestruturadas. */
body[data-active-tab="demandas"] .monday-toolbar,
body[data-active-tab="demandas"] .filters,
body[data-active-tab="demandas"] .summary-strip,
body[data-active-tab="prazos"] .monday-toolbar,
body[data-active-tab="prazos"] .filters,
body[data-active-tab="prazos"] .summary-strip,
body[data-active-tab="publicacao"] .monday-toolbar,
body[data-active-tab="publicacao"] .filters,
body[data-active-tab="publicacao"] .summary-strip { display: none !important; }

/* As ações do cabeçalho pertencem à Visão geral; nas outras abas ficam ocultas. */
.dashboard-top-actions { display: none; }
body[data-active-tab="demandas"] .dashboard-top-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.source-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid #d7eee2;
  border-radius: 10px;
  background: #f0faf5;
  color: #137a50;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.source-status i { width: 8px; height: 8px; border-radius: 50%; background: #16a36a; box-shadow: 0 0 0 3px rgba(22,163,106,.12); }
.source-status.is-loading { color: var(--ds-muted); border-color: var(--ds-line); background: #fff; }
.source-status.is-loading i { background: var(--ds-blue); animation: source-pulse 1.1s ease-in-out infinite; }
.source-status.is-warning { color: #9a5b08; border-color: #f5dfba; background: #fff8eb; }
.source-status.is-warning i { background: var(--ds-amber); box-shadow: 0 0 0 3px rgba(245,158,11,.13); }
@keyframes source-pulse { 50% { opacity: .35; transform: scale(.82); } }

/* ---------- Controles ---------- */

.ds-select select,
.ov-period select {
  appearance: none;
  min-width: 156px;
  padding: 9.5px 32px 9.5px 13px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 11px center/14px;
  color: var(--ds-text);
  font-size: 14px;
  cursor: pointer;
}
.ds-select select:focus-visible { outline: 2px solid var(--ds-blue); outline-offset: 1px; }

.ds-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9.5px 15px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ds-text);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease;
}
.ds-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ds-btn:hover { background: #f4f6fb; border-color: #dbe2ee; }
.ds-btn-primary {
  background: var(--ds-blue);
  border-color: var(--ds-blue);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .26);
}
.ds-btn-primary:hover { background: #1d55d0; border-color: #1d55d0; }
.ds-btn-icon { padding: 9.5px; }
.ds-btn[disabled] { opacity: .6; cursor: progress; }
.ds-btn.is-busy svg { animation: ds-spin .9s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

.ds-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: #f1f4f9;
}
.ds-segmented button {
  padding: 7px 17px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ds-muted);
  font-size: 14px;
  font-weight: 500;
}
.ds-segmented button.active {
  background: #e8f0fe;
  color: var(--ds-blue);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #cddffb;
}

.ds-card {
  padding: 20px 22px 22px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow);
  min-width: 0;
}
.ds-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.ds-card-head h2 {
  margin: 0;
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -.012em;
  color: var(--ds-text);
}
.ds-card-head svg {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: var(--ds-blue);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ds-sub { margin: 0 0 14px; color: var(--ds-muted); font-size: 13.5px; }

.ds-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ds-blue);
  font-size: 13.5px;
  font-weight: 600;
}
.ds-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ds-link::after { content: "›"; font-size: 16px; line-height: 1; }
.ds-link:hover { text-decoration: underline; }

.ds-chip {
  display: inline-flex;
  align-items: center;
  padding: 3.5px 9px;
  border-radius: 6px;
  background: #eef2f8;
  color: var(--ds-body);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ds-chip-red { background: #fdeaee; color: #c02348; }
.ds-chip-amber { background: #fef3e2; color: #b45309; }
.ds-chip-blue { background: #e8f0fe; color: #1d55d0; }
.ds-chip-green { background: #e7f6ed; color: #15803d; }
.ds-chip-violet { background: #f1ebfe; color: #6d28d9; }

.ds-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tone, #64748b);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
}

.ds-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 26px 18px;
  border: 1px dashed #dde4ef;
  border-radius: 11px;
  background: #fafbfe;
  color: var(--ds-muted);
  font-size: 13.5px;
  text-align: center;
}
.ds-empty strong { color: #4b5563; font-weight: 600; }
.ds-empty small { color: var(--ds-faint); font-size: 12.5px; }

/* ==========================================================================
   Visão geral
   ========================================================================== */

.overview { display: grid; gap: 16px; }

.ov-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.ov-kpi {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 13px;
  row-gap: 8px;
  padding: 17px 18px 15px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow);
  overflow: hidden;
}
.ov-kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--tone, #2563eb);
}
.ov-kpi-icon {
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--tone, #2563eb) 11%, #fff);
}
.ov-kpi-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--tone, #2563eb);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ov-kpi-label { align-self: end; color: var(--ds-muted); font-size: 14px; }
.ov-kpi-value {
  align-self: start;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1;
  color: var(--ds-text);
}
.ov-kpi-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ds-muted);
}
.ov-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.ov-delta svg { width: 10px; height: 10px; fill: currentColor; stroke: none; }
.ov-delta-up { color: var(--ds-green); }
.ov-delta-down { color: var(--ds-red); }
.ov-delta-flat { color: var(--ds-muted); }
.ov-delta-none { color: var(--ds-faint); font-style: italic; }

.ov-row { display: grid; gap: 16px; }
.ov-row-main,
.ov-row-second { grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); }

.ov-statusbar {
  display: flex;
  height: 9px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--ds-line-soft);
  margin-bottom: 15px;
}
.ov-statusbar i { display: block; height: 100%; }
.ov-statusbar i + i { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .85); }

.ov-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ds-line-soft);
}
.ov-legend-item { display: grid; gap: 5px; min-width: 0; }
.ov-legend-item > span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ds-muted);
  font-size: 13px;
}
.ov-legend-item > span::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--tone);
}
.ov-legend-item > span b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-legend-item strong { font-size: 19px; font-weight: 700; color: var(--ds-text); }

.ov-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
}
.ov-chart-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ds-text); }
.ov-chart-legend { display: flex; gap: 16px; color: var(--ds-muted); font-size: 12.5px; }
.ov-chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ov-chart-legend i { width: 22px; height: 0; border-top: 2px solid var(--ds-blue); }
.ov-chart-legend i.dashed { border-top-style: dashed; border-color: #9aa4b8; }

.ov-chart { width: 100%; height: auto; display: block; overflow: visible; }
.ov-chart .grid { stroke: var(--ds-line-soft); stroke-width: 1; }
.ov-chart .axis { fill: var(--ds-faint); font-size: 10.5px; }
.ov-chart .line-main { fill: none; stroke: var(--ds-blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ov-chart .line-capacity { fill: none; stroke: #9aa4b8; stroke-width: 1.6; stroke-dasharray: 5 4; }
.ov-chart .dot { fill: var(--ds-blue); }

.ov-card-accent { background: linear-gradient(#f8fbff, #fff 130px); }
.ov-pending-total { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 16px; }
.ov-pending-total strong {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ds-text);
}
.ov-pending-total span { color: var(--ds-muted); font-size: 13.5px; }
.ov-pending-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 14px 0;
  border-top: 1px solid var(--ds-line-soft);
}
.ov-pending-row:first-child { border-top: 0; }
.ov-pending-row svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--tone, #6b7280);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ov-pending-row strong { font-size: 25px; font-weight: 700; letter-spacing: -.02em; color: var(--ds-text); }
.ov-pending-row span { color: var(--ds-muted); font-size: 13.5px; }
.ov-pending-list + .ds-link { margin-top: 14px; }

/* styles.css impõe min-width nas tabelas do grid de demandas; aqui não vale. */
.ov-table { width: 100% !important; min-width: 0 !important; border-collapse: collapse; table-layout: fixed; }
.ov-table th {
  padding: 0 10px 10px 0;
  border-bottom: 1px solid var(--ds-line-soft);
  color: var(--ds-muted);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
}
.ov-table td {
  padding: 12px 10px 12px 0;
  border-bottom: 1px solid var(--ds-line-soft);
  font-size: 13.5px;
  color: var(--ds-text);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ov-table th:nth-child(1), .ov-table td:nth-child(1) { width: 26%; }
.ov-table th:nth-child(2), .ov-table td:nth-child(2) { width: 18%; }
.ov-table th:nth-child(3), .ov-table td:nth-child(3) { width: 26%; }
.ov-table th:nth-child(4), .ov-table td:nth-child(4) { width: 30%; padding-right: 0; }
/* Os chips precisam quebrar em vez de serem cortados pelo overflow da célula. */
.ov-table td:nth-child(4) { overflow: visible; white-space: normal; }
.ov-table tr:last-child td { border-bottom: 0; }
.ov-table tbody tr { cursor: pointer; }
.ov-table tbody tr:hover td { background: #f7f9fe; }
.ov-cell-name { font-weight: 600; }
.ov-cell-muted { color: var(--ds-muted); }
.ov-cell-stage { color: var(--ds-muted); }
.ov-chips { display: flex; flex-wrap: wrap; gap: 5px; white-space: normal; }
.ov-table + .ds-link { margin-top: 14px; }

.ov-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  margin: 14px 0 18px;
}
.ov-period-metric { display: grid; gap: 3px; min-width: 0; }
.ov-period-metric > span:first-child { color: var(--ds-muted); font-size: 13px; }
.ov-period-metric strong { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--ds-text); }
.ov-period-metric .ov-kpi-foot { grid-column: auto; }

.ov-spark-head { margin: 0 0 8px; color: var(--ds-muted); font-size: 13px; }
.ov-spark { width: 100%; height: auto; display: block; overflow: visible; }
.ov-spark .line { fill: none; stroke: var(--ds-blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ov-spark .dot { fill: var(--ds-blue); }
.ov-spark .axis { fill: var(--ds-faint); font-size: 10px; }

body[data-active-tab="demandas"] #statusDistribution { margin-top: 16px; }
body[data-active-tab="demandas"] #statusDistribution.hidden { display: none !important; }

/* ==========================================================================
   Prazos de produção
   ========================================================================== */

.production { display: grid; gap: 16px; }

.prod-toolbar { padding: 0 !important; }
.prod-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.prod-month {
  margin-left: 6px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ds-text);
  white-space: nowrap;
}
.prod-toolbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }

/* Os menus de equipe/filtros são <details>; o summary vira botão. */
.prod-menu { position: relative; }
.prod-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9.5px 15px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ds-text);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}
.prod-menu > summary::-webkit-details-marker { display: none; }
.prod-menu > summary::marker { content: ""; }
.prod-menu > summary svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.prod-menu > summary:hover { background: #f4f6fb; border-color: #dbe2ee; }
.prod-menu[open] > summary { border-color: #c7d7f7; color: var(--ds-blue); }
.prod-menu .calendar-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 240px;
  max-height: 340px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--ds-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
}
.prod-menu .calendar-popover-wide { min-width: 320px; }

.prod-stats {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--ds-line-soft);
  color: var(--ds-muted);
  font-size: 13.5px;
}
.prod-stat { display: inline-flex; align-items: center; gap: 8px; }
.prod-stat svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: var(--ds-faint);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.prod-stat strong { color: var(--ds-text); font-weight: 600; }
.prod-stat-muted i { width: 9px; height: 9px; border-radius: 50%; background: #c8cdd8; }
.prod-source-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: #137a50;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.prod-source-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ds-green); box-shadow: 0 0 0 3px rgba(22,163,106,.12); }
.prod-source-status.is-warning { color: #9a5b08; }
.prod-source-status.is-warning i { background: var(--ds-amber); box-shadow: 0 0 0 3px rgba(245,158,11,.13); }

.prod-grid { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 16px; align-items: start; }
.prod-side { display: grid; gap: 16px; min-width: 0; }
.prod-calendar-card { padding-bottom: 18px; }
.prod-calendar-card .ds-card-head { padding-bottom: 14px; border-bottom: 1px solid var(--ds-line-soft); margin-bottom: 0; }

.prod-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 0 4px;
  color: var(--ds-muted);
  font-size: 12px;
}
.prod-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.prod-legend .legend-item i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Visão de mês ---------- */

.prod-month-grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--ds-line-soft);
  border-left: 1px solid var(--ds-line-soft);
  margin-top: 10px;
}
.prod-weekday {
  padding: 9px 8px;
  border-right: 1px solid var(--ds-line-soft);
  border-bottom: 1px solid var(--ds-line-soft);
  color: var(--ds-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: center;
}
.prod-day {
  position: relative;
  min-height: 104px;
  padding: 6px 6px 8px;
  border-right: 1px solid var(--ds-line-soft);
  border-bottom: 1px solid var(--ds-line-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.prod-day.is-out { background: #fbfcfe; }
.prod-day.is-out .prod-day-number { color: #c3c9d6; }
.prod-day.is-today { box-shadow: inset 0 0 0 2px var(--ds-blue); border-radius: 4px; }
.prod-day-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; }
.prod-day-number { margin-left: auto; color: var(--ds-muted); font-size: 12.5px; font-weight: 500; }
.prod-today-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ds-blue);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

.prod-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 3.5px 4px 3.5px 4px;
  border: 0;
  border-left: 3px solid var(--person-color, #94a3b8);
  border-radius: 4px;
  background: #f3f5fa;
  color: var(--ds-text);
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  min-width: 0;
}
.prod-chip:hover { background: #e9eef7; }
.prod-chip.is-alert { background: #fdeef1; }
.prod-chip-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.prod-chip-tag { flex: none; color: var(--ds-faint); font-size: 9.5px; letter-spacing: -.01em; }
.prod-chip-alert { flex: none; width: 10px; height: 10px; fill: var(--ds-red); stroke: none; }
.prod-chip-done { flex: none; width: 11px; height: 11px; fill: none; stroke: var(--ds-green); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.prod-chip.is-done { background: #edf7f0; }
.prod-chip.is-done .prod-chip-title { color: var(--ds-muted); }

.prod-more {
  align-self: flex-start;
  margin-top: 1px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ds-blue);
  font-size: 10.5px;
  font-weight: 600;
}
.prod-more:hover { text-decoration: underline; }

/* ---------- Visão de semana ---------- */

.prod-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.prod-week-col { border: 1px solid var(--ds-line-soft); border-radius: 10px; overflow: hidden; min-width: 0; }
.prod-week-col.is-today { border-color: var(--ds-blue); box-shadow: 0 0 0 1px var(--ds-blue); }
.prod-week-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--ds-line-soft);
  background: #fafbfe;
  color: var(--ds-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.prod-week-head strong { color: var(--ds-text); font-size: 14px; letter-spacing: 0; }
.prod-week-body { display: flex; flex-direction: column; gap: 4px; padding: 8px; min-height: 150px; }
/* Na semana há altura de sobra: o título quebra em vez de truncar. */
.prod-week-body .prod-chip { flex-wrap: wrap; row-gap: 1px; padding: 5px 6px; }
.prod-week-body .prod-chip-title { flex: 1 1 100%; white-space: normal; line-height: 1.3; }
.prod-week-body .prod-chip-tag { flex: 1 1 auto; }
.prod-week-empty { margin: 0; color: #b6bdcb; font-size: 11.5px; text-align: center; padding-top: 12px; }

/* ---------- Visão de lista ---------- */

.prod-list { display: grid; gap: 6px; margin-top: 14px; }
.prod-list-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ds-line-soft);
  border-left: 3px solid var(--person-color, #94a3b8);
  border-radius: 9px;
  background: #fff;
  font-size: 13.5px;
  text-align: left;
  color: var(--ds-text);
}
.prod-list-row:hover { background: #f7f9fe; }
.prod-list-row.is-alert { border-color: #f6ccd6; border-left-color: var(--person-color, #94a3b8); }
.prod-list-date { color: var(--ds-muted); font-size: 12.5px; font-weight: 600; }
.prod-list-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-list-client,
.prod-list-person { color: var(--ds-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Entregas do dia ---------- */

.prod-day-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 6px; color: var(--ds-body); font-size: 13.5px; font-weight: 500; }
.prod-delivery-list { display: grid; }
.prod-delivery {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--ds-line-soft);
  background: none;
  text-align: left;
}
.prod-delivery:first-child { border-top: 0; }
.prod-delivery:hover .prod-delivery-body strong { color: var(--ds-blue); }
.prod-delivery-body { display: grid; gap: 2px; min-width: 0; }
.prod-delivery-body strong { font-size: 13.5px; font-weight: 600; color: var(--ds-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-delivery-body small { color: var(--ds-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-delivery-list + .ds-link { margin-top: 14px; }

/* ---------- Carga da equipe ---------- */

.prod-load-list { display: grid; }
.prod-load-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 11px;
  padding: 12px 0;
  border-top: 1px solid var(--ds-line-soft);
}
.prod-load-row:first-child { border-top: 0; }
.prod-load-name { font-size: 13.5px; font-weight: 600; color: var(--ds-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-load-track {
  grid-column: 2 / 3;
  height: 6px;
  border-radius: 3px;
  background: var(--ds-line-soft);
  overflow: hidden;
}
.prod-load-track i { display: block; height: 100%; border-radius: 3px; }
.prod-load-percent { grid-row: 2; color: var(--ds-muted); font-size: 12.5px; font-weight: 600; }
.prod-load-row > .ds-chip { grid-row: 1; grid-column: 3; }
.prod-load-list + .ds-link { margin-top: 14px; }

/* ---------- Responsivo ---------- */

@media (max-width: 1320px) {
  .prod-grid { grid-template-columns: minmax(0, 1fr); }
  .prod-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-row-main,
  .ov-row-second { grid-template-columns: minmax(0, 1fr); }
  .ov-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body[data-active-tab] .app-shell { grid-template-columns: minmax(0, 1fr) !important; }
  body[data-active-tab] .sidebar { height: auto !important; position: static !important; border-right: 0 !important; border-bottom: 1px solid rgba(255,255,255,.1) !important; }
  body[data-active-tab] main { padding: 18px 16px 28px !important; }
  body[data-active-tab] .topbar { flex-direction: column; align-items: stretch; gap: 14px; }
  body[data-active-tab] #pageTitle { font-size: 24px; }
  .dashboard-top-actions { flex-wrap: wrap; }
  .source-status { order: -1; width: 100%; justify-content: center; }
  .ov-kpis { grid-template-columns: minmax(0, 1fr); }
  .ov-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-card, .ov-kpi { padding: 17px 16px 18px; }
  .ov-table th:nth-child(3), .ov-table td:nth-child(3) { display: none; }
  .ov-table th:nth-child(1), .ov-table td:nth-child(1) { width: 40%; }
  .ov-table th:nth-child(2), .ov-table td:nth-child(2) { width: 28%; }
  .ov-table th:nth-child(4), .ov-table td:nth-child(4) { width: 32%; }
  .prod-side { grid-template-columns: minmax(0, 1fr); }
  .prod-toolbar-right { margin-left: 0; width: 100%; }
  .prod-stats { gap: 14px; }
  .prod-week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prod-month-grid { font-size: 10px; }
  .prod-day { min-height: 78px; }
  .prod-list-row { grid-template-columns: 54px minmax(0, 1fr) auto; row-gap: 4px; }
  .prod-list-client, .prod-list-person { grid-column: 2; font-size: 11.5px; }
}
