/* ============================================================
   Diárias — Design System CSS
   GOV.BR DS · adaptado CGE-RJ
   Doc 01 (Direção de Design) + Doc 02 (Módulos Operacionais)
   ============================================================ */

/* ============================================================
   1. TOKENS GOV.BR DS
   ============================================================ */
:root {
  /* Branco puro */
  --pure-0: #ffffff;

  /* Azuis institucionais */
  --blue-5: #e6eef9;
  --blue-10: #c5d4eb;
  --blue-20: #5992ed;
  --blue-30: #93c5fd;
  --blue-50: #2670e8;
  --blue-70: #1351b4;
  /* PRIMARY */
  --blue-80: #0c326f;
  --blue-90: #071d41;
  /* DARK — sidebar/header */

  /* Cinzas neutros */
  --gray-1: #f8f8f8;
  --gray-2: #ededed;
  --gray-3: #dedede;
  --gray-4: #cccccc;
  --gray-5: #9e9d9d;
  --gray-6: #888888;
  --gray-7: #555555;
  --gray-8: #333333;
  --gray-9: #1c1c1c;

  /* Status semântico */
  --green-50: #168821;
  --green-10: #e3f5e1;
  --yellow-50: #ffcd07;
  --yellow-10: #fff5c2;
  --orange-50: #a26b00;
  --orange-10: #fdf2da;
  --red-50: #e52207;
  --red-10: #fde0db;
  --gray-status: #71757a;

  /* Tipografia */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* Espaçamento (base 8 px) */
  --sp-half: 4px;
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;
  --sp-8: 64px;

  /* Raio */
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 6px;
  --r-pill: 999px;

  /* Sombras */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .06);
  --sh-2: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  --sh-3: 0 4px 12px rgba(7, 29, 65, .10);

  /* Chrome */
  --side-width: 280px;
  --header-h: 56px;
  --bar-total-h: 12px;

  /* Aliases de compatibilidade com tokens.css */
  --color-primary: var(--blue-70);
  --color-primary-700: var(--blue-80);
  --color-primary-foreground: #fff;
  --color-border: var(--gray-3);
  --color-background: #fff;
  --color-foreground: var(--gray-9);
  --color-muted-foreground: var(--gray-6);
  --color-bg: var(--gray-1);
  --color-brand: var(--blue-90);
  --radius: 4px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --shadow-sm: var(--sh-1);
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 14px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
}

/* ============================================================
   2. BASE
   ============================================================ */
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--gray-8);
  background: var(--gray-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue-70);
  text-underline-offset: 3px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue-70);
  font-weight: 500;
}

.muted {
  color: var(--gray-7);
}

.dim {
  color: var(--gray-6);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* ============================================================
   3. APP CHROME — faixas institucionais
   ============================================================ */
body.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gray-1);
}

.app-bar {
  height: 8px;
  background: var(--blue-90);
  flex-shrink: 0;
}

.app-bar.yellow {
  height: 4px;
  background: var(--yellow-50);
  flex-shrink: 0;
}

/* ── App progress bar (loading) ───────────────────────
     Inspirado no padrão Gov.br — barra fina no topo
     com progressão suave e feedback de estado.
     Usada internamente via window.AppProgress.         */
.app-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--blue-50);
  z-index: 99999;
  opacity: 0;
  transition: width .35s cubic-bezier(.4, 0, .2, 1),
              opacity .25s ease,
              background .3s ease;
  box-shadow: 0 0 8px rgba(38, 112, 232, .35);
  pointer-events: none;
}

.app-progress.active {
  opacity: 1;
}

.app-progress.error {
  background: var(--red-50);
  box-shadow: 0 0 8px rgba(229, 34, 7, .35);
}

/* ============================================================
   4. APP HEADER
   ============================================================ */
.app-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-3);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: var(--sh-1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--blue-90);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  flex-shrink: 0;
  user-select: none;
}

.brand-name {
  font-weight: 600;
  color: var(--gray-9);
  font-size: 15px;
  letter-spacing: .01em;
  line-height: 1.2;
}

.brand-name small {
  display: block;
  font-size: 11px;
  color: var(--gray-6);
  font-weight: 400;
  letter-spacing: 0;
}

.app-header .breadcrumbs {
  flex: 1;
  font-size: 13px;
  color: var(--gray-6);
  display: flex;
  gap: 8px;
  align-items: center;
  padding-left: var(--sp-3);
  margin-left: var(--sp-2);
  border-left: 1px solid var(--gray-3);
  overflow: hidden;
}

.app-header .breadcrumbs a {
  color: var(--gray-7);
  text-decoration: none;
}

.app-header .breadcrumbs a:hover {
  color: var(--blue-70);
}

.app-header .breadcrumbs .sep {
  color: var(--gray-4);
  flex-shrink: 0;
}

.app-header .breadcrumbs .current {
  color: var(--gray-9);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.search-global {
  position: relative;
  width: 300px;
}

.search-global .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-5);
  font-size: 14px;
  pointer-events: none;
}

