@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

/* Bee.Pulse — componentes em CSS. Prefixo bp-. Valores vêm de tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}
.bp-num { font-variant-numeric: tabular-nums; }
.bp-mono { font-family: var(--font-mono); font-size: 13px; line-height: 20px; }
.bp-muted { color: var(--ink-muted); }
.bp-h1 { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.bp-h2 { font-size: 20px; line-height: 28px; font-weight: 600; margin: 0; }
.bp-h3 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
.bp-caption { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-muted); }
.bp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Marca ---------- */
.bp-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.bp-brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); display: inline-grid; place-items: center; flex: none; }
.bp-brand-mark svg { width: 15px; height: 18px; fill: var(--on-brand); }
.bp-brand-dot { color: var(--brand); }

/* ---------- App shell ---------- */
.bp-shell { min-height: 100%; display: flex; flex-direction: column; }
.bp-shell-bar {
  height: var(--shell-h); display: flex; align-items: center; gap: 32px;
  padding: 0 32px; background: var(--shell); color: var(--on-shell);
}
.bp-shell-bar .bp-brand { color: var(--on-shell); }
.bp-shell-bar :focus-visible { outline-color: var(--brand); }
.bp-nav { display: flex; gap: 4px; height: 100%; }
.bp-nav a {
  display: inline-flex; align-items: center; height: 100%; padding: 0 12px;
  color: var(--on-shell-muted); text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent;
}
.bp-nav a:hover { color: var(--on-shell); }
.bp-nav a[aria-current="page"] { color: var(--on-shell); font-weight: 600; border-bottom-color: var(--brand); }
.bp-shell-user { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.bp-shell-user .bp-who { text-align: right; line-height: 18px; }
.bp-shell-user .bp-who small { display: block; color: var(--on-shell-muted); font-size: 12px; }
.bp-main { flex: 1; width: 100%; max-width: calc(var(--content-max) + 64px); margin: 0 auto; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.bp-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bp-back { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-ink); text-decoration: none; font-weight: 500; margin-bottom: 4px; }
.bp-back:hover { text-decoration: underline; }

/* ---------- Botão ---------- */
.bp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 16px; border-radius: var(--radius-md);
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background-color .12s, border-color .12s;
}
.bp-btn svg { width: 16px; height: 16px; flex: none; }
.bp-btn-primary { background: var(--brand); color: var(--on-brand); }
.bp-btn-primary:hover { background: var(--brand-hover); }
.bp-btn-secondary { background: var(--surface-1); color: var(--ink); border-color: var(--border-strong); }
.bp-btn-secondary:hover { background: var(--surface-2); }
.bp-btn-danger { background: var(--danger); color: var(--on-danger); }
.bp-btn-danger:hover { background: var(--danger-hover); }
.bp-btn-link { background: none; color: var(--brand-ink); padding: 0 4px; height: auto; min-height: 32px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.bp-btn-link:hover { text-decoration-thickness: 2px; }
.bp-btn-link.bp-danger-link { color: var(--danger); }
.bp-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.bp-btn:disabled, .bp-btn[aria-disabled="true"] {
  background: var(--surface-2); color: var(--ink-muted); border-color: var(--border); cursor: not-allowed;
}
.bp-btn-link:disabled { background: none; text-decoration: none; }
.bp-btn.is-hover.bp-btn-primary { background: var(--brand-hover); }
.bp-btn.is-hover.bp-btn-secondary { background: var(--surface-2); }
.bp-btn.is-hover.bp-btn-danger { background: var(--danger-hover); }
.bp-btn.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Campo ---------- */
.bp-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bp-label { font-weight: 600; font-size: 14px; line-height: 20px; }
.bp-label .bp-opt { font-weight: 400; color: var(--ink-muted); }
.bp-input, .bp-select, .bp-textarea {
  width: 100%; height: var(--control-h); padding: 0 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--ink);
  font: inherit; font-variant-numeric: tabular-nums;
}
.bp-input::placeholder, .bp-textarea::placeholder { color: var(--ink-muted); }
.bp-textarea { height: auto; min-height: 112px; padding: 10px 12px; resize: vertical; line-height: 22px; }
.bp-select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.bp-input:focus-visible, .bp-select:focus-visible, .bp-textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.bp-input:disabled, .bp-select:disabled, .bp-textarea:disabled { background: var(--surface-2); color: var(--ink-muted); border-color: var(--border); cursor: not-allowed; }
.bp-hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.bp-field.has-error .bp-input, .bp-field.has-error .bp-select, .bp-field.has-error .bp-textarea { border-color: var(--danger); border-width: 2px; padding-left: 11px; }
.bp-error { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; line-height: 18px; color: var(--danger); font-weight: 500; }
.bp-error svg { width: 14px; height: 14px; margin-top: 2px; flex: none; fill: currentColor; }
.bp-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.bp-form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Dias da semana ---------- */
.bp-days { display: inline-flex; gap: 6px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.bp-days legend { padding: 0; margin-bottom: 6px; }
.bp-day { position: relative; }
.bp-day input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bp-day span {
  display: inline-grid; place-items: center; min-width: 48px; height: var(--control-h); padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-1);
  color: var(--ink); font-weight: 500; user-select: none;
}
.bp-day input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.bp-day input:checked + span::before { content: ""; width: 6px; height: 10px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin: -3px 6px 0 0; display: inline-block; }
.bp-day span { grid-auto-flow: column; }
.bp-day input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.bp-day input:disabled + span { background: var(--surface-2); color: var(--ink-muted); border-color: var(--border); }

