/* ============================================================
   RESET & DESIGN TOKENS
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --brand:           #2563eb;
  --brand-dark:      #1d4ed8;
  --brand-light:     #eff6ff;
  --brand-glow:      rgba(37, 99, 235, .18);

  /* Backgrounds */
  --bg-app:          #f1f5fb;
  --bg-sidebar:      #0f172a;
  --bg-surface:      #ffffff;
  --bg-raised:       #f8fafc;
  --bg-hover:        #f1f5f9;

  /* Text */
  --tx-primary:      #0f172a;
  --tx-secondary:    #475569;
  --tx-muted:        #94a3b8;
  --tx-brand:        #2563eb;

  /* Borders */
  --bd-subtle:       #e2e8f0;
  --bd-default:      #cbd5e1;
  --bd-strong:       #94a3b8;

  /* Status — Aberto */
  --aberto-bg:       #eff6ff;
  --aberto-bd:       #bfdbfe;
  --aberto-tx:       #1d4ed8;
  --aberto-dot:      #3b82f6;

  /* Status — Em Andamento */
  --andamento-bg:    #fffbeb;
  --andamento-bd:    #fde68a;
  --andamento-tx:    #92400e;
  --andamento-dot:   #f59e0b;

  /* Status — Resolvido */
  --resolvido-bg:    #f0fdf4;
  --resolvido-bd:    #bbf7d0;
  --resolvido-tx:    #166534;
  --resolvido-dot:   #22c55e;

  /* Status — Urgente */
  --urgente-bg:      #fff1f2;
  --urgente-bd:      #fecdd3;
  --urgente-tx:      #be123c;
  --urgente-dot:     #f43f5e;

  /* Priority */
  --alta-bg:         #fff1f2;
  --alta-tx:         #be123c;
  --media-bg:        #fffbeb;
  --media-tx:        #92400e;
  --baixa-bg:        #f0fdf4;
  --baixa-tx:        #166534;

  /* Shadows */
  --shadow-sm:       0 1px 2px rgba(0,0,0,.06);
  --shadow:          0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-md:       0 4px 16px rgba(0,0,0,.1), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg:       0 12px 40px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.08);
  --shadow-brand:    0 4px 20px rgba(37,99,235,.28);

  /* Misc */
  --r-sm:       6px;
  --r:          10px;
  --r-lg:       14px;
  --r-xl:       20px;
  --r-pill:     999px;
  --sidebar-w:  240px;
  --font:       'Plus Jakarta Sans', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;
  --transition: .18s cubic-bezier(.4, 0, .2, 1);
}

/* ---- DARK MODE ---- */
[data-theme="dark"] {
  --bg-app:          #080c14;
  --bg-sidebar:      #05080f;
  --bg-surface:      #111827;
  --bg-raised:       #1a2235;
  --bg-hover:        #1e2a3d;

  --tx-primary:      #f1f5f9;
  --tx-secondary:    #94a3b8;
  --tx-muted:        #475569;
  --tx-brand:        #60a5fa;

  --bd-subtle:       #1e293b;
  --bd-default:      #334155;
  --bd-strong:       #475569;

  --aberto-bg:       #172554;
  --aberto-bd:       #1d4ed8;
  --aberto-tx:       #93c5fd;

  --andamento-bg:    #1c1505;
  --andamento-bd:    #92400e;
  --andamento-tx:    #fcd34d;

  --resolvido-bg:    #052e16;
  --resolvido-bd:    #166534;
  --resolvido-tx:    #86efac;

  --urgente-bg:      #1f0a10;
  --urgente-bd:      #be123c;
  --urgente-tx:      #fda4af;

  --alta-bg:         #1f0a10;
  --alta-tx:         #fda4af;
  --media-bg:        #1c1505;
  --media-tx:        #fcd34d;
  --baixa-bg:        #052e16;
  --baixa-tx:        #86efac;

  --shadow-sm:       0 1px 2px rgba(0,0,0,.3);
  --shadow:          0 1px 3px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.2);
  --shadow-md:       0 4px 16px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.2);
  --shadow-lg:       0 12px 40px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
  --shadow-brand:    0 4px 20px rgba(37,99,235,.4);
}

/* ============================================================
   BASE
============================================================ */
html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-app);
  color: var(--tx-primary);
  -webkit-font-smoothing: antialiased;
}
/* Bloqueia a rolagem da página de fundo enquanto qualquer modal estiver
   aberto (.modal-backdrop.open ou .config-modal-backdrop.open) — cobre
   TI e Impressoras automaticamente, sem precisar de JS/listener próprio,
   porque ambos os módulos usam essas mesmas classes-base.
   O conteúdo do modal continua rolável normalmente: o bloqueio é só no
   <html>/<body>, o .modal-body tem sua própria área de overflow. */
