/* =============================================================================
   SANKHYA ANALYTICA STUDIO — PURCHASES INTELLIGENCE
   Official Sankhya ERP Design System & Studio UX/UI Pattern
   ============================================================================= */

:root {
  /* Sankhya Studio Official Light Palette */
  --bg-page: #f4f6fa;
  --bg-canvas: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-rail: #ffffff;
  --bg-header: #ffffff;
  --bg-input: #f8fafc;
  --bg-hover: #f1f5f9;

  /* Typography Colors */
  --text-main: #1e293b;
  --text-primary: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-dark: #0f172a;

  /* Borders & Dividers */
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-light: #f1f5f9;

  /* Sankhya Green Branding */
  --sankhya-green: #00c058;
  --sankhya-green-hover: #00a84c;
  --sankhya-green-light: #e6f9f0;
  --sankhya-green-border: #a7f3d0;

  /* Accent & Status Colors */
  --primary: #00c058;
  --primary-hover: #00a84c;
  --primary-light: #e6f9f0;

  --accent-blue: #0284c7;
  --accent-purple: #7c3aed;
  --accent-orange: #f97316;
  --accent-pink: #e11d48;
  --accent-amber: #d97706;

  /* KPI Pastel Box Tints (Matching Reference Image) */
  --kpi-green-bg: #e8f8f0;
  --kpi-green-text: #00c058;
  --kpi-orange-bg: #fff4e6;
  --kpi-orange-text: #ea580c;
  --kpi-pink-bg: #ffeef2;
  --kpi-pink-text: #e11d48;
  --kpi-purple-bg: #f1effe;
  --kpi-purple-text: #7c3aed;

  /* Table In-Cell Heatmaps (Matching Reference Image) */
  --heatmap-green: #bbf7d0;
  --heatmap-green-text: #14532d;
  --heatmap-yellow: #fef08a;
  --heatmap-yellow-text: #713f12;
  --heatmap-orange: #fed7aa;
  --heatmap-orange-text: #7c2d12;

  /* Shadows & Radius */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-drawer: -4px 0 20px rgba(0, 0, 0, 0.08);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Layout Dimensions */
  --rail-width: 54px;
  --header-height: 54px;
}

/* Vue 3 v-cloak & Loader Bar */
[v-cloak] {
  display: none !important;
}

.studio-loader-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sankhya-green), #38bdf8, #a855f7, var(--sankhya-green));
  background-size: 200% 100%;
  animation: studioLoading 1.2s infinite linear;
  z-index: 1100;
}

@keyframes studioLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-main);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =============================================================================
   STUDIO TOP HEADER
   ============================================================================= */

.studio-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.studio-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-nav-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.studio-nav-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.studio-nav-toggle.active {
  background: var(--bg-hover);
  color: var(--sankhya-green);
}

/* Brand Logo */
.studio-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding-right: 8px;
}

.studio-brand-logo {
  height: 28px;
  max-height: 32px;
  max-width: 170px;
  width: auto;
  object-fit: contain;
  display: block;
}

.sankhya-logo-svg {
  width: 24px;
  height: 24px;
  display: block;
}

.sankhya-brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #1e293b;
}

/* Studio Tab Chip (e.g. Analytica Studio) */
.studio-tab-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  user-select: none;
}

.studio-tab-close {
  background: transparent;
  border: none;
  font-size: 14px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 2px;
}

.studio-tab-close:hover {
  color: #ef4444;
}

/* Breadcrumb / Screen Title */
.studio-screen-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  padding-left: 12px;
  border-left: 1px solid var(--border-color);
}

.studio-screen-icon {
  color: var(--text-muted);
  display: flex;
}

/* Header Right Actions */
.studio-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Redefinir Button */
.btn-studio-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-studio-reset:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text-main);
}

/* Search Box Pill */
.studio-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  width: 190px;
  transition: all 0.2s ease;
}

.studio-search-box:focus-within {
  background: #ffffff;
  border-color: var(--sankhya-green);
  box-shadow: 0 0 0 2px var(--sankhya-green-light);
  width: 230px;
}

.studio-search-box svg {
  color: var(--text-muted);
}

