/* ==========================================================================
   IMPULSIONAAI - DESIGN SYSTEM & STYLESHEET (LIGHT PREMIUM) - ATUALIZADO OS
   ========================================================================== */

/* VARIABLES & THEME CONFIGURATION */
:root {
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Inter', sans-serif;

  /* Color Palette: White background, Black details, Baby Blue/Navy accents */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  
  --text-main: #000000;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-color-dark: #0f172a;
  --border-focus: #0ea5e9;

  /* Accent Colors */
  --accent-blue-baby: #38bdf8;
  --accent-blue-medium: #0ea5e9;
  --accent-blue-navy: #0f172a;
  --accent-blue-hover: #0284c7;

  /* Operational Colors */
  --color-green: #10b981;
  --color-green-light: #ecfdf5;
  --color-amber: #f59e0b;
  --color-amber-light: #fef3c7;
  --color-blue: #3b82f6;
  --color-blue-light: #eff6ff;
  --color-purple: #8b5cf6;
  --color-purple-light: #f5f3ff;
  --color-pink: #ec4899;
  --color-pink-light: #fdf2f8;
  --color-red: #ef4444;
  --color-red-light: #fef2f2;
  --color-orange: #f97316;
  --color-orange-light: #fff7ed;

  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-premium: 0 20px 25px -5px rgba(15, 23, 42, 0.03), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Animations */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* BASE STYLES & RESET */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-body);
  background-color: var(--bg-app);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-title);
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.25;
}

/* TYPOGRAPHY HELPERS */
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-dark { color: var(--text-dark); }
.text-green { color: var(--color-green); }
.text-blue { color: var(--accent-blue-medium); }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.flex-grow { flex-grow: 1; }
.overflow-y { overflow-y: auto; }
.flex-col { display: flex; flex-direction: column; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mr-2 { margin-right: 8px; }

/* APP LAYOUT STRUCTURE */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR STYLING */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  background-color: var(--accent-blue-navy);
  color: var(--bg-card);
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-details h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-details span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 1px solid transparent;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-family-body);
  font-size: 0.925rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
  position: relative;
}

.nav-item svg {
  transition: var(--transition-fast);
}

.nav-item:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.nav-item:hover svg {
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--accent-blue-navy);
  color: #ffffff;
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--accent-blue-baby);
}

.nav-item .badge {
  position: absolute;
  right: 16px;
  background-color: var(--color-amber);
  color: #ffffff;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-profile .avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--border-color-dark);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-title);
  font-weight: 700;
  font-size: 0.875rem;
}

.user-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-info span {
  font-size: 0.75rem;
  color: var(--color-green);
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-info span::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--color-green);
  border-radius: 50%;
}

/* MAIN CONTENT AREA */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* MAIN HEADER */
.main-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.header-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title p {
  font-size: 0.875rem;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* SEARCH BAR */
.search-bar {
  display: flex;
  align-items: center;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  gap: 8px;
  width: 320px;
  transition: var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--border-color-dark);
  box-shadow: 0 0 0 1px var(--border-color-dark);
}

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

.search-bar input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-family-body);
  font-size: 0.875rem;
  color: var(--text-dark);
  width: 100%;
}

.search-bar input::placeholder {
  color: var(--text-light);
}

/* DYNAMIC CONTENT BODY */
.content-body {
  padding: 30px 40px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* TAB PANELS TRIGGER */
.tab-panel {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  flex-grow: 1;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-family-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.btn-primary:hover {
  background-color: #222;
  border-color: #222;
}

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

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: var(--text-light);
}

.btn-danger {
  background-color: var(--color-red-light);
  color: var(--color-red);
  border-color: var(--color-red-light);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  position: relative;
}

.btn-icon:hover {
  background-color: #f1f5f9;
  border-color: var(--text-light);
}

.notification-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: var(--accent-blue-medium);
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

/* METRICS GRID (DASHBOARD) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-value {
  font-family: var(--font-family-title);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 8px;
}

.metric-trend {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* METRICS ICON COLORS */
.bg-sky-light { background-color: var(--color-blue-light); }
.text-sky { color: var(--color-blue); }
.bg-emerald-light { background-color: var(--color-green-light); }
.text-emerald { color: var(--color-green); }
.bg-amber-light { background-color: var(--color-amber-light); }
.text-amber { color: var(--color-amber); }
.bg-purple-light { background-color: var(--color-purple-light); }
.text-purple { color: var(--color-purple); }

/* DASHBOARD DUAL GRID */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  flex-grow: 1;
}

.dashboard-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 20px;
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.card-header span {
  font-size: 0.825rem;
  display: block;
  margin-top: 2px;
}

.chart-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  position: relative;
  min-height: 250px;
}

/* RECENT ACTIVITY FEED */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-content {
  flex-grow: 1;
}