html:has(.modal-backdrop.open),
html:has(.config-modal-backdrop.open) {
  overflow: hidden;
}
button  { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
a { text-decoration: none; color: inherit; }

/* ============================================================
   LAYOUT
============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 10;
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.06) 30%, rgba(255,255,255,.06) 70%, transparent);
}
.sidebar-logo {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--r);
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}
.sidebar-logo-text { display: flex; flex-direction: column; gap: 1px; }
.sidebar-logo-name  { font-size: 15px; font-weight: 800; color: #f1f5f9; letter-spacing: -.4px; }
.sidebar-logo-sub   { font-size: 10px; color: rgba(255,255,255,.35); font-weight: 500; letter-spacing: .5px; text-transform: uppercase; }

.sidebar-section { padding: 20px 12px 8px; flex: 1; overflow-y: auto; }
.sidebar-section-label {
  font-size: 9.5px; font-weight: 700; color: rgba(255,255,255,.25);
  letter-spacing: 1.2px; text-transform: uppercase;
  padding: 0 8px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: rgba(255,255,255,.5); font-size: 13px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: var(--transition); position: relative;
  margin-bottom: 2px;
}
.nav-item i { font-size: 18px; flex-shrink: 0; }
.nav-item:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(37,99,235,.35); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: rgba(37,99,235,.4);
  color: #93c5fd; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nav-item.active .nav-badge { background: var(--brand); color: #fff; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.theme-toggle {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
  background: none; border: none;
  color: rgba(255,255,255,.45); font-size: 12px; font-weight: 500;
  transition: var(--transition);
}
.theme-toggle:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.07); }
.theme-toggle i { font-size: 18px; }
.toggle-track {
  width: 36px; height: 20px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.12);
  position: relative; transition: var(--transition);
  margin-left: auto; flex-shrink: 0;
}
.toggle-track.on { background: var(--brand); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: var(--transition);
}
.toggle-track.on .toggle-thumb { left: 19px; }

/* ---- MAIN ---- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 56px; flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-subtle);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.topbar-title    { font-size: 16px; font-weight: 700; color: var(--tx-primary); letter-spacing: -.3px; }
.topbar-breadcrumb {
  font-size: 12px; color: var(--tx-muted);
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
}
.topbar-breadcrumb i { font-size: 15px; }

.page-content { flex: 1; overflow-y: auto; padding: 28px; background: var(--bg-app); }

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-body   { padding: 20px; }
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--bd-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--tx-primary);
  letter-spacing: -.2px;
  display: flex; align-items: center; gap: 8px;
}
.card-title i { font-size: 18px; color: var(--brand); }

/* ---- Metric Cards ---- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative; overflow: hidden;
  cursor: pointer;
}
.metric-card::before {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--mc-color, var(--brand));
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; }
.metric-icon {
  width: 44px; height: 44px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--mc-bg, var(--bg-raised));
  color: var(--mc-color, var(--brand));
}
.metric-label  { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--tx-muted); margin-bottom: 4px; }
.metric-value  { font-size: 32px; font-weight: 800; color: var(--tx-primary); letter-spacing: -1px; line-height: 1; }
.metric-sub    { font-size: 11px; color: var(--tx-muted); margin-top: 4px; }
.metric-hint   { font-size: 11px; color: var(--brand); margin-top: 6px; opacity: 0; transition: var(--transition); }
.metric-card:hover .metric-hint { opacity: 1; }

/* ============================================================
   BADGES
============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-aberto    { background: var(--aberto-bg);    color: var(--aberto-tx);    border-color: var(--aberto-bd); }
.badge-andamento { background: var(--andamento-bg); color: var(--andamento-tx); border-color: var(--andamento-bd); }
.badge-resolvido { background: var(--resolvido-bg); color: var(--resolvido-tx); border-color: var(--resolvido-bd); }
.badge-urgente   { background: var(--urgente-bg);   color: var(--urgente-tx);   border-color: var(--urgente-bd); }
.badge-alta      { background: var(--alta-bg);      color: var(--alta-tx); }
.badge-media     { background: var(--media-bg);     color: var(--media-tx); }
.badge-baixa     { background: var(--baixa-bg);     color: var(--baixa-tx); }
.badge-cat       { background: var(--bg-raised);    color: var(--tx-secondary);  border: 1px solid var(--bd-subtle); }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition); white-space: nowrap;
}
.btn i { font-size: 17px; }
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(37,99,235,.36); }
.btn-primary:active { transform: none; }
.btn-ghost {
  background: transparent; color: var(--tx-secondary);
  border-color: var(--bd-default);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--tx-primary); border-color: var(--bd-strong); }
.btn-danger {
  background: var(--urgente-bg); color: var(--urgente-tx);
  border-color: var(--urgente-bd);
}
.btn-danger:hover { background: var(--urgente-dot); color: #fff; border-color: var(--urgente-dot); }
.btn-warning {
  background: var(--andamento-bg); color: var(--andamento-tx);
  border-color: var(--andamento-bd);
}
.btn-warning:hover { background: var(--andamento-dot); color: #fff; border-color: var(--andamento-dot); }
.btn-sm  { padding: 7px 13px; font-size: 12px; }
.btn-sm i { font-size: 15px; }
.btn-xs  { padding: 5px 10px; font-size: 11px; }
.btn-xs i { font-size: 13px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
}
.btn-icon-sm {
  width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
}

/* ============================================================
   FORMS
============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }

.form-label {
  font-size: 11px; font-weight: 700; color: var(--tx-secondary);
  letter-spacing: .5px; text-transform: uppercase;
}
.form-label .req { color: var(--urgente-dot); }

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-surface);
  border: 1.5px solid var(--bd-default);
  border-radius: var(--r);
  padding: 10px 13px;
  font-size: 13px; color: var(--tx-primary);
  outline: none; width: 100%;
  transition: var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-input::placeholder { color: var(--tx-muted); }
.form-textarea {
  resize: vertical; min-height: 110px; line-height: 1.6;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================
   TABLE
============================================================ */

/* Wrapper com scroll horizontal isolado */
.table-outer {
  border-radius: var(--r-lg);
  border: 1px solid var(--bd-subtle);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;                    /* scroll horizontal quando necessário */
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;   /* scroll suave no iOS */
  width: 100%;
  max-width: 100%;
  /* Scrollbar estilizada para combinar com o tema */
  scrollbar-width: thin;
  scrollbar-color: var(--bd-default) transparent;
}
.table-outer::-webkit-scrollbar       { height: 6px; }
.table-outer::-webkit-scrollbar-track { background: transparent; }
.table-outer::-webkit-scrollbar-thumb { background: var(--bd-default); border-radius: 99px; }
.table-outer::-webkit-scrollbar-thumb:hover { background: var(--bd-strong); }

.data-table {
  width: 100%;
  min-width: 680px;        /* largura mínima para preservar leitura de todas as colunas */
  border-collapse: collapse;
  border-radius: var(--r-lg);
  overflow: hidden;        /* arredondamento nas células dos cantos */
}
.data-table th {
  padding: 11px 16px; text-align: left;
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--tx-muted);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bd-subtle);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bd-subtle);
  vertical-align: middle; font-size: 13px; color: var(--tx-primary);
  white-space: nowrap;     /* evita quebra de linha nas células */
}
.data-table tbody tr { transition: var(--transition); cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }

/* Coluna título: permite truncar com ellipsis em textos longos */
.td-id {
  font-family: var(--mono); font-size: 11px;
  color: var(--tx-muted); font-weight: 500;
  white-space: nowrap;
}
.td-title-wrap {
  max-width: 280px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.td-title  { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.td-sub    { font-size: 11px; color: var(--tx-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.td-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

/* ============================================================
   FILTERS BAR
============================================================ */
.filters-bar {
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.filter-select {
  background: var(--bg-raised);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-sm);
  padding: 7px 32px 7px 10px;
  font-size: 12px; font-weight: 500; color: var(--tx-secondary);
  outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: var(--transition);
}
.filter-select:focus { border-color: var(--brand); }
.search-wrap  { position: relative; flex: 1; min-width: 200px; }
.search-field {
  width: 100%;
  background: var(--bg-raised); border: 1px solid var(--bd-subtle);
  border-radius: var(--r-sm);
  padding: 7px 12px 7px 34px;
  font-size: 12px; color: var(--tx-primary); outline: none;
  transition: var(--transition);
}
.search-field:focus { border-color: var(--brand); background: var(--bg-surface); }
.search-icon  { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--tx-muted); font-size: 16px; pointer-events: none; }

/* ---- View switcher: botões separados ---- */
.view-switcher { display: flex; gap: 6px; }
.view-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--bd-default);
  background: var(--bg-raised); color: var(--tx-secondary);
  transition: var(--transition); cursor: pointer;
}
.view-btn i { font-size: 16px; }
.view-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.view-btn.active {
  background: var(--brand); color: #fff;
  border-color: var(--brand);
  box-shadow: var(--shadow-brand);
}

/* ============================================================
   GRADE VIEW
============================================================ */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.chamado-card {
  background: var(--bg-surface); border: 1.5px solid var(--bd-subtle);
  border-radius: var(--r-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  transition: var(--transition); cursor: pointer; box-shadow: var(--shadow-sm);
}
.chamado-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.chamado-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.chamado-num   { font-family: var(--mono); font-size: 10px; color: var(--tx-muted); font-weight: 500; }
.chamado-title { font-size: 14px; font-weight: 700; color: var(--tx-primary); line-height: 1.35; margin-bottom: 4px; }
.chamado-desc  { font-size: 12px; color: var(--tx-secondary); line-height: 1.55; }
.chamado-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px; border-top: 1px solid var(--bd-subtle);
}
.chamado-meta { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--tx-muted); }
.chamado-meta i { font-size: 14px; }
.chamado-card-actions { display: flex; gap: 5px; margin-top: 4px; }

/* ============================================================
   KANBAN VIEW
============================================================ */
.kanban-wrap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kanban-col  {
  background: var(--bg-raised); border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg); overflow: hidden;
}
.kanban-col-head {
  padding: 13px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--bd-subtle);
}
.kanban-col-title {
  font-size: 12px; font-weight: 700; letter-spacing: .4px;
  display: flex; align-items: center; gap: 7px;
}
.kanban-col-dot   { width: 8px; height: 8px; border-radius: 50%; }
.kanban-count {
  font-size: 11px; font-weight: 700;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); color: var(--tx-secondary);
  border: 1px solid var(--bd-subtle);
}
.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: var(--bg-surface); border: 1px solid var(--bd-subtle);
  border-radius: var(--r); padding: 12px; cursor: pointer;
  transition: var(--transition); box-shadow: var(--shadow-sm);
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand); }
.kanban-card-title  { font-size: 13px; font-weight: 600; line-height: 1.35; margin-bottom: 8px; color: var(--tx-primary); }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; }
.kanban-card-id     { font-family: var(--mono); font-size: 10px; color: var(--tx-muted); }
.kanban-card-actions { display: flex; gap: 4px; margin-top: 8px; }
.kanban-empty { text-align: center; padding: 20px; color: var(--tx-muted); font-size: 12px; }

/* ============================================================
   FLUTUANTE VIEW
============================================================ */
.flutuante-list { display: flex; flex-direction: column; gap: 8px; }
.flutuante-item {
  background: var(--bg-surface); border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg); padding: 14px 18px;
  display: flex; align-items: center; gap: 16px;
  cursor: pointer; transition: var(--transition); box-shadow: var(--shadow-sm);
}
.flutuante-item:hover { box-shadow: var(--shadow-md); border-color: var(--brand); transform: translateX(4px); }
.flutuante-item-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.flutuante-cat-icon {
  width: 40px; height: 40px; border-radius: var(--r); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-light); color: var(--brand); font-size: 20px;
}
[data-theme="dark"] .flutuante-cat-icon { background: rgba(37,99,235,.15); }
.flutuante-body    { flex: 1; min-width: 0; }
.flutuante-title   { font-size: 14px; font-weight: 700; color: var(--tx-primary); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flutuante-sub     { font-size: 11px; color: var(--tx-muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flutuante-sub i   { font-size: 13px; }
.flutuante-right   { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.flutuante-id      { font-family: var(--mono); font-size: 10px; color: var(--tx-muted); }
.flutuante-actions { display: flex; gap: 5px; margin-top: 4px; }

/* ============================================================
   SECTION HEADER
============================================================ */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.section-title { font-size: 20px; font-weight: 800; color: var(--tx-primary); letter-spacing: -.5px; }
.section-sub   { font-size: 13px; color: var(--tx-muted); margin-top: 3px; }
.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   MODAL
============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 700; /* acima do config-modal (600) para sub-modais */
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  overflow: hidden; /* única rolagem do fluxo é a do .modal-body */
}
.modal-backdrop.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh; max-height: 90dvh;
  display: flex; flex-direction: column;
  overflow: hidden; /* só o .modal-body rola — ver regra abaixo */
  animation: slideUp .25s cubic-bezier(.34, 1.56, .64, 1);
}
.modal-wide { max-width: 680px; }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head {
  flex: 0 0 auto; /* nunca encolhe, nunca rola junto com o conteúdo */
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--bd-subtle);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.modal-id    { font-family: var(--mono); font-size: 11px; color: var(--tx-muted); margin-bottom: 5px; }
.modal-title { font-size: 18px; font-weight: 800; color: var(--tx-primary); letter-spacing: -.4px; line-height: 1.3; }

/* Close button — visível com ícone X */
.modal-close {
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1.5px solid var(--bd-default);
  border-radius: var(--r-sm);
  background: var(--bg-raised); color: var(--tx-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: var(--transition);
}
.modal-close:hover { background: var(--urgente-bg); color: var(--urgente-tx); border-color: var(--urgente-bd); }
.modal-close i { pointer-events: none; }

.modal-body {
  flex: 1 1 auto;   /* única área rolável do modal */
  min-height: 0;    /* evita que o conteúdo empurre o modal além da tela */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 22px 24px;
}
/* Reservado para modais que futuramente separem um rodapé próprio do
   HTML gerado (hoje os botões de ação ficam dentro de .modal-body,
   e por isso já rolam com o conteúdo — o que os mantém sempre
   alcançáveis por scroll). */
.modal-footer { flex: 0 0 auto; }
.modal-section { margin-bottom: 20px; }
.modal-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--tx-muted); margin-bottom: 10px;
}
.modal-desc {
  font-size: 13px; color: var(--tx-secondary); line-height: 1.65;
  background: var(--bg-raised); border: 1px solid var(--bd-subtle);
  border-radius: var(--r); padding: 14px 15px;
  white-space: pre-wrap; overflow-wrap: anywhere; /* preserva quebras de linha digitadas na descrição */
}
.modal-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-field-label { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--tx-muted); margin-bottom: 5px; }
.modal-field-value { font-size: 13px; font-weight: 600; color: var(--tx-primary); }

