:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --line: #d7dde6;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { margin: 4px 0 0; font-size: 28px; }
.eyebrow, .section-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.topnav { display: flex; gap: 10px; flex-wrap: wrap; }
.topnav a {
  text-decoration: none; color: var(--text); padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
.topnav a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-shell { padding: 24px 28px 40px; }
.app-back-row {
  display: flex;
  align-items: center;
  margin: 0 0 16px;
}
.app-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
}
.app-back-button span[aria-hidden="true"] { font-size: 18px; line-height: 1; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.04);
}
.hero-panel { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.hero-panel h2 { margin: 6px 0; }
.group-filter-panel { margin-bottom: 20px; padding: 12px 16px; }
.group-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .55);
  background: #f8fafc;
  color: #0f172a;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.chip-active {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
  background: #fff;
}
.search-row { display: flex; gap: 10px; min-width: min(460px, 100%); }
.search-row input {
  flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px;
}
.search-row button, .primary-btn, .secondary-btn, .danger-btn, .success-btn {
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; text-decoration: none;
  font-weight: 600;
}
.search-row button, .primary-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.secondary-btn { background: #fff; color: var(--text); }
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #f87171;
  color: #fff;
  border-color: #f87171;
  box-shadow: 0 4px 8px rgba(185, 28, 28, .28);
}
.danger-btn::before {
  content: "X";
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
}
.danger-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
}
.success-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #86d99a;
  color: #fff;
  border-color: #86d99a;
  box-shadow: 0 4px 8px rgba(22, 101, 52, .24);
}
.success-btn::before {
  content: "✓";
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
}
.success-btn:hover {
  background: #62c97d;
  border-color: #62c97d;
}
.layout-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.sidebar { align-self: start; position: sticky; top: 100px; }
.content-stack { display: grid; gap: 20px; }
.side-list { display: grid; gap: 10px; }
.side-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px;
  text-decoration: none; border: 1px solid var(--line); color: var(--text); background: #fff;
}
.side-item.active { background: var(--accent-soft); border-color: #93c5fd; }
.side-item.disabled { opacity: .45; pointer-events: none; }
.top-structure-grid, .current-sub { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.current-sub { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row h2 { margin: 0; }
.badge { background: #eef2ff; color: #334155; border: 1px solid #c7d2fe; padding: 6px 10px; border-radius: 999px; }
.actions-inline { display: flex; gap: 10px; }
.breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.crumb {
  text-decoration: none; color: var(--text); padding: 8px 10px; border-radius: 999px; background: #f8fafc; border: 1px solid var(--line);
}
.crumb.current { background: var(--accent-soft); border-color: #93c5fd; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; }
.table-wrap { overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:hover td { background: #fafcff; }
.mono { font-family: Consolas, "Courier New", monospace; }
.muted { color: var(--muted); }
.compat-cell {
  max-width: 360px;
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
}
.actions-cell { white-space: nowrap; }
.btn-link {
  text-decoration: none; color: var(--accent); font-weight: 600; margin-right: 12px;
}
.empty { text-align: center; color: var(--muted); padding: 24px 10px; }
.compact { margin-bottom: 14px; }
@media (max-width: 980px) {
  .layout-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero-panel, .top-structure-grid, .current-sub, .topbar { flex-direction: column; align-items: stretch; }
  .search-row { min-width: 0; }
}


.selected-row td {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}
.selected-row:hover td {
  background: #dbeafe;
}
.selected-row td:first-child {
  box-shadow: inset 4px 0 0 var(--accent);
}
.with-viewer .content-stack {
  gap: 20px;
}
.pdf-panel {
  overflow: hidden;
}
.pdf-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.pdf-frame.standalone {
  min-height: calc(100vh - 220px);
}
.sharepoint-viewer {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(16, 18, 20, .88);
  color: #fff;
  overflow: hidden;
}
.sp-viewer-topbar {
  height: 58px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(260px, 520px) minmax(170px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  background: #111820;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}
.sp-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sp-viewer-actions.right {
  justify-content: flex-end;
}
.sp-file-pill {
  height: 38px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 6px;
  background: rgba(255,255,255,.10);
  color: #fff;
}
.sp-file-icon {
  flex: 0 0 auto;
  padding: 3px 5px;
  border-radius: 3px;
  background: #f3f4f6;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 800;
}
.sp-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-icon-btn,
.sp-text-btn {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 7px;
  background: rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.sp-text-btn {
  width: auto;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 650;
}
.sp-icon-btn:hover,
.sp-text-btn:hover {
  background: rgba(255,255,255,.15);
}
.sp-document-stage {
  position: relative;
  height: calc(100vh - 58px);
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0 92px 0;
}
.sp-pdf-frame {
  width: min(100%, 920px);
  height: 100%;
  border: 0;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.sp-pdf-frame embed {
  width: 100%;
  height: 100%;
  display: block;
}
.sp-pdf-fallback {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  background: #fff;
  font-weight: 700;
  text-decoration: none;
}
.pdf-overlay-native .sp-viewer-topbar,
.pdf-overlay-native .sp-bottom-toolbar,
.pdf-overlay-native .sp-nav-btn {
  display: none;
}
.pdf-overlay-native .sp-document-stage {
  height: 100vh;
  padding: 0;
}
.pdf-overlay-native .sp-pdf-frame {
  width: 100%;
  height: 100%;
  box-shadow: none;
}
.sp-native-close,
.sp-native-open {
  position: fixed;
  top: 18px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 6px;
  background: rgba(32,32,32,.82);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sp-native-close {
  right: 14px;
}
.sp-native-open {
  right: 58px;
}
.sp-native-close:hover,
.sp-native-open:hover {
  background: rgba(64,64,64,.95);
}
.sp-nav-btn {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.40);
  background: rgba(20, 24, 28, .62);
  color: #fff;
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}
.sp-nav-btn.prev { left: 44px; }
.sp-nav-btn.next { right: 44px; }
.sp-bottom-toolbar {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 9px 16px;
  border-radius: 28px;
  background: #101010;
  color: #fff;
  box-shadow: 0 14px 34px rgba(0,0,0,.35);
  transform: translateX(-50%);
}
.sp-icon-btn.compact,
.sp-icon-static {
  min-width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  font-size: 20px;
}
.sp-icon-static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.92);
}
.sp-page-count {
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  font-weight: 700;
}
.sp-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.24);
}
@media (max-width: 860px) {
  .sp-viewer-topbar {
    grid-template-columns: 1fr auto;
  }
  .sp-file-pill {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .sp-viewer-topbar {
    height: auto;
  }
  .sp-document-stage {
    height: calc(100vh - 104px);
    padding: 0 14px;
  }
  .sp-nav-btn {
    display: none;
  }
  .sp-bottom-toolbar {
    bottom: 14px;
  }
}

/* --- Top controls (Banco/Grupo) --- */
.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.db-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-color: rgba(255, 255, 255, 0.06);
  color: inherit;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;

  padding: 8px 34px 8px 12px;
  line-height: 1.1;

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
  outline: none;

  /* caret */
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(30,41,59,0.65) 50%),
    linear-gradient(135deg, rgba(30,41,59,0.65) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
}

.db-form select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.db-form select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* screen-reader only helper */
.sr-only {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 640px) {
  .top-controls {
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
    justify-content: flex-start;
  }
  .db-form {
    width: 100%;
    flex-wrap: wrap;
  }
  .db-form select {
    width: 100%;
  }
}

.floating-quote-btn{
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
  transition: transform .15s ease, box-shadow .15s ease;
}

.floating-quote-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0,0,0,.22);
}

@media (max-width: 768px){
  .floating-quote-btn{
    right: 16px;
    bottom: 16px;
    padding: 11px 16px;
    font-size: 14px;
  }
}


.float-menu-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ffffff;
  color: #1e3a8a;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}

.float-menu-caret {
  font-size: 11px;
  opacity: .9;
}