.studio-search-box input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 12px;
  color: var(--text-main);
  width: 100%;
}

.studio-search-box input::placeholder {
  color: #94a3b8;
}

/* Action Icons */
.studio-action-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.studio-icon-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.studio-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.studio-icon-btn.active {
  background: #e2e8f0;
  color: #0f172a;
}

.studio-dot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  border: 1.5px solid #ffffff;
}

.studio-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 2px;
}

/* User Profile Avatar with Sankhya Badge */
.studio-user-profile {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 4px;
  cursor: pointer;
}

.studio-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
}

.studio-avatar-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sankhya-green);
  border: 2px solid #ffffff;
}

/* =============================================================================
   SLIM VERTICAL ICON RAIL & SIDEBAR (SANKHYA ANALYTICA STUDIO)
   ============================================================================= */

.studio-rail {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--rail-width);
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  z-index: 1050;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, transform 0.22s ease;
  overflow: hidden;
}

.rail-scroll-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  gap: 3px;
}

.rail-scroll-content::-webkit-scrollbar {
  width: 4px;
}
.rail-scroll-content::-webkit-scrollbar-track {
  background: transparent;
}
.rail-scroll-content::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}
.rail-scroll-content::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

.rail-footer-content {
  flex: 0 0 auto;
  border-top: 1px solid var(--border-color);
  padding: 6px 6px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #f8fafc;
}

.rail-icons-top, .rail-icons-bottom {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.rail-section-header {
  display: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 10px 10px 4px 10px;
  user-select: none;
}

.rail-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  margin: 0 auto;
}

.rail-btn svg {
  flex-shrink: 0;
}

.rail-label {
  display: none;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.rail-badge {
  display: none;
  background: #ef4444;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.3;
}

.rail-btn:hover {
  background: var(--bg-hover);
  color: var(--sankhya-green);
}

.rail-btn:hover .rail-label {
  color: var(--text-main);
}

.rail-btn.active {
  background: #ecfdf5;
  color: var(--sankhya-green);
}

.rail-btn.active .rail-label {
  color: var(--sankhya-green);
  font-weight: 600;
}

.rail-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  background: var(--sankhya-green);
  border-radius: 0 2px 2px 0;
}

/* =============================================================================
   EXPANDED SIDEBAR / STUDIO RAIL (DESKTOP)
   ============================================================================= */

body.rail-expanded .studio-rail {
  width: 240px;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
}

body.rail-expanded .rail-scroll-content,
body.rail-expanded .rail-footer-content {
  align-items: stretch;
}

body.rail-expanded .rail-btn {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  justify-content: flex-start;
  gap: 10px;
  margin: 0;
}

body.rail-expanded .rail-label {
  display: inline-block;
}

body.rail-expanded .rail-section-header {
  display: block;
}

body.rail-expanded .rail-badge {
  display: inline-block;
}

body.rail-expanded .studio-canvas {
  margin-left: 240px;
}

body.rail-expanded .studio-left-filter-pill,
body.rail-expanded .studio-right-filter-pill,
body.rail-expanded .rail-filter-pill {
  left: 240px;
}

/* Backdrop for Mobile */
.studio-rail-backdrop {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.studio-rail-backdrop.active {
  display: block;
  opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .studio-rail {
    transform: translateX(-100%);
    width: 240px !important;
    align-items: stretch !important;
    padding: 8px 0 !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 1200;
  }

  .studio-rail.mobile-open,
  body.rail-expanded .studio-rail {
    transform: translateX(0);
  }

  .studio-canvas {
    margin-left: 0 !important;
    padding: 14px 14px 40px 14px;
  }

  .studio-left-filter-pill {
    left: 0 !important;
  }

  .rail-btn {
    width: 100% !important;
    height: 38px !important;
    padding: 0 10px !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    margin: 0 !important;
  }

  .rail-label {
    display: inline-block !important;
  }

  .rail-section-header {
    display: block !important;
  }

  .rail-badge {
    display: inline-block !important;
  }
}

/* =============================================================================
   FLOATING FILTER PILL (LEFT SIDE OF SCREEN)
   ============================================================================= */

/* Floating filter pill removed per user request */
.studio-left-filter-pill,
.studio-right-filter-pill,
.rail-filter-pill {
  display: none !important;
}

/* =============================================================================
   MAIN CANVAS & LAYOUT
   ============================================================================= */

.studio-canvas {
  margin-left: var(--rail-width);
  margin-top: var(--header-height);
  padding: 16px 22px 40px 22px;
  min-height: calc(100vh - var(--header-height));
  background: var(--bg-canvas);
  transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================================
   KPI SCORECARD ROW (4 CARDS - SANKHYA STUDIO PATTERN)
   ============================================================================= */

.studio-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1400px) {
  .studio-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .studio-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.studio-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 130px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: visible;
}

.studio-kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Top Row inside KPI Card (Title on left, Icon on right) */
.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
}