/* Status action buttons */
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status-btn {
  padding: 7px 14px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
  border: 1.5px solid transparent;
  transition: var(--transition); cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.status-btn .sdot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-btn.s-aberto    { background: var(--aberto-bg);    color: var(--aberto-tx);    border-color: var(--aberto-bd); }
.status-btn.s-andamento { background: var(--andamento-bg); color: var(--andamento-tx); border-color: var(--andamento-bd); }
.status-btn.s-resolvido { background: var(--resolvido-bg); color: var(--resolvido-tx); border-color: var(--resolvido-bd); }
.status-btn.s-urgente   { background: var(--urgente-bg);   color: var(--urgente-tx);   border-color: var(--urgente-bd); }
.status-btn:hover { filter: brightness(.9); transform: scale(.97); }

/* ============================================================
   PAINEL
============================================================ */
.painel-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; margin-top: 4px; }
.painel-main { display: flex; flex-direction: column; gap: 16px; }
.painel-side { display: flex; flex-direction: column; gap: 16px; }

.urgente-list { display: flex; flex-direction: column; gap: 8px; }
.urgente-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  background: var(--bg-raised); border: 1px solid var(--bd-subtle); border-radius: var(--r);
  cursor: pointer; transition: var(--transition);
}
.urgente-item:hover { border-color: var(--urgente-bd); background: var(--urgente-bg); }
.urgente-item-body   { flex: 1; min-width: 0; }
.urgente-item-title  { font-size: 12px; font-weight: 700; color: var(--tx-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urgente-item-sub    { font-size: 10px; color: var(--tx-muted); margin-top: 2px; }

.stat-row  { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-mini {
  background: var(--bg-raised); border: 1px solid var(--bd-subtle);
  border-radius: var(--r); padding: 12px; text-align: center;
}
.stat-mini-val { font-size: 22px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat-mini-lbl { font-size: 10px; color: var(--tx-muted); font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: .4px; }

/* ============================================================
   SETORES
============================================================ */
.setores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.setor-card {
  background: var(--bg-surface); border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg); padding: 17px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: var(--transition); box-shadow: var(--shadow-sm);
}
.setor-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.setor-icon-wrap {
  width: 44px; height: 44px; border-radius: var(--r); flex-shrink: 0;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
[data-theme="dark"] .setor-icon-wrap { background: rgba(37,99,235,.15); }
.setor-info   { flex: 1; min-width: 0; }
.setor-name   { font-size: 14px; font-weight: 700; color: var(--tx-primary); }
.setor-count  { font-size: 11px; color: var(--tx-muted); margin-top: 2px; }
.setor-actions { display: flex; gap: 6px; }

/* ============================================================
   TOAST
============================================================ */
.toast-container {
  position: fixed; bottom: 28px; right: 28px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--r-lg);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.34, 1.56, .64, 1);
  max-width: 320px;
}
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { background: #16a34a; color: #fff; }
.toast.error   { background: #dc2626; color: #fff; }
.toast.info    { background: var(--brand); color: #fff; }
.toast i       { font-size: 18px; }

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--tx-muted); }
.empty-state i    { font-size: 52px; display: block; margin-bottom: 14px; opacity: .35; }
.empty-state h3   { font-size: 15px; font-weight: 700; color: var(--tx-secondary); margin-bottom: 6px; }
.empty-state p    { font-size: 13px; }

/* ============================================================
   MISC
============================================================ */
hr { border: none; border-top: 1px solid var(--bd-subtle); margin: 18px 0; }

.stagger > * { animation: staggerIn .35s ease both; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .09s; }
.stagger > *:nth-child(3) { animation-delay: .14s; }
.stagger > *:nth-child(4) { animation-delay: .19s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }
@keyframes staggerIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ============================================================
   SETOR SEARCH DROPDOWN
============================================================ */
.setor-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1.5px solid var(--brand);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}
.setor-dropdown-item {
  padding: 9px 13px;
  font-size: 13px;
  color: var(--tx-primary);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--bd-subtle);
}
.setor-dropdown-item:last-child { border-bottom: none; }
.setor-dropdown-item:hover { background: var(--brand-light); color: var(--brand); }
[data-theme="dark"] .setor-dropdown-item:hover { background: rgba(37,99,235,.15); }

/* ---- Variável extra para Alta ---- */
:root  { --alta-bd: #fca5a5; }
[data-theme="dark"] { --alta-bd: #7f1d1d; }

/* ============================================================
   MODAL DE CONFIGURAÇÕES
============================================================ */
.config-modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 600;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.config-modal-backdrop.open { display: flex; animation: fadeIn .2s ease; }

.config-modal {
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-xl);
  width: min(920px, 95vw);
  height: min(680px, 90dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.config-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; flex-shrink: 0;
  border-bottom: 1px solid var(--bd-subtle);
}
.config-modal-header-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700; color: var(--tx-primary);
}
.config-modal-header-title i { font-size: 22px; color: var(--brand); }

.config-modal-body {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
}

.config-modal-nav {
  width: 210px; flex-shrink: 0;
  border-right: 1px solid var(--bd-subtle);
  background: var(--bg-raised);
  padding: 12px 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.config-modal-nav::-webkit-scrollbar { display: none; }
.config-nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--tx-muted); padding: 6px 12px 4px; margin-top: 4px;
}
.config-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--tx-secondary); transition: var(--transition);
  border: none; background: transparent; width: 100%; text-align: left;
  text-decoration: none; /* .config-nav-item também é usado como <a> (link externo de Auditoria) */
}
.config-nav-item:hover { background: var(--bg-hover); color: var(--tx-primary); }
.config-nav-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.config-nav-item i { font-size: 17px; flex-shrink: 0; }

.config-modal-content {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 24px;
  -webkit-overflow-scrolling: touch;
}

/* Botão Configurações na sidebar */
.sidebar-config-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  border: none; background: transparent;
  color: rgba(255,255,255,.55); font-size: 13px; font-weight: 600;
  cursor: pointer; width: 100%; transition: var(--transition);
  margin-bottom: 6px;
}
.sidebar-config-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.sidebar-config-btn i { font-size: 18px; flex-shrink: 0; }

/* Mobile: config modal tela cheia */
@media (max-width: 640px) {
  .config-modal {
    width: 100%; height: 100vh; height: 100dvh; border-radius: 0;
    max-height: 100vh; max-height: 100dvh;
  }
  .config-modal-body { flex-direction: column; }
  .config-modal-nav {
    width: 100%; border-right: none;
    border-bottom: 1px solid var(--bd-subtle);
    display: flex; overflow-x: auto; padding: 8px; gap: 4px;
    flex-shrink: 0;
  }
  .config-nav-section-label { display: none; }
  .config-nav-item { white-space: nowrap; width: auto; padding: 7px 10px; font-size: 12px; }
  .config-modal-content { padding: 14px; }
}