/* ---------- Filtro de período ---------- */
.bp-filter {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.bp-filter .bp-field { width: 168px; }
.bp-filter .bp-field.bp-wide { width: 220px; }
.bp-filter-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.bp-filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- Banner ---------- */
.bp-banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px;
  border-radius: var(--radius-md); border: 1px solid; line-height: 22px;
}
.bp-banner > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; fill: currentColor; }
.bp-banner-body { flex: 1; min-width: 0; }
.bp-banner-title { font-weight: 600; }
.bp-banner-success { background: var(--info-surface); border-color: var(--info); color: var(--ink); }
.bp-banner-success > svg { color: var(--info); }
.bp-banner-error { background: var(--danger-surface); border-color: var(--danger); color: var(--ink); }
.bp-banner-error > svg { color: var(--danger); }
.bp-banner-once { background: var(--brand-surface); border-color: var(--brand); color: var(--ink); flex-direction: column; gap: 12px; padding: 16px; }
.bp-banner-once .bp-banner-head { display: flex; gap: 12px; align-items: flex-start; }
.bp-banner-once .bp-banner-head svg { width: 18px; height: 18px; flex: none; margin-top: 2px; fill: var(--ink); }
.bp-banner-close { margin-left: auto; }

/* ---------- Nota de presença ---------- */
.bp-note {
  margin: 0; display: flex; gap: 10px; align-items: center; padding: 10px 16px;
  background: var(--brand-surface); border-radius: var(--radius-md); color: var(--ink);
  font-size: 13px; line-height: 18px;
}
.bp-note svg { width: 16px; height: 16px; flex: none; fill: var(--ink); }

/* ---------- Cartão ---------- */
.bp-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.bp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.bp-card-head p { margin: 2px 0 0; color: var(--ink-muted); font-size: 13px; line-height: 18px; }

