/* ============================================================================= */
/* gfila — Bold Design System (alinhado ao NeoGestor / saude_new / educacao_v2) */
/* Tokens espelhados de frontend/src/theme.ts do NeoGestor. */
/* ============================================================================= */

:root {
  /* Superfícies */
  --g-bg:            #F0F0F5;   /* background.default */
  --g-surface:       #ffffff;   /* background.paper */
  --g-surface-2:     #F7F7FA;
  --g-border:        #D3D4DD;   /* divider */
  --g-text:          #24252E;   /* text.primary */
  --g-text-soft:     #515162;   /* secondary.main */
  --g-text-faint:    #696979;   /* text.secondary */

  /* Marca (primary/secondary/info) */
  --g-brand:         #007AF0;   /* primary.main */
  --g-brand-light:   #498FFF;   /* primary.light */
  --g-brand-dark:    #0069D0;   /* primary.dark */
  --g-accent:        #02786D;   /* info.main */
  --g-secondary:     #515162;

  /* Semânticas */
  --g-ok:            #217B00;  --g-ok-bg:     #E4F4E0;   /* success */
  --g-warn:          #E76F00;  --g-warn-bg:   #FDEEDF;   /* warning */
  --g-danger:        #D01E29;  --g-danger-bg: #FBE2E4;   /* error */
  --g-info:          #007AF0;  --g-info-bg:   #E3F0FE;

  /* Sidebar (slate escuro do NeoGestor) */
  --g-sb-bg:         #1e293b;
  --g-sb-hover:      #334155;
  --g-sb-active:     #1e40af;
  --g-sb-text:       #e2e8f0;
  --g-sb-muted:      #94a3b8;
  --g-sb-accent:     #60a5fa;

  /* Forma e sombra (Bold DS) */
  --g-radius:        8px;
  --g-radius-lg:     12px;
  --g-shadow-card:   0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --g-shadow-hover:  0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --g-shadow-modal:  0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --g-sidebar-w:     264px;
  --g-font:          "IBM Plex Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body.rf-body {
  margin: 0;
  background: var(--g-bg);
  color: var(--g-text);
  font-family: var(--g-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--g-brand); text-decoration: none; }
a:hover { color: var(--g-brand-dark); }

/* ---- Shell ----------------------------------------------------------------- */
.rf-shell { display: grid; grid-template-columns: var(--g-sidebar-w) 1fr; min-height: 100vh; }

.rf-sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 42%, #16233b 100%);
  color: var(--g-sb-text);
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.06);
}
.rf-sidebar::-webkit-scrollbar { width: 6px; }
.rf-sidebar::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 3px; }
.rf-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.6); }

.rf-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 2px 8px 18px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.rf-brand__mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--g-ai-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,122,240,.4), inset 0 1px 0 rgba(255,255,255,.25);
}
.rf-brand__name { font-weight: 700; font-size: 17px; color: #fff; letter-spacing: -.02em; line-height: 1.1; }
.rf-brand__sub  { font-size: 10px; color: var(--g-sb-muted); text-transform: uppercase; letter-spacing: .9px; margin-top: 2px; }

.rf-nav { list-style: none; margin: 0; padding: 0; }
.rf-nav__section { font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; color: #64748b; margin: 18px 12px 7px; font-weight: 700; }
.rf-nav li { margin: 1px 0; }
.rf-nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: #cbd5e1; font-weight: 500; font-size: 13.5px;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.rf-nav a .ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; color: #8b9bb4; flex: none; transition: color .18s ease, transform .18s ease; }
.rf-nav a:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(3px); }
.rf-nav a:hover .ico { color: #cbd5e1; }
.rf-nav a.is-active {
  background: linear-gradient(90deg, rgba(0,122,240,.22), rgba(109,74,224,.16));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(96,165,250,.25);
}
.rf-nav a.is-active .ico { color: #7dd3fc; }
.rf-nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #38bdf8, #6d4ae0); box-shadow: 0 0 10px rgba(56,189,248,.7);
}

.rf-sidebar__foot { margin-top: 22px; padding: 14px 12px 4px; font-size: 12px; color: var(--g-sb-muted); border-top: 1px solid rgba(255,255,255,.07); }
.rf-sidebar__foot a { color: #93c5fd; display: inline-flex; align-items: center; gap: 6px; transition: color .15s ease; }
.rf-sidebar__foot a:hover { color: #dbeafe; }

/* ---- Main ------------------------------------------------------------------ */
.rf-main { display: flex; flex-direction: column; min-width: 0; }

.rf-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background: var(--g-surface); border-bottom: 1px solid var(--g-border);
  position: sticky; top: 0; z-index: 20;
}
.rf-topbar__title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.rf-topbar__title p  { margin: 2px 0 0; font-size: 12.5px; color: var(--g-text-faint); }
.rf-topbar__right { display: flex; align-items: center; gap: 14px; }
.rf-user-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; transition: background .12s ease; }
.rf-user-link:hover { background: var(--g-surface-2); }
.rf-user { text-align: right; line-height: 1.25; }
.rf-user b { font-size: 13px; }
.rf-user span { display: block; font-size: 11.5px; color: var(--g-text-faint); }
.rf-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--g-brand);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
}
#rf-menu-toggle { display: none; }

.rf-content { padding: 26px 28px 48px; }

/* ---- KPI tiles ------------------------------------------------------------- */
.rf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.rf-kpi {
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-radius);
  padding: 18px; box-shadow: var(--g-shadow-card); transition: box-shadow .2s ease;
}
.rf-kpi:hover { box-shadow: var(--g-shadow-hover); }
.rf-kpi__label { font-size: 11.5px; color: var(--g-text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rf-kpi__value { font-size: 30px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.02em; }
.rf-kpi__hint  { font-size: 12px; color: var(--g-text-faint); }
.rf-kpi--brand  { border-top: 3px solid var(--g-brand); }
.rf-kpi--ok     { border-top: 3px solid var(--g-ok); }
.rf-kpi--warn   { border-top: 3px solid var(--g-warn); }
.rf-kpi--danger { border-top: 3px solid var(--g-danger); }

/* ---- Cards ----------------------------------------------------------------- */
.rf-card {
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-radius);
  box-shadow: var(--g-shadow-card); margin-bottom: 22px; transition: box-shadow .2s ease;
}
.rf-card:hover { box-shadow: var(--g-shadow-hover); }
.rf-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--g-border); }
.rf-card__head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.rf-card__head p  { margin: 2px 0 0; font-size: 12.5px; color: var(--g-text-faint); }
.rf-card__body { padding: 20px; }
.rf-card__body--flush { padding: 0; }

