/* =========================================================
   THEME / BASE — UI avançada, responsiva e consistente
   (versão refinada do seu CSS — mantém identidade e melhora
    mobile, overlay, acessibilidade, foco, e painéis)
   ========================================================= */

:root{
  --bg: #0f172a;
  --surface: #111827;
  --card: #161f32;
  --text: #e5e7eb;
  --muted: #9ca3af;

  --primary: #f97316;
  --primary-strong: #ea580c;

  --border: #1f2937;
  --border-soft: rgba(31,41,55,0.65);

  --success: #22c55e;
  --danger: #ef4444;

  /* layout */
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-1: 0 10px 40px rgba(0,0,0,0.35);
  --shadow-2: 0 16px 50px rgba(0,0,0,0.45);

  /* alturas de barras */
  --topbar-h: 64px;
  --sidebar-w: clamp(240px, 18vw, 320px);
  --sidebar-w-collapsed: 76px;

  /* foco/acessibilidade */
  --focus: rgba(249,115,22,0.38);
  --focus-strong: rgba(249,115,22,0.62);

  /* transições */
  --t: 180ms;
  --e: cubic-bezier(.2,.8,.2,1);
}

*{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body{
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: radial-gradient(120% 120% at 20% 20%, #1f2937, #0b1224);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
a{ color: var(--primary); text-decoration: none; }
a:hover{ filter: brightness(1.06); }

::selection{ background: rgba(249,115,22,0.25); }

/* Melhor experiência de rolagem (sem “quebrar” em iOS) */
*{
  scrollbar-width: thin;
  scrollbar-color: rgba(249,115,22,0.35) rgba(15,23,42,0.35);
}
*::-webkit-scrollbar{ width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb{
  background: rgba(249,115,22,0.35);
  border-radius: 999px;
  border: 2px solid rgba(15,23,42,0.35);
}
*::-webkit-scrollbar-track{ background: rgba(15,23,42,0.35); }

/* =========================================================
   LAYOUT
   ========================================================= */

.layout{
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-areas: "sidebar page";
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}
.layout.collapsed{
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
  grid-template-areas: "sidebar page";
}

/* Overlay do mobile (agora realmente bloqueia clique e dá destaque) */
body::after{
  content:"";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.0);
  opacity: 0;
  pointer-events: none;
  z-index: 65;
  transition: opacity var(--t) var(--e), background var(--t) var(--e);
  backdrop-filter: blur(0px);
}
body.sidebar-open::after{
  background: rgba(0,0,0,0.55);
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar{
  height: var(--topbar-h);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  position: sticky;
  top: 0;
  z-index: 80;
  backdrop-filter: blur(12px);
}
.topbar-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
}
.brand{ display:flex; align-items:center; gap:10px; min-width: 0; }
.brand strong{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-stack{
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.brand-main{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width: 0;
}
.brand-text{
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.brand-sub{
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(148,163,184,0.9);
}
.logo-dot{
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(249,115,22,0.35);
}
.brand-logo{
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.topbar-right{ display:flex; gap:10px; align-items:center; }

.hamburger{
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 8px;
  cursor: pointer;
  transition: transform var(--t) var(--e), border-color var(--t) var(--e), background var(--t) var(--e);
}
.hamburger:hover{ border-color: rgba(249,115,22,0.6); background: rgba(255,255,255,0.03); transform: translateY(-1px); }
.hamburger:active{ transform: translateY(0px) scale(0.98); }
.hamburger span{ width: 18px; height: 2px; background: var(--text); display:block; }

/* User menu */
.user-menu{ position: relative; }
.avatar{
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, #0b1020, #1f2937);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--t) var(--e), border-color var(--t) var(--e);
}
.avatar:hover{ border-color: rgba(249,115,22,0.55); transform: translateY(-1px); }
.avatar:active{ transform: translateY(0px) scale(0.98); }

.user-dropdown{
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 220px;
  background: rgba(17,24,39,0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  display: none;
  flex-direction: column;
  padding: 8px;
  z-index: 90;
  backdrop-filter: blur(10px);
}
.user-dropdown.open{ display:flex; }
.user-dropdown a{
  padding: 10px 10px;
  border-radius: 10px;
  color: var(--text);
  transition: background var(--t) var(--e);
}
.user-dropdown a:hover{ background: rgba(255,255,255,0.06); }
.user-section{
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.user-info{
  padding: 6px 10px 10px;
  display:flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar{
  background: rgba(8,13,26,0.82);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 16px 12px;
  display:flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(10px);
  z-index: 70;
  grid-area: sidebar;
  width: var(--sidebar-w);
  min-width: 0;
}

.sidebar-brand{
  display:flex;
  flex-direction: column;
  align-items:center;
  text-align:center;
  gap: 6px;
  font-weight: 800;
  min-width:0;
  flex: 0 0 auto;
}
.sidebar-brand .brand-text{
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand .brand-logo{
  width: 42px;
  height: 42px;
  border-radius: 12px;
}
.sidebar-brand .brand-sub{ line-height: 1; }

.sidebar-nav{
  display:flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  padding: 4px 2px 6px 0;
  padding-bottom: 16px;
  overflow-x: hidden;
}

.nav-item{
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  line-height: 1.2;
  transition: background var(--t) var(--e), border-color var(--t) var(--e), transform var(--t) var(--e);
  outline: none;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover{
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
  transform: translateY(-1px);
}
.nav-item:active{ transform: translateY(0px) scale(0.99); }
.nav-item.active{
  background: rgba(249,115,22,0.14);
  border-color: rgba(249,115,22,0.85);
  color: #fff;
  box-shadow: 0 10px 24px rgba(249,115,22,0.12);
}
.nav-section{
  margin: 12px 0 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sidebar collapsed */
.sidebar.collapsed{
  width: var(--sidebar-w-collapsed);
  padding: 16px 10px;
}
.sidebar.collapsed .nav-section{ display:none; }
.sidebar.collapsed .nav-item{
  text-indent: -9999px;
  padding: 10px;
  overflow: hidden;
}
.sidebar.collapsed .nav-item::after{
  content: attr(data-short);
  text-indent: 0;
  position: absolute;
  inset: 0;
  display:grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.sidebar.collapsed .nav-item.active::after{ color: #fff; }
.sidebar.collapsed .sidebar-brand .brand-sub{ display:none; }
.sidebar.collapsed .sidebar-brand .brand-text{ display:none; }
.sidebar.collapsed .sidebar-brand .brand-logo{ width: 28px; height: 28px; }
.sidebar.collapsed .logo-dot{ margin-right: 0; }

/* =========================================================
   PAGE / CARDS / GRIDS
   ========================================================= */

.page{
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 32px 72px;
  grid-area: page;
  min-width: 0;
}
.page-header{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.with-actions .actions{ display:flex; gap: 8px; flex-wrap: wrap; }

h1,h2,h3{ margin: 0 0 8px 0; font-weight: 800; letter-spacing: -0.01em; }
p.muted, .muted{ color: var(--muted); margin: 0; }

.card{
  background: linear-gradient(135deg, rgba(15,23,42,0.92), rgba(15,23,42,0.84));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
  width: 100%;
}
.card-header{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.grid{ display:grid; gap: 12px; }
.grid-2{ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3{ grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.full{ grid-column: 1 / -1; }

/* =========================================================
   TABLES
   ========================================================= */

.table-responsive{
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

/* “Moldura” elegante e sticky header opcional */
table{ width: 100%; border-collapse: collapse; }
thead{ background: rgba(255,255,255,0.03); }
th, td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th{ color: rgba(229,231,235,0.92); font-weight: 800; font-size: 13px; }
tbody tr:hover td{ background: rgba(255,255,255,0.02); }
.table-sticky thead th{
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}

/* =========================================================
   DRIVE
   ========================================================= */

.drive-toolbar{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.drive-toolbar-left{ display:flex; align-items:center; gap: 12px; min-width: 0; }
.drive-toolbar-right{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.drive-actions{ display:flex; gap: 8px; align-items:center; flex-wrap: wrap; }
.drive-breadcrumb{
  display:flex;
  gap: 10px;
  align-items:center;
  font-weight: 800;
  min-width: 0;
}
.drive-breadcrumb > *{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drive-crumb{
  padding: 2px 6px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--t) var(--e), background var(--t) var(--e), color var(--t) var(--e);
}
.drive-crumb:hover{
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
}
.drive-crumb.current{ color: var(--accent); }
.drive-crumb-sep{ color: var(--muted); }
.drive-crumb.drop-target{
  border-color: rgba(56,189,248,0.6);
  background: rgba(56,189,248,0.12);
  color: #38bdf8;
}
.drive-sort{ width: 180px; }

.drive-surface{ position: relative; min-height: 320px; overflow: visible; }
.drive-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.drive-grid.list{ grid-template-columns: 1fr; }
.drive-grid.list .drive-card{ flex-direction: row; align-items: center; }
.drive-grid.list .drive-card-body{ flex: 1; }

.drive-card{
  background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color var(--t) var(--e), transform var(--t) var(--e), box-shadow var(--t) var(--e);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  position: relative;
  z-index: 1;
  overflow: visible;
}
.drive-card:hover{
  border-color: rgba(249,115,22,0.85);
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(0,0,0,0.42);
}
.drive-card:active{ transform: translateY(0px) scale(0.99); }
.drive-card.selected{
  border-color: rgba(56,189,248,0.9);
  box-shadow: 0 0 0 2px rgba(56,189,248,0.2), 0 18px 44px rgba(0,0,0,0.45);
}
.drive-card.menu-open{
  z-index: 20;
}

.drive-card-header{ display:flex; justify-content: space-between; align-items:center; gap: 10px; }
.drive-icon{
  width: 44px; height: 44px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(249,115,22,0.62), rgba(17,24,39,0.95));
  display:grid;
  place-items: center;
  font-size: 20px;
  border: 1px solid var(--border);
}

.drive-menu-btn{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  transition: border-color var(--t) var(--e), background var(--t) var(--e);
}
.drive-menu-btn:hover{ border-color: rgba(249,115,22,0.65); background: rgba(255,255,255,0.03); }

.drive-card-body strong{
  display:block;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drive-card-body small{ display:block; color: var(--muted); }

.note-badge{
  position: absolute;
  top: 8px;
  right: 42px;
  background: rgba(249,115,22,0.12);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  border: 1px solid rgba(249,115,22,0.25);
  display:inline-flex;
  gap: 4px;
  align-items:center;
}

.drive-menu{
  position: absolute;
  right: 6px;
  top: 46px;
  background: rgba(8,13,26,0.97);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 0;
  min-width: 180px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  display:none;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.drive-menu.open{ display:block; }

.drive-grid.list .drive-menu{
  left: 6px;
  right: auto;
}
.drive-menu button{
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 9px 12px;
  text-align: left;
  display:flex;
  align-items:center;
  gap: 8px;
  cursor: pointer;
}
.drive-menu button:hover{ background: rgba(255,255,255,0.06); }

.drive-empty{ text-align:center; padding: 32px 12px; color: var(--muted); }

body.drive-drag-active .drive-surface{
  outline: 2px dashed rgba(249,115,22,0.7);
  outline-offset: 6px;
  border-radius: 16px;
}
.drive-card.drop-target{
  border-color: rgba(249,115,22,0.95);
  box-shadow: 0 0 0 2px rgba(249,115,22,0.25), 0 18px 44px rgba(0,0,0,0.45);
}

.drive-card-footer{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
}
.drive-select-btn{
  position: static;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(8,13,26,0.92);
  color: var(--muted);
  display:grid;
  place-items: center;
  font-size: 11px;
  cursor: pointer;
  transition: transform var(--t) var(--e), border-color var(--t) var(--e), color var(--t) var(--e), background var(--t) var(--e);
}
.drive-card.selected .drive-select-btn{
  color: #38bdf8;
  border-color: rgba(56,189,248,0.6);
  background: rgba(56,189,248,0.12);
}
.drive-select-btn:hover{
  transform: scale(1.05);
  border-color: rgba(56,189,248,0.5);
  color: #38bdf8;
}

.drive-selection-bar{
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(8,13,26,0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(10px);
}
.drive-selection-info{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.drive-selection-actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}
.drop-upload-panel{
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: auto;
  width: 360px;
  max-width: calc(100vw - 24px);
  margin: 0;
  background: linear-gradient(145deg, rgba(10,16,30,0.98), rgba(8,13,26,0.96));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: none;
  z-index: 50;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
}
.drop-upload-panel.open{ display:block; }
.drop-upload-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.drop-upload-list{
  margin-top: 8px;
  display:flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow:auto;
}
.drop-upload-item{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
}
.drop-upload-file strong{ display:block; font-size: 13px; }
.drop-upload-file span{ display:block; font-size: 11px; color: var(--muted); }
.drop-upload-actions{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.drop-upload-buttons{ display:flex; gap: 8px; }

/* Painel de detalhes: desktop (lateral), mobile (bottom sheet) */
.drive-details{
  width: 320px;
  border-left: 1px solid var(--border);
  background: rgba(8,13,26,0.92);
  padding: 16px;
  position: fixed;
  right: 0;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  display:none;
  flex-direction: column;
  gap: 12px;
  z-index: 85;
  box-shadow: -12px 0 30px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
}
.drive-details.open{ display:flex; }
.drive-details header{ display:flex; justify-content: space-between; align-items:center; gap: 10px; }
.drive-details-body p{ margin: 0 0 10px 0; }

/* Drag */
.drag-handle{ cursor: grab; padding: 6px 8px; display:inline-block; }
.dragging{ opacity: 0.72; background: rgba(255,255,255,0.05); }

/* =========================================================
   MODAL
   ========================================================= */

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.70);
  display:none;
  align-items:center;
  justify-content:center;
  z-index: 200;
  backdrop-filter: blur(6px);
}
.modal-backdrop.open{ display:flex; }

.modal{
  background: rgba(17,24,39,0.98);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: min(540px, 96vw);
  max-height: calc(100vh - 96px);
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  display:flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(10px);
}
.modal.large{
  width: min(1100px, 96vw);
  max-height: 90vh;
}
.modal header{ display:flex; justify-content: space-between; align-items:center; gap: 10px; }
.modal form{ display:grid; gap: 12px; }
.modal footer{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

#modal-body-move .move-target-head{
  display:flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.move-target-list{
  display:flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}
.move-target-item{
  display:grid;
  grid-template-columns: 18px 1fr;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8,13,26,0.85);
  cursor: pointer;
  transition: border-color var(--t) var(--e), background var(--t) var(--e), transform var(--t) var(--e);
}
.move-target-item:hover{
  border-color: rgba(249,115,22,0.45);
  background: rgba(255,255,255,0.03);
}
.move-target-item input{
  width: 16px;
  height: 16px;
  accent-color: #38bdf8;
}
.move-target-title{
  font-weight: 700;
}
.move-target-full{
  grid-column: 2 / 3;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#modal-body-move .muted.small{
  margin-top: 4px;
}

.preview-modal{
  width: min(980px, 96vw);
  max-height: 90vh;
}
.preview-body{
  width: 100%;
  max-height: 70vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.preview-media{
  width: 100%;
  max-height: 70vh;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}
iframe.preview-media,
video.preview-media{
  height: 70vh;
}
.preview-text{
  width: 100%;
  max-height: 70vh;
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  overflow: auto;
}
.preview-placeholder{
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  text-align: center;
}
.preview-footer{
  justify-content: space-between;
}

.progress-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
}
.progress-overlay.open{ display:flex; }
.progress-card{
  background: rgba(17,24,39,0.98);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}
.progress-ring{
  --p: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), rgba(255,255,255,0.08) 0);
  display: grid;
  place-items: center;
  position: relative;
}
.progress-ring::after{
  content:"";
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(8,13,26,0.95);
  border: 1px solid var(--border);
}
.progress-ring span{
  position: absolute;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}
.progress-ring.indeterminate{
  animation: spin 1s linear infinite;
  background: conic-gradient(var(--primary) 20%, rgba(255,255,255,0.06) 0);
}
.progress-ring.indeterminate span{ display:none; }
.progress-label{
  font-weight: 700;
}
.progress-actions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content:center;
}

@media (max-width: 640px){
  .preview-modal{
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .preview-body, .preview-media, .preview-text{
    max-height: calc(100vh - 180px);
  }
  iframe.preview-media,
  video.preview-media{
    height: calc(100vh - 200px);
  }
  .progress-card{
    width: min(280px, 92vw);
  }
}

/* SweetAlert refinado */
.swal2-popup .swal-blocked{
  text-align: left;
  margin: 10px 0 0 0;
  padding-left: 18px;
}
.swal2-popup .swal-blocked li{
  margin: 4px 0;
  font-size: 13px;
}

/* Compartilhamento */
.share-tabs{
  display:flex;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.share-tab{
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  padding: 6px 8px;
  border-bottom: 2px solid transparent;
}
.share-tab.active{
  color: var(--text);
  border-color: var(--primary);
}
.share-mode{
  display:flex;
  gap: 8px;
  margin-bottom: 6px;
}
.share-mode-btn{
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.share-mode-btn.active{
  border-color: rgba(249,115,22,0.8);
  background: rgba(249,115,22,0.15);
}
.share-search input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
}
.share-results{
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  max-height: 180px;
  overflow: auto;
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.share-result{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.share-result .btn[disabled]{
  opacity: 0.6;
  cursor: not-allowed;
}
.share-result-info{
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.share-selected{
  margin-top: 8px;
}
.share-selected-title{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.share-chips{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
}
.share-chip{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}
.share-chip button{
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}
.share-perms{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.perm-btn{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
}
.perm-btn.active{
  border-color: rgba(249,115,22,0.8);
  background: rgba(249,115,22,0.12);
}
.share-feedback{
  margin-top: 8px;
  display:flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.share-feedback-item{
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.share-feedback-item.criado{ border-color: rgba(34,197,94,0.6); }
.share-feedback-item.ja_existia{ border-color: rgba(249,115,22,0.6); }
.share-feedback-item.erro{ border-color: rgba(239,68,68,0.6); }

.share-existing-wrap{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.share-existing-title{
  font-weight: 700;
  margin-bottom: 8px;
}
.share-existing{
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.share-existing-item{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8,13,26,0.75);
}

@media (max-width: 640px){
  .share-perms{
    grid-template-columns: 1fr;
  }
}
.avisos-list{
  max-height: 300px;
  overflow: auto;
  display:flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px;
}
.aviso-card{
  padding: 12px 14px;
  border: 1px solid rgba(249,115,22,0.18);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aviso-head{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.aviso-meta{
  font-size: 12px;
  color: var(--muted);
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.aviso-author{
  font-weight: 700;
  color: #f8fafc;
  font-size: 13px;
}
.aviso-date{
  font-size: 11px;
  color: rgba(148,163,184,0.8);
}
.aviso-text{
  font-size: 14px;
  color: #e5e7eb;
  line-height: 1.4;
  word-break: break-word;
}
.aviso-delete{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.1);
  color: #fecaca;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--t) var(--e), background var(--t) var(--e), border-color var(--t) var(--e);
}
.aviso-delete:hover{
  transform: translateY(-1px);
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.7);
}
.aviso-delete:active{ transform: translateY(0); }

#modal-avisos .modal{
  max-width: 820px;
}
.avisos-form{
  width: 100%;
  display: grid;
  gap: 12px;
}
.avisos-form textarea{
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border-radius: 12px;
  padding: 12px;
  background: rgba(8,13,26,0.6);
  border: 1px solid var(--border);
}
.avisos-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
@media (max-width: 640px){
  #modal-avisos .modal{
    max-width: none;
  }
  .avisos-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .avisos-actions .btn{
    width: 100%;
  }
}

/* =========================================================
   BUTTONS / INPUTS — acabamento e foco
   ========================================================= */

.btn{
  background: var(--primary);
  color: #0b0f1a;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(249,115,22,0.25);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  position: relative;
  transition: transform var(--t) var(--e), filter var(--t) var(--e), background var(--t) var(--e);
}
.btn:hover{ background: var(--primary-strong); transform: translateY(-1px); }
.btn:active{ transform: translateY(0px) scale(0.99); }

.btn.ghost{
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.ghost:hover{ border-color: rgba(249,115,22,0.55); background: rgba(255,255,255,0.03); }

.btn.success{ background: var(--success); color: #031008; }
.btn.danger{ background: var(--danger); color: #190405; }

.btn.small{ padding: 6px 10px; font-size: 13px; border-radius: 9px; }

.btn.loading{
  pointer-events:none;
  opacity: 0.92;
  padding-right: 40px;
}
.btn.loading:after{
  content:"";
  position:absolute;
  right: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: rgba(0,0,0,0.82);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin{ to{ transform: rotate(360deg); } }

input, select, textarea{
  width: 100%;
  background: rgba(17,24,39,0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 10px;
  outline: none;
  transition: border-color var(--t) var(--e), box-shadow var(--t) var(--e), background var(--t) var(--e);
}
input:focus, select:focus, textarea:focus{
  border-color: rgba(249,115,22,0.75);
  box-shadow: 0 0 0 3px var(--focus);
  background: rgba(17,24,39,0.98);
}
input::placeholder, textarea::placeholder{ color: rgba(156,163,175,0.75); }

label{
  display:flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
textarea{ min-height: 110px; resize: vertical; }

/* =========================================================
   ALERTS / CHECKS / COLORS / AUTH
   ========================================================= */

.alert{
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.alert-error{
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.55);
  color: #fecdd3;
}

.checkbox-row{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.checkbox-row input{ width: auto; accent-color: var(--primary); }

.checkbox-pair{
  display:flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items:center;
  padding: 8px 0 4px;
}
.checkbox-pair .checkbox-row{ justify-content:flex-start; padding: 0; }

.color-row{ display:flex; align-items:center; gap: 10px; flex-wrap: wrap; }
.color-row input[type="color"]{
  width: 52px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  background: rgba(17,24,39,0.9);
  border-radius: 10px;
}
.color-preview{
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(17,24,39,0.7);
  font-weight: 800;
  min-width: 90px;
  text-align:center;
}
.color-cell{ display:flex; align-items:center; gap: 8px; }
.color-cell .color-chip{
  width: 18px; height: 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display:inline-block;
}

.auth-page{
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: 32px;
}
.auth-shell{
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 24px;
  position: relative;
}
.auth-shell::before{
  content:"";
  position: absolute;
  width: 360px;
  height: 360px;
  left: -140px;
  top: -160px;
  background: radial-gradient(circle, rgba(249,115,22,0.28), rgba(249,115,22,0) 70%);
  pointer-events: none;
}
.auth-shell::after{
  content:"";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -180px;
  bottom: -200px;
  background: radial-gradient(circle, rgba(59,130,246,0.18), rgba(59,130,246,0) 70%);
  pointer-events: none;
}
.auth-hero{
  position: relative;
  z-index: 1;
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(8,13,26,0.96));
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}
.auth-hero::after{
  content:"";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -120px;
  top: -120px;
  background: radial-gradient(circle, rgba(249,115,22,0.25), rgba(249,115,22,0) 70%);
  pointer-events: none;
}
.auth-brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}
.auth-brand-name{
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-title{
  margin: 4px 0 0;
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.1;
}
.auth-list{
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: grid;
  gap: 10px;
}
.auth-list li{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text);
}
.auth-list li::before{
  content:"";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.18);
  margin-top: 6px;
  flex-shrink: 0;
}
.auth-hero-footer{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.auth-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(249,115,22,0.16);
  border: 1px solid rgba(249,115,22,0.5);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-card{
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 28px;
  background: rgba(17,24,39,0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  box-shadow: var(--shadow-2);
  justify-self: end;
}
.auth-card-header{
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.auth-card h2{ margin: 0; }
.auth-form{
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.auth-form label span{
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-form .btn{
  width: 100%;
  margin-top: 6px;
}
.auth-meta{
  margin-top: 14px;
  font-size: 13px;
}

.stat{ text-align:left; }
.stat h2{ font-size: 32px; margin: 4px 0; }

/* Progress */
.progress{
  width: 100%;
  height: 10px;
  background: #0b1020;
  border-radius: 999px;
  overflow:hidden;
  border: 1px solid var(--border);
}
.progress.small{ height: 6px; }
.progress-bar{
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ffb703);
  transition: width 0.2s ease;
}

/* Pills */
.pill-list{ display:flex; flex-wrap: wrap; gap: 8px; }
.pill{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}

/* Accordion/Setores */
.accordion .card{ margin-bottom: 12px; }
.sector-header{
  cursor: pointer;
  display:grid;
  grid-template-columns: 1fr 200px 200px;
  gap: 12px;
  align-items:center;
}
.sector-actions{ display:flex; justify-content:flex-end; gap: 8px; align-items:center; flex-wrap: wrap; }
.save-status{ color: var(--muted); font-size: 12px; }

.sticky{ position: sticky; top: 0; z-index: 10; }
.quick-filters, .quick-actions{ display:flex; gap: 8px; align-items:center; flex-wrap: wrap; }

/* =========================================================
   OPTION BUILDER (mantém seu visual, melhora espaçamento)
   ========================================================= */

.option-builder{
  border: 1px solid #1c2434;
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(15,23,42,0.95), rgba(10,16,28,0.92));
  display:grid;
  gap: 16px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
}
.option-form{
  background: #0b1220;
  border: 1px solid #1c2434;
  border-radius: 12px;
  padding: 12px;
  display:grid;
  gap: 12px;
}
.option-form-wrapper{
  display:grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}
.option-list-panel{
  border: 1px solid #1c2434;
  border-radius: 12px;
  background: #0b1220;
  padding: 12px;
  display:grid;
  gap: 10px;
}
.option-actions{
  display:flex;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;
}
.option-list-header{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.option-list{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.option-card{
  border: 1px solid #1c2434;
  border-radius: 12px;
  padding: 12px;
  background: #0b1220;
  display:grid;
  gap: 10px;
}
.option-card-head{ display:flex; justify-content: space-between; gap: 10px; }
.option-card-body{
  font-size: 13px;
  color: #c5d0e0;
  display:grid;
  gap: 8px;
}
.option-card-actions{
  display:flex;
  gap: 8px;
  justify-content: space-between;
  align-items:center;
  flex-wrap: wrap;
}
.option-badges{
  display:flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(31,42,61,0.8), rgba(24,34,52,0.8));
  color: #dbe7ff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid #1f2a3d;
}
.badge.success{ background: #1f3d2a; color: #c5f2d6; }
.badge.info{ background: #1f3450; color: #cfe6ff; }
.badge.warning{ background: #3a2f1a; color: #ffe7b1; border-color: #5a4320; }
.badge.danger{ background: #3f1f25; color: #ffd0d6; border-color: #5f2932; }

.option-media{
  font-size: 12px;
  color: #9fb4d1;
  word-break: break-word;
}

.option-presets{ display:flex; align-items:center; gap: 12px; flex-wrap: wrap; }
.option-presets-actions{ display:flex; gap: 8px; flex-wrap: wrap; }

.chip-group{ display:flex; gap: 8px; flex-wrap: wrap; }
.chip{
  border: 1px solid #1f2a3d;
  background: #0f1725;
  color: #dbe7ff;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--t) var(--e), border-color var(--t) var(--e), background var(--t) var(--e);
}
.chip:hover{ border-color: rgba(249,115,22,0.6); transform: translateY(-1px); }
.chip.active{
  background: linear-gradient(135deg, #ff8a00, #ff5a00);
  border-color: #ff8a00;
  color: #0b1220;
  box-shadow: 0 4px 12px rgba(255, 138, 0, 0.25);
}

.label-inline{ font-size: 13px; font-weight: 800; color: #cbd6e5; margin-bottom: 6px; }
.mini{ font-size: 12px; }
.checkbox-row.align-end{ align-self:end; }

.reorder-group{ display:flex; gap: 6px; align-items:center; }
.reorder-btn{
  border: 1px solid #1f2a3d;
  background: #0f1725;
  color: #dbe7ff;
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color var(--t) var(--e), transform var(--t) var(--e);
}
.reorder-btn:hover{ border-color: rgba(249,115,22,0.65); transform: translateY(-1px); }
.reorder-btn.danger{ border-color: #ef4444; color: #ef4444; }

.muted.small{ font-size: 12px; color: #7f8aa5; }

/* Upload previews */
.preview-upload{ display:grid; gap: 6px; }
.preview-upload input[type="file"]{
  background: rgba(255,255,255,0.03);
  border: 1px solid #1f2a3d;
  color: #dbe7ff;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}
.preview-upload input[type="file"]::file-selector-button{
  background: linear-gradient(135deg, #ff8a00, #ff5a00);
  color: #0b0f1a;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  margin-right: 8px;
  cursor: pointer;
  font-weight: 900;
}
.preview-upload input[type="file"]:hover::file-selector-button{ filter: brightness(0.95); }

.preview-thumbs{ display:flex; gap: 8px; flex-wrap: wrap; }
.preview-thumb{
  width: 70px; height: 70px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #1f2a3d;
  background: #0f1725;
  position: relative;
  overflow:hidden;
}
.preview-thumb img{ width:100%; height:100%; object-fit: cover; display:block; }
.thumb-remove{
  position:absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border:none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-weight: 900;
  line-height: 20px;
  text-align:center;
}

/* =========================================================
   BUILDER MODELOS (refino + responsividade)
   ========================================================= */

.builder{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border: 1px solid #1c2434;
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(15,23,42,0.94), rgba(12,18,30,0.9));
}
.builder-left, .builder-right{
  border: 1px solid #1c2434;
  border-radius: 14px;
  padding: 12px;
  background: #0b1220;
  display:grid;
  gap: 12px;
}
.builder-header{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.builder-setores{
  display:grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  max-height: 440px;
  overflow:auto;
  padding: 2px;
}
.builder-setor-card{
  border: 1px solid #1f2a3d;
  border-radius: 14px;
  padding: 12px;
  background: #0f1725;
  display:grid;
  gap: 10px;
}
.builder-setor-card header{ display:flex; justify-content: space-between; align-items:center; gap: 10px; }

.builder-itens-list{ display:grid; gap: 8px; }
.builder-itens-list .checkbox-row{
  border: 1px solid #1f2a3d;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  align-items:flex-start;
  gap: 10px;
  transition: border-color var(--t) var(--e), background var(--t) var(--e);
}
.builder-itens-list .checkbox-row:hover{
  border-color: rgba(249,115,22,0.65);
  background: rgba(255,138,0,0.08);
}

.builder-itens{
  border: 1px dashed #1f2a3d;
  border-radius: 12px;
  padding: 12px;
  min-height: 240px;
  display:grid;
  gap: 10px;
  background: rgba(255,255,255,0.02);
}

.selected-card{
  border: 1px solid #1f2a3d;
  border-radius: 12px;
  padding: 10px;
  background: #0f1725;
  display:grid;
  gap: 8px;
  cursor: grab;
}
.selected-head{ display:flex; justify-content: space-between; gap: 8px; align-items:center; }
.selected-actions{ display:flex; gap: 6px; flex-wrap: wrap; }
.selected-card.dragging{ opacity: 0.72; border-color: rgba(249,115,22,0.8); }

.checkbox-row.small{ font-size: 13px; }

.preview-modelo{ text-align:left; display:grid; gap: 8px; }
.preview-row{
  border: 1px solid #1f2a3d;
  border-radius: 12px;
  padding: 8px 10px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  background: #0b1220;
  flex-wrap: wrap;
}
.preview-field{ flex: 1; display:grid; gap: 4px; min-width: 220px; }
.preview-field .field-input input{
  width: 100%;
  background: #0f1725;
  border: 1px solid #1f2a3d;
  border-radius: 10px;
  color: #dbe7ff;
  padding: 7px 10px;
}
.preview-field .field-input select.preview-select{
  width: 100%;
  background: #0f1725;
  border: 1px solid #1f2a3d;
  border-radius: 10px;
  color: #dbe7ff;
  padding: 8px 10px;
}
.preview-check-list{ display:grid; gap: 4px; }
.preview-select-img{ display:flex; gap: 12px; flex-wrap: wrap; }
.preview-select-img .img-option{
  border: 1px solid #1f2a3d;
  border-radius: 12px;
  padding: 8px 10px;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  background: #0f1725;
}
.img-dot{
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(255,138,0,0.6), rgba(15,23,42,0.9));
  border: 1px solid #1f2a3d;
  display:inline-block;
}
.img-dot img{ width:100%; height:100%; object-fit: cover; border-radius: 10px; display:block; }

.preview-check-img{ display:grid; gap: 6px; }
.preview-check-img label{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  border: 1px solid #1f2a3d;
  border-radius: 12px;
  padding: 6px 8px;
  background: #0f1725;
}

.preview-label select,
.preview-check input,
.preview-upload input,
.option-preview input,
.option-preview textarea{ width: 100%; }

.preview-check{ display:flex; align-items:center; gap: 8px; }
.preview-signature{
  padding: 10px;
  border: 1px dashed #1f2a3d;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  text-align:center;
}
.preview-stars{ letter-spacing: 2px; color: #fbbf24; }

/* =========================================================
   MODELOS/VISTORIA — overrides (melhor responsivo)
   ========================================================= */

.modelos-wrapper .page{
  padding: clamp(14px, 2.2vw, 32px) clamp(12px, 2vw, 28px);
  max-width: 1600px;
  margin: 0 auto;
}
.modelos-wrapper .page-header{
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.modelos-wrapper .actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.modelos-wrapper .card{ width: 100%; }

/* Tabela: moldura + rolagem suave */
.modelos-wrapper .table-responsive{
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.10);
}
.modelos-wrapper table{ min-width: 760px; }

.modelos-wrapper .table-actions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* =========================================================
   RESPONSIVO — breakpoints limpos (sem duplicar regras)
   ========================================================= */

/* <= 1200px: padding mais compacto + modal full quando necessário */
@media (max-width: 1200px){
  .page{
    padding: 16px 12px 56px;
    max-width: 100%;
  }
  .topbar-inner{ padding: 0 6px; }

  .modal{
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px;
    margin: 0;
    overflow:auto;
  }
  .modal footer{ justify-content: stretch; }
  .modal footer .btn{ flex: 1; text-align:center; }

  .page-header{ flex-direction: column; align-items:flex-start; gap: 8px; }
  .with-actions .actions{ width: 100%; justify-content:flex-start; gap: 8px; flex-wrap: wrap; }

  .card-header.filters{ flex-direction: column; align-items: stretch; gap: 8px; }
  .card-header.filters input,
  .card-header.filters select,
  .card-header.filters button{ width: 100%; }

  .drive-toolbar{ grid-template-columns: 1fr; }
  .drive-toolbar-right{ justify-content:flex-start; }
  .table-responsive{ overflow-x: auto; }
}

/* <= 900px: sidebar vira off-canvas + layout 1 coluna */
@media (max-width: 900px){
  :root{ --topbar-h: 56px; }

  .layout{
    grid-template-columns: 1fr;
    grid-template-areas: "page";
  }
  .page{ padding: 20px 12px 48px; }

  .auth-page{ padding: 20px; }
  .auth-shell{ grid-template-columns: 1fr; }
  .auth-card{
    max-width: none;
    justify-self: stretch;
    order: 1;
  }
  .auth-hero{
    order: 2;
    padding: 28px;
  }

  .sidebar{
    position: fixed;
    top: var(--topbar-h);
    left: calc(-1 * var(--sidebar-w));
    width: 240px;
    height: calc(100vh - var(--topbar-h));
    transition: left var(--t) var(--e);
    z-index: 75; /* acima do overlay */
    display:block;
  }
  body.sidebar-open .sidebar{ left: 0; }

  .sector-header{ grid-template-columns: 1fr; }

  /* Drive details vira bottom-sheet */
  .drive-details{
    width: 100%;
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
    height: min(62vh, 520px);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -18px 40px rgba(0,0,0,0.45);
  }
}

/* <= 768px: ajustes finos de tipografia e builder */
@media (max-width: 768px){
  .modelos-wrapper h1{ font-size: clamp(18px, 4.2vw, 22px); }
  .modelos-wrapper table{ min-width: 560px; }

  .builder{ grid-template-columns: 1fr; }
  .builder-setores{ grid-template-columns: 1fr; }
  .option-form-wrapper{ grid-template-columns: 1fr; }

  .drive-crumb-sep{ display:none; }
  .drive-breadcrumb{
    overflow-x: auto;
    scrollbar-width: none;
  }
  .drive-breadcrumb::-webkit-scrollbar{ display:none; }
}

/* <= 640px: drive cards + ações */
@media (max-width: 640px){
  .drive-toolbar{ grid-template-columns: 1fr; }
  .drive-toolbar-right{ justify-content:flex-start; }
  .drive-sort{ width: 100%; }
  .drive-actions{ width: 100%; }
  .drive-actions .btn{
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
    text-align:center;
  }

  .drive-grid{ grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .drive-card{ padding: 12px; gap: 8px; }
  .drive-card-header{ gap: 8px; }
  .drive-icon{ width: 38px; height: 38px; }

  .drive-card-footer{ gap: 6px; }
  .drive-select-btn{
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  .drive-selection-bar{
    position: sticky;
    top: 0;
    padding: 10px;
  }
  .drive-selection-actions{
    width: 100%;
    justify-content: space-between;
  }
  .drive-selection-actions .btn{
    flex: 1 1 calc(33% - 6px);
    min-width: 110px;
    text-align: center;
  }

  .move-target-list{
    max-height: 220px;
  }
  .move-target-item{
    padding: 12px 14px;
  }
  .move-target-title{
    font-size: 14px;
  }
  .move-target-full{
    font-size: 11px;
  }
}

@media (max-width: 720px){
  .drop-upload-panel{
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 12px;
  }
  .drop-upload-list{ max-height: 140px; }
  .drop-upload-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .drop-upload-buttons{ width: 100%; }
  .drop-upload-buttons .btn{ flex: 1 1 auto; }
}

/* <= 480px: tabela e ações mais “tocáveis” */
@media (max-width: 480px){
  .modelos-wrapper table{ min-width: 520px; }
  .modelos-wrapper .table-actions .btn{ flex: 1 1 auto; }
  .btn{ border-radius: 12px; }
  .auth-card, .auth-hero{ padding: 22px; }
}

/* =========================================================
   Preferência de redução de movimento
   ========================================================= */
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}

/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard-wrapper{
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

.dashboard-wrapper .dash-hero{
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(56,189,248,0.2);
  background: radial-gradient(120% 140% at 12% 10%, rgba(56,189,248,0.15), rgba(15,23,42,0.95));
}
.dashboard-wrapper .dash-hero::before{
  content:"";
  position:absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  top: -120px;
  background: radial-gradient(circle, rgba(249,115,22,0.35), rgba(15,23,42,0));
  opacity: 0.7;
  pointer-events: none;
}
.dashboard-wrapper .dash-hero::after{
  content:"";
  position:absolute;
  width: 280px;
  height: 280px;
  left: -120px;
  bottom: -140px;
  background: radial-gradient(circle, rgba(34,197,94,0.25), rgba(15,23,42,0));
  opacity: 0.7;
  pointer-events: none;
}

.dash-hero-main{
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
  align-items: stretch;
}
.dash-hero-text h1{ margin-bottom: 6px; }
.dash-kicker{
  display:inline-block;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9fb4d1;
  margin-bottom: 8px;
  font-weight: 700;
}
.dash-hero-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.dash-hero-meta{
  display:grid;
  gap: 10px;
  background: rgba(8,13,26,0.55);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}
.dash-hero-meta .meta-item{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

.stat-grid{
  display:grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 12px;
}
.stat-card{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}
.stat-note{
  display:block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.stat-icon{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display:grid;
  place-items: center;
  font-size: 18px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 30% 30%, rgba(56,189,248,0.35), rgba(15,23,42,0.92));
}
.stat-icon.success{ background: radial-gradient(circle at 30% 30%, rgba(34,197,94,0.35), rgba(15,23,42,0.92)); }
.stat-icon.warn{ background: radial-gradient(circle at 30% 30%, rgba(245,158,11,0.35), rgba(15,23,42,0.92)); }
.stat-icon.danger{ background: radial-gradient(circle at 30% 30%, rgba(239,68,68,0.35), rgba(15,23,42,0.92)); }

.mini-grid{
  display:grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
}
.mini-card{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
}
.mini-card strong{ font-size: 20px; }
.mini-label{ color: var(--muted); font-size: 13px; }

.dash-main-grid{
  display:grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: start;
}
.dash-side{
  display:grid;
  gap: 12px;
}
.dash-bottom{
  grid-column: 1 / -1;
}
.dash-bottom-grid{
  display:grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-table table{ min-width: 760px; }
.dash-table-card .card-header{ align-items: center; }

.status-breakdown{
  display:grid;
  gap: 10px;
}
.status-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  font-size: 13px;
  color: #dbe7ff;
}
.progress{
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress span{
  display:block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}
.progress.warn span{ background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.progress.info span{ background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.progress.danger span{ background: linear-gradient(90deg, #f87171, #ef4444); }

.dash-list{
  display:grid;
  gap: 10px;
}
.dash-item{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15,23,42,0.6);
}
.dash-item strong{ display:block; }
.dash-item .muted.small{ display:block; }
.pill{
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(249,115,22,0.5);
  background: rgba(249,115,22,0.15);
  font-weight: 800;
  font-size: 12px;
  color: var(--text);
}
.empty{ text-align:center; padding: 12px; }

@media (max-width: 1100px){
  .dash-main-grid{
    grid-template-columns: 1fr;
  }
  .dashboard-table table{ min-width: 0; }
  .dash-bottom{
    grid-column: auto;
  }
}

@media (max-width: 900px){
  .dash-hero-main{
    grid-template-columns: 1fr;
  }
  .dash-bottom-grid{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px){
  .stat-grid{ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .mini-grid{ grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

  .dashboard-wrapper .dashboard-table table,
  .dashboard-wrapper .dashboard-table thead,
  .dashboard-wrapper .dashboard-table tbody,
  .dashboard-wrapper .dashboard-table th,
  .dashboard-wrapper .dashboard-table td,
  .dashboard-wrapper .dashboard-table tr{
    display: block;
    width: 100%;
  }

  .dashboard-wrapper .dashboard-table thead{
    display: none !important;
  }

  .dashboard-wrapper .dashboard-table tbody{
    display: grid;
    gap: 12px;
  }

  .dashboard-wrapper .dashboard-table tbody tr{
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
    box-shadow: 0 12px 34px rgba(0,0,0,0.35);
    padding: 12px;
    overflow: hidden;
  }

  .dashboard-wrapper .dashboard-table tbody td{
    border-bottom: 1px solid rgba(31,41,55,0.55);
    padding: 10px 6px;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 44px;
  }

  .dashboard-wrapper .dashboard-table tbody td:last-child{
    border-bottom: none;
    padding-bottom: 6px;
  }

  .dashboard-wrapper .dashboard-table tbody td::before{
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
    opacity: 0.95;
  }

  .dashboard-wrapper .dashboard-table tbody td.table-actions{
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 12px;
  }

  .dashboard-wrapper .dashboard-table tbody td.table-actions .btn{
    width: 100%;
  }
}

@media (max-width: 520px){
  .dash-hero{ padding: 18px; }
  .stat-card{ flex-direction: column; align-items:flex-start; }
  .stat-icon{ align-self: flex-end; }
  .dash-hero-actions .btn{ flex: 1 1 100%; }
}

@media (max-width: 420px){
  .dashboard-wrapper .dashboard-table tbody td{
    grid-template-columns: 96px 1fr;
  }
}


/* =========================================================
   FIX RESPONSIVO (TABELA -> CARDS) — Modelos de Vistoria
   Objetivo: no mobile a tabela vira lista de “cards”,
   com labels por campo e botões 100% encaixados.
   Cole ESTE BLOCO NO FINAL do seu CSS (depois do theme).
   ========================================================= */

/* (opcional) dê uma classe no container da página: <body class="modelos-wrapper"> ... */

/* --- ajustes gerais para não “estourar” largura --- */
.modelos-wrapper .card,
.modelos-wrapper .table-responsive{
  max-width: 100%;
}

.modelos-wrapper .table-responsive{
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ====== MOBILE: tabela vira cards ====== */
@media (max-width: 768px){

  /* tira o min-width fixo que força rolagem e quebra layout */
  .modelos-wrapper table{ min-width: 0 !important; }

  /* moldura mais “card list” */
  .modelos-wrapper .table-responsive{
    border: none;
    background: transparent;
    padding: 0;
  }

  /* transforma a tabela em bloco */
  .modelos-wrapper table,
  .modelos-wrapper thead,
  .modelos-wrapper tbody,
  .modelos-wrapper th,
  .modelos-wrapper td,
  .modelos-wrapper tr{
    display: block;
    width: 100%;
  }

  /* esconde cabeçalho */
  .modelos-wrapper thead{
    display: none !important;
  }

  /* lista com espaçamento */
  .modelos-wrapper tbody{
    display: grid;
    gap: 12px;
  }

  /* cada linha vira um card */
  .modelos-wrapper tbody tr{
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
    box-shadow: 0 12px 34px rgba(0,0,0,0.35);
    padding: 12px;
    overflow: hidden;
  }

  /* cada célula vira linha com label + valor */
  .modelos-wrapper tbody td{
    border-bottom: 1px solid rgba(31,41,55,0.55);
    padding: 10px 6px;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 44px; /* toque */
  }

  .modelos-wrapper tbody td:last-child{
    border-bottom: none;
    padding-bottom: 6px;
  }

  /* label padrão via data-label (RECOMENDADO no HTML) */
  .modelos-wrapper tbody td::before{
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
    opacity: 0.95;
  }

  /* fallback caso você NÃO tenha data-label no HTML */
  .modelos-wrapper tbody td:nth-child(1)::before{ content: "Modelo"; }
  .modelos-wrapper tbody td:nth-child(2)::before{ content: "Itens"; }
  .modelos-wrapper tbody td:nth-child(3)::before{ content: "Ativo"; }
  .modelos-wrapper tbody td:nth-child(4)::before{ content: "Ações"; }

  /* campo “Ações” vira área de botões em grid */
  .modelos-wrapper tbody td:nth-child(4){
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 12px;
  }
  .modelos-wrapper tbody td:nth-child(4)::before{
    margin-bottom: -2px;
  }

  /* botões dentro de ações */
  .modelos-wrapper tbody td:nth-child(4) .btn,
  .modelos-wrapper tbody td:nth-child(4) button{
    width: 100%;
  }

  /* se você tiver um wrapper tipo .table-actions dentro do td */
  .modelos-wrapper .table-actions{
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    justify-content: stretch;
    width: 100%;
  }
  .modelos-wrapper .table-actions .btn,
  .modelos-wrapper .table-actions button{
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
  }

  /* se só tiver 2 botões (Visualizar / Excluir) fica perfeito */
  .modelos-wrapper .table-actions .btn.danger,
  .modelos-wrapper .table-actions .danger{
    grid-column: span 2; /* Excluir ocupa a linha inteira (mais “premium”) */
  }

  /* alinhamentos quando o valor for curto */
  .modelos-wrapper tbody td:nth-child(3){
    align-items: center;
  }
}

/* ====== MOBILE MUITO PEQUENO ====== */
@media (max-width: 420px){
  .modelos-wrapper tbody td{
    grid-template-columns: 110px 1fr;
  }
  .modelos-wrapper .table-actions{
    grid-template-columns: 1fr; /* empilha */
  }
  .modelos-wrapper .table-actions .btn.danger,
  .modelos-wrapper .table-actions .danger{
    grid-column: auto;
  }
}

/* =========================================================
   RESPONSIVO (TABELA -> CARDS) â€” Vistorias
   ========================================================= */

.vistorias-wrapper .card,
.vistorias-wrapper .table-responsive{
  max-width: 100%;
}

@media (max-width: 768px){
  .vistorias-wrapper table{ min-width: 0 !important; }

  .vistorias-wrapper .table-responsive{
    border: none;
    background: transparent;
    padding: 0;
  }

  .vistorias-wrapper table,
  .vistorias-wrapper thead,
  .vistorias-wrapper tbody,
  .vistorias-wrapper th,
  .vistorias-wrapper td,
  .vistorias-wrapper tr{
    display: block;
    width: 100%;
  }

  .vistorias-wrapper thead{
    display: none !important;
  }

  .vistorias-wrapper tbody{
    display: grid;
    gap: 12px;
  }

  .vistorias-wrapper tbody tr{
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
    box-shadow: 0 12px 34px rgba(0,0,0,0.35);
    padding: 12px;
    overflow: hidden;
  }

  .vistorias-wrapper tbody td{
    border-bottom: 1px solid rgba(31,41,55,0.55);
    padding: 10px 6px;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 44px;
  }

  .vistorias-wrapper tbody td:last-child{
    border-bottom: none;
    padding-bottom: 6px;
  }

  .vistorias-wrapper tbody td::before{
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
    opacity: 0.95;
  }

  .vistorias-wrapper tbody td.table-actions{
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 12px;
  }

  .vistorias-wrapper tbody td.table-actions::before{
    margin-bottom: -2px;
  }

  .vistorias-wrapper .table-actions{
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    justify-content: stretch;
    width: 100%;
  }

  .vistorias-wrapper .table-actions .btn,
  .vistorias-wrapper .table-actions button{
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
  }
}

@media (max-width: 420px){
  .vistorias-wrapper tbody td{
    grid-template-columns: 96px 1fr;
  }
  .vistorias-wrapper .table-actions{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   AVCB / CLCB
   ========================================================= */

.status-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-ok{
  color: #bbf7d0;
  background: rgba(34,197,94,0.18);
  border-color: rgba(34,197,94,0.4);
}
.status-warn{
  color: #fde68a;
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.45);
}
.status-danger{
  color: #fecaca;
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.55);
}
.avcb-note{
  display: block;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.row-highlight{
  outline: 2px solid rgba(249,115,22,0.8);
  outline-offset: 2px;
  border-radius: 12px;
  animation: avcbPulse 1.2s ease;
}
@keyframes avcbPulse{
  0%{ box-shadow: 0 0 0 rgba(249,115,22,0.0); }
  50%{ box-shadow: 0 0 0 6px rgba(249,115,22,0.15); }
  100%{ box-shadow: 0 0 0 rgba(249,115,22,0.0); }
}

.avcb-alert-fab{
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(249,115,22,0.45);
  background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.94));
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  cursor: pointer;
}
.avcb-alert-fab.has-alerts::after{
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(249,115,22,0.35);
  animation: avcbRing 1.6s ease-in-out infinite;
}
@keyframes avcbRing{
  0%{ transform: scale(0.9); opacity: 0.7; }
  70%{ transform: scale(1.05); opacity: 0.1; }
  100%{ opacity: 0; }
}
.avcb-alert-icon{
  font-weight: 900;
  font-size: 18px;
}
.avcb-alert-count{
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 999px;
  border: 2px solid rgba(8,13,26,0.95);
  min-width: 22px;
  text-align: center;
}

.avcb-alert-panel{
  position: fixed;
  right: 22px;
  bottom: 86px;
  width: 320px;
  max-width: calc(100vw - 28px);
  background: rgba(8,13,26,0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  z-index: 90;
}
.avcb-alert-panel.open{ display: flex; }
.avcb-alert-panel header{
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.avcb-alert-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}
.avcb-alert-item{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  text-align: left;
}
.avcb-alert-item strong{ display: block; font-size: 13px; }
.avcb-alert-item span{ display: block; font-size: 11px; color: var(--muted); }
.avcb-alert-tag{
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(249,115,22,0.2);
  border: 1px solid rgba(249,115,22,0.5);
}

@media (max-width: 768px){
  .avcb-wrapper table{ min-width: 0 !important; }
  .avcb-wrapper .table-responsive{
    border: none;
    background: transparent;
    padding: 0;
  }
  .avcb-wrapper table,
  .avcb-wrapper thead,
  .avcb-wrapper tbody,
  .avcb-wrapper th,
  .avcb-wrapper td,
  .avcb-wrapper tr{
    display: block;
    width: 100%;
  }
  .avcb-wrapper thead{ display: none !important; }
  .avcb-wrapper tbody{
    display: grid;
    gap: 12px;
  }
  .avcb-wrapper tbody tr{
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
    box-shadow: 0 12px 34px rgba(0,0,0,0.35);
    padding: 12px;
    overflow: hidden;
  }
  .avcb-wrapper tbody td{
    border-bottom: 1px solid rgba(31,41,55,0.55);
    padding: 10px 6px;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 44px;
  }
  .avcb-wrapper tbody td:last-child{
    border-bottom: none;
    padding-bottom: 6px;
  }
  .avcb-wrapper tbody td::before{
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
    opacity: 0.95;
  }
  .avcb-wrapper .table-actions{
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }
  .avcb-wrapper .table-actions .btn{
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
  }
}

@media (max-width: 640px){
  .avcb-alert-panel{
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* =========================================================
   Menu Lateral (Admin)
   ========================================================= */

.menu-lateral-list{
  display: grid;
  gap: 18px;
}
.menu-lateral-section h3{
  margin: 0 0 10px 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.menu-lateral-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.menu-item-card{
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(145deg, rgba(17,24,39,0.96), rgba(8,13,26,0.92));
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  display: grid;
  gap: 12px;
}
.menu-item-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.menu-item-head strong{
  display: block;
  font-size: 15px;
}
.menu-item-meta{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: rgba(148,163,184,0.8);
}
.menu-item-key{
  font-weight: 700;
  color: rgba(248,250,252,0.85);
}
.menu-item-url{
  opacity: 0.8;
}
.menu-item-body{
  display: grid;
  gap: 10px;
}
.menu-item-body label{
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.menu-item-body input{
  height: 40px;
  border-radius: 10px;
}

/* toggle */
.switch{
  position: relative;
  display: inline-block;
  width: 54px;
  height: 30px;
}
.switch input{
  opacity: 0;
  width: 0;
  height: 0;
}
.slider{
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.08);
  transition: all var(--t) var(--e);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
}
.slider:before{
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  top: 3px;
  background: #cbd5f5;
  transition: all var(--t) var(--e);
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.switch input:checked + .slider{
  background: rgba(249,115,22,0.3);
  border-color: rgba(249,115,22,0.6);
}
.switch input:checked + .slider:before{
  transform: translateX(24px);
  background: #fff;
}

@media (max-width: 640px){
  .menu-lateral-grid{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   IMPORTANTE (para ficar 100% perfeito):
   No seu PHP/HTML, coloque data-label em cada <td>.
   Exemplo:
     <td data-label="Itens">5</td>
     <td data-label="Ativo">Sim</td>
     <td data-label="Ações">...</td>
   Assim o CSS usa labels reais sem depender do nth-child.
   ========================================================= */