/* ---------- Cartão de métrica ---------- */
.bp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bp-metric { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; min-height: 140px; }
.bp-metric-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-muted); }
.bp-metric-value { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.bp-metric-value small { font-size: 16px; font-weight: 500; color: var(--ink-muted); margin-left: 2px; }
.bp-metric-prev { font-size: 13px; line-height: 18px; color: var(--ink-muted); font-variant-numeric: tabular-nums; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.bp-metric-prev b { color: var(--ink); font-weight: 600; }
.bp-metric-empty { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-muted); font-size: 14px; line-height: 20px; padding-top: 4px; }
.bp-metric-empty svg { width: 16px; height: 16px; flex: none; margin-top: 2px; fill: currentColor; }
.bp-metric.is-offline .bp-metric-empty { color: var(--ink); }
.bp-metric.is-offline .bp-metric-empty svg { fill: var(--ink); }

/* ---------- Tabela ---------- */
.bp-table-wrap { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.bp-table-scroll { overflow-x: auto; }
.bp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.bp-table th, .bp-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.bp-table thead th { background: var(--surface-2); font-weight: 600; font-size: 13px; line-height: 18px; color: var(--ink-muted); position: sticky; top: 0; }
.bp-table tbody tr:last-child > * { border-bottom: 0; }
.bp-table tbody tr:hover td { background: var(--surface-2); }
.bp-table .bp-r { text-align: right; }
.bp-table .bp-actions { text-align: right; width: 1%; }
.bp-table .bp-actions > div { display: inline-flex; gap: 8px; }
.bp-table .bp-sticky { position: sticky; left: 0; background: var(--surface-1); z-index: 1; }
.bp-table thead .bp-sticky { background: var(--surface-2); z-index: 2; }
.bp-table tbody tr:hover .bp-sticky { background: var(--surface-2); }
.bp-person { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px; }
.bp-person:hover { text-decoration-color: var(--brand); color: var(--ink); }
.bp-sort { display: inline-flex; gap: 4px; align-items: center; }
.bp-sort svg { width: 10px; height: 10px; fill: currentColor; }
.bp-cell-nodata { color: var(--ink-muted); font-style: italic; }
.bp-table-empty { padding: 48px 16px; text-align: center; color: var(--ink-muted); }
.bp-table-empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.bp-table-foot { padding: 12px 16px; border-top: 1px solid var(--border); color: var(--ink-muted); font-size: 13px; line-height: 18px; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.bp-pct { display: inline-flex; align-items: center; gap: 8px; }
.bp-pct-bar { width: 56px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.bp-pct-bar i { display: block; height: 100%; background: var(--data-active); }
@media (max-width: 900px) {
  .bp-table th, .bp-table td { padding: 10px 12px; }
  .bp-table .bp-hide-md { display: none; }
}

/* ---------- Status ---------- */
.bp-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.bp-status::before { content: ""; width: 8px; height: 8px; border-radius: 999px; flex: none; box-sizing: border-box; }
.bp-status-online, .bp-status-active { color: var(--info); }
.bp-status-online::before, .bp-status-active::before { background: currentColor; }
.bp-status-offline { color: var(--ink); }
.bp-status-offline::before { border: 2px solid currentColor; background: transparent; }
.bp-status-revoked { color: var(--status-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.bp-status-revoked::before { border-radius: 1px; background: currentColor; width: 8px; height: 2px; }
.bp-status-nodata { color: var(--status-muted); }
.bp-status-nodata::before { border: 1.5px dashed currentColor; background: transparent; }

/* ---------- Gráfico de horas ---------- */
.bp-chart { display: flex; flex-direction: column; gap: 12px; }
.bp-legend { display: flex; gap: 20px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.bp-legend span { display: inline-flex; gap: 8px; align-items: center; }
.bp-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.bp-chart svg { max-width: 100%; height: auto; display: block; overflow: visible; }
.bp-chart .ax { font: 500 12px/1 var(--font-sans); fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.bp-chart .grid { stroke: var(--border); stroke-width: 1; }
.bp-chart .base { stroke: var(--border-strong); stroke-width: 1; }
.bp-chart .s-active, .bp-legend .s-active { fill: var(--data-active); background: var(--data-active); }
.bp-chart .s-inactive, .bp-legend .s-inactive { fill: var(--data-inactive); background: var(--data-inactive); }
.bp-chart .s-gap { fill: none; stroke: var(--status-muted); stroke-dasharray: 3 3; }
.bp-legend .s-gap { border: 1.5px dashed var(--status-muted); }

/* ---------- Linha de aplicativo ---------- */
.bp-apps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bp-app { display: grid; grid-template-columns: minmax(180px, 280px) 1fr 104px; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.bp-app:last-child { border-bottom: 0; }
.bp-app-name { font-family: var(--font-mono); font-size: 13px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-app-name small { display: block; font-family: var(--font-sans); font-size: 12px; line-height: 16px; color: var(--ink-muted); font-style: italic; }
.bp-app-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bp-app-track i { display: block; height: 100%; border-radius: 999px; background: var(--data-active); }
.bp-app-dur { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
@media (max-width: 700px) { .bp-app { grid-template-columns: 1fr auto; } .bp-app-track { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Diálogo ---------- */
.bp-scrim { position: fixed; inset: 0; background: rgba(20,19,16,.45); display: grid; place-items: center; padding: 16px; }
.bp-scrim.bp-inline { position: relative; inset: auto; min-height: 100%; }
.bp-dialog { width: 100%; max-width: 440px; background: var(--surface-1); border-radius: var(--radius-lg); box-shadow: var(--shadow-dialog); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.bp-dialog p { margin: 0; color: var(--ink-muted); }
.bp-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }

/* ---------- Código copiável ---------- */
.bp-copy { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-1); overflow: hidden; max-width: 560px; }
.bp-copy code { flex: 1; min-width: 0; padding: 10px 16px; font-family: var(--font-mono); font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: 0.08em; overflow-wrap: anywhere; user-select: all; color: var(--ink); }
.bp-copy code.bp-token { font-size: 14px; line-height: 22px; letter-spacing: 0.02em; }
.bp-copy button { border: 0; border-left: 1px solid var(--border-strong); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 600; padding: 0 16px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.bp-copy button:hover { background: var(--border); }
.bp-copy button svg { width: 16px; height: 16px; fill: currentColor; }
.bp-copy button.is-copied { color: var(--info); }
.bp-copy-meta { font-size: 13px; line-height: 18px; color: var(--ink-muted); }

/* ---------- Administração ---------- */
.bp-admin { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.bp-toc { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.bp-toc a { padding: 6px 12px; border-radius: var(--radius-md); color: var(--ink-muted); text-decoration: none; font-weight: 500; border-left: 3px solid transparent; }
.bp-toc a:hover { color: var(--ink); background: var(--surface-2); }
.bp-toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--brand); background: var(--surface-1); }
.bp-stack { display: flex; flex-direction: column; gap: 24px; }

/* ---------- Login ---------- */
.bp-login { min-height: 100%; display: grid; place-items: center; padding: 48px 16px; }
.bp-login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 24px; }
.bp-login-card form { display: flex; flex-direction: column; gap: 16px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; }
.bp-login-card .bp-btn { width: 100%; margin-top: 8px; }

.bp-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bp-col { display: flex; flex-direction: column; gap: 12px; }

.bp-shell-bar .bp-btn-secondary { background: transparent; color: var(--on-shell); border-color: var(--on-shell-muted); }
.bp-shell-bar .bp-btn-secondary:hover { background: rgba(255,255,255,.1); }