/* ---- Buttons (Bold DS: radius 8, sem sombra, textTransform none) ----------- */
.rf-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px;
  border: 1px solid transparent; font-weight: 500; font-size: 13px; letter-spacing: .02em;
  cursor: pointer; line-height: 1; transition: background-color .15s, border-color .15s; text-decoration: none;
}
.rf-btn:hover { text-decoration: none; box-shadow: none; }
.rf-btn--primary { background: var(--g-brand); color: #fff; }
.rf-btn--primary:hover { background: var(--g-brand-dark); color: #fff; }
.rf-btn--ghost { background: var(--g-surface); color: var(--g-text); border-color: var(--g-border); }
.rf-btn--ghost:hover { background: var(--g-surface-2); color: var(--g-text); border-color: var(--g-brand); }
.rf-btn--ok { background: var(--g-ok); color: #fff; }
.rf-btn--danger { background: var(--g-danger); color: #fff; }
.rf-btn--danger:hover { background: #A4151E; color: #fff; }
.rf-btn--sm { padding: 6px 11px; font-size: 12px; }

/* ---- Pills / badges (Chip: radius 8, weight 500) --------------------------- */
.rf-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.rf-pill--vermelho { background: var(--g-danger-bg); color: var(--g-danger); }
.rf-pill--laranja  { background: var(--g-warn-bg);   color: var(--g-warn); }
.rf-pill--azul     { background: var(--g-info-bg);   color: var(--g-info); }
.rf-pill--verde    { background: var(--g-ok-bg);     color: var(--g-ok); }
.rf-pill--cinza    { background: #ECEDF2;            color: var(--g-text-soft); }
.rf-pill--roxo     { background: #EBE9FB;            color: #5B3FC4; }

.rf-risco { font-weight: 700; }
.rf-risco--alto  { color: var(--g-danger); }
.rf-risco--medio { color: var(--g-warn); }
.rf-risco--baixo { color: var(--g-ok); }

/* ---- Tables ---------------------------------------------------------------- */
.rf-table, table.rf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rf-table thead th { background: var(--g-surface-2); color: var(--g-text-faint); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--g-border); font-weight: 600; }
.rf-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--g-border); vertical-align: middle; }
.rf-table tbody tr:hover { background: var(--g-surface-2); }
.fixed-table-container { border: none !important; }

/* ---- Toolbar da bootstrap-table (sem Bootstrap CSS/JS) — estilo próprio ----- */
.fixed-table-toolbar { padding: 10px 14px; }
.fixed-table-toolbar::after { content: ''; display: block; clear: both; }
.fixed-table-toolbar .pull-right { float: right; }
.fixed-table-toolbar .search { float: left; }
.fixed-table-toolbar .search input {
  border-radius: 8px !important; border: 1px solid var(--g-border) !important;
  padding: 8px 11px; font-size: 13px; min-width: 220px; background: var(--g-surface); color: var(--g-text);
}
.fixed-table-toolbar .btn-group { display: inline-flex; gap: 6px; position: relative; }
.fixed-table-toolbar .btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text-soft);
  border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1;
}
.fixed-table-toolbar .btn:hover { background: var(--g-surface-2); border-color: var(--g-brand); color: var(--g-brand); }
.fixed-table-toolbar .btn .caret { display: inline-block; width: 0; height: 0; margin-left: 4px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.fixed-table-toolbar .dropdown-menu {
  display: none; position: absolute; right: 0; top: 42px; z-index: 40; min-width: 200px; margin: 0; padding: 6px; list-style: none;
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: 10px; box-shadow: var(--g-shadow-modal);
}
.fixed-table-toolbar .btn-group.open .dropdown-menu { display: block; }
.fixed-table-toolbar .dropdown-menu li { list-style: none; padding: 0; }
.fixed-table-toolbar .dropdown-menu li a, .fixed-table-toolbar .dropdown-menu label {
  display: block; padding: 6px 10px; font-size: 13px; color: var(--g-text); border-radius: 6px; cursor: pointer; white-space: nowrap; font-weight: 400;
}
.fixed-table-toolbar .dropdown-menu li a:hover, .fixed-table-toolbar .dropdown-menu label:hover { background: var(--g-surface-2); text-decoration: none; }
/* filtros por coluna (filter-control) */
.rf-table thead .filter-control input, .rf-table thead .filter-control select {
  width: 100%; border: 1px solid var(--g-border); border-radius: 6px; padding: 5px 7px; font-size: 12px; font-weight: 400; margin-top: 4px; background: var(--g-surface);
}

/* ---- Empty / flash / forms / detail ---------------------------------------- */
.rf-empty { text-align: center; padding: 48px 20px; color: var(--g-text-faint); }
.rf-empty__icon { font-size: 40px; margin-bottom: 8px; opacity: .5; }
.rf-empty h3 { margin: 0 0 4px; color: var(--g-text-soft); font-size: 16px; }

.rf-flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; }
.rf-flash--notice { background: var(--g-ok-bg); color: #14532d; border-color: #BBE6B0; }
.rf-flash--alert  { background: var(--g-danger-bg); color: #7f1d1d; border-color: #F3C2C6; }
.rf-flash--info   { background: var(--g-info-bg); color: #0B3D91; border-color: #BBD9FB; }

.rf-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.rf-field { display: flex; flex-direction: column; gap: 5px; }
.rf-field label { font-size: 11.5px; font-weight: 600; color: var(--g-text-soft); }
.rf-field input, .rf-field select, .rf-field textarea, .rf-input {
  padding: 9px 11px; border: 1px solid var(--g-border); border-radius: 8px; font-size: 13px;
  background: var(--g-surface); color: var(--g-text); min-width: 170px; font-family: inherit;
}
.rf-field input:focus, .rf-field select:focus, .rf-field textarea:focus, .rf-input:focus {
  outline: none; border-color: var(--g-brand); box-shadow: 0 0 0 3px rgba(0,122,240,.15);
}

.rf-dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; }
.rf-dl dt { color: var(--g-text-faint); font-weight: 600; font-size: 12.5px; }
.rf-dl dd { margin: 0; font-size: 13.5px; }

.rf-callout { border-left: 3px solid var(--g-brand); background: var(--g-info-bg); padding: 12px 16px; border-radius: 8px; font-size: 13px; color: #0B3D91; }

/* ---- Ícones (SVG inline) --------------------------------------------------- */
.rf-ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.rf-ico--lg { width: 20px; height: 20px; vertical-align: -4px; }
.rf-ico--xl { width: 44px; height: 44px; stroke-width: 1.4; }
.rf-nav a .ico { display: inline-flex; }
.rf-btn .rf-ico { vertical-align: middle; }

/* ---- Toolbar de filtros (acima das grids) ---------------------------------- */
.rf-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 14px 16px; border-bottom: 1px solid var(--g-border); background: var(--g-surface-2);
}
.rf-toolbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.rf-toolbar__count { font-size: 12.5px; color: var(--g-text-faint); font-weight: 600; white-space: nowrap; }

.rf-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; }
.rf-chip-filtro {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px;
  border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--g-info-bg); color: var(--g-info);
}
.rf-chip-filtro a { color: inherit; opacity: .7; line-height: 1; font-weight: 700; }
.rf-chip-filtro a:hover { opacity: 1; text-decoration: none; }

/* ---- Botão só-ícone -------------------------------------------------------- */
.rf-btn--icon {
  padding: 0; width: 36px; height: 36px; justify-content: center;
  background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text-soft); border-radius: 8px;
}
.rf-btn--icon:hover { background: var(--g-surface-2); border-color: var(--g-brand); color: var(--g-brand); }

/* ---- Segmented control ----------------------------------------------------- */
.rf-segmented { display: inline-flex; border: 1px solid var(--g-border); border-radius: 8px; overflow: hidden; background: var(--g-surface); }
.rf-segmented > * {
  padding: 8px 14px; font-size: 13px; font-weight: 500; border: 0; background: transparent;
  color: var(--g-text-soft); cursor: pointer; border-right: 1px solid var(--g-border); display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.rf-segmented > *:last-child { border-right: 0; }
.rf-segmented > *:hover { background: var(--g-surface-2); color: var(--g-text); text-decoration: none; }
.rf-segmented > .is-active { background: var(--g-brand); color: #fff; }
.rf-segmented > .is-active:hover { background: var(--g-brand-dark); color: #fff; }

/* ---- KPI com ícone em caixa + delta ----------------------------------------- */
.rf-kpi__top { display: flex; align-items: center; justify-content: space-between; }
.rf-kpi__icon { width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.rf-kpi__icon--brand  { background: #E3F0FE; color: var(--g-brand); }
.rf-kpi__icon--ok     { background: var(--g-ok-bg); color: var(--g-ok); }
.rf-kpi__icon--warn   { background: var(--g-warn-bg); color: var(--g-warn); }
.rf-kpi__icon--danger { background: var(--g-danger-bg); color: var(--g-danger); }

/* ---- Medidor de risco (0..100) --------------------------------------------- */
.rf-meter { display: inline-flex; align-items: center; gap: 8px; }
.rf-meter__track { width: 64px; height: 6px; border-radius: 3px; background: var(--g-border); overflow: hidden; }
.rf-meter__fill { height: 100%; border-radius: 3px; }
.rf-meter__fill--alto  { background: var(--g-danger); }
.rf-meter__fill--medio { background: var(--g-warn); }
.rf-meter__fill--baixo { background: var(--g-ok); }

/* ---- Empty-state (com CTA) -------------------------------------------------- */
.rf-empty__icon { color: var(--g-text-faint); margin-bottom: 8px; opacity: .55; }
.rf-empty__action { margin-top: 14px; }

/* ---- Toast (feedback pós-ação) --------------------------------------------- */
.rf-toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.rf-toast { box-shadow: var(--g-shadow-modal); cursor: pointer; margin: 0; align-items: center; transition: opacity .3s ease, transform .3s ease; }
.rf-toast > span { flex: 1 1 auto; min-width: 0; }
.rf-toast--leaving { opacity: 0; transform: translateX(12px); }
.rf-toast__close { flex: none; border: 0; background: transparent; color: inherit; opacity: .55; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; margin: -2px -4px -2px 4px; transition: opacity .12s ease; }
.rf-toast__close:hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .rf-toast { transition: none; } }

/* ---- Ação recomendada + details (workspace) -------------------------------- */
.rf-action-card--primary { border-left: 3px solid var(--g-brand); background: var(--g-info-bg); }
.rf-badge-ia { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--g-brand); background: #fff; border: 1px solid var(--g-brand-light); padding: 2px 8px; border-radius: 999px; }

.rf-details { background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-radius); margin-bottom: 12px; overflow: hidden; }
.rf-details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 14px 18px; font-weight: 600; font-size: 14px; }
.rf-details > summary::-webkit-details-marker { display: none; }
.rf-details > summary .rf-chevron { margin-left: auto; transition: transform .15s; }
.rf-details[open] > summary .rf-chevron { transform: rotate(90deg); }
.rf-details[open] > summary { border-bottom: 1px solid var(--g-border); }
.rf-details__body { padding: 18px; }

/* ---- Barra de navegação de caso -------------------------------------------- */
.rf-actionbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.rf-actionbar__pos { font-size: 12.5px; color: var(--g-text-soft); font-weight: 600; }

/* ---- Badge de dias na fila + números --------------------------------------- */
.rf-num { text-align: right; font-variant-numeric: tabular-nums; }
.rf-day-badge { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.rf-day-badge--verde   { background: var(--g-ok-bg);     color: var(--g-ok); }
.rf-day-badge--laranja { background: var(--g-warn-bg);   color: var(--g-warn); }
.rf-day-badge--vermelho{ background: var(--g-danger-bg); color: var(--g-danger); }

/* Badge de pendência (! amarelo) na coluna Solicitação; tooltip via title nativo. */
.rf-pend-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 6px; vertical-align: middle;
  background: var(--g-warn); color: #fff; font-weight: 800; font-size: 12px; line-height: 1;
  cursor: help; box-shadow: 0 0 0 2px var(--g-warn-bg);
}
.rf-pend-badge:focus-visible { outline: 2px solid var(--g-warn); outline-offset: 2px; }

/* Badge de erro (! vermelho) — ex.: rodada de higienização com falha; tooltip via title. */
.rf-err-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 6px; vertical-align: middle;
  background: var(--g-danger); color: #fff; font-weight: 800; font-size: 12px; line-height: 1;
  cursor: help; box-shadow: 0 0 0 2px var(--g-danger-bg);
}
.rf-err-badge:focus-visible { outline: 2px solid var(--g-danger); outline-offset: 2px; }

/* ---- Fila: registro expansível (procedimentos vinculados) ------------------ */
.rf-row-toggle { width: 22px; height: 22px; line-height: 1; border: 1px solid var(--g-border); border-radius: 6px; background: var(--g-surface); color: var(--g-text-soft); font-size: 15px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: background .12s ease, border-color .12s ease, color .12s ease; }
.rf-row-toggle:hover { background: var(--g-brand); border-color: var(--g-brand); color: #fff; }

/* Separação entre registros: um respiro sob cada tbody da fila */
.rf-table--fila > tbody { border-bottom: 1px solid var(--g-border); }

/* Registro ABERTO: destaque coerente amarrando linha-mãe + detalhe */
.rf-table--fila tbody.is-expanded { border-bottom: 0; }
.rf-table--fila tbody.is-expanded .rf-fila-main > td {
  background: var(--g-info-bg);
  border-bottom-color: transparent;
}
.rf-table--fila tbody.is-expanded .rf-fila-main > td:first-child {
  box-shadow: inset 3px 0 0 0 var(--g-brand);
}
/* neutraliza zebra/hover na linha-mãe e de detalhe do registro aberto */
.rf-table--fila tbody.is-expanded .rf-fila-main:hover > td { background: var(--g-info-bg); }
.rf-table--fila tbody.is-expanded .rf-row-toggle { background: var(--g-brand); border-color: var(--g-brand); color: #fff; }

/* Linha de detalhe: a coluna do toggle vira uma faixa/trilho de acento */
.rf-fila-detail > td { padding: 0 !important; background: transparent !important; border-bottom: 0 !important; }
.rf-fila-detail:hover > td { background: transparent !important; }
.rf-fila-detail__rail { position: relative; }
.rf-fila-detail__rail::before {
  content: ""; position: absolute; top: 0; bottom: 18px; left: 0; width: 3px;
  background: var(--g-brand); border-radius: 0 0 3px 3px; opacity: .45;
}

/* Caixa "filha" que contém a subtabela — recuada, delimitada e destacada */
.rf-fila-detail__box {
  margin: 2px 14px 18px 0;
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-left: 3px solid var(--g-brand);
  border-radius: var(--g-radius);
  box-shadow: var(--g-shadow-card);
  overflow: hidden;
}
.rf-fila-detail__title {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--g-text-soft);
  background: var(--g-surface-2);
  border-bottom: 1px solid var(--g-border);
}
.rf-fila-detail__title .rf-ico { color: var(--g-brand); flex: none; }
.rf-fila-detail__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 6px;
  font-size: 11px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--g-brand); border-radius: 999px;
}

.rf-subtable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 0; background: var(--g-surface); }
.rf-subtable thead th { background: var(--g-surface); color: var(--g-text-faint); text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em; padding: 8px 14px; text-align: left; border-bottom: 1px solid var(--g-border); font-weight: 600; }
.rf-subtable tbody td { padding: 8px 14px; border-bottom: 1px solid var(--g-border); vertical-align: middle; }
.rf-subtable tbody tr:last-child td { border-bottom: 0; }
/* impede que o zebra/hover da tabela-mãe (.rf-table ...) vaze para a subtabela */
.rf-subtable tbody tr, .rf-subtable tbody tr:nth-child(even) { background: transparent; }
.rf-subtable tbody tr:hover { background: transparent; }
.rf-subtable tbody tr:hover td { background: var(--g-surface-2); }