/* ============================================================
   TELA DE LOGIN
============================================================ */
.login-wrap {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  /* Gradiente de fundo moderno */
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(99,102,241,.14) 0%, transparent 55%),
    radial-gradient(ellipse at 60% 80%, rgba(16,185,129,.10) 0%, transparent 50%),
    var(--bg-app);
}
[data-theme="dark"] .login-wrap {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.22) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(99,102,241,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 60% 80%, rgba(16,185,129,.12) 0%, transparent 50%),
    var(--bg-app);
}

.login-box {
  /* Efeito glass */
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--r-xl);
  box-shadow:
    0 8px 32px rgba(37,99,235,.12),
    0 2px 8px rgba(0,0,0,.06),
    inset 0 1px 0 rgba(255,255,255,.8);
  padding: 40px 36px;
  width: 100%; max-width: 380px;
}
[data-theme="dark"] .login-box {
  background: rgba(15,23,42,.65);
  border-color: rgba(255,255,255,.1);
  box-shadow:
    0 8px 32px rgba(0,0,0,.4),
    0 2px 8px rgba(0,0,0,.3),
    inset 0 1px 0 rgba(255,255,255,.05);
}

.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo-icon {
  width: 56px; height: 56px;
  background: var(--brand); border-radius: var(--r-lg);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; margin-bottom: 12px;
  box-shadow: var(--shadow-brand);
}
.login-logo-name {
  font-size: 22px; font-weight: 800; color: var(--tx-primary); letter-spacing: -.5px;
}
.login-logo-sub {
  font-size: 12px; color: var(--tx-muted); margin-top: 2px;
}
.login-form { display: flex; flex-direction: column; }
.login-erro {
  background: var(--urgente-bg); border: 1px solid var(--urgente-dot);
  color: var(--urgente-tx); border-radius: var(--r-sm);
  padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}

/* ============================================================
   SIDEBAR — USUÁRIO LOGADO
============================================================ */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: rgba(255,255,255,.06);
  margin-top: 8px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  background: var(--brand); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-perfil {
  font-size: 10.5px; color: rgba(255,255,255,.45);
  text-transform: uppercase; letter-spacing: .5px; margin-top: 1px;
}
.sidebar-logout-btn {
  width: 28px; height: 28px;
  border: none; border-radius: var(--r-sm);
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-logout-btn:hover { background: rgba(239,68,68,.25); color: #fca5a5; }

/* ============================================================
   LISTA COMPACTA — visualização de chamados
============================================================ */
.compact-list { display: flex; flex-direction: column; gap: 6px; }

.compact-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.compact-item:hover { border-color: var(--brand); box-shadow: var(--shadow); background: var(--bg-hover); }

.compact-left  { flex: 1; min-width: 0; }
.compact-top   { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.compact-id    { font-family: var(--mono); font-size: 11px; color: var(--tx-muted); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.compact-title { font-size: 14px; font-weight: 700; color: var(--tx-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-meta  { display: flex; gap: 12px; flex-wrap: wrap; }
.compact-meta span {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--tx-muted);
  white-space: nowrap;
}
.compact-meta i { font-size: 12px; }

.compact-right  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.compact-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.compact-actions { display: flex; gap: 4px; }

@media (max-width: 640px) {
  .compact-item  { flex-direction: column; align-items: flex-start; gap: 8px; }
  .compact-right { width: 100%; justify-content: space-between; }
  .compact-title { white-space: normal; }
}

/* ============================================================
   PROJETOS
============================================================ */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.proj-card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.proj-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.proj-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.proj-card-name {
  font-size: 15px; font-weight: 700; color: var(--tx-primary);
  line-height: 1.3;
}
.proj-card-desc {
  font-size: 12.5px; color: var(--tx-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.proj-card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.proj-card-date {
  font-size: 11.5px; color: var(--tx-muted);
  display: flex; align-items: center; gap: 4px;
}
.proj-card-date i { font-size: 13px; }

/* Barra de progresso */
.proj-progress-wrap { margin-top: 2px; }
.proj-progress-info {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--tx-muted); font-weight: 600;
  margin-bottom: 5px;
}
.proj-progress-bar {
  height: 7px; background: var(--bg-raised);
  border-radius: 99px; overflow: hidden;
}
.proj-progress-fill {
  height: 100%; border-radius: 99px;
  transition: width .5s ease;
}

/* ============================================================
   VISUALIZAÇÃO FLUTUANTE — BOARD
============================================================ */
#flt-board-wrap {
  width: 100%;
  overflow: auto;
  background: var(--bg-raised);
  border: 1px solid var(--bd-subtle);
  border-radius: var(--r-lg);
  position: relative;
  /* Altura dinâmica: ocupa o espaço restante da tela */
  height: calc(100vh - 260px);
  min-height: 400px;
  transition: border-radius .2s;
}

/* Tela cheia via JS */
#flt-board-wrap.flt-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  border-radius: 0;
  height: 100vh !important;
  width: 100vw !important;
}

#flt-board {
  position: relative;
  width: 100%;
  min-width: 100%;
  min-height: 100%;
  padding: 16px;
}

.flt-card {
  position: absolute;
  background: var(--bg-surface);
  border: 3.5px solid var(--bd-subtle); /* borda mais grossa */
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow .15s;
  z-index: 1;
  min-width: 220px;
  min-height: 130px;
}
.flt-card:hover { box-shadow: var(--shadow-md); }

/* Botão tela cheia */
#flt-fs-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--bd-default);
  background: var(--bg-raised); color: var(--tx-secondary);
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
#flt-fs-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
#flt-fs-btn i { font-size: 16px; }

/* Cabeçalho (alça de drag) */
.flt-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bd-subtle);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.flt-card-header:active { cursor: grabbing; }

.flt-drag-handle {
  color: var(--tx-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.flt-card-id {
  font-family: var(--mono);
  font-size: .85em;
  color: var(--tx-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.flt-card-badges {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.flt-open-btn {
  width: 24px; height: 24px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--tx-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.flt-open-btn:hover { background: var(--brand-light); color: var(--brand); }

/* Corpo do card */
.flt-card-body {
  padding: 10px 12px;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flt-card-title {
  font-weight: 700;
  color: var(--tx-primary);
  font-size: 1em;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.flt-card-status { display: flex; }

.flt-card-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: .85em;
  color: var(--tx-muted);
}
.flt-card-meta i { font-size: 1em; vertical-align: -1px; }

.flt-card-desc {
  font-size: .82em;
  color: var(--tx-secondary);
  line-height: 1.5;
  overflow: hidden;
  flex: 1;           /* ocupa todo o espaço restante do card-body */
  min-height: 0;     /* necessário para flex funcionar com overflow */
  white-space: pre-line;  /* respeita quebras de linha do texto */
  word-break: break-word;
}

/* Alça de redimensionamento */
.flt-resize-handle {
  position: absolute;
  bottom: 0; right: 0;
  width: 22px; height: 22px;
  cursor: se-resize;
  display: flex; align-items: center; justify-content: center;
  color: var(--tx-muted);
  font-size: 12px;
  border-radius: var(--r-sm) 0 var(--r-lg) 0;
  background: var(--bg-raised);
  border-top: 1px solid var(--bd-subtle);
  border-left: 1px solid var(--bd-subtle);
  transition: var(--transition);
}
.flt-resize-handle:hover { color: var(--brand); background: var(--brand-light); }

/* ---- Topbar: grupo direito (tabelas + data) ---- */
.topbar-right-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Indicador de tabelas de preços */
.price-tables-summary {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--tx-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}
.price-tables-summary i { font-size: 14px; flex-shrink: 0; }
.price-tables-summary:hover {
  background: var(--bg-hover);
  color: var(--tx-secondary);
}

/* ============================================================
   MULTI-SELECT STATUS
============================================================ */
.status-multiselect { position: relative; flex-shrink: 0; }

.status-ms-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--bd-subtle);
  border-radius: var(--r-sm); padding: 7px 10px;
  font-size: 12px; font-weight: 500; color: var(--tx-secondary);
  cursor: pointer; white-space: nowrap; min-width: 150px;
  transition: var(--transition);
}
.status-ms-btn:hover { border-color: var(--brand); color: var(--brand); }

.status-ms-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1.5px solid var(--brand);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  z-index: 60;
  padding: 6px 0;
}
.status-ms-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer;
  font-size: 13px; color: var(--tx-primary);
  transition: var(--transition);
}
.status-ms-item:hover { background: var(--bg-hover); }
.status-ms-item input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--brand); flex-shrink: 0;
}

/* ============================================================
   PAINEL — lista mobile para chamados recentes
============================================================ */
.painel-table-wrap { display: block; }
.painel-list-wrap  { display: none; }

.painel-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--bd-subtle);
  cursor: pointer; transition: var(--transition);
}
.painel-list-item:last-child { border-bottom: none; }
.painel-list-item:hover { padding-left: 4px; }
.painel-list-left  { flex: 1; min-width: 0; }
.painel-list-title { font-size: 13px; font-weight: 600; color: var(--tx-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.painel-list-sub   { font-size: 11px; color: var(--tx-muted); margin-top: 2px; }
.painel-list-right { flex-shrink: 0; }

/* ============================================================
   TOPBAR — hamburguer (oculto no desktop)
============================================================ */
.topbar-hamburger {
  display: none;
  width: 36px; height: 36px;
  border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--tx-secondary);
  align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  transition: var(--transition);
}
.topbar-hamburger:hover { background: var(--bg-hover); color: var(--tx-primary); }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  z-index: 90;
}
.sidebar-overlay.open { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   BOTTOM NAV — oculto no desktop
============================================================ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--bg-surface);
  border-top: 1px solid var(--bd-subtle);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
  z-index: 80;
  align-items: center; justify-content: space-around;
  padding: 0 4px;
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; flex: 1; height: 100%;
  border: none; background: transparent;
  color: var(--tx-muted); font-size: 10px; font-weight: 600;
  transition: var(--transition); position: relative; padding: 6px 4px;
}
.bnav-item i { font-size: 22px; transition: var(--transition); }
.bnav-item.active { color: var(--brand); }
.bnav-item.active i { transform: scale(1.1); }
.bnav-badge {
  position: absolute; top: 5px; left: calc(50% + 4px);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--urgente-dot); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.bnav-center {
  background: var(--brand); color: #fff !important;
  border-radius: var(--r-lg);
  margin: 0 6px; height: 50px; flex: 0 0 58px;
  box-shadow: var(--shadow-brand);
}
.bnav-center i { font-size: 24px !important; }