.activity-user {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-dark);
}

.activity-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

.bg-dot-success { background-color: var(--color-green); }
.bg-dot-info { background-color: var(--color-blue); }
.bg-dot-warning { background-color: var(--color-amber); }
.bg-dot-default { background-color: var(--text-light); }

/* ==========================================================================
   OS STYLE LAYOUT - PROJETOS & PROPOSTAS (TAB 2)
   ========================================================================== */

/* Contadores Superiores */
.os-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.os-stat-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.os-stat-box.border-gray { border-left: 4px solid var(--text-light); }
.os-stat-box.border-amber { border-left: 4px solid var(--color-amber); }
.os-stat-box.border-sky { border-left: 4px solid var(--accent-blue-baby); }
.os-stat-box.border-orange { border-left: 4px solid var(--color-orange); }
.os-stat-box.border-green { border-left: 4px solid var(--color-green); }

.stat-num {
  font-family: var(--font-family-title);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Barra de Filtros */
.os-filters-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filter-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-col label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
}

.filter-col input[type="text"],
.filter-col select,
.filter-col input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-size: 0.825rem;
  outline: none;
  background-color: #ffffff;
}

.filter-col input[type="text"] {
  min-width: 200px;
}

.filter-col input:focus,
.filter-col select:focus {
  border-color: var(--border-color-dark);
}

.width-150 { width: 150px; }
.width-130 { width: 130px; }

.filter-col-btn {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 38px;
}

.filter-col-btn .btn {
  padding: 8px 16px;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
}

/* Tabela de Listagem Unificada */
.table-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.unified-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
  table-layout: fixed;
}

.unified-table th:nth-child(1),
.unified-table td:nth-child(1) {
  width: 90px;
}

.unified-table th:nth-child(2),
.unified-table td:nth-child(2) {
  width: 110px;
}