/* ---- Paginação ------------------------------------------------------------- */
.rf-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--g-border); }
.rf-pagination__left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.rf-pagination__info { font-size: 12.5px; color: var(--g-text-faint); }
.rf-pagination__nav { display: flex; align-items: center; gap: 4px; }
.rf-perpage { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.rf-perpage label { font-size: 12.5px; color: var(--g-text-faint); font-weight: 500; }
.rf-input--sm, .rf-field .rf-input--sm { height: 32px; padding: 4px 8px; font-size: 13px; width: auto; min-width: 64px; }

/* Filtro de faixa etária (min–máx) */
.rf-field-inline { display: flex; align-items: center; gap: 6px; }
.rf-field-inline .rf-input--sm { width: 70px; min-width: 0; }
.rf-field-inline__sep { color: var(--g-text-faint); }

/* Filtros da fila (em linhas: tipo+prioridade | idade | ações) */
.rf-fila-filtros { display: flex; flex-direction: column; gap: 12px; width: 100%; flex: 1 1 100%; }
.rf-fila-filtros__row { display: grid; gap: 12px; }
.rf-fila-filtros__row--2 { grid-template-columns: 1fr 1fr; }
.rf-fila-filtros__row--2 .rf-input { width: 100%; }
.rf-fila-filtros__acoes { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--g-border); padding-top: 12px; }
@media (max-width: 640px) { .rf-fila-filtros__row--2 { grid-template-columns: 1fr; } }
.rf-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--g-border); border-radius: 8px; background: var(--g-surface);
  color: var(--g-text-soft); font-size: 13px; font-weight: 600; text-decoration: none;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.rf-page-btn:hover { background: var(--g-surface-2); color: var(--g-text); border-color: var(--g-brand-light); }