/* Icon Box (Pastel Tints) */
.kpi-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.kpi-icon-box.green {
  background: var(--kpi-green-bg);
  color: var(--kpi-green-text);
}

.kpi-icon-box.orange {
  background: var(--kpi-orange-bg);
  color: var(--kpi-orange-text);
}

.kpi-icon-box.pink {
  background: var(--kpi-pink-bg);
  color: var(--kpi-pink-text);
}

.kpi-icon-box.purple {
  background: var(--kpi-purple-bg);
  color: var(--kpi-purple-text);
}

/* Metrics Content */
.kpi-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  min-width: 0;
  width: 100%;
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.3;
}

.kpi-value {
  font-size: clamp(20px, 1.45vw, 26px);
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.3px;
  line-height: 1.25;
  margin-bottom: 8px;
  word-break: normal;
  white-space: nowrap;
}

.kpi-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: auto;
  width: 100%;
}

.kpi-subtext {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: normal;
}

/* Target Progress Capsule Pill */
.kpi-progress-capsule {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================================================
   MIDDLE SECTION: COMBO CHART & FORNECEDORES TABLE
   ============================================================================= */

.studio-grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1200px) {
  .studio-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Standard Studio Card */
.studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.studio-card-header {
  padding: 14px 18px 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.studio-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.studio-card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-tool-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.studio-tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Card Search Bar (Inside Table Card) */
.in-card-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  margin: 0 18px 10px 18px;
  width: 180px;
}

.in-card-search input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 11.5px;
  color: var(--text-main);
  width: 100%;
}

.in-card-search input::placeholder {
  color: #94a3b8;
}

/* =============================================================================
   DESEMPENHO POR FORNECEDOR (TABLE & IN-CELL HEATMAPS)
   ============================================================================= */

.studio-table-container {
  overflow-x: auto;
  max-height: 420px;
}

.studio-table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.studio-table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.studio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.studio-table th {
  background: #ffffff;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 11.5px;
  user-select: none;
  white-space: nowrap;
}

.studio-table th.num {
  text-align: right;
}

.studio-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  white-space: nowrap;
}

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

.studio-table tr:hover td {
  background: #fbfcfe;
}

/* Table Footer Row (Total Bold) */
.studio-table tfoot tr td {
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  font-weight: 800;
  color: var(--text-dark);
  padding: 9px 12px;
}

/* In-Cell Concentration Heatmap Badges */
.heatmap-cell {
  display: inline-block;
  min-width: 58px;
  text-align: right;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
}

.heatmap-cell.tier-green {
  background: var(--heatmap-green);
  color: var(--heatmap-green-text);
}

.heatmap-cell.tier-yellow {
  background: var(--heatmap-yellow);
  color: var(--heatmap-yellow-text);
}

.heatmap-cell.tier-orange {
  background: var(--heatmap-orange);
  color: var(--heatmap-orange-text);
}

/* =============================================================================
   BOTTOM SECTION: 3-COLUMN GRID
   ============================================================================= */

.studio-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  align-items: stretch;
}

@media (max-width: 1280px) {
  .studio-grid-3col {
    grid-template-columns: 1fr;
  }
}

/* Callout tags for Doughnut Chart */
.donut-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: normal;
  line-height: 1.25;
  transition: transform 0.1s ease;
}