.search-global input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 30px;
  font-family: var(--font-sans);
  font-size: 13px;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  background: var(--gray-1);
  color: var(--gray-8);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.search-global input:focus {
  border-color: var(--blue-70);
  box-shadow: 0 0 0 3px var(--blue-5);
  background: #fff;
}

/* ── Search dropdown ─────────────────────────── */
.gsearch-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  z-index: 9200;
  max-height: 420px;
  overflow-y: auto;
  font-size: 13px;
}
.gsearch-hd {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-5);
}
.gsearch-grp-hd {
  padding: 4px 12px 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-70);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.gsearch-item {
  display: block;
  padding: 7px 12px;
  text-decoration: none;
  color: var(--gray-8);
  transition: background .1s;
}
.gsearch-item:hover {
  background: var(--blue-5);
}
.gsearch-item-title {
  font-weight: 600;
  font-size: 13px;
}
.gsearch-item-sub {
  font-size: 11.5px;
  color: var(--gray-5);
  margin-top: 1px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-7);
  border: 0;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--gray-2);
  color: var(--gray-9);
}

.notif {
  position: relative;
}

.notif .badge-count {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: var(--red-50);
  border-radius: 8px;
  border: 1.5px solid #fff;
}

.sep-v {
  width: 1px;
  height: 24px;
  background: var(--gray-3);
  margin: 0 2px;
  flex-shrink: 0;
}

/* --- User button --- */
.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 0;
  border-radius: 100px;
  transition: background .14s ease;
}

.user:hover {
  background: var(--gray-2);
}

.user[aria-expanded="true"] {
  background: var(--gray-2);
}

.user[aria-expanded="true"] .chev {
  transform: rotate(180deg);
  color: var(--blue-70);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-70);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  flex-shrink: 0;
  user-select: none;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: left;
}

.user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-9);
}

.user-info .role {
  font-size: 11px;
  color: var(--gray-6);
}

.chev {
  color: var(--gray-5);
  font-size: 11px;
  margin-left: 2px;
  display: inline-block;
  transition: transform .14s ease, color .14s ease;
}

/* --- User menu dropdown --- */
.um-scrim {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: transparent;
}

.user-menu {
  position: fixed;
  width: 288px;
  background: var(--pure-0);
  border: 1px solid var(--gray-3);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 8px rgba(7, 29, 65, .08), 0 16px 40px rgba(7, 29, 65, .14);
  z-index: 100;
  font-size: 13px;
  color: var(--gray-8);
  overflow: hidden;
  transform-origin: top right;
  animation: um-in .14s cubic-bezier(.16, .84, .44, 1) both;
}

@keyframes um-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(.985);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.user-menu[hidden] {
  display: none;
}

.um-head {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px 12px;
  background: var(--pure-0);
  border-bottom: 1px solid var(--gray-2);
}

.um-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-70);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  position: relative;
}

.um-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green-50);
  border: 2px solid var(--pure-0);
}

.um-id {
  min-width: 0;
}

.um-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-9);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.um-role {
  font-size: 11.5px;
  color: var(--gray-6);
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.um-cpf {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--gray-6);
  margin-top: 4px;
  letter-spacing: .02em;
}

.um-section {
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-2);
}

.um-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 16px;
  border: 0;
  color: var(--gray-8);
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  transition: background .12s, color .12s;
}

.um-item:hover,
.um-item:focus-visible {
  background: var(--gray-2);
  color: var(--gray-9);
  outline: 0;
}

.um-item:focus-visible {
  box-shadow: inset 3px 0 0 var(--blue-70);
}

.um-ic {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-6);
  flex-shrink: 0;
}

.um-ic svg {
  width: 16px;
  height: 16px;
}

.um-item:hover .um-ic {
  color: var(--blue-70);
}

.um-item-lb {
  flex: 1;
  line-height: 1.3;
}

.um-item-meta {
  font-size: 11px;
  color: var(--gray-6);
  font-family: var(--font-mono);
}

.um-item-badge {
  background: var(--red-50);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.um-foot {
  padding: 12px 16px 14px;
  background: var(--gray-1);
  border-top: 1px solid var(--gray-2);
}

.um-session {
  font-size: 11px;
  color: var(--gray-6);
  line-height: 1.5;
  margin-bottom: 10px;
}

.um-session b {
  color: var(--gray-8);
  font-weight: 500;
}

.um-session .um-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--gray-4);
  border-radius: 50%;
  margin: 0 6px;
  vertical-align: middle;
}

.um-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--pure-0);
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  color: var(--red-50);
  font-size: 13px;
  font-weight: 500;
  transition: background .14s, border-color .14s, color .14s;
}

.um-logout:hover {
  background: var(--red-50);
  color: #fff;
  border-color: var(--red-50);
}

.um-logout:hover .um-ic {
  color: #fff;
}

/* --- Logout confirm dialog --- */
.umd-scrim {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(7, 29, 65, .42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: umd-fade .14s ease both;
}

@keyframes umd-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.umd-dialog {
  width: 440px;
  max-width: calc(100vw - 32px);
  background: var(--pure-0);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(7, 29, 65, .25);
  overflow: hidden;
  animation: umd-pop .18s cubic-bezier(.16, .84, .44, 1) both;
}

@keyframes umd-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.umd-head {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--gray-2);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.umd-ic-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red-10);
  color: var(--red-50);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.umd-ic-wrap svg {
  width: 18px;
  height: 18px;
}