.rf-page-btn.is-active { background: var(--g-brand); border-color: var(--g-brand); color: #fff; cursor: default; }
.rf-page-ellipsis { padding: 0 4px; color: var(--g-text-faint); }

/* ============================================================================= */
/* Sinalizações — triagem em cards (paciente · regra · risco · sugestão da IA)   */
/* ============================================================================= */

/* Legenda de severidade na toolbar */
.rf-sev-legend { display: inline-flex; align-items: center; gap: 12px; }
.rf-sev { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.rf-sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.rf-sev--alta  { color: var(--g-danger); }
.rf-sev--media { color: var(--g-warn); }
.rf-sev--baixa { color: var(--g-text-faint); }

/* Lista de cards */
.rf-sinal-list { display: flex; flex-direction: column; gap: 14px; padding: 18px; }

.rf-sinal {
  position: relative; display: flex; gap: 18px;
  background: var(--g-surface); border: 1px solid var(--g-border);
  border-left: 4px solid var(--g-border); border-radius: var(--g-radius);
  padding: 16px 18px; box-shadow: var(--g-shadow-card);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.rf-sinal:hover { box-shadow: var(--g-shadow-hover); }
.rf-sinal--alta  { border-left-color: var(--g-danger); }
.rf-sinal--media { border-left-color: var(--g-warn); }
.rf-sinal--baixa { border-left-color: var(--g-border); }

.rf-sinal__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.rf-sinal__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.rf-sinal__ident { min-width: 0; }
.rf-sinal__nome { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.rf-sinal__meta { font-size: 11.5px; color: var(--g-text-faint); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px; }
.rf-sinal__actions { flex: none; display: flex; align-items: center; gap: 8px; }

.rf-sinal__tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rf-tag-soft { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 500; color: var(--g-text-soft); background: var(--g-surface-2); border: 1px solid var(--g-border); }
/* Chips dos filtros de escopo aplicados numa rodada (histórico da higienização) */
.rf-exec-filtros { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.rf-exec-filtros .rf-tag-soft { font-size: 11px; padding: 2px 8px; }

.rf-sinal__proc { font-size: 13px; color: var(--g-text-soft); }
.rf-sinal__proc-cod { font-weight: 700; color: var(--g-text); font-variant-numeric: tabular-nums; margin-right: 4px; }

.rf-sinal__detalhe {
  margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--g-text-soft);
  background: var(--g-surface-2); border-left: 2px solid var(--g-border);
  border-radius: 0 6px 6px 0; padding: 8px 12px;
}

/* Badge de dias (variante com ícone) reutiliza .rf-day-badge; ajuste de layout */
.rf-sinal__tags .rf-day-badge { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 3px 9px; border-radius: 8px; }
.rf-sinal__tags .rf-day-badge .rf-ico { vertical-align: 0; }

/* ---- Gauge de risco de absenteísmo (0..100) -------------------------------- */
.rf-gauge { --gc: var(--g-text-faint); flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 60px; }
.rf-gauge--alto  { --gc: var(--g-danger); }
.rf-gauge--medio { --gc: var(--g-warn); }
.rf-gauge--baixo { --gc: var(--g-ok); }
.rf-gauge__ring {
  --val: 0; width: 54px; height: 54px; border-radius: 50%;
  background: conic-gradient(var(--gc) calc(var(--val) * 3.6deg), var(--g-border) 0);
  display: grid; place-items: center; position: relative;
}
.rf-gauge__ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--g-surface); }
.rf-gauge__num { position: relative; font-size: 16px; font-weight: 700; color: var(--gc); font-variant-numeric: tabular-nums; line-height: 1; }
.rf-gauge__cap { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--gc); text-align: center; line-height: 1.15; }

/* ---- Bloco de sugestões da IA (expandível, nativo <details>) --------------- */
.rf-ia { border: 1px solid var(--g-brand-light); border-radius: var(--g-radius); overflow: hidden; background: linear-gradient(180deg, #F5F8FF, var(--g-surface) 46px); }
.rf-ia__summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 12px; }
.rf-ia__summary::-webkit-details-marker { display: none; }
.rf-ia__summary:hover { background: rgba(0,122,240,.04); }
.rf-ia__summary .rf-pill { font-size: 11px; }
.rf-ia__more { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--g-brand); white-space: nowrap; }
.rf-ia__more .rf-chevron { transition: transform .15s ease; }
.rf-ia[open] .rf-ia__more .rf-chevron { transform: rotate(90deg); }
.rf-ia__body { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-top: 1px solid var(--g-brand-light); background: var(--g-surface); }
.rf-ia__item { display: flex; flex-direction: column; gap: 5px; }
.rf-ia__item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rf-ia__resumo { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--g-text-soft); }
.rf-ia__acao { margin: 0; font-size: 12px; color: var(--g-text-soft); display: inline-flex; align-items: center; gap: 5px; }
.rf-ia__acao b { color: var(--g-text); text-transform: capitalize; }
.rf-ia__nota { color: var(--g-text-soft); font-style: italic; }

