/* ===== Reset básico ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1A1A1A;
  --surface: #242424;
  --surface-2: #353535;
  --sidebar-bg: #121212;
  --sidebar-text: #9199b0;
  --text: #e7e9f1;
  --muted: #9096a8;
  --border: #2a2f3f;
  --white: #242424;

  --red: #f0554a;
  --red-bg: rgba(240, 85, 74, 0.14);
  --orange: #f0954a;
  --orange-bg: rgba(240, 149, 74, 0.14);
  --purple: #5b8cff;
  --purple-bg: rgba(91, 140, 255, 0.16);
  --blue: #21AE9F;
  --blue-bg: rgba(33, 174, 159, 0.14);
  --yellow: #f0c94a;
  --yellow-bg: rgba(240, 201, 74, 0.14);
  --green: #43c98a;
  --green-bg: rgba(67, 201, 138, 0.14);
  --gray: #7d8296;
  --gray-bg: rgba(125, 130, 150, 0.14);

  --accent: #21AE9F;
  --accent-dark: #1a8c80;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout com sidebar ===== */
.layout { display: flex; min-height: 100vh; }

/* No desktop, o details/summary do sidebar fica invisível — parece estrutura normal */
.sidebar-collapsible { display: contents; }
.sidebar-collapsible > summary.sidebar-header { display: flex; list-style: none; }
.sidebar-collapsible > summary::-webkit-details-marker { display: none; }
.sidebar-body { display: flex; flex-direction: column; flex: 1; }
.sidebar-toggle-icon { display: none; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
}

.sidebar-header { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }

/* ===== Sininho de notificações ===== */
.notif-bell { margin-left: auto; position: relative; }
.notif-bell summary { list-style: none; cursor: pointer; font-size: 18px; position: relative; padding: 4px; }
.notif-bell summary::-webkit-details-marker { display: none; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notif-dropdown {
  position: absolute; top: 32px; left: 0; z-index: 50;
  width: 300px; max-width: calc(100vw - 32px); max-height: 360px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); padding: 8px;
}
.notif-list { display: flex; flex-direction: column; gap: 2px; }
.notif-list li { border-radius: 6px; }
.notif-list li a { display: block; padding: 8px 10px; font-size: 12px; color: var(--text); border-radius: 6px; }
.notif-list li a:hover { background: var(--surface-2); text-decoration: none; }
.notif-list li.notif-unread a { font-weight: 700; color: #fff; }
.notif-list li.notif-unread { background: rgba(124, 92, 255, 0.08); }
.logo-icon { font-size: 24px; }
.logo-text { display: flex; flex-direction: column; }
.logo-title { color: #fff; font-weight: 600; font-size: 15px; }
.logo-subtitle { font-size: 12px; color: var(--sidebar-text); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.nav-item-active { background: var(--accent); color: #fff; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.sidebar-footer .nav-item,
.sidebar-footer .logout-link { display: block; }
.user-info { display: flex; flex-direction: column; margin-bottom: 8px; }
.user-name { color: #fff; font-weight: 600; }
.user-role { font-size: 12px; }
.logout-link { font-size: 13px; color: var(--sidebar-text); }

/* ===== Área principal ===== */
.main { flex: 1; padding: 28px 32px; max-width: 100%; min-width: 0; }

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-title { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; color: #fff; }
.panel-chip { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px; }
.section-title { margin: 4px 0 14px; }

/* ===== Seleção de painel ===== */
.panel-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.panel-picker-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
}
.panel-picker-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.panel-picker-card:hover { border-color: var(--accent); text-decoration: none; background: var(--surface-2); }
.panel-picker-name { font-size: 18px; font-weight: 700; color: #fff; }
.panel-picker-go { font-size: 13px; color: var(--accent); font-weight: 600; }

/* ===== Painel de Limites ===== */
.limits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.limits-grid-3col { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .limits-grid-3col { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .limits-grid-3col { grid-template-columns: 1fr; } }
/* min-width:0 evita que um card com texto mais longo (ex: "Limite
   ultrapassado") force a coluna do grid a ficar mais larga que as outras */
.limits-card { min-width: 0; }
.limits-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.limits-card-header h3 { margin-bottom: 0; }
.limits-metric { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.limits-metric-row { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
/* especificidade maior que .bar-chart-fill (que vem depois no arquivo) pra garantir que a cor de status sempre vença */
.limits-metric .bar-chart-fill.limits-fill-ok { background: var(--green); }
.limits-metric .bar-chart-fill.limits-fill-near { background: var(--yellow); }
.limits-metric .bar-chart-fill.limits-fill-exceeded { background: var(--red); }
/* align-self:flex-start evita que a badge estique de ponta a ponta dentro
   do container flex em coluna (comportamento padrão do "stretch") */
.limits-metric .badge.limits-badge-ok { background: rgba(67, 201, 138, 0.16); color: var(--green); align-self: flex-start; }
.limits-metric .badge.limits-badge-near { background: var(--yellow-bg); color: var(--yellow); align-self: flex-start; }
.limits-metric .badge.limits-badge-exceeded { background: rgba(240, 85, 74, 0.16); color: var(--red); align-self: flex-start; }
.limits-extra { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.limits-extra > div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

/* ===== Balanço das Whitelabels ===== */
.finance-card h3 { margin-bottom: 14px; }
.finance-toggles { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.finance-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.finance-toggle input { width: 16px; height: 16px; flex-shrink: 0; }
.finance-fees { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.finance-fees label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.finance-fees input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 13px; }
.finance-payment { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 16px; }
.page-subtitle { color: var(--muted); margin-top: 4px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Botões ===== */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn:hover { text-decoration: none; filter: brightness(1.15); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-bg); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red-bg); }
.btn-warning { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }
.btn-success { background: var(--green-bg, #e6f4ea); color: var(--green, #2a7a2a); border-color: var(--green-bg, #e6f4ea); }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; text-align: center; }

/* ===== Indicadores (grupo principal em destaque) ===== */
.indicators-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.indicator-card {
  border-radius: 12px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
.indicator-value { font-size: 30px; font-weight: 800; color: #fff; }
.indicator-label { font-size: 13px; color: rgba(255,255,255,0.85); font-weight: 500; }

.indicator-total { background: #00E0E0; }
.indicator-total .indicator-value,
.indicator-total .indicator-label { color: #04292c; }
.indicator-pending { background: #FF5858; }
.indicator-progress { background: #6f5bf2; }
.indicator-resolved { background: #2e9e5b; }

/* ===== Submódulos de prazo — metade da altura, estilo "vazado" ===== */
.indicators-row-sm { margin-bottom: 20px; }
.indicator-card-sm {
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  background: transparent;
  border: 2px solid;
}
.indicator-value-sm { font-size: 18px; font-weight: 800; }
.indicator-label-sm { font-size: 11px; font-weight: 600; }

.indicator-outline-overdue { border-color: #b80c00; color: #b80c00; }
.indicator-outline-today { border-color: #ff0e00; color: #ff0e00; }
.indicator-outline-3days { border-color: #e6bb3c; color: #e6bb3c; }
.indicator-outline-7days { border-color: #4d8dfa; color: #4d8dfa; }

/* ===== Filtros ===== */

/* Seção de filtros colapsável — fechada por padrão, expande ao clicar
   no cabeçalho. Usa <details>/<summary> nativos, sem JS extra. */
.filters-collapsible {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  background: var(--surface);
}
.filters-collapsible-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.filters-collapsible-summary::-webkit-details-marker { display: none; }
.filters-collapsible-arrow { display: inline-block; transition: transform .15s ease; font-size: 12px; }
.filters-collapsible[open] .filters-collapsible-arrow { transform: rotate(90deg); }
.filters-collapsible .filters-bar {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
  border-radius: 0 0 10px 10px;
  background: transparent;
}

.filters-field-toggles { grid-column: 1 / -1; }
.filters-field-toggles .panel-checkboxes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

.filters-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
}
.filters-bar select,
.filters-bar input[type="text"],
.filters-bar input[type="date"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  color-scheme: dark;
}
.filters-search { width: 100%; }
.filters-date { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; color: var(--muted); }
.filters-check { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }

/* ===== Filtros com rótulo em cima (telas de analytics) ===== */
.filters-bar-labeled { align-items: end; }
.filters-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters-field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.filters-field select, .filters-field input[type="date"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  color-scheme: dark;
}
.filters-field-actions { flex-direction: row; align-items: flex-end; }
.filters-field-search { grid-column: span 2; }

/* ===== Tabela ===== */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin-bottom: 14px;
}
.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.cards-table { width: 100%; border-collapse: collapse; min-width: 1000px; }
.cards-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cards-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}
.cards-table tr:last-child td { border-bottom: none; }
.cards-table tr:hover { background: var(--surface-2); }
.cards-table td input[type="text"],
.cards-table td input[type="email"],
.cards-table td input[type="password"],
.cards-table td select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  color-scheme: dark;
  width: 100%;
  min-width: 140px;
}
.card-title-link { color: var(--text); font-weight: 600; }
.attachment-badge { font-size: 11px; color: var(--muted); margin-left: 6px; }
.empty-state { text-align: center; color: var(--muted); padding: 32px !important; white-space: normal; }

/* Cores de linha por prazo/status */
.row-red { border-left: 3px solid var(--red); background: var(--red-bg); }
.row-orange { border-left: 3px solid var(--orange); background: var(--orange-bg); }
.row-blue { border-left: 3px solid var(--blue); background: var(--blue-bg); }
.row-yellow { border-left: 3px solid var(--yellow); background: var(--yellow-bg); }
.row-green { border-left: 3px solid var(--green); background: var(--green-bg); }
.row-gray { border-left: 3px solid var(--gray); background: var(--gray-bg); opacity: .75; }

/* ===== Badges de status/prioridade/VIP/prazo ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-status-pending { background: var(--red); color: #fff; }
.badge-status-in_progress { background: var(--orange); color: #fff; }
.badge-status-resolved { background: var(--green); color: #fff; }
.badge-status-cancelled { background: var(--gray-bg); color: var(--gray); }

.badge-priority-low { background: var(--gray-bg); color: var(--gray); }
.badge-priority-normal { background: var(--blue-bg); color: var(--blue); }
.badge-priority-high { background: var(--orange-bg); color: var(--orange); }
.badge-priority-urgent { background: var(--red-bg); color: var(--red); }

.badge-vip { background: linear-gradient(135deg, #f0c94a, #e0a91f); color: #1a1200; }

.badge-takedown-none { background: var(--surface-2); color: var(--muted); }
.badge-takedown-yes { background: var(--green); color: #fff; }
.badge-takedown-no { background: var(--red); color: #fff; }

.badge-legal-authorized { background: var(--green-bg, #e6f4ea); color: var(--green, #2a7a2a); }
.badge-mirror-pending    { background: var(--red-bg, #fde8e8); color: var(--red, #c81e1e); }
.badge-mirror-in_progress { background: var(--yellow-bg); color: var(--yellow); }
.badge-mirror-resolved   { background: var(--green-bg, #e6f4ea); color: var(--green, #2a7a2a); }
.badge-mirror-cancelled  { background: var(--gray-bg); color: var(--gray); }

/* Badges de prazo — cores definidas pelo cliente */
.badge-due-overdue { background: #FF5858; color: #fff; }
.badge-due-today { background: #FF5858; color: #fff; }
.badge-due-soon { background: #f0453f; color: #fff; }
.badge-due-week { background: #ffa500; color: #1a1200; }
.badge-due-normal { background: var(--surface-2); color: var(--muted); }
.badge-due-none { background: transparent; color: var(--muted); font-weight: 400; }

/* ===== Paginação ===== */
.pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 16px 0 32px; }
.pagination-info { font-size: 13px; color: var(--muted); }
.list-pagination { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; }

/* ===== Login ===== */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--sidebar-bg); }
.login-container {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { font-size: 20px; margin: 8px 0 2px; color: #fff; }
.login-brand p { color: var(--muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
}

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--green-bg); color: var(--green); }

/* ===== Formulários de card ===== */
.card-form { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  font-weight: 400;
  background: var(--surface-2);
  color-scheme: dark;
}
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }

/* ===== Detalhe de card ===== */
.card-detail { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 22px; margin-bottom: 16px; }
.panel textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  color-scheme: dark;
  resize: vertical;
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 18px; }
.detail-grid > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail-grid > div > span:last-child { overflow-wrap: anywhere; word-break: break-word; }
.detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.detail-description p { white-space: pre-wrap; }

.status-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.inline-form { display: inline-block; }

.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 20px; }
.panel h3 { font-size: 14px; margin-bottom: 12px; color: #fff; }
.muted { color: var(--muted); font-size: 13px; }

.attachment-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.attachment-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }

.timeline { list-style: none; display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; }
.timeline li { display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--border); padding-left: 12px; }
.timeline-date { font-size: 11px; color: var(--muted); }
.timeline-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* ===== Configurações ===== */
.settings-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.settings-list-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.settings-edit-form { display: flex; align-items: center; gap: 8px; flex: 1; }
.settings-edit-form input[type="text"] { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); }
.settings-add-form { display: flex; gap: 8px; }
.settings-add-form input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); }
.panel-checkboxes { display: flex; flex-wrap: wrap; gap: 10px; }

/* ===== Dropdown de checkboxes com busca (Área, Painéis, etc.) ===== */
.multiselect { position: relative; width: 100%; min-width: 170px; }
.multiselect-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; cursor: pointer; text-align: left;
}
.multiselect-toggle-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multiselect-chevron { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.multiselect-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  width: max(260px, 100%); max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45); padding: 8px;
}
.multiselect-search-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  border: 1px solid var(--accent); border-radius: 6px; padding: 5px 8px;
}
.multiselect-search { flex: 1; background: transparent; border: none; color: var(--text); font-size: 13px; outline: none; min-width: 0; }
.multiselect-clear { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.multiselect-options { display: flex; flex-direction: column; gap: 1px; }
.multiselect-option.multiselect-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.multiselect-option.multiselect-option input[type="checkbox"] { flex-shrink: 0; order: -1; }
.multiselect-option.multiselect-option:hover { background: var(--surface-2); }

.settings-list-search {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  margin-bottom: 10px;
}
.settings-list-pagination { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.settings-list-pagination-info { font-size: 12px; }

/* ===== Dropdown com busca por digitação ===== */
.select-search-wrapper { position: relative; }
.select-search-native {
  position: absolute;
  opacity: 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
  pointer-events: none;
}
.select-search-control {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.select-search-wrapper.is-open .select-search-control { border-color: var(--accent); }
.select-search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: none;
  font-size: 14px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}
.select-search-input:focus { outline: none; }
.select-search-clear {
  flex-shrink: 0;
  width: 28px;
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.select-search-clear:hover { color: var(--red); background: var(--surface); }
.select-search-toggle {
  flex-shrink: 0;
  width: 34px;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.select-search-toggle:hover { background: var(--accent-dark); }
.filters-bar .select-search-input { padding: 7px 10px; font-size: 13px; }
.filters-bar .select-search-wrapper { min-width: 160px; }
.select-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 190px; /* ~5 itens visíveis, o resto rola */
  overflow-y: auto;
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}
.select-search-option { padding: 9px 12px; font-size: 13px; cursor: pointer; line-height: 1.3; }
.select-search-option:hover, .select-search-option.is-selected { background: var(--accent); color: #fff; }
.select-search-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }

/* ===== Gráficos de barra (analytics) ===== */
.chart-block { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.chart-block h3 { font-size: 14px; margin-bottom: 14px; color: #fff; }
.chart-total { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.chart-total strong { color: var(--text); }
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-chart-row { display: grid; grid-template-columns: 140px 1fr 70px; align-items: center; gap: 10px; }
.bar-chart-label { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-chart-track { background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-chart-fill { background: linear-gradient(90deg, var(--accent), #5b8cff); height: 100%; border-radius: 6px; transition: width .3s ease; }
.bar-chart-value { font-size: 12px; font-weight: 700; color: var(--text); text-align: right; white-space: nowrap; }

@media (max-width: 700px) {
  .bar-chart-row { grid-template-columns: 90px 1fr 55px; }
  .bar-chart-label { font-size: 11px; }
}

@media (max-width: 1000px) {
  .indicators-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  /* ===== Layout mobile ===== */
  .layout { flex-direction: column; }

  /* Desfaz o display:contents do desktop */
  .sidebar-collapsible { display: block; }
  .sidebar-body { display: flex; }
  .sidebar-toggle-icon { display: inline; }

  /* Sidebar vira barra de topo colapsável */
  .sidebar {
    width: 100%;
    flex-direction: column;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Header do sidebar: sempre visível, funciona como toggle */
  .sidebar-header {
    padding: 12px 16px;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
  }

  /* Seta indicando estado aberto/fechado */
  .sidebar-toggle-icon {
    margin-left: auto;
    font-size: 18px;
    color: var(--muted);
    transition: transform 0.2s;
  }
  .sidebar-collapsible[open] .sidebar-toggle-icon { transform: rotate(180deg); }

  /* Ocultar o summary nativo */
  .sidebar-collapsible summary { list-style: none; }
  .sidebar-collapsible summary::-webkit-details-marker { display: none; }

  /* Conteúdo colapsável: nav + footer */
  .sidebar-body {
    display: flex;
    flex-direction: column;
    padding: 8px 16px 16px;
    gap: 4px;
    border-top: 1px solid var(--border);
  }

  .sidebar-nav { flex-direction: column; }
  .sidebar-footer { display: block; margin-top: 8px; padding-top: 12px; }

  /* Área principal */
  .main { padding: 16px; }
  .main-header { flex-direction: column; gap: 12px; }
  .main-header .header-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }

  /* Conteúdo */
  .two-columns { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .indicators-row { grid-template-columns: 1fr 1fr; }

  /* Tabelas: scroll horizontal já resolvido pelo .table-wrapper global */

  /* Notif dropdown: abre para baixo sem sair da tela */
  .notif-dropdown { left: auto; right: 0; }
}

/* ---- Componente "Criar novo" em selects de lookup ---- */
.create-new-wrapper { display: flex; flex-direction: column; gap: 4px; }
.create-new-input-row { display: none; align-items: center; gap: 6px; }
.create-new-input-row.visible { display: flex; }
.create-new-input-row input { flex: 1; }
.create-new-cancel { font-size: 12px; color: var(--text-muted); cursor: pointer; background: none; border: none; padding: 0; }

/* ---- Componente "olhinho" de visibilidade de senha ---- */
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { flex: 1; padding-right: 40px; }
.password-toggle-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  opacity: .7;
}
.password-toggle-btn:hover { opacity: 1; }

/* Links clicáveis dentro de Descrição e Anotações (linkify) */
.timeline-text a,
.notes-tooltip-text a,
.detail-description a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}
.timeline-text a:hover,
.notes-tooltip-text a:hover,
.detail-description a:hover {
  opacity: .85;
}

/* ===== QC - Tipo de produto: cor por grupo (Total / Álbum / Single) ===== */
/* Mesmas cores dos cards de indicador, em tom mais claro para ler bem no fundo escuro. */
.cards-table .pt-total { color: #00E0E0; font-weight: 700; }
.cards-table .pt-tipo-0 { color: #a99bff; }
.cards-table .pt-tipo-1 { color: #43c98a; }
.cards-table .pt-tipo-2 { color: #ff8a80; }
.cards-table th.pt-total,
.cards-table th.pt-tipo-0,
.cards-table th.pt-tipo-1,
.cards-table th.pt-tipo-2 { font-weight: 700; }
/* Divisória discreta à esquerda de cada grupo, para separar Total / Álbum / Single */
.cards-table .pt-group-start { border-left: 1px solid var(--border); }

/* ===== Filtros do dashboard: rodapé com marcadores + botões (sem células vazias) ===== */
.filters-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-top: 4px;
}
.filters-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.filters-actions { display: flex; gap: 8px; margin-left: auto; }

/* ===== Métricas do painel: gráficos em 2 colunas que se encaixam ===== */
/* Cada caixa tem a altura do próprio conteúdo; a caixa seguinte sobe para ocupar o espaço livre. */
.charts-masonry { column-count: 2; column-gap: 16px; margin-bottom: 20px; }
.charts-masonry > .chart-block { break-inside: avoid; margin-bottom: 16px; }
@media (max-width: 900px) { .charts-masonry { column-count: 1; } }

/* Dashboard COPY: nome/email do usuário cortam com reticências (o texto completo fica no title) */
.cards-table td.cell-clip { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards-table td.cell-clip-wide { max-width: 230px; }

/* Seletor de itens por página (30 / 60 / 120) no rodapé da tabela */
.pagination { flex-wrap: wrap; }
.page-size-picker { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; padding-left: 16px; border-left: 1px solid var(--border); }



/* ===== Artistas do produto (somente leitura, um item por artista) ===== */
.artists-field { display: flex; flex-direction: column; gap: 6px; }
.artists-field-label { font-size: 13px; font-weight: 500; }
.artists-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 34px; }
.artist-chip {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  margin: 0 6px 4px 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
}
.artists-chips .artist-chip { margin: 0; }
.artists-empty { color: var(--muted); font-size: 13px; font-style: italic; }
.cell-artists { min-width: 110px; }
.cell-artists .artist-line { white-space: nowrap; line-height: 1.5; }


/* ===== Multas Spotify ===== */
.fine-flag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--green); }
.fine-warn {
  display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; cursor: help;
}
.bulk-responsible-select { max-width: 200px; }
.batch-edit-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.batch-edit-form select, .batch-edit-form input { max-width: 120px; }
.autocomplete-field { position: relative; }
.autocomplete-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.autocomplete-item {
  display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0;
  background: transparent; color: var(--text); cursor: pointer; font: inherit;
}
.autocomplete-item:hover { background: var(--surface-2); }
.autocomplete-empty { padding: 8px 12px; color: var(--muted); font-size: 13px; }

/* ===== Análise de Risco ===== */
.alert-warning { background: var(--yellow-bg); color: var(--yellow); }
.risk-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.risk-sum { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 16px 14px; border-radius: 12px; border: 2px solid transparent; text-decoration: none; text-align: center; }
.risk-sum:hover { text-decoration: none; filter: brightness(1.1); }
.risk-sum-active { border-color: var(--text); }
.risk-sum-value { font-size: 28px; font-weight: 800; }
.risk-sum-label { font-size: 13px; font-weight: 500; }
.risk-none { background: var(--gray-bg); color: var(--gray); }
.risk-low { background: var(--green-bg); color: var(--green); }
.risk-medium { background: var(--yellow-bg); color: var(--yellow); }
.risk-high { background: var(--orange-bg); color: var(--orange); }
.risk-critical { background: var(--red-bg); color: var(--red); }
.risk-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; align-self: flex-start; }
.risk-badge-lg { font-size: 16px; padding: 4px 16px; }
.risk-score-num { font-size: 12px; color: var(--muted); margin-top: 2px; }
.risk-score-big { font-size: 40px; font-weight: 800; line-height: 1; }
.risk-score-big small { font-size: 14px; font-weight: 500; color: var(--muted); }
.risk-tag { display: inline-block; padding: 1px 8px; margin: 2px 4px 2px 0; border-radius: 99px; font-size: 11px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.risk-tag-lg { font-size: 13px; padding: 3px 12px; }
.risk-tag-weight { color: var(--orange); font-weight: 700; margin-left: 4px; }
.risk-tags-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-right: 4px; border-radius: 99px; background: var(--red-bg); color: var(--red); font-weight: 700; font-size: 12px; text-align: center; }
.risk-hero { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.risk-hero-main { display: flex; flex-direction: column; gap: 8px; min-width: 180px; }
.risk-hero-parts { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 20px; flex: 1; min-width: 0; }
.risk-part { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.risk-bar { background: var(--surface-2); border-radius: 99px; height: 6px; overflow: hidden; }
.risk-bar-fill { background: var(--accent); height: 6px; border-radius: 99px; }
@media (max-width: 900px) {
  .risk-summary { grid-template-columns: 1fr 1fr; }
  .risk-hero-parts { grid-template-columns: 1fr; }
}
.risk-more-items[hidden] { display: none; }
.risk-more-btn { display: inline-block; padding: 1px 8px; margin: 2px 0; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--accent); font-size: 11px; font-weight: 700; cursor: pointer; }
.risk-more-btn:hover { background: var(--surface-2); }