.umd-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-9);
  letter-spacing: -.01em;
}

.umd-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--gray-7);
  line-height: 1.5;
}

.umd-body {
  padding: 16px 24px;
  background: var(--gray-1);
  font-size: 12px;
  color: var(--gray-7);
}

.umd-body dl {
  margin: 0;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 12px;
}

.umd-body dt {
  color: var(--gray-6);
  font-size: 11.5px;
}

.umd-body dd {
  margin: 0;
  color: var(--gray-8);
  font-weight: 500;
}

.umd-body dd.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.umd-foot {
  padding: 14px 24px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.umd-foot .umd-spacer {
  flex: 1;
}

.umd-fineprint {
  font-size: 11px;
  color: var(--gray-6);
}

.umd-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .14s, border-color .14s, color .14s;
}

.umd-btn-secondary {
  background: transparent;
  border-color: var(--blue-70);
  color: var(--blue-70);
}

.umd-btn-secondary:hover {
  background: var(--blue-5);
}

.umd-btn-danger {
  background: var(--red-50);
  border-color: var(--red-50);
  color: #fff;
}

.umd-btn-danger:hover {
  background: #c91c00;
  border-color: #c91c00;
}

.umd-btn-danger svg {
  width: 14px;
  height: 14px;
}

/* --- Notificação dropdown --- */
.notif-menu {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 16px);
  max-height: 480px;
  background: var(--pure-0);
  border: 1px solid var(--gray-3);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 8px rgba(7, 29, 65, .08), 0 16px 40px rgba(7, 29, 65, .14);
  z-index: 100;
  font-size: 13px;
  color: var(--gray-8);
  overflow: hidden;
  transform-origin: top right;
  animation: um-in .14s cubic-bezier(.16, .84, .44, 1) both;
}

.notif-menu[hidden] { display: none; }

.nm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-2);
  background: var(--pure-0);
}

.nm-head-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-9);
}

.nm-mark-btn {
  background: none;
  border: 0;
  font-size: 12px;
  color: var(--blue-70);
  cursor: pointer;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 4px;
}

.nm-mark-btn:hover { background: var(--blue-5); text-decoration: underline; }

.nm-list {
  overflow-y: auto;
  max-height: 360px;
}

.nm-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--gray-2);
  align-items: start;
}

.nm-item:last-child { border-bottom: 0; }

.nm-item:hover { background: var(--blue-5); }

.nm-item.unread { background: var(--blue-5); }

.nm-item.unread:hover { background: var(--blue-10); }

.nm-body { min-width: 0; }

.nm-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-9);
  line-height: 1.4;
}

.nm-item.unread .nm-title { font-weight: 600; }

.nm-msg {
  font-size: 12px;
  color: var(--gray-7);
  margin-top: 2px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nm-time {
  font-size: 11px;
  color: var(--gray-6);
  margin-top: 3px;
}

.nm-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--gray-6);
  font-size: 13px;
}

.nm-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--gray-2);
  text-align: center;
}

.nm-foot a {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-70);
  text-decoration: none;
}

.nm-foot a:hover { text-decoration: underline; }

/* Severity dots */
.nm-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.nm-dot--info    { background: var(--blue-70); }
.nm-dot--success { background: var(--green-50); }
.nm-dot--warning { background: var(--yellow-50); }
.nm-dot--danger  { background: var(--red-50); }

/* --- Toast --- */
.um-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  background: var(--gray-9);
  color: #fff;
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
  animation: umt-in .18s ease both;
}

@keyframes umt-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.um-toast .um-ic {
  color: var(--green-50);
  width: 14px;
  height: 14px;
}

/* ============================================================
   5. APP BODY + SIDEBAR
   ============================================================ */
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-side {
  width: var(--side-width);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--gray-3);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) transparent;
  z-index: 10;
}

/* ── Accordion sections ─────────────────────────────────────── */
.side-section-group {
  border-top: 1px solid var(--gray-2);
}
.side-section-group:first-child {
  border-top: none;
}

.side-section {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-500, #6b7280);
  background: none;
  border: 0;
  padding: 10px var(--sp-2) 10px;
  margin: 0;
  cursor: pointer;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  transition: color .15s ease;
}
.side-section:hover {
  color: var(--gray-700, #374151);
}
.side-section .lb {
  flex: 1;
}
.side-section .sg-chev {
  width: 14px;
  height: 14px;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.side-section .sg-chev svg {
  width: 100%;
  height: 100%;
}
.side-section.expanded .sg-chev {
  transform: rotate(90deg);
}
/* Badge inside section header */
.side-section .badge-side {
  font-size: 10px;
  padding: 1px 5px;
  margin-left: auto;
}

.side-section-items {
  display: flex;
  flex-direction: column;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .25s ease, opacity .18s ease;
}
.side-section-group:has(.side-section.expanded) > .side-section-items {
  max-height: 500px;
  opacity: 1;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--sp-2);
  font-size: 14px;
  color: var(--gray-8);
  text-decoration: none;
  border-left: 4px solid transparent;
  transition: background .12s;
  cursor: pointer;
}

.side-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--gray-9);
}