/* Barra de confiança da IA */
.rf-conf { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; color: var(--g-text-faint); font-variant-numeric: tabular-nums; }
.rf-conf__track { width: 60px; height: 5px; border-radius: 3px; background: var(--g-border); overflow: hidden; }
.rf-conf__fill { height: 100%; border-radius: 3px; background: var(--g-brand); }

@media (max-width: 640px) {
  .rf-sinal { flex-direction: column; gap: 12px; }
  .rf-gauge { flex-direction: row; width: auto; gap: 10px; align-items: center; }
  .rf-sinal__top { flex-direction: column; }
  .rf-sinal__actions { width: 100%; }
}

/* ---- Detalhe (key/value) + JSON — usado na auditoria -----------------------  */
.rf-kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.rf-kv th { text-align: left; width: 230px; color: var(--g-text-faint); font-weight: 600; padding: 8px 12px 8px 0; vertical-align: top; border-bottom: 1px solid var(--g-border); }
.rf-kv td { padding: 8px 0; border-bottom: 1px solid var(--g-border); vertical-align: top; }
.rf-json { background: var(--g-surface-2); border: 1px solid var(--g-border); border-radius: var(--g-radius); padding: 12px; font-size: 12px; line-height: 1.5; overflow-x: auto; margin: 0; }

/* Modal genérico (<dialog> nativo) */
.rf-modal { border: 0; padding: 0; width: min(640px, calc(100vw - 32px)); position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; border-radius: var(--g-radius-lg); background: var(--g-surface); color: var(--g-text); box-shadow: var(--g-shadow-modal); }
.rf-modal::backdrop { background: rgba(15, 23, 42, .45); }
.rf-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--g-border); }
.rf-modal__head h2 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.rf-modal__close { border: 0; background: transparent; color: var(--g-text-faint); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.rf-modal__close:hover { background: var(--g-surface-2); color: var(--g-text); }
.rf-modal__body { padding: 20px; max-height: 70vh; overflow-y: auto; }

/* Botão "?" de ajuda (abre modal) */
.rf-help-toggle { width: 34px; height: 34px; border-radius: 50%; padding: 0; font-weight: 800; font-size: 15px; flex: none; }

/* Seção de ajuda (ex.: parâmetros/regras da higienização) */
.rf-help__sub { font-size: 13px; font-weight: 700; color: var(--g-text); margin: 18px 0 8px; }
.rf-help-dl { margin: 0; display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; font-size: 13px; }
.rf-help-dl dt { font-weight: 600; color: var(--g-text-soft); }
.rf-help-dl dd { margin: 0; color: var(--g-text-soft); }
.rf-help-dl__pad { color: var(--g-text-faint); }
.rf-help-regras { margin: 0; padding-left: 18px; font-size: 13px; color: var(--g-text-soft); display: grid; gap: 5px; }
@media (max-width: 640px) { .rf-help-dl { grid-template-columns: 1fr; gap: 2px 0; } .rf-help-dl dt { margin-top: 8px; } }

/* ---- Contexto fixo no workspace -------------------------------------------- */
.rf-sticky-context { position: sticky; top: 84px; }

/* ---- Zebra striping --------------------------------------------------------- */
.rf-table tbody tr:nth-child(even) { background: rgba(0,0,0,.015); }
.rf-table tbody tr:hover { background: var(--g-surface-2); }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) { .rf-sticky-context { position: static; } }
@media (max-width: 900px) {
  .rf-shell { grid-template-columns: 1fr; }
  .rf-sidebar { position: fixed; left: -100%; width: var(--g-sidebar-w); z-index: 60; transition: left .2s; }
  .rf-shell--nav-open .rf-sidebar { left: 0; }
  #rf-menu-toggle { display: inline-flex; }
}