/* Regional State Progress Bars */
.uf-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-size: 12px;
}

.uf-bar-track {
  flex-grow: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin: 0 12px;
  overflow: hidden;
}

.uf-bar-fill {
  height: 100%;
  background: #a855f7;
  border-radius: 3px;
}

/* =============================================================================
   SLIDE-OUT FILTER DRAWER
   ============================================================================= */

.studio-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(2px);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.studio-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.studio-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: 0;
  width: 350px;
  background: #ffffff;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 1300;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.studio-drawer.active {
  transform: translateX(0);
}

.studio-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.studio-drawer-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.drawer-field-group {
  margin-bottom: 16px;
}

.drawer-field-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.drawer-select, .drawer-input {
  width: 100%;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.drawer-select:focus, .drawer-input:focus {
  border-color: var(--sankhya-green);
  background: #ffffff;
}

.studio-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.btn-drawer-apply {
  flex: 1;
  padding: 9px;
  background: var(--sankhya-green);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.btn-drawer-apply:hover {
  background: var(--sankhya-green-hover);
}

.btn-drawer-reset {
  padding: 9px 14px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

/* Common UI Elements across other views (Tables, Forms, Badges) */
.card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.card-body {
  padding: 18px;
}

.form-control, .form-select {
  width: 100%;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--sankhya-green);
  box-shadow: 0 0 0 2px var(--sankhya-green-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--sankhya-green);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--sankhya-green-hover);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border-color);
  color: #475569;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text-main);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: #475569;
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text-main);
}

.btn-success {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

/* Tamanhos Padronizados de Botão */
.btn-sm {
  padding: 4px 10px;
  font-size: 11.5px;
  line-height: 1.35;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.btn-xs {
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.3;
  border-radius: 4px;
  font-weight: 500;
}

/* Padronização Compacta das Ações em Tabelas */
.data-table td .btn,
.data-table .btn-sm {
  padding: 4px 10px !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  border-radius: 4px !important;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }

.status-badge-active { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.status-badge-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.status-badge-disconnected { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.status-badge-authenticated { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }

/* Filter Toolbar & Forms for List Views */
.filter-toolbar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Data Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11.5px;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* Pagination Styles */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn, .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover, .page-link:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--text-dark);
}

.page-btn.active, .page-item.active .page-link {
  background: var(--sankhya-green);
  border-color: var(--sankhya-green);
  color: #ffffff;
  font-weight: 700;
}

/* Data Bars (Horizontal Progress inside Tables) */
.data-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-bar {
  flex-grow: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.data-bar-fill {
  height: 100%;
  background: var(--sankhya-green);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Standard Detail KPI Cards (for detail templates) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.kpi-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  border-top: 1px solid #f1f5f9;
  padding-top: 6px;
}

/* Badge Status Styles */
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-approved { background: #dcfce7; color: #15803d; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-completed, .badge-received { background: #e0f2fe; color: #0369a1; }
.badge-partially_received { background: #fef08a; color: #854d0e; }
.badge-urgent, .badge-critical { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.badge-high { background: #fed7aa; color: #9a3412; }
.badge-medium { background: #fef3c7; color: #b45309; }
.badge-low { background: #f1f5f9; color: #475569; }

/* Interactive Real Brazil Map Styles (Matching Analytica Studio) */
.brazil-map-card-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 14px 16px;
  min-height: 220px;
}

.brazil-map-wrapper {
  position: relative;
  width: 100%;
  max-width: 280px;
  height: 195px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brazil-real-svg {
  width: 100%;
  height: 100%;
  max-height: 195px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.04));
  overflow: visible;
}

.brazil-state-real {
  cursor: pointer;
  stroke: #cbd5e1;
  stroke-width: 1.2;
  stroke-linejoin: round;
  transition: all 0.18s ease;
}

.brazil-state-real:hover {
  stroke: #7c3aed;
  stroke-width: 2.5;
  filter: brightness(0.92);
}

.map-state-badge {
  position: absolute;
  bottom: 8px;
  left: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .studio-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .studio-grid-2col { grid-template-columns: 1fr; }
  .studio-grid-3col { grid-template-columns: 1fr; }
}