.side-item.active {
  background: var(--blue-5);
  border-left-color: var(--blue-70);
  color: var(--blue-70);
  font-weight: 600;
}

.side-item .ic {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-5);
  flex-shrink: 0;
}

.side-item .ic svg {
  width: 18px;
  height: 18px;
  display: block;
}

.side-item:hover .ic {
  color: var(--gray-7);
}

.side-item:hover .sg-chev {
  color: var(--gray-7);
}

.side-item.active .ic {
  color: var(--blue-70);
}

.side-item.active .sg-chev {
  color: var(--blue-70);
}

.side-item .lb {
  flex: 1;
}

/* ── Sidebar submenu groups ──────────────────────── */
.side-group-trigger {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.sg-chev {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--gray-5);
  transition: transform .18s ease;
  line-height: 0;
}

.sg-chev svg {
  width: 14px;
  height: 14px;
  display: block;
}

.side-group.expanded .sg-chev {
  transform: rotate(90deg);
}

.side-group-items {
  display: flex;
  flex-direction: column;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .25s ease, opacity .18s ease;
}

.side-group.expanded .side-group-items {
  max-height: 300px;
  opacity: 1;
}

.side-sub {
  padding-left: 34px !important;
  font-size: 13px !important;
}

.side-sub .ic {
  width: 16px !important;
  height: 16px !important;
}

.side-sub .ic svg {
  width: 14px !important;
  height: 14px !important;
}

/* Collapsed: grupo se comporta como item único */
body.side-collapsed .side-group {
  display: flex;
  justify-content: center;
  margin: 2px 4px;
}

body.side-collapsed .side-group .side-group-trigger {
  width: auto;
  padding: 10px;
  margin: 0;
  border-left: 4px solid transparent;
  border-radius: var(--r-md);
}

body.side-collapsed .side-group .side-group-trigger.active {
  border-left-color: var(--blue-70);
}

body.side-collapsed .sg-chev,
body.side-collapsed .side-group-items {
  display: none;
}

/* Dropdown flutuante para sidebar colapsada */
.side-group-dropdown {
  display: none;
  position: fixed;
  left: 56px;
  top: auto;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 4px 0;
  z-index: 8000;
}
.side-group-dropdown.open {
  display: block;
}
.side-group-dropdown .side-sub {
  padding: 8px 14px;
  border-radius: 0;
  justify-content: flex-start;
}
.side-group-dropdown .side-sub:hover {
  background: var(--blue-10);
}
.side-group-dropdown .side-sub.active {
  background: var(--blue-10);
  color: var(--blue-70);
  font-weight: 600;
}
/* Garante que labels no dropdown fiquem visíveis mesmo com sidebar colapsada */
body.side-collapsed .side-group-dropdown .side-item .lb {
  display: inline;
}

.badge-side {
  background: var(--red-50);
  color: #fff;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

.badge-side.ok {
  background: var(--blue-70);
}

.badge-side.warn {
  background: var(--orange-50);
}

.side-foot {
  margin-top: auto;
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--gray-2);
}

.env {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.env-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--orange-50);
  font-weight: 600;
}

.env-v {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-6);
}

/* ══ Sidebar recolhida ══════════════════════════════════════════════
   Dois níveis: sidebar colapsada (body.side-collapsed) e accordion
   de seções. Quando a sidebar colapsa, TODOS os itens devem aparecer
   como ícones, ignorando o estado do accordion.
   ═══════════════════════════════════════════════════════════════════ */

body.side-collapsed .app-side {
  width: 56px;
}

/* 1) Esconder cabeçalhos de seção, labels, badges, info de ambiente */
body.side-collapsed .side-section,
body.side-collapsed .side-item .lb,
body.side-collapsed .badge-side,
body.side-collapsed .env-v,
body.side-collapsed .env-tag {
  display: none;
}

/* 2) Forçar container dos itens totalmente aberto, sem transição */
body.side-collapsed .side-section-items {
  max-height: none;
  opacity: 1;
  overflow: visible;
  transition: none;
}

/* 3) Itens como ícones centralizados */
body.side-collapsed .side-item {
  justify-content: center;
  padding: 10px;
  border-left: 4px solid transparent;
  border-radius: var(--r-md);
  margin: 2px 4px;
}

body.side-collapsed .side-item.active {
  border-left-color: var(--blue-70);
}

/* 4) Rodapé compacto */
body.side-collapsed .side-foot {
  padding: var(--sp-2) 6px;
}

/* ============================================================
   6. MAIN CONTENT
   ============================================================ */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
}

.view {
  padding: var(--sp-4);
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
}

.page-head h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--gray-9);
  letter-spacing: -.015em;
  line-height: 1.15;
  margin: 4px 0 0;
}

.page-head .sub {
  font-size: 13px;
  color: var(--gray-6);
  margin-top: 4px;
}

.page-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  padding-top: 4px;
}