/* ============================================================================= */
/* Painel preditivo: tokens de série, superfícies de IA, skeleton e charts */
/* ============================================================================= */
:root {
  --g-cat-1:#007AF0; --g-cat-2:#0EA5A0; --g-cat-3:#C98500; --g-cat-4:#6D4AE0;
  --g-cat-5:#E85AA0; --g-cat-6:#00A46B; --g-cat-7:#EB6834;
  --g-ai-grad: linear-gradient(90deg,#007AF0,#6D4AE0);
  --g-sidebar-w-rail:64px;
}

/* ---- Selo e superfície de IA ----------------------------------------------- */
.rf-ai-badge {
  display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; letter-spacing:.02em;
  color:var(--g-brand); background:linear-gradient(90deg,#E3F0FE,#EDE9FB);
  border:1px solid var(--g-brand-light); padding:2px 9px; border-radius:8px; line-height:1.6;
}
.rf-ai-badge .rf-ico { width:12px; height:12px; }
.rf-ai-surface { position:relative; border:1px solid var(--g-brand-light); background:linear-gradient(180deg,#F5F8FF 0,var(--g-surface) 64px); }
.rf-ai-surface::before { content:""; position:absolute; inset:0 0 auto 0; height:3px; background:var(--g-ai-grad); border-radius:var(--g-radius) var(--g-radius) 0 0; }
.rf-recommendation { border:1px solid var(--g-brand-light); border-left:3px solid var(--g-brand); background:linear-gradient(180deg,#F1F6FF,var(--g-surface)); border-radius:var(--g-radius); }

/* ---- Skeleton / shimmer / spinner ------------------------------------------ */
.rf-skeleton { border-radius:6px; background:#E9EAF0; position:relative; overflow:hidden; }
.rf-skeleton::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg,transparent,rgba(255,255,255,.65),transparent); transform:translateX(-100%); animation:rf-shimmer 1.3s infinite; }
@keyframes rf-shimmer { 100% { transform:translateX(100%); } }
.rf-skeleton--line { height:12px; margin:8px 0; }
.rf-skeleton--line.is-70 { width:70%; } .rf-skeleton--line.is-90 { width:90%; }
.rf-spin { display:inline-block; width:14px; height:14px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:rf-spin .7s linear infinite; vertical-align:-2px; }
.rf-btn.is-loading { pointer-events:none; opacity:.85; }
@keyframes rf-spin { to { transform:rotate(360deg); } }

/* ---- Responsividade: tabela e grids ---------------------------------------- */
.rf-table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.rf-grid-2 { display:grid; grid-template-columns:1.1fr 1fr; gap:22px; align-items:start; }
.rf-grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
@media (max-width:900px){ .rf-grid-2, .rf-grid-3 { grid-template-columns:1fr; } }
@media (max-width:640px){ .rf-kpis { grid-template-columns:1fr 1fr; gap:10px; } .rf-kpi__value { font-size:24px; } }

/* ---- Topbar viva ------------------------------------------------------------ */
.rf-breadcrumb { font-size:12px; color:var(--g-text-faint); margin-bottom:2px; }
.rf-breadcrumb b { color:var(--g-text-soft); font-weight:600; }
.rf-topbar__meta { display:flex; align-items:center; gap:10px; font-size:12px; color:var(--g-text-faint); }
.rf-status-dot { width:8px; height:8px; border-radius:50%; background:var(--g-ok); display:inline-block; }
.rf-status-dot--off { background:var(--g-text-faint); }

/* ---- Card de chart ---------------------------------------------------------- */
.rf-chart-card__head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:16px 20px 0; }
.rf-chart-card__title { font-size:15px; font-weight:600; letter-spacing:-.01em; margin:0; }
.rf-chart-card__subtitle { font-size:12.5px; color:var(--g-text-faint); margin:2px 0 0; }
.rf-chart-card__source { font-size:10.5px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; color:var(--g-text-faint); background:var(--g-surface-2); border:1px solid var(--g-border); padding:2px 8px; border-radius:8px; white-space:nowrap; }
.rf-chart-card__plot { padding:12px 20px 20px; }
.rf-chart-card__plot svg { width:100%; height:auto; display:block; }
.rf-chart-legend { display:flex; flex-wrap:wrap; gap:12px 18px; padding:0 20px 16px; font-size:12px; color:var(--g-text-soft); }
.rf-chart-legend__item { display:inline-flex; align-items:center; gap:6px; }
.rf-chart-legend__dot { width:10px; height:10px; border-radius:3px; flex:none; }

/* ---- Acessibilidade / motion ------------------------------------------------ */
:focus-visible { outline:2px solid var(--g-brand); outline-offset:2px; border-radius:4px; }
.rf-content { animation:rf-fade .18s ease; }
@keyframes rf-fade { from { opacity:.5; } to { opacity:1; } }
@media (prefers-reduced-motion: reduce){ .rf-skeleton::after, .rf-spin, .rf-content { animation:none; } }

/* ---- Grid compacto de charts (painel) -------------------------------------- */
.rf-charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 22px; }
.rf-charts-grid .rf-card { margin-bottom: 0; }
.rf-charts-grid .rf-chart-card__head { padding: 14px 16px 0; }
.rf-charts-grid .rf-chart-card__plot { padding: 10px 16px 14px; }
.rf-chart-card--wide { grid-column: 1 / -1; } /* ocupa a linha toda quando necessário */

/* Linha de charts compactos: ao contrário do grid, os cards CRESCEM para ocupar
   a largura restante — nunca sobra coluna vazia quando o nº de cards não fecha. */
.rf-charts-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.rf-charts-row > .rf-card { flex: 1 1 300px; min-width: 0; margin-bottom: 0; }
.rf-charts-row .rf-chart-card__head { padding: 14px 16px 0; }
.rf-charts-row .rf-chart-card__plot { padding: 10px 16px 14px; }

/* ---- Login / auth (nao autenticado) ---- */
.rf-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--g-bg); }
.rf-auth__card { width: 100%; max-width: 400px; background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-radius-lg); box-shadow: var(--g-shadow-card); padding: 28px; }
.rf-auth__brand { text-align: center; margin-bottom: 22px; }
.rf-auth__brand h1 { margin: 8px 0 2px; font-size: 22px; font-weight: 700; color: var(--g-brand); letter-spacing: -.02em; }
.rf-auth__brand p { margin: 0; font-size: 12.5px; color: var(--g-text-faint); }
.rf-auth__mark { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto; background: var(--g-ai-grad); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,122,240,.4); }

/* ---- Logo (SVG inline, herda currentColor no variant :mark) ---- */
.rf-logo { display: block; }
.rf-brand__mark .rf-logo, .rf-auth__mark .rf-logo { color: #fff; }

/* ============================================================================= */
/* Login split — painel de marca (gradiente IA) + card do formulario            */
/* ============================================================================= */
.rf-login {
  width: 100%; max-width: 960px; min-height: 560px;
  display: grid; grid-template-columns: 1.02fr 1fr;
  background: var(--g-surface); border: 1px solid var(--g-border);
  border-radius: 18px; overflow: hidden; box-shadow: var(--g-shadow-modal);
}

/* Painel esquerdo — gradiente de IA */
.rf-login__brand {
  position: relative; display: flex; flex-direction: column;
  padding: 34px 38px; color: #fff;
  background: linear-gradient(150deg, #007AF0 0%, #3f5fe6 46%, #6D4AE0 100%);
  overflow: hidden;
}
/* brilho decorativo sutil (nao interfere no texto) */
.rf-login__brand::before {
  content: ""; position: absolute; top: -80px; right: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.20), transparent 68%);
  pointer-events: none;
}
.rf-login__brand::after {
  content: ""; position: absolute; bottom: -120px; left: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%);
  pointer-events: none;
}
.rf-login__brand-top { position: relative; display: flex; align-items: center; gap: 11px; }
.rf-login__logo {
  width: 44px; height: 44px; border-radius: 12px; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(2px);
}
.rf-login__brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

.rf-login__hero { position: relative; margin: auto 0; padding: 24px 0; }
.rf-login__tagline { margin: 0 0 12px; font-size: 27px; line-height: 1.18; font-weight: 700; letter-spacing: -.02em; }
.rf-login__lead { margin: 0 0 26px; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,.88); max-width: 34ch; }

.rf-login__points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.rf-login__points li { display: flex; gap: 12px; font-size: 13px; line-height: 1.45; color: rgba(255,255,255,.9); }
.rf-login__points li b { color: #fff; font-weight: 600; }
.rf-login__point-ico {
  flex: none; width: 32px; height: 32px; border-radius: 9px; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.24);
}

.rf-login__brand-foot { position: relative; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.72); }

/* Painel direito — formulario */
.rf-login__form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 44px; }
.rf-login__card { width: 100%; max-width: 340px; }
.rf-login__card-mark { display: none; margin-bottom: 16px; }
.rf-login__title { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--g-text); }
.rf-login__subtitle { margin: 0 0 24px; font-size: 13px; color: var(--g-text-faint); }

.rf-login__field { margin-bottom: 14px; }
.rf-login__field label { margin-bottom: 2px; }
.rf-login__remember { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--g-text-soft); margin-bottom: 18px; cursor: pointer; }
.rf-login__submit { width: 100%; justify-content: center; padding: 12px 16px; font-size: 14px; }

.rf-login__sso { margin-top: 22px; }
.rf-login__divider { position: relative; text-align: center; margin-bottom: 16px; }
.rf-login__divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--g-border); }
.rf-login__divider span { position: relative; background: var(--g-surface); padding: 0 12px; font-size: 12px; color: var(--g-text-faint); }
.rf-login__sso-form { display: flex; gap: 8px; }

@media (max-width: 820px) {
  .rf-login { grid-template-columns: 1fr; max-width: 440px; min-height: 0; }
  .rf-login__brand { padding: 26px 28px; }
  .rf-login__hero { margin: 20px 0 4px; padding: 0; }
  .rf-login__tagline { font-size: 22px; }
  .rf-login__lead { margin-bottom: 20px; }
  .rf-login__brand-foot { display: none; }
  .rf-login__form-wrap { padding: 30px 28px; }
  .rf-login__card { max-width: none; }
}
@media (max-width: 480px) {
  .rf-login__points { display: none; }
  .rf-login__hero { margin: 16px 0 2px; }
}

/* ---- Acoes no topo do conteudo (ex.: botao "Nova fonte") ---- */
.rf-content-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }

/* ---- Barras horizontais (distribuicoes do painel) ---- */
.rf-bars { display: flex; flex-direction: column; gap: 12px; }
.rf-bar__top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.rf-bar__track { height: 8px; border-radius: 4px; background: var(--g-surface-2); overflow: hidden; }
.rf-bar__fill { height: 8px; border-radius: 4px; background: var(--g-brand); }

/* ---- Popover de acoes na fila ---- */
.rf-actions-pop-wrap { display: inline-block; }

/* Painel: position fixed (posicionado via Stimulus) para escapar do overflow-x
   da .rf-table-wrap, que recortaria um popover absoluto. */
.rf-actions-pop {
  position: fixed; top: 0; left: 0; z-index: 1000; width: 328px;
  max-height: min(74vh, 580px); overflow-y: auto;
  background: var(--g-surface); border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg); box-shadow: var(--g-shadow-modal);
  padding: 14px; text-align: left;
}
.rf-actions-pop[hidden] { display: none; }

.rf-actions-pop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.rf-actions-pop__head > span { font-weight: 600; font-size: 13px; color: var(--g-text); }
.rf-actions-pop__close {
  border: 0; background: transparent; color: var(--g-text-faint); font-size: 20px;
  line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.rf-actions-pop__close:hover { color: var(--g-text); background: var(--g-surface-2); }
.rf-actions-pop__hint { font-size: 11px; color: var(--g-text-faint); margin: 0 0 12px; }

/* Cada ação em um "card" com acento colorido por natureza. */
.rf-act {
  background: var(--g-surface-2); border: 1px solid var(--g-border); border-left-width: 3px;
  border-radius: var(--g-radius); padding: 12px; margin-bottom: 12px;
}
.rf-act:last-child { margin-bottom: 0; }
.rf-act__head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.rf-act__head .rf-ico { flex: none; }
.rf-act .rf-field { margin-bottom: 8px; }
.rf-act__submit { width: 100%; margin-top: 2px; justify-content: center; }

.rf-act--priorizar { border-left-color: var(--g-brand); }
.rf-act--priorizar .rf-act__head { color: var(--g-brand); }
.rf-act--pendencia { border-left-color: var(--g-warn); }
.rf-act--pendencia .rf-act__head { color: var(--g-warn); }
.rf-act--remover { border-left-color: var(--g-danger); }
.rf-act--remover .rf-act__head { color: var(--g-danger); }
.rf-act--avaliar { border-left-color: var(--g-accent); }
.rf-act--avaliar .rf-act__head { color: var(--g-accent); }
.rf-act textarea { resize: vertical; min-height: 62px; font-family: inherit; }

/* ---- Aviso "exige análise humana" (popover de sugestão da IA) ---------------- */
.rf-aviso-humano {
  margin: 0 0 10px; padding: 9px 11px; border-radius: var(--g-radius);
  background: var(--g-warn-bg); border: 1px solid var(--g-warn); border-left-width: 3px;
}
.rf-aviso-humano__head {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; color: var(--g-warn);
}
.rf-aviso-humano p { margin: 5px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--g-text); }

/* ---- Desfecho da sinalização (o que a equipe fez, no card já revisado) ------- */
.rf-desfecho {
  margin: 10px 0 0; padding: 9px 12px; border-radius: var(--g-radius);
  background: var(--g-surface-2); border: 1px solid var(--g-border); border-left: 3px solid var(--g-text-faint);
}
.rf-desfecho--resolvida  { border-left-color: var(--g-brand); }
.rf-desfecho--confirmada { border-left-color: var(--g-ok); }
.rf-desfecho--descartada { border-left-color: var(--g-text-faint); }
.rf-desfecho__head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rf-desfecho__acao {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; color: var(--g-text-soft);
}
.rf-desfecho--resolvida  .rf-desfecho__acao { color: var(--g-brand); }
.rf-desfecho--confirmada .rf-desfecho__acao { color: var(--g-ok); }
.rf-desfecho__meta { margin-left: auto; font-size: 11.5px; color: var(--g-text-faint); }
.rf-desfecho__texto { margin: 5px 0 0; font-size: 13px; color: var(--g-text); }
.rf-desfecho__texto--livre { color: var(--g-text-soft); font-style: italic; }
.rf-desfecho__texto--erro  { color: var(--g-danger); }
@media (max-width: 640px) { .rf-desfecho__meta { margin-left: 0; width: 100%; } }

/* ============================================================================= */
/* Sidebar 2.0 — layout em coluna, botao de rail, card do operador, tooltips     */
/* ============================================================================= */

/* Estrutura em coluna: nav ocupa o espaco e empurra o rodape p/ o fim */
.rf-sidebar { display: flex; flex-direction: column; }
.rf-nav-wrap { flex: 1 1 auto; }

/* Transicao suave da largura ao colapsar/expandir */
.rf-shell { transition: grid-template-columns .2s ease; }
.rf-sidebar { transition: padding .2s ease; }

/* Marca: reserva espaco p/ o botao de recolher */
.rf-brand { position: relative; }
.rf-brand__txt { min-width: 0; }

/* Botao de recolher para "rail" (so no desktop) */
.rf-rail-toggle {
  margin-left: auto; flex: none; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); color: var(--g-sb-muted);
  border: 1px solid rgba(255,255,255,.10); border-radius: 7px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .2s ease;
}
.rf-rail-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }
.rf-rail-toggle .rf-ico { transition: transform .2s ease; transform: rotate(180deg); }