.unified-table th:nth-child(3),
.unified-table td:nth-child(3) {
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-table th:nth-child(4),
.unified-table td:nth-child(4) {
  width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-table th:nth-child(5),
.unified-table td:nth-child(5) {
  width: 125px;
}

.unified-table th:nth-child(6),
.unified-table td:nth-child(6) {
  width: 125px;
}

.unified-table th:nth-child(7),
.unified-table td:nth-child(7) {
  width: 180px;
}

.unified-table th:nth-child(8),
.unified-table td:nth-child(8) {
  width: 120px;
  text-align: right;
}

.unified-table th {
  background-color: #f8fafc;
  color: var(--text-dark);
  font-weight: 700;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.unified-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dark);
}

.unified-table tr:last-child td {
  border-bottom: none;
}

.unified-table tr {
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.unified-table tr:hover {
  background-color: #f8fafc;
}

.badge-tipo-os {
  font-size: 0.675rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.badge-tipo-os.projeto {
  background-color: var(--color-blue-light);
  color: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-tipo-os.proposta {
  background-color: var(--color-amber-light);
  color: var(--color-amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-tag-os {
  font-size: 0.675rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  display: inline-block;
}

.status-tag-os.briefing { background-color: var(--color-purple-light); color: var(--color-purple); }
.status-tag-os.fila { background-color: #f1f5f9; color: var(--text-muted); }
.status-tag-os.producao { background-color: var(--color-blue-light); color: var(--color-blue); }
.status-tag-os.revisao { background-color: var(--color-pink-light); color: var(--color-pink); }
.status-tag-os.entregue { background-color: var(--color-green-light); color: var(--color-green); }

/* TAB 3: KANBAN PRODUCTION */
.kanban-wrapper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  overflow-x: auto;
  flex-grow: 1;
  align-items: stretch;
  min-height: 60vh;
}

.kanban-column {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  max-height: calc(100vh - 160px);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.column-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.column-dot.bg-purple { background-color: var(--color-purple); }
.column-dot.bg-amber { background-color: var(--color-amber); }
.column-dot.bg-blue { background-color: var(--color-blue); }
.column-dot.bg-pink { background-color: var(--color-pink); }
.column-dot.bg-green { background-color: var(--color-green); }

.kanban-column-header h3 {
  font-size: 0.875rem;
  font-weight: 700;
  flex-grow: 1;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.column-count {
  background-color: var(--bg-app);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kanban-column-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  overflow-y: auto;
  min-height: 100px;
  padding: 2px;
}

/* Custom Scrollbar for columns */
.kanban-column-body::-webkit-scrollbar {
  width: 4px;
}
.kanban-column-body::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: var(--radius-full);
}

/* KANBAN TASK CARD */
.kanban-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--text-dark);
}

.task-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 8px;
}

.tag-site { background-color: var(--color-blue-light); color: var(--color-blue); }
.tag-arte { background-color: var(--color-purple-light); color: var(--color-purple); }
.tag-trafego { background-color: var(--color-amber-light); color: var(--color-amber); }
.tag-branding { background-color: var(--color-pink-light); color: var(--color-pink); }
.tag-outros { background-color: #f1f5f9; color: var(--text-muted); }

.kanban-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.task-client {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.task-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  font-size: 0.725rem;
  color: var(--text-muted);
}

.task-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.task-deadline.deadline-urgent {
  color: var(--color-red);
}

.task-assignee {
  background-color: var(--border-color-dark);
  color: #ffffff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.65rem;
}

/* Priority Card Borders */
.kanban-card.priority-Alta {
  border-left: 3px solid var(--color-red);
}
.kanban-card.priority-Média {
  border-left: 3px solid var(--color-amber);
}
.kanban-card.priority-Baixa {
  border-left: 3px solid var(--color-green);
}

/* ==========================================================================
   MODAL SYSTEM & LAYOUT
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow-premium);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-large {
  max-width: 1100px;
}

.modal-small {
  max-width: 400px;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
}

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

.modal-form {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.col-8 { width: 66.66%; }
.col-5 { width: 41.66%; }
.col-4 { width: 33.33%; }
.col-6 { width: 50%; }
.col-3 { width: 25%; }
.col-25 { width: 20.83%; }
.col-2 { width: 16.66%; }

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-fast);
  background-color: #ffffff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
}

.form-help {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 12px;
  flex-shrink: 0;
}

/* ==========================================================================
   DYNAMIC ESCOPO TABLE IN MODAL FORM
   ========================================================================== */
.escopo-section {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.section-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--text-dark);
  font-weight: 700;
  margin-bottom: 12px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.escopo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
  text-align: left;
}

.escopo-table th {
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.725rem;
}

.escopo-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.escopo-table input,
.escopo-table select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  outline: none;
  background-color: #ffffff;
}

.escopo-table input:focus,
.escopo-table select:focus {
  border-color: var(--border-focus);
}

.btn-remove-row {
  background: none;
  border: none;
  color: var(--color-red);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-remove-row:hover {
  color: #c92a2a;
}

/* Financeiro Bloco */
.financial-row {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.financial-total-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 250px;
  box-shadow: var(--shadow-sm);
}

.total-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.total-value {
  font-family: var(--font-family-title);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin: 2px 0;
}

.total-sub {
  font-size: 0.65rem;
  color: var(--text-light);
}

/* Anexos e Alertas */
.attachments-section {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.attachments-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.attachment-box {
  background-color: #f8fafc;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.attachment-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.file-upload-wrapper input[type="file"] {
  font-size: 0.8rem;
  width: 100%;
}

.info-alert-box {
  background-color: var(--color-blue-light);
  color: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.825rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
}

.warning-alert-box {
  background-color: var(--color-amber-light);
  color: var(--color-amber);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.8rem;
  line-height: 1.4;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* PROJECT DETAILS MODAL */
.project-details-container {
  max-width: 850px;
}

.project-header-info h2 {
  margin-top: 4px;
  font-size: 1.5rem;
}

.badge-type {
  font-size: 0.65rem;
  font-weight: 700;
  background-color: #e2e8f0;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  text-transform: uppercase;
}

.project-details-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  flex-grow: 1;
  overflow: hidden;
}

.project-main-info {
  padding: 24px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.project-meta-sidebar {
  padding: 24px;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.details-section h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* COMMENTS SYSTEM */
.comments-section {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.comment-card {
  background-color: #f8fafc;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.725rem;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 700;
  color: var(--text-dark);
}

.comment-date {
  color: var(--text-light);
}

.comment-body {
  font-size: 0.825rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.comment-input-row {
  display: flex;
  gap: 8px;
}

.comment-input-row input {
  flex-grow: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-size: 0.875rem;
  outline: none;
}

.comment-input-row input:focus {
  border-color: var(--border-color-dark);
}

/* SIDEBAR META */
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meta-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.form-select-sm, .form-input-sm {
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  outline: none;
  background-color: #ffffff;
}

.form-select-sm:focus, .form-input-sm:focus {
  border-color: var(--border-color-dark);
}

.meta-actions {
  margin-top: auto;
  padding-top: 10px;
}

/* TOAST / NOTIFICATION */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background-color: var(--border-color-dark);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  opacity: 0;
  animation: slideIn 0.3s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* RESPONSIEVNESS */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .kanban-wrapper {
    align-items: flex-start;
  }
  .os-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .main-header {
    padding: 16px 20px;
  }
  .content-body {
    padding: 20px;
  }
  .search-bar {
    width: 100%;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .col-8, .col-5, .col-4, .col-6, .col-3, .col-25, .col-2 {
    width: 100%;
  }
  .project-details-grid {
    grid-template-columns: 1fr;
    max-height: unset;
  }
  .project-main-info {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .os-filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .width-150, .width-130 {
    width: 100%;
  }
  .attachments-grid {
    grid-template-columns: 1fr;
  }
}

/* LOGIN SCREEN STYLE */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-app);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-screen.active {
  display: flex;
}

.login-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 420px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  margin-bottom: 8px;
}

.logo-icon-large {
  background-color: var(--accent-blue-navy);
  color: #ffffff;
  padding: 12px;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.login-brand h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-brand span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.25px;
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-family-body);
  font-size: 0.95rem;
  outline: none;
  background-color: #f8fafc;
  transition: var(--transition-fast);
}

.login-form input:focus {
  border-color: var(--border-color-dark);
  background-color: #ffffff;
  box-shadow: 0 0 0 1px var(--border-color-dark);
}

.login-error-msg {
  color: var(--color-red);
  font-size: 0.825rem;
  font-weight: 500;
  text-align: center;
  min-height: 20px;
}

/* SIDEBAR PROFILE & LOGOUT STYLE */
.user-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

#user-role {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: 1px solid transparent;
  color: var(--text-light);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background-color: var(--color-red-light);
  color: var(--color-red);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Body class helper to hide main app container */
body.not-logged-in .app-container {
  display: none !important;
}

/* ==========================================================================
   SUBTAB SYSTEM, ROLES MANAGEMENT & AUDIT LOGS
   ========================================================================== */
.sub-tab-nav {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  margin-bottom: 1.5rem;
  padding-bottom: 0.25rem;
}

.sub-tab-item {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.sub-tab-item:hover {
  color: var(--text-dark, #0f172a);
}

.sub-tab-item.active {
  color: var(--accent-blue-navy, #0f172a);
  font-weight: 700;
}

.sub-tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent-blue-navy, #0f172a);
  border-radius: 2px;
}

.subtab-panel {
  display: none;
}

.subtab-panel.active {
  display: block;
}

/* Roles Layout */
.roles-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .roles-grid {
    grid-template-columns: 1fr;
  }
}

.permissions-checklist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  background-color: #f8fafc;
  padding: 16px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  max-height: 280px;
  overflow-y: auto;
}

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

.permission-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm, 4px);
  transition: background-color var(--transition-fast);
}

.permission-item:hover {
  background-color: #f1f5f9;
}

.permission-item input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
}

.permission-label {
  display: flex;
  flex-direction: column;
}

.permission-label strong {
  font-size: 0.85rem;
  color: var(--text-dark, #0f172a);
  text-transform: none;
}

.permission-label small {
  font-size: 0.725rem;
  color: var(--text-muted, #64748b);
  font-weight: 400;
  line-height: 1.3;
}

/* Tables inside roles & users */
.roles-table,
.users-roles-table,
.audit-logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.roles-table th,
.users-roles-table th,
.audit-logs-table th {
  background-color: #f8fafc;
  padding: 12px 16px;
  color: var(--text-muted, #64748b);
  font-weight: 700;
  border-bottom: 2px solid var(--border-color, #e2e8f0);
  text-transform: uppercase;
  font-size: 0.725rem;
}

.roles-table td,
.users-roles-table td,
.audit-logs-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  vertical-align: middle;
}

.role-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.role-perm-badge {
  background-color: #e2e8f0;
  color: #475569;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.role-actions {
  display: flex;
  gap: 8px;
}

.btn-table-action {
  background: none;
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-table-action.edit {
  color: var(--color-blue, #3b82f6);
}
.btn-table-action.edit:hover {
  background-color: var(--color-blue-light, rgba(59, 130, 246, 0.05));
  border-color: var(--color-blue, #3b82f6);
}

.btn-table-action.delete {
  color: var(--color-red, #ef4444);
}
.btn-table-action.delete:hover {
  background-color: var(--color-red-light, rgba(239, 68, 68, 0.05));
  border-color: var(--color-red, #ef4444);
}

/* User role styling */
.users-roles-table select {
  padding: 6px 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-sm, 4px);
  background-color: #ffffff;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.users-roles-table select:focus {
  border-color: var(--border-color-dark, #0f172a);
}

/* Audit logs specific */
.log-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-user-avatar {
  background-color: var(--accent-blue-navy, #0f172a);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.7rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.log-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
}

.log-badge.login {
  background-color: var(--color-blue-light);
  color: var(--color-blue);
}

.log-badge.warning {
  background-color: var(--color-amber-light);
  color: var(--color-amber);
}

.log-badge.success {
  background-color: var(--color-green-light);
  color: var(--color-green);
}

.log-badge.default {
  background-color: #f1f5f9;
  color: var(--text-muted);
}