/* ============================================================
   7. BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--blue-70);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-80);
}

.btn-secondary {
  background: transparent;
  color: var(--blue-70);
  border-color: var(--blue-70);
}

.btn-secondary:hover {
  background: var(--blue-5);
}

.btn-tertiary {
  background: transparent;
  color: var(--gray-7);
  border-color: transparent;
}

.btn-tertiary:hover {
  background: var(--gray-2);
  color: var(--gray-9);
}

.btn-danger {
  background: var(--red-50);
  color: #fff;
  border-color: var(--red-50);
}

.btn-danger:hover {
  background: #c01b05;
}

.btn-sm {
  padding: 5px 14px;
  font-size: 13px;
}

.btn-md {
  padding: 8px 18px;
  font-size: 14px;
}

.btn-lg {
  padding: 11px 24px;
  font-size: 15px;
}

.w-full {
  width: 100%;
}

/* ============================================================
   8. ALERTAS
   ============================================================ */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
  background: #fff;
  margin-bottom: var(--sp-3);
}

.alert-tight {
  padding: 10px 14px;
  font-size: 13px;
}

.alert-ic {
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-top: 1px;
}

.alert-body {
  flex: 1;
}

.alert-body b {
  display: block;
  color: var(--gray-9);
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-action {
  font-size: 13px;
  color: var(--blue-70);
  text-decoration: none;
  white-space: nowrap;
  align-self: center;
  font-weight: 500;
}

.alert-action:hover {
  text-decoration: underline;
}

.alert.warn {
  border-color: #f0d97a;
  border-left-color: #c79900;
  background: var(--yellow-10);
}

.alert.warn .alert-ic {
  background: #c79900;
}

.alert.info {
  border-color: var(--blue-10);
  border-left-color: var(--blue-70);
  background: var(--blue-5);
}

.alert.info .alert-ic {
  background: var(--blue-70);
}

.alert.success {
  border-color: #c5e7c2;
  border-left-color: var(--green-50);
  background: var(--green-10);
}

.alert.success .alert-ic {
  background: var(--green-50);
}

.alert.danger {
  border-color: #f5c0b6;
  border-left-color: var(--red-50);
  background: var(--red-10);
}

.alert.danger .alert-ic {
  background: var(--red-50);
}

/* Compat: classes antigas usadas na tela de auth */
.alert-error {
  background: var(--red-10);
  border: 1px solid #f5c0b6;
  border-left: 4px solid var(--red-50);
  color: #8a1a00;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
}

.alert-success {
  background: var(--green-10);
  border: 1px solid #c5e7c2;
  border-left: 4px solid var(--green-50);
  color: #0c5a17;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
}

.alert-info {
  background: var(--blue-5);
  border: 1px solid var(--blue-10);
  border-left: 4px solid var(--blue-70);
  color: var(--blue-80);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
}

/* ============================================================
   9. KPI CARDS
   ============================================================ */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.kpi {
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi.kpi-muted {
  background: var(--gray-1);
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gray-6);
  line-height: 1.4;
}

.kpi-label em {
  font-style: normal;
  color: var(--gray-8);
}

.kpi-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--gray-9);
  letter-spacing: -.02em;
  line-height: 1;
}

.kpi-trend {
  font-size: 12.5px;
  color: var(--gray-7);
}

.kpi-trend.down {
  color: var(--red-50);
}

.kpi-trend.up {
  color: var(--green-50);
}

.kpi-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  flex-wrap: wrap;
}

.kpi-tag {
  font-size: 11.5px;
  color: var(--gray-7);
  background: var(--gray-2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

.kpi-tag.kpi-tag-danger {
  background: var(--red-10);
  color: #8a1a00;
}

.kpi-tag.kpi-tag-warn {
  background: var(--yellow-10);
  color: #6b4f00;
}

.kpi-tag.kpi-tag-info {
  background: var(--blue-5);
  color: var(--blue-80);
  font-size: 11px;
}

.kpi-link {
  font-size: 12.5px;
  color: var(--blue-70);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.kpi-link:hover {
  text-decoration: underline;
}

/* ============================================================
   10. LAYOUT
   ============================================================ */
.grid-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start;
  padding-bottom: 48px;
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ============================================================
   11. CARD (PANEL)
   ============================================================ */
.card {
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  overflow: hidden;
}

.card-bordered-top {
  border-top: 3px solid var(--blue-70);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--gray-2);
}

.card-head h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-9);
  margin: 0;
}

.card-sub {
  font-size: 12.5px;
  color: var(--gray-6);
  margin: 2px 0 0;
}

.card-link {
  font-size: 12.5px;
  color: var(--blue-70);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
  align-self: center;
}

.card-link:hover {
  text-decoration: underline;
}

.card-body {
  padding: var(--sp-3);
}

.card-body.p-0 {
  padding: 0;
}

/* Auth card (compat) */
.card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--sp-3);
  text-align: center;
}

.card-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  color: var(--gray-9);
}

.card-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--gray-6);
}