/* ============================================================
   RESPONSIVE — TABLET (≤1024px)
============================================================ */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .painel-grid  { grid-template-columns: 1fr; }
  .kanban-wrap  { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤768px)
============================================================ */
@media (max-width: 768px) {

  /* Previne scroll horizontal na página */
  html, body { overflow-x: hidden; }

  /* ---- Sidebar: vira gaveta lateral ---- */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px !important;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  /* App shell sem sidebar no fluxo */
  :root { --sidebar-w: 0px; }
  .app-shell { display: flex; }
  .main { width: 100%; flex: 1; }

  /* ---- Topbar mobile ---- */
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-hamburger { display: flex; }
  .topbar-breadcrumb { display: none; }
  /* Tabelas: versão compacta no mobile */
  .price-tables-summary { max-width: 160px; font-size: 10px; padding: 3px 6px; gap: 3px; }
  #price-tables-text { overflow: hidden; text-overflow: ellipsis; }

  /* ---- Bottom nav visível ---- */
  .bottom-nav { display: flex; }

  /* ---- Conteúdo: scroll vertical, sem overflow horizontal ---- */
  .page-content {
    padding: 14px 12px 74px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
  }
  .page-content * { box-sizing: border-box; }
  .card { overflow: hidden; max-width: 100%; }

  /* ---- Grids ---- */
  .metrics-grid      { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .painel-grid       { grid-template-columns: 1fr; gap: 12px; }
  .kanban-wrap       { grid-template-columns: 1fr; }
  .grade-grid        { grid-template-columns: 1fr; }
  .setores-grid      { grid-template-columns: 1fr; }
  .proj-grid         { grid-template-columns: 1fr; }
  .form-grid         { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .modal-grid        { grid-template-columns: 1fr; }
  .stat-row          { grid-template-columns: repeat(2, 1fr); }

  /* ---- Painel: troca tabela por lista ---- */
  .painel-table-wrap { display: none; }
  .painel-list-wrap  { display: block; }

  /* ---- Section head ---- */
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
  .section-actions { width: 100%; flex-wrap: wrap; gap: 6px; }

  /* ---- View switcher: só ícones ---- */
  .view-btn span { display: none; }
  .view-btn { width: 34px; height: 32px; padding: 0; justify-content: center; }
  .view-switcher { flex-wrap: wrap; gap: 4px; }

  /* ---- Filtros em coluna ---- */
  .filters-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
  .filter-select, .search-field, .search-wrap { width: 100%; min-width: unset; }

  /* ---- Tabela: só ela rola horizontalmente ---- */
  .table-outer { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table  { min-width: 480px; }

  /* ---- Cards ---- */
  .card-body    { padding: 14px; }
  .card-header  { padding: 14px; flex-wrap: wrap; gap: 8px; }
  .card-title   { font-size: 13px; }
  .metric-card  { padding: 14px; cursor: pointer; }
  .metric-icon  { width: 36px; height: 36px; font-size: 18px; }
  .metric-sub   { display: none; }
  .metric-value { font-size: 26px; }

  /* ---- Flutuante ---- */
  .flutuante-item { flex-wrap: wrap; padding: 12px; }
  .flutuante-item:hover { transform: none; }
  .flutuante-right { flex-direction: row; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 6px; }
  .flutuante-id { display: none; }

  /* ---- Modais: bottom sheet ---- */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }
  .modal-wide { max-width: 100%; }
  .modal-head { padding: 16px; }
  .modal-body { padding: 16px; }
  .status-actions { flex-wrap: wrap; gap: 6px; }
  .status-btn { font-size: 11px; padding: 6px 10px; }

  /* ---- Inputs: evita zoom iOS ---- */
  .form-input, .form-select, .form-textarea { font-size: 16px; }

  /* ---- Setor/Categoria cards ---- */
  .setor-card { padding: 12px 14px; }

  /* ---- Toasts ---- */
  .toast-container { left: 10px; right: 10px; bottom: 70px; }
  .toast { max-width: 100%; font-size: 12px; }
}

/* ============================================================
   RESPONSIVE — TELAS PEQUENAS (≤420px)
============================================================ */
@media (max-width: 420px) {
  .metrics-grid { gap: 8px; }
  .metric-value { font-size: 22px; }
  .page-content { padding: 10px 10px 74px; }
  .topbar       { padding: 0 10px; }
}


/* ---- Botão trocar módulo ---- */
.sidebar-switch-btn {
  display: none;              /* oculto por padrão; JS exibe quando >1 módulo */
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: rgba(255,255,255,.55);
  font-size: 13px; font-weight: 600;
  cursor: pointer; width: 100%;
  transition: var(--transition);
  margin-bottom: 4px;
}
.sidebar-switch-btn:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
}
.sidebar-switch-btn i { font-size: 18px; flex-shrink: 0; }

/* ============================================================
   ANEXOS / FOTOS — Chamados de TI
   Mesmo padrão visual/funcional do módulo Impressoras
   (impressoras.css: .imp-anx-*, .imp-lb-*, .imp-cam-*), com
   classes próprias (prefixo tk-) e cor do tema de TI (--brand).
============================================================ */

/* Botão câmera compacto (usado em actionBtns: tabela/grade/kanban) */
/* Botão câmera compacto (usado em actionBtns: tabela/grade/kanban).
   Estilo próprio (não herda .btn-warning/.btn-danger) para não ficar
   sem cor de fundo/tema — precisa de variante dark explícita. */
.tk-anx-toggle-btn {
  position: relative;
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand);
}
.tk-anx-toggle-btn:hover { background: var(--brand); color: #fff; }
[data-theme="dark"] .tk-anx-toggle-btn {
  background: rgba(37, 99, 235, .18);
  color: #93c5fd;
  border-color: rgba(37, 99, 235, .5);
}
[data-theme="dark"] .tk-anx-toggle-btn:hover { background: var(--brand); color: #fff; }
.tk-anx-count {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--brand); color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 99px; padding: 1px 4px;
  min-width: 14px; text-align: center; line-height: 14px;
  pointer-events: none;
}

/* Seção de anexos no modal de detalhe */
.tk-anx-section, .tk-modal-anx-wrap {
  margin: 14px 0;
}
.tk-anx-section {
  padding: 12px 14px;
  background: var(--bg-raised);
  border-radius: var(--r-lg);
  border: 1px solid var(--bd-subtle);
}
.tk-anx-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.tk-anx-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--tx-muted);
  display: flex; align-items: center; gap: 6px;
}
.tk-anx-count {
  background: var(--brand); color: #fff;
  border-radius: 99px; padding: 1px 7px;
  font-size: 11px; font-weight: 700;
}
.tk-cam-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--bd-subtle);
  background: var(--bg-surface);
  color: var(--tx-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  font-size: 15px;
  padding: 0;
}
.tk-cam-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
[data-theme="dark"] .tk-cam-btn:hover { background: rgba(37, 99, 235, .18); }