/* Card do operador no rodape */
.rf-sidebar__foot { margin-top: 18px; padding: 12px 4px 2px; border-top: 1px solid rgba(255,255,255,.07); }
.rf-op-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 11px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06); transition: background-color .15s ease;
}
.rf-op-card:hover { background: rgba(255,255,255,.07); }
.rf-op-card__avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--g-ai-grad); box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.rf-op-card__info { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.rf-op-card__info b { display: block; font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-op-card__info span { display: block; font-size: 11px; color: var(--g-sb-muted); text-transform: capitalize; }
.rf-op-card__sair {
  flex: none; width: 32px; height: 32px; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--g-sb-muted);
  border: 1px solid rgba(255,255,255,.10); border-radius: 8px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.rf-op-card__sair:hover { background: rgba(208,30,41,.18); color: #fecaca; border-color: rgba(208,30,41,.4); }

/* Scrim (fundo escurecido) do off-canvas no mobile */
.rf-scrim {
  display: none; position: fixed; inset: 0; z-index: 55; border: 0; padding: 0;
  background: rgba(2,6,23,.5); cursor: pointer; -webkit-appearance: none; appearance: none;
}

/* ---- Modo RAIL (desktop, so icones) --------------------------------------- */
.rf-shell--rail { --g-sidebar-w: var(--g-sidebar-w-rail); }
.rf-shell--rail .rf-sidebar { padding-left: 8px; padding-right: 8px; }
.rf-shell--rail .rf-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.rf-shell--rail .rf-brand__txt,
.rf-shell--rail .rf-nav__label,
.rf-shell--rail .rf-nav__section,
.rf-shell--rail .rf-op-card__info { display: none; }
.rf-shell--rail .rf-rail-toggle { position: absolute; top: -4px; right: -2px; }
.rf-shell--rail .rf-rail-toggle .rf-ico { transform: rotate(0deg); }
.rf-shell--rail .rf-nav a { justify-content: center; gap: 0; padding: 10px 0; }
.rf-shell--rail .rf-nav a.is-active::before { left: -8px; }
/* Rail: rodapé empilha em COLUNA (avatar em cima, Sair embaixo) — cabe na largura
   estreita e mantém o Sair visível e CLICÁVEL. Em linha, avatar+botão não cabiam
   nos ~48px do rail e o Sair transbordava para baixo do menu. */
.rf-shell--rail .rf-op-card { flex-direction: column; justify-content: center; padding: 8px 4px; gap: 8px; }

/* Tooltip dos itens no modo rail (usa data-tip) */
.rf-shell--rail .rf-nav a { position: relative; }
.rf-shell--rail .rf-nav a::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
  padding: 6px 10px; border-radius: 7px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: #0f172a; color: #fff; box-shadow: var(--g-shadow-modal);
  opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 70;
}
.rf-shell--rail .rf-nav a:hover::after { opacity: 1; }

/* ---- Responsivo: ≤900px vira off-canvas; rail nao se aplica --------------- */
@media (max-width: 900px) {
  .rf-rail-toggle { display: none; }
  /* Neutraliza o rail no mobile: sempre largura cheia e textos visiveis */
  .rf-shell--rail { --g-sidebar-w: 264px; }
  .rf-shell--rail .rf-brand__txt,
  .rf-shell--rail .rf-nav__label,
  .rf-shell--rail .rf-nav__section,
  .rf-shell--rail .rf-op-card__info { display: block; }
  .rf-shell--rail .rf-nav a { justify-content: flex-start; gap: 11px; padding: 9px 12px; }
  .rf-shell--rail .rf-nav a::after { display: none; }
  .rf-shell--rail .rf-op-card { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 8px; }
  /* Scrim visivel quando o menu esta aberto */
  .rf-shell--nav-open .rf-scrim { display: block; }
}

/* ============================================================================= */
/* Formularios em grade (telas de cadastro / admin)                              */
/* ============================================================================= */
.rf-form { max-width: 860px; }
.rf-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.rf-form-grid .rf-field { min-width: 0; }
.rf-form-grid .rf-field input,
.rf-form-grid .rf-field select,
.rf-form-grid .rf-field textarea { width: 100%; min-width: 0; }
.rf-field--full { grid-column: 1 / -1; }
.rf-field__hint { font-size: 11.5px; color: var(--g-text-faint); margin: 2px 0 0; }
.rf-field__hint code { background: var(--g-surface-2); border: 1px solid var(--g-border); border-radius: 4px; padding: 0 4px; font-size: 11px; }
.rf-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--g-text); font-weight: 500; cursor: pointer; }
.rf-check input { width: 16px; height: 16px; accent-color: var(--g-brand); }

/* Switch (toggle) — flags Sim/Não; substitui o checkbox p/ campos booleanos. */
.rf-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--g-text); font-weight: 500; cursor: pointer; user-select: none; }
.rf-switch__input { position: absolute; opacity: 0; width: 0; height: 0; }
.rf-switch__track { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--g-surface-2); border: 1px solid var(--g-border); transition: background .15s ease, border-color .15s ease; }
.rf-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s ease; }
.rf-switch__input:checked + .rf-switch__track { background: var(--g-brand); border-color: var(--g-brand); }
.rf-switch__input:checked + .rf-switch__track::after { transform: translateX(18px); }
.rf-switch__input:focus-visible + .rf-switch__track { outline: 2px solid var(--g-brand); outline-offset: 2px; }
.rf-switch__state { min-width: 26px; color: var(--g-text-faint); font-weight: 600; }
.rf-switch__state::after { content: "Não"; }
.rf-switch__input:checked ~ .rf-switch__state { color: var(--g-brand); }
.rf-switch__input:checked ~ .rf-switch__state::after { content: "Sim"; }
.rf-form-actions { display: flex; gap: 12px; margin-top: 4px; }
.rf-card__foot { display: flex; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--g-border); background: var(--g-surface-2); border-radius: 0 0 var(--g-radius) var(--g-radius); }
@media (max-width: 640px) { .rf-form-grid { grid-template-columns: 1fr; } }

/* ============================ Ações em lote (sinalizações) ==================== */
/* Toolbar: bloco destacado de filtro pela sugestão da IA */
.rf-filters--lote { flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.rf-ia-filter { display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px; border: 1px solid var(--g-brand-light); border-radius: var(--g-radius); background: var(--g-info-bg); }
.rf-ia-filter .rf-ai-badge { align-self: center; }

/* Tabela selecionável */
.rf-table--select .rf-check-col { width: 34px; text-align: center; }
.rf-check { width: 16px; height: 16px; accent-color: var(--g-brand); cursor: pointer; }
.rf-table--select tbody tr:has(.rf-check:checked) { background: var(--g-info-bg); box-shadow: inset 3px 0 0 var(--g-brand); }
.rf-cell-sub { font-size: 11px; color: var(--g-text-faint); margin-top: 2px; }
.rf-mono { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--g-text); }

/* Botão com gradiente de IA */
.rf-btn--ia { background: var(--g-ai-grad); color: #fff; border-color: transparent; }
.rf-btn--ia:hover { filter: brightness(1.05); color: #fff; }
.rf-act--ia .rf-actions-pop__hint { margin: 0 0 8px; }

/* Barra de ações em lote (sticky no rodapé do card) */
.rf-bulkbar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--g-border); background: var(--g-surface); box-shadow: 0 -4px 14px rgba(0,0,0,.06); opacity: .55; transition: opacity .15s ease; }
.rf-bulkbar.is-active { opacity: 1; }
.rf-bulkbar__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rf-bulkbar__count { font-size: 13px; font-weight: 600; color: var(--g-text); }
.rf-bulkbar__count b { color: var(--g-brand); font-size: 15px; }
.rf-bulkbar__hint { font-size: 11.5px; color: var(--g-text-faint); display: inline-flex; align-items: center; gap: 6px; }
.rf-bulkbar__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rf-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.rf-dot--warn { background: var(--g-warn); }

/* Página de progresso do lote */
.rf-lote-progress { margin-bottom: 14px; }
.rf-lote-progress__bar { height: 12px; border-radius: 999px; background: var(--g-surface-2); border: 1px solid var(--g-border); overflow: hidden; }
.rf-lote-progress__bar span { display: block; height: 100%; background: var(--g-ai-grad); border-radius: 999px; transition: width .3s ease; }
.rf-lote-progress__label { margin-top: 6px; font-size: 12px; color: var(--g-text-soft); font-variant-numeric: tabular-nums; }
.rf-lote-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.rf-lote-stat { padding: 6px 12px; border-radius: var(--g-radius); background: var(--g-surface-2); border: 1px solid var(--g-border); font-size: 13px; color: var(--g-text-soft); }
.rf-lote-stat b { color: var(--g-text); font-size: 15px; margin-right: 3px; }
.rf-lote-stat--ok b { color: var(--g-ok); }
.rf-lote-stat--err b { color: var(--g-danger); }

@media (max-width: 640px) {
  .rf-bulkbar { flex-direction: column; align-items: stretch; }
  .rf-bulkbar__actions { justify-content: space-between; }
}