/* ============================================================
   12. BADGES DE STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.bd-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bd-success {
  background: var(--green-10);
  color: #0c5a17;
  border-color: #c5e7c2;
}

.bd-success .bd-dot {
  background: var(--green-50);
}

.bd-warning {
  background: var(--yellow-10);
  color: #6b4f00;
  border-color: #f0d97a;
}

.bd-warning .bd-dot {
  background: #c79900;
}

.bd-info {
  background: var(--blue-5);
  color: var(--blue-80);
  border-color: var(--blue-10);
}

.bd-info .bd-dot {
  background: var(--blue-70);
}

.bd-danger {
  background: var(--red-10);
  color: #8a1a00;
  border-color: #f5c0b6;
}

.bd-danger .bd-dot {
  background: var(--red-50);
}

.bd-neutral {
  background: var(--gray-2);
  color: var(--gray-7);
  border-color: var(--gray-3);
}

.bd-neutral .bd-dot {
  background: var(--gray-status);
}

.bd-progress {
  background: #fff;
  color: var(--orange-50);
  border-color: #e6c896;
}

.bd-progress .bd-dot {
  background: var(--orange-50);
}

/* ============================================================
   13. TABELAS
   ============================================================ */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: #fff;
}

.tbl thead th {
  background: #fff;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--gray-7);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--gray-3);
  white-space: nowrap;
}

.tbl thead th.num {
  text-align: right;
}

.tbl thead th.action {
  text-align: center;
  width: 90px;
}

.tbl tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-2);
  vertical-align: middle;
  color: var(--gray-8);
}

.tbl tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tbl tbody td.action {
  text-align: center;
}

.tbl tbody td.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--blue-70);
}

.tbl tbody td.mono a {
  color: var(--blue-70);
  text-decoration: none;
  font-weight: 500;
}

.tbl tbody td.mono a:hover {
  text-decoration: underline;
}

.tbl tbody tr:hover {
  background: var(--gray-1);
}

.tbl tbody tr:last-child td {
  border-bottom: 0;
}

.tbl.tbl-compact thead th {
  padding: 7px 12px;
}

.tbl.tbl-compact tbody td {
  padding: 7px 12px;
  font-size: 13px;
}

.warn-row {
  background: #fffef5 !important;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-xs {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue-5);
  color: var(--blue-80);
  font-size: 9.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

.cell-name {
  display: block;
  font-size: 13.5px;
  color: var(--gray-9);
  font-weight: 500;
}

.cell-sub {
  display: block;
  font-size: 11.5px;
  color: var(--gray-6);
}

.cell-strong {
  display: block;
  font-weight: 500;
  color: var(--gray-9);
}

.time-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--gray-2);
  color: var(--gray-7);
  white-space: nowrap;
}

.time-pill.warn {
  background: var(--yellow-10);
  color: #6b4f00;
}

.time-pill.danger {
  background: var(--red-10);
  color: #8a1a00;
}

.btn-mini {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--gray-7);
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}

.btn-mini:hover {
  background: var(--gray-2);
}

.btn-mini.ok {
  border-color: var(--green-50);
  color: var(--green-50);
}

.btn-mini.ok:hover {
  background: var(--green-10);
}

.btn-mini.no {
  border-color: var(--red-50);
  color: var(--red-50);
}

.btn-mini.no:hover {
  background: var(--red-10);
}

.next {
  font-size: 12.5px;
  color: var(--gray-7);
}

.next.dim {
  color: var(--gray-5);
}

.next small {
  color: var(--gray-5);
}

.mono-link {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--blue-70);
  text-decoration: none;
  font-weight: 500;
}

.mono-link:hover {
  text-decoration: underline;
}

/* ============================================================
   14. ATALHOS
   ============================================================ */
ul.shortcuts,
.shortcuts ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shortcuts li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-2);
  text-decoration: none;
  color: var(--gray-8);
  font-size: 13.5px;
  transition: color .12s;
}

.shortcuts li:last-child a {
  border-bottom: 0;
}

.shortcuts li a:hover {
  color: var(--blue-70);
}

.sc-ic {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: var(--blue-5);
  color: var(--blue-70);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.shortcuts small {
  font-size: 11.5px;
  color: var(--gray-6);
  display: block;
  margin-top: 1px;
}

/* ============================================================
   15. MINI TIMELINE
   ============================================================ */
.tl-mini {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tl-mini li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 16px;
  position: relative;
}

.tl-mini li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-3);
}

.tl-mini li.tl-done::before {
  background: var(--green-50);
}

.tl-mini li.tl-info::before {
  background: var(--blue-70);
}

.tl-when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-6);
}

.tl-what {
  font-size: 13px;
  color: var(--gray-9);
  font-weight: 500;
}

.tl-who {
  font-size: 12px;
  color: var(--gray-6);
}

/* ============================================================
   16. AVISOS
   ============================================================ */
.notices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.notices li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-2);
}

.notices li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.notice-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-6);
  flex-shrink: 0;
  padding-top: 2px;
  min-width: 32px;
}

.notices b {
  font-size: 13.5px;
  color: var(--gray-9);
  font-weight: 600;
  display: block;
}

.notices p {
  font-size: 12.5px;
  color: var(--gray-7);
  margin: 3px 0 0;
  line-height: 1.5;
}

/* ============================================================
   17. COMPAT — Auth page + utilitários
   ============================================================ */
.auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--gray-1);
}

.diarias-wordmark {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--blue-90);
  letter-spacing: -1px;
  line-height: 1;
}

.diarias-wordmark--lg {
  font-size: 56px;
  letter-spacing: -3px;
}

.diarias-wordmark--md {
  font-size: 22px;
}

.diarias-wordmark--sm {
  font-size: 18px;
}

.space-y-6 {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.space-y-2 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-center {
  text-align: center;
}

.text-xs {
  font-size: 11.5px;
  color: var(--gray-6);
}

.mt-8 {
  margin-top: 32px;
}

/* Input / label genéricos (components/input + label) */
.input {
  height: 38px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  border: 1px solid var(--gray-4);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--gray-9);
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus {
  border-color: var(--blue-70);
  box-shadow: 0 0 0 3px var(--blue-5);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
textarea,
select {
  font-family: var(--font-sans);
}

.input-field,
input.input-field {
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
  border: 1px solid var(--gray-4);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--gray-9);
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

.input-field:focus {
  border-color: var(--blue-70);
  box-shadow: 0 0 0 3px var(--blue-5);
}

/* ============================================================
   18. RESPONSIVIDADE
   ============================================================ */
@media (max-width: 1280px) {
  :root {
    --side-width: 260px;
  }

  .search-global {
    width: 240px;
  }
}

@media (max-width: 991px) {
  .app-header {
    padding: 0 var(--sp-2);
    gap: var(--sp-2);
  }

  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2-1 {
    grid-template-columns: 1fr;
  }

  .search-global {
    width: 180px;
  }
}

@media (max-width: 768px) {
  .app-side {
    position: fixed;
    left: calc(-1 * var(--side-width) - 10px);
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    z-index: 200;
    transition: left .22s ease;
    box-shadow: var(--sh-3);
    width: var(--side-width) !important;
  }

  .app-side.mobile-open {
    left: 0;
  }

  body.side-collapsed .app-side {
    left: calc(-1 * var(--side-width) - 10px);
  }

  .card {
    overflow: visible;
  }
  .card-body.p-0 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .card-body.p-0 .tbl {
    width: auto;
    min-width: 100%;
  }

  .search-global {
    display: none;
  }

  .brand-name small {
    display: none;
  }

  .user-info .role {
    display: none;
  }

  .kpis {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── SelectSearch ───────────────────────────────────────── */
.ss {
  position: relative;
  width: 100%;
}

.ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 12px;
  height: 40px;
  background: var(--pure-0);
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 14px;
  color: var(--gray-8);
  cursor: pointer;
  text-align: left;
  gap: 8px;
}

.ss-trigger-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.ss-trigger::after {
  content: '';
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--gray-5);
  transition: transform .15s;
}

.ss.open .ss-trigger::after {
  transform: rotate(180deg);
}

.ss-trigger.placeholder {
  color: var(--gray-5);
}

.ss-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--pure-0);
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
}

.ss.open .ss-dropdown {
  display: flex;
  flex-direction: column;
}

.ss-search {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--gray-2);
  font: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.ss-search:focus {
  background: var(--gray-1);
}

.ss-opts {
}

.ss-opt {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--gray-8);
}

.ss-opt:hover,
.ss-opt:focus {
  background: var(--blue-5);
  outline: none;
}

.ss-opt:first-child {
  color: var(--gray-5);
}

@media (max-width: 576px) {
  .app-header {
    padding: 0 var(--sp-1);
    gap: var(--sp-1);
  }

  .app-header .breadcrumbs {
    padding-left: var(--sp-1);
    margin-left: var(--sp-1);
    gap: 4px;
    font-size: 12px;
  }

  .app-header .breadcrumbs a:not(.current) {
    display: none;
  }
  .app-header .breadcrumbs .sep {
    display: none;
  }

  .user {
    padding: 4px 4px 4px 4px;
  }

  .user-info {
    display: none;
  }

  .chev {
    display: none;
  }

  .header-actions .btn-icon:not(.user):not(.notif) {
    display: none;
  }

  .header-actions .sep-v {
    display: none;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  .view {
    padding: var(--sp-2);
  }

  .page-head {
    flex-direction: column;
  }

  .page-head-actions {
    padding-top: 0;
  }

  /* ── Dashboard: card-head empilhado ────────────── */
  .card-head {
    flex-direction: column;
    gap: 6px;
  }
  .card-link {
    align-self: flex-start;
  }

  /* ── Dashboard: tabelas viram cards ────────────── */
  .card-body.p-0 {
    overflow-x: visible;
  }

  .tbl.tbl-compact thead {
    display: none;
  }

  .tbl.tbl-compact tbody tr {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-2);
    gap: 6px;
  }

  .tbl.tbl-compact tbody tr:last-child {
    border-bottom: 0;
  }

  .tbl.tbl-compact tbody tr td[colspan] {
    display: block;
    padding: 14px;
    text-align: center;
  }

  .tbl.tbl-compact tbody td {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 0;
    border: 0;
    font-size: 13px;
  }

  .tbl.tbl-compact tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--gray-6);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 80px;
    flex-shrink: 0;
  }

  .tbl.tbl-compact tbody td.num {
    text-align: left;
    justify-content: flex-start;
  }

  .tbl.tbl-compact tbody td.action {
    text-align: left;
    justify-content: flex-start;
    gap: 6px;
  }

  .tbl.tbl-compact tbody td.mono {
    font-size: 13px;
  }

  .tbl.tbl-compact tbody td .cell-user {
    flex: 1;
  }

  .tbl.tbl-compact tbody tr:hover {
    background: transparent;
  }

  /* ── Dashboard: shortcuts mais compactos ────────── */
  .shortcuts li a {
    padding: 7px 0;
    font-size: 13px;
  }
}