/* Grid de miniaturas */
.tk-anx-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tk-anx-thumb {
  position: relative;
  width: 72px; height: 72px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1.5px solid var(--bd-subtle);
  display: block;
  transition: var(--transition);
  flex-shrink: 0;
}
.tk-anx-thumb:hover { border-color: var(--brand); transform: scale(1.05); }
.tk-anx-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  cursor: zoom-in;
}
.tk-anx-seq {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 9px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  pointer-events: none;
}
.tk-anx-del-btn {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.tk-anx-del-btn:hover { background: #dc2626; }

/* Novo Chamado — seção de fotos */
.tk-nc-fotos-section {
  padding: 14px;
  background: var(--bg-raised);
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--bd-subtle);
  margin: 16px 0;
}
.tk-nc-cam-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--bd-subtle);
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  color: var(--tx-secondary);
  cursor: pointer; transition: var(--transition);
  user-select: none;
}
.tk-nc-cam-label:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.tk-nc-cam-label i { font-size: 18px; }

.tk-modal-anx-loading {
  font-size: 12px; color: var(--tx-muted);
  display: flex; align-items: center; gap: 6px;
  padding: 8px 0;
}
.tk-modal-anx-empty { padding: 8px 0; }

/* Lightbox — z-index acima do .modal-backdrop (700) */
#tk-lightbox { position: fixed; inset: 0; z-index: 9999; }
.tk-lb-backdrop {
  width: 100%; height: 100%;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: fadeIn .2s ease;
}
.tk-lb-img {
  max-width: 95vw; max-height: 92dvh;
  object-fit: contain;
  border-radius: var(--r-lg);
  box-shadow: 0 0 60px rgba(0,0,0,.8);
  cursor: default;
  pointer-events: none; /* clique na imagem também fecha (delega pro backdrop) */
}
.tk-lb-close {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px;
  background: rgba(255,255,255,.15);
  border: none; border-radius: 50%;
  color: #fff; font-size: 22px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background .2s; z-index: 1;
}
.tk-lb-close:hover { background: rgba(255,255,255,.3); }