/* ============================================================
   19. ACOMPANHAMENTO — Detalhe da solicitação
   ============================================================ */

/* ── Back link ────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-7);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: var(--sp-3);
  transition: color .12s;
}
.back-link svg { width: 14px; height: 14px; }
.back-link:hover { color: var(--blue-70); }

/* ── Detail DL ────────────────────────────────────── */
.detail-dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 32px;
}
.detail-dl > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.detail-dl dt {
  font-size: 10.5px;
  color: var(--gray-5);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--font-mono);
  font-weight: 500;
}
.detail-dl dd {
  font-size: 13.5px;
  color: var(--gray-9);
  margin: 0;
}
.detail-dl dd.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--blue-70); }
.detail-cost { font-size: 18px !important; font-weight: 700 !important; color: var(--blue-70) !important; letter-spacing: -.01em; }
.detail-dl-span { grid-column: span 2; }

/* ── Flow Steps ───────────────────────────────────── */
.flow-steps {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding: 8px 0 4px;
  scrollbar-width: none;
}
.flow-steps::-webkit-scrollbar { display: none; }

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  min-width: 64px;
}
.fs-node {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--gray-3);
  background: #fff;
  color: var(--gray-5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.fs-node svg { width: 13px; height: 13px; }
.fs-done .fs-node  { border-color: var(--green-50); background: var(--green-50); color: #fff; }
.fs-current .fs-node {
  border-color: var(--blue-70);
  background: var(--blue-70);
  color: #fff;
  box-shadow: 0 0 0 4px var(--blue-5);
}
.fs-label {
  font-size: 10.5px;
  color: var(--gray-5);
  text-align: center;
  white-space: nowrap;
  letter-spacing: .01em;
}
.fs-done .fs-label    { color: var(--green-50); font-weight: 500; }
.fs-current .fs-label { color: var(--blue-70);  font-weight: 600; }

.flow-conn {
  flex: 1;
  height: 2px;
  background: var(--gray-3);
  margin-top: 14px;
  min-width: 12px;
}
.flow-conn.fc-done { background: var(--green-50); opacity: .6; }

/* ── Timeline Solicitação ─────────────────────────── */
.tl-sol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.tl-sol-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 22px;
}
.tl-sol-item:last-child { padding-bottom: 0; }

.tl-sol-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background: var(--gray-2);
}
.tl-sol-done:not(:last-child)::before { background: var(--green-10); }
.tl-sol-neg:not(:last-child)::before  { background: var(--red-10);  }

.tl-sol-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--gray-3);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  color: var(--gray-5);
}
.tl-sol-icon svg { width: 13px; height: 13px; }
.tl-sol-done .tl-sol-icon    { border-color: var(--green-50); background: var(--green-10); color: var(--green-50); }
.tl-sol-neg .tl-sol-icon     { border-color: var(--red-50);   background: var(--red-10);   color: var(--red-50); }
.tl-sol-pending .tl-sol-icon { border-color: var(--blue-10);  background: var(--blue-5);   color: var(--blue-70); }

.tl-sol-body { flex: 1; padding-top: 4px; }
.tl-sol-what { font-size: 13.5px; color: var(--gray-9); font-weight: 500; margin: 0 0 2px; }
.tl-sol-when { font-size: 11px; color: var(--gray-6); font-family: var(--font-mono); margin: 0; }

/* ── Resumo financeiro lateral ────────────────────── */
.fin-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--gray-2);
  margin-bottom: var(--sp-1);
}
.fin-label { font-size: 11px; color: var(--gray-6); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-mono); }
.fin-value { font-size: 22px; font-weight: 700; color: var(--blue-70); letter-spacing: -.02em; }

/* ── Attach row ───────────────────────────────────── */
.attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-md);
  background: var(--gray-1);
  color: var(--gray-6);
}
.attach-name {
  flex: 1;
  font-size: 13px;
  color: var(--gray-8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ══════════════════════════════════════════════════════════
   Notificação — badge no sino
   ══════════════════════════════════════════════════════════ */

.btn-icon.notif {
  position: relative;
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red-50);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* Sino balança como pêndulo quando chega notificação */
.btn-icon.notif.bell-ring {
  animation: bell-swing 0.8s ease-in-out 4;
  transform-origin: top center;
}

@keyframes bell-swing {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(7deg); }
  60% { transform: rotate(-5deg); }
  75% { transform: rotate(3deg); }
  90% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .badge-count { animation: none; }
  .btn-icon.notif svg.bell-ring { animation: none; }
}

}