/* Mobile: câmera visível/clicável, sem rolagem horizontal na imagem ampliada */
@media (max-width: 640px) {
  .tk-nc-fotos-section { margin: 12px 0; }
  .tk-nc-cam-label { width: 100%; justify-content: center; padding: 12px; }
  .tk-lb-close { top: 8px; right: 8px; }
  .tk-lb-img { max-width: 100vw; }
}

/* ============================================================
   USUÁRIOS E ACESSOS — listagem simplificada + modal de detalhe
============================================================ */

/* Listagem: linhas clicáveis, sem botões por linha */
.ud-list { display: flex; flex-direction: column; }
.ud-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bd-subtle);
  cursor: pointer;
  transition: var(--transition);
}
.ud-list .ud-row:last-child { border-bottom: none; }
.ud-row:hover { background: var(--bg-hover); }
.ud-row:focus-visible {
  outline: 2px solid var(--brand); outline-offset: -2px;
  background: var(--bg-hover);
}
.ud-row-main { flex: 1 1 auto; min-width: 0; }
.ud-row-nome {
  font-weight: 600; font-size: 13px; color: var(--tx-primary);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.35;
}
.ud-row-login {
  font-family: var(--mono); font-size: 11px; color: var(--tx-muted);
  margin-top: 2px;
}
.ud-row-meta {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  flex-wrap: wrap; justify-content: flex-end; max-width: 40%;
}
.ud-row-chevron { font-size: 18px; color: var(--tx-muted); flex-shrink: 0; }

/* Abas do modal de detalhe */
.ud-tabs {
  display: flex; gap: 2px; overflow-x: auto;
  padding: 0 24px; border-bottom: 1px solid var(--bd-subtle);
  flex: 0 0 auto; /* nunca encolhe, nunca rola com o conteúdo (mesmo padrão de .modal-head) */
}
.ud-tabs::-webkit-scrollbar { display: none; }
.ud-tab {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 12px 14px;
  background: none; border: none; border-bottom: 2px solid transparent;
  font-size: 13px; font-weight: 600; color: var(--tx-muted);
  cursor: pointer; white-space: nowrap;
  transition: var(--transition);
}
.ud-tab:hover { color: var(--tx-secondary); }
.ud-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.ud-tab-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--andamento-dot, #f59e0b);
  margin-left: 2px;
}

/* Resumo da aba Permissões */
.ud-perm-resumo {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 18px;
}
.ud-perm-resumo > div {
  background: var(--bg-raised); border: 1px solid var(--bd-subtle);
  border-radius: var(--r-sm); padding: 10px; text-align: center;
  font-size: 11px; color: var(--tx-muted);
}
.ud-perm-resumo strong { display: block; font-size: 18px; color: var(--tx-primary); }

/* Bloco por módulo */
.ud-modulo-bloco { margin-bottom: 18px; }
.ud-modulo-titulo {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 700; color: var(--tx-primary);
  margin-bottom: 10px;
}
.ud-modulo-sem-acesso .ud-modulo-titulo { color: var(--tx-muted); }
.ud-sem-acesso-tag {
  font-size: 11px; font-weight: 600; color: var(--urgente-tx);
  background: var(--urgente-bg); padding: 2px 8px; border-radius: 99px;
}

/* Grupo expansível */
.ud-grupo {
  border: 1px solid var(--bd-subtle); border-radius: var(--r-sm);
  margin-bottom: 8px; overflow: hidden;
}
.ud-grupo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--tx-secondary);
  background: var(--bg-raised);
  list-style: none;
}
.ud-grupo-head::-webkit-details-marker { display: none; }
.ud-grupo-head::before {
  content: '\25B8'; margin-right: 6px; color: var(--tx-muted);
  transition: transform .15s;
}
.ud-grupo[open] > .ud-grupo-head::before { transform: rotate(90deg); }
.ud-grupo-body { padding: 4px 12px 8px; }

/* Item de permissão individual */
.ud-perm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--bd-subtle);
  flex-wrap: wrap;
}
.ud-perm-item:last-child { border-bottom: none; }
.ud-perm-info { min-width: 0; flex: 1 1 220px; }
.ud-perm-nome { font-size: 13px; font-weight: 600; color: var(--tx-primary); }
.ud-perm-origem { font-size: 11px; color: var(--tx-muted); margin-top: 2px; }
.ud-efetiva-sim { color: var(--resolvido-tx); font-weight: 600; }
.ud-efetiva-nao { color: var(--urgente-tx); font-weight: 600; }
.ud-perm-codigo { font-family: var(--mono); font-size: 10px; color: var(--tx-muted); margin-top: 2px; display: none; }

/* Controle de três estados (Padrão / Permitir / Negar) — mesmo espírito visual de .status-btn */
.ud-seg { display: flex; gap: 4px; flex-shrink: 0; }
.ud-seg-btn {
  padding: 5px 10px; border-radius: var(--r-sm);
  border: 1.5px solid var(--bd-subtle); background: var(--bg-surface);
  font-size: 11px; font-weight: 600; color: var(--tx-muted);
  cursor: pointer; transition: var(--transition);
}
.ud-seg-btn:hover:not(:disabled) { border-color: var(--tx-muted); }
.ud-seg-btn:disabled { opacity: .4; cursor: not-allowed; }
.ud-seg-btn.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }
.ud-seg-permitir.active { border-color: var(--resolvido-dot); background: var(--resolvido-bg); color: var(--resolvido-tx); }
.ud-seg-negar.active { border-color: var(--urgente-dot); background: var(--urgente-bg); color: var(--urgente-tx); }

/* Aba Segurança */
.ud-sec-bloco { margin-bottom: 8px; }
.ud-sec-titulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--tx-primary);
  margin-bottom: 12px;
}
.ud-sec-perigo {
  border: 1.5px dashed var(--urgente-bd); border-radius: var(--r-lg);
  padding: 14px; background: var(--urgente-bg);
}
.ud-sec-perigo .ud-sec-titulo { color: var(--urgente-tx); }

/* Mobile */
@media (max-width: 640px) {
  .ud-row { padding: 12px; gap: 8px; }
  .ud-row-meta { flex-direction: column; align-items: flex-end; gap: 4px; max-width: 34%; }
  .ud-tabs { padding: 0 12px; }
  .ud-tab { padding: 10px 10px; font-size: 12px; }
  .ud-perm-resumo { grid-template-columns: repeat(2, 1fr); }
  .ud-perm-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ud-seg { width: 100%; }
  .ud-seg-btn { flex: 1; text-align: center; }
}
