/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0B0F2E;
  --navy-mid:   #111540;
  --navy-card:  #161A45;
  --navy-light: #1E2355;
  --border:     rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --blue:       #3B82F6;
  --blue-dark:  #2563EB;
  --green:      #22C55E;
  --red:        #EF4444;
  --yellow:     #F59E0B;
  --text:       #E8EAF6;
  --text-dim:   rgba(232,234,246,0.55);
  --text-faint: rgba(232,234,246,0.30);
  --radius:     10px;
  --radius-sm:  6px;
  --header-h:   56px;
  --sidebar-w:  220px;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--navy);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Light Mode ───────────────────────────────────────────────────────────── */

body.light-mode {
  --navy:         #F1F3FA;
  --navy-mid:     #FFFFFF;
  --navy-card:    #FFFFFF;
  --navy-light:   #E4E8F5;
  --border:       rgba(0,0,0,0.09);
  --border-hover: rgba(0,0,0,0.22);
  --text:         #111537;
  --text-dim:     rgba(17,21,55,0.62);
  --text-faint:   rgba(17,21,55,0.38);
}

body.light-mode .header {
  background: #FFFFFF;
  border-bottom-color: rgba(0,0,0,0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

body.light-mode .nav-sidebar {
  background: #F8F9FE;
  border-right-color: rgba(0,0,0,0.08);
}

body.light-mode .nav-section-label { color: rgba(17,21,55,0.35); }
html.light-mode body.login-page { background: radial-gradient(ellipse at 50% 0%, #dce2f5 0%, #f1f3fa 70%); }
html.light-mode .login-card { background: #FFFFFF; border-color: rgba(0,0,0,0.09); }
html.light-mode .login-subtitle { color: rgba(17,21,55,0.55); }
html.light-mode .field input { background: #f1f3fa; border-color: rgba(0,0,0,0.1); color: #111537; }
html.light-mode .field label { color: rgba(17,21,55,0.55); }

body.light-mode .code-block,
body.light-mode .code-block-inline,
body.light-mode .req-code-block {
  background: #F0F2FA;
  color: #2a3060;
  border-color: rgba(0,0,0,0.08);
}

body.light-mode .chat-input-area { background: #FFFFFF; }
body.light-mode .chat-msg-assistant .msg-bubble {
  background: #F0F2FA;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .chat-msg-user .msg-bubble { background: var(--blue); color: #fff; }

body.light-mode .modal-box { background: #FFFFFF; }
body.light-mode .modal-input { background: #F1F3FA; }

body.light-mode .req-result-header { background: #F8F9FE; }
body.light-mode .req-result { background: #FFFFFF; }

body.light-mode .drop-zone-big { background: #F8F9FE; }

body.light-mode .ai-box {
  background: rgba(59,130,246,0.05);
  border-color: rgba(59,130,246,0.18);
}

/* Toggle button */
.btn-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-theme:hover { color: var(--text); border-color: var(--border-hover); }
body.light-mode .header-logo { filter: brightness(0) saturate(100%); }
.btn-theme .icon-sun  { display: none; }
.btn-theme .icon-moon { display: block; }
body.light-mode .btn-theme .icon-sun  { display: block; }
body.light-mode .btn-theme .icon-moon { display: none; }

/* ── Login Page ───────────────────────────────────────────────────────────── */

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1a2060 0%, var(--navy) 70%);
}

.login-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 4px;
}
.login-logo-img {
  height: 64px;
  width: auto;
}

.logo-up       { color: var(--blue); }
.logo-software { color: var(--text); }

.login-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 32px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus { border-color: var(--blue); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; margin-top: 8px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

.error-msg {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.hidden { display: none !important; }

/* ── Header ───────────────────────────────────────────────────────────────── */

.header {
  height: var(--header-h);
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  gap: 16px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  height: 32px;
  width: auto;
}

.header-tagline {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── App Layout ───────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
}

.nav-sidebar {
  width: var(--sidebar-w);
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 0 24px;
}

.nav-section {
  padding: 0 10px;
  margin-bottom: 4px;
}

.nav-section-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  padding: 10px 8px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--navy-light); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,0.12); color: var(--blue); }
.nav-item svg { flex-shrink: 0; }

.app-content {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.user-badge {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 10px;
  background: var(--navy-light);
  border-radius: 20px;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover { color: var(--red); border-color: rgba(239,68,68,0.4); }

/* ── Pages ────────────────────────────────────────────────────────────────── */

.page {
  height: 100%;
  overflow: hidden;
}
.page.hidden { display: none; }

/* ── Procedure Analyser Layout ────────────────────────────────────────────── */

.page-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
}

/* Sidebar */
.sidebar {
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.input-search {
  width: 100%;
  padding: 8px 10px 8px 32px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.input-search:focus { border-color: var(--blue); }

.proc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.proc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  gap: 6px;
}
.proc-item:hover { background: var(--navy-light); }
.proc-item.active { background: rgba(59,130,246,0.15); }
.proc-item.in-compare { border-left: 2px solid var(--blue); }

.proc-item-name {
  font-size: 12.5px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-compare {
  font-size: 10px;
  padding: 2px 5px;
  background: rgba(59,130,246,0.2);
  color: var(--blue);
  border-radius: 4px;
  flex-shrink: 0;
}

.list-empty, .list-loading {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Content area */
.content-area {
  padding: 24px;
  overflow-y: auto;
  height: 100%;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  gap: 12px;
  color: var(--text-faint);
  text-align: center;
}
.empty-state h3 { font-size: 18px; color: var(--text-dim); }
.empty-state p  { font-size: 13px; max-width: 360px; }

/* Procedure view */
.proc-view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}
.proc-name {
  font-size: 18px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.proc-meta {
  font-size: 12px;
  color: var(--text-faint);
  display: block;
  margin-top: 4px;
}

.code-block {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  color: #a8b4d8;
}

/* Compare view */
.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.compare-head h2 { font-size: 16px; font-weight: 600; }

.compare-slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.compare-slot {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
}
.slot-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.slot-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
}
.slot-remove {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.slot-remove:hover { color: var(--red); }

.compare-vs {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  text-align: center;
}

.btn-compare {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
  margin-bottom: 20px;
}

/* Code tabs */
.code-tabs {
  margin-bottom: 16px;
}

.code-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.code-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  bottom: -1px;
}
.code-tab-btn:hover { color: var(--text); background: var(--navy-light); }
.code-tab-btn.active {
  color: var(--text);
  background: var(--navy-mid);
  border-color: var(--border);
  border-bottom-color: var(--navy-mid);
}

.code-tab-panel {
  display: none;
  border-radius: 0 6px 6px 6px;
  max-height: 380px;
  overflow-y: auto;
  font-size: 12px;
}
.code-tab-panel.active { display: block; }

.code-block-sm {
  font-size: 11.5px;
  max-height: 300px;
  overflow-y: auto;
}

.ai-box {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 20px;
}
.ai-box-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 14px;
}
.ai-content { font-size: 13.5px; line-height: 1.7; }

/* Compare loading */
.compare-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-dim);
}

/* ── Procedure Analyser guided layout ─────────────────────────────────────── */

.pa-layout {
  height: 100%;
  overflow-y: auto;
  padding: 32px 40px;
  box-sizing: border-box;
}

/* Home: escolha o modo */
.pa-home-title {
  font-size: 13px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 16px;
}

.pa-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
}

.pa-mode-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  width: 100%;
}
.pa-mode-card:hover {
  border-color: var(--border-hover);
  background: var(--navy-light);
  transform: translateX(3px);
}

.pa-mode-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pa-mode-icon-blue   { background: rgba(59,130,246,0.15); color: var(--blue); }
.pa-mode-icon-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }

.pa-mode-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pa-mode-label { font-size: 15px; font-weight: 600; color: var(--text); }
.pa-mode-desc  { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.pa-mode-arrow { color: var(--text-faint); flex-shrink: 0; }

/* Flow container */
.pa-flow { height: 100%; }

.pa-flow-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-back:hover { border-color: var(--border-hover); color: var(--text); }

.pa-flow-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pa-flow-title h2 { font-size: 18px; font-weight: 600; }

.pa-flow-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pa-flow-badge-blue   { background: rgba(59,130,246,0.15); color: var(--blue); }
.pa-flow-badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* Step indicator */
.pa-step { max-width: 100%; }

.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--navy-light);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: all 0.2s;
}
.step-dot.active { border-color: var(--blue); color: var(--blue); background: rgba(59,130,246,0.12); }
.step-dot.done   { border-color: var(--green); color: var(--green); background: rgba(34,197,94,0.1); }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
}
.step-line-done { background: var(--green); }

.step-content { }
.step-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.step-desc  { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }

.step-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px;
  text-align: center;
}

/* Drop zone big */
.drop-zone-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 32px;
  background: var(--navy-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-dim);
  width: 100%;
}
.drop-zone-big:hover, .drop-zone-big.dragging {
  border-color: var(--blue);
  background: rgba(59,130,246,0.05);
  color: var(--blue);
}
.drop-zone-title { font-size: 15px; font-weight: 500; }
.drop-zone-sub   { font-size: 12px; color: var(--text-faint); }
.drop-zone-hint  { font-size: 12px; color: var(--text-faint); }

/* Upload confirm */
.upload-confirm {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 16px;
}
.upload-confirm-file {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
}
.upload-confirm-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Result title row */
.result-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/* Compare guided layout */
.compare-guide-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  height: calc(100vh - var(--header-h) - 120px);
  overflow: hidden;
}

.compare-work-area {
  overflow-y: auto;
  padding-right: 4px;
}

.compare-slots-guide {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.compare-slot-guide {
  background: var(--navy-card);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  transition: border-color 0.15s;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compare-slot-guide.filled { border-style: solid; border-color: var(--border-hover); }

.slot-guide-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.slot-guide-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
}
.slot-placeholder {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
}

.slot-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.slot-letter-a { background: rgba(59,130,246,0.2); color: var(--blue); }
.slot-letter-b { background: rgba(139,92,246,0.2); color: #a78bfa; }

.compare-vs-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-align: center;
  padding: 0 4px;
}

.sidebar-hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
  line-height: 1.4;
}

.compare-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-dim);
}

/* ── Modificadas Recentemente ─────────────────────────────────────────────── */

.recent-layout {
  height: 100%;
  overflow-y: auto;
  padding: 32px 40px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.recent-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.recent-subtitle {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.recent-filters {
  display: flex;
  gap: 6px;
}

.filter-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.recent-loading, .recent-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--text-faint);
  font-size: 13px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-card {
  display: flex;
  flex-direction: column;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.recent-card-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

.review-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.recent-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.recent-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-card-date {
  font-size: 11.5px;
  color: var(--text-faint);
}

.recent-card-result {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
}

.result-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.result-inner-detail {
  flex-direction: column;
  gap: 12px;
}

.result-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

.detail-analysis {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  margin-top: 1px;
}
.status-ok      { background: rgba(34,197,94,0.15);  color: #4ade80; }
.status-atencao { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-problema{ background: rgba(239,68,68,0.15);  color: #f87171; }

.status-resumo {
  font-size: 13px;
  color: var(--text-dim);
  flex: 1;
  line-height: 1.5;
}

.btn-close-result {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.btn-close-result:hover { color: var(--text); }

.btn-review {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-review:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.btn-review:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-review-detail { border-color: rgba(245,158,11,0.3); color: var(--yellow); }
.btn-review-detail:hover:not(:disabled) { border-color: var(--yellow); color: var(--yellow); background: rgba(245,158,11,0.06); }

.recent-error {
  color: #f87171;
  font-size: 13px;
  padding: 16px;
}

/* ── Chat Layout ──────────────────────────────────────────────────────────── */

.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: auto 0;
  text-align: center;
  color: var(--text-dim);
  padding: 48px 0;
}
.chat-welcome svg { color: var(--text-faint); }
.chat-welcome h3 { font-size: 20px; color: var(--text); }
.chat-welcome p  { font-size: 13px; color: var(--text-dim); }

.chat-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.chat-example {
  padding: 8px 14px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-example:hover { border-color: var(--blue); color: var(--blue); }

.chat-msg {
  max-width: 820px;
}
.chat-msg-user { align-self: flex-end; }
.chat-msg-assistant, .chat-msg-error { align-self: flex-start; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.7;
}
.chat-msg-user .msg-bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .msg-bubble {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
}

/* Loading dots */
.msg-loading {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}
.msg-loading span {
  width: 7px; height: 7px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: dots 1.2s ease-in-out infinite;
}
.msg-loading span:nth-child(2) { animation-delay: 0.2s; }
.msg-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dots {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40%            { opacity: 1;   transform: scale(1); }
}

/* Chat input */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 16px 40px;
  background: var(--navy-mid);
}
.chat-input-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--blue); }
.chat-send {
  width: 44px; height: 44px;
  background: var(--blue);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
}
.chat-send:hover { background: var(--blue-dark); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--text-faint);
}

.btn-clear-chat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-clear-chat:hover { color: var(--red); border-color: rgba(239,68,68,0.4); }

/* ── Markdown rendered content ────────────────────────────────────────────── */

.ai-content h1, .ai-content h2, .ai-content h3,
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--text);
}
.ai-content h1, .msg-bubble h1 { font-size: 16px; }
.ai-content h2, .msg-bubble h2 { font-size: 15px; }
.ai-content h3, .msg-bubble h3 { font-size: 14px; }

.ai-content p, .msg-bubble p { margin: 6px 0; }

.ai-content ul, .msg-bubble ul { padding-left: 20px; margin: 6px 0; }
.ai-content li, .msg-bubble li { margin: 3px 0; }

.ai-content code, .msg-bubble code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
}

.code-block-inline {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
  white-space: pre;
  color: #a8b4d8;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.md-table th {
  padding: 10px 14px;
  background: var(--navy-light);
  font-weight: 600;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.md-table td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  text-align: left;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.md-table tbody tr:last-child td { border-bottom: none; }
.md-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* ── Dashboard ────────────────────────────────────────────────────────────── */

.dash-layout {
  height: 100%;
  overflow-y: auto;
  padding: 28px 36px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.dash-date {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
  text-transform: capitalize;
}

.dash-refresh {
  font-size: 12px;
  padding: 6px 12px;
  gap: 6px;
}
.dash-refresh svg { transition: transform 0.6s ease; }
.dash-refresh.refreshing svg { animation: spin-once 0.6s ease; }

@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.dash-card { transition: opacity 0.25s, transform 0.25s; }
.dash-card-pulse {
  animation: card-pulse 0.45s ease;
}
@keyframes card-pulse {
  0%   { opacity: 1;    transform: scale(1); }
  40%  { opacity: 0.55; transform: scale(0.98); }
  100% { opacity: 1;    transform: scale(1); }
}

/* Cards */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.dash-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s;
}
.dash-card:hover { border-color: var(--border-hover); }

.dash-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-icon-blue   { background: rgba(59,130,246,0.12);  color: var(--blue); }
.dash-icon-yellow { background: rgba(245,158,11,0.12);  color: var(--yellow); }
.dash-icon-green  { background: rgba(34,197,94,0.12);   color: var(--green); }
.dash-icon-red    { background: rgba(239,68,68,0.12);   color: var(--red); }
.dash-icon-purple { background: rgba(139,92,246,0.12);  color: #a78bfa; }

.dash-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dash-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  display: flex;
  align-items: center;
}

.dash-card-label {
  font-size: 12px;
  color: var(--text-faint);
}

/* Recent section */
.dash-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dash-link {
  font-size: 12px;
  padding: 5px 10px;
  gap: 4px;
  color: var(--text-faint);
}

.dash-recent-list {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
}

.dash-recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  gap: 12px;
}
.dash-recent-row:last-child { border-bottom: none; }
.dash-recent-row:hover { background: var(--navy-light); }

.dash-recent-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-recent-name {
  font-size: 13px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-recent-date {
  font-size: 11px;
  color: var(--text-faint);
}

.dash-goto {
  padding: 5px 8px;
  flex-shrink: 0;
  color: var(--text-faint);
  border-color: transparent;
}
.dash-goto:hover { color: var(--blue); border-color: var(--border); }

.dash-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-faint);
  font-size: 13px;
}

.dash-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ── Assistente SQL ──────────────────────────────────────────────────────── */

.req-layout {
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 24px 32px 0;
  gap: 16px;
  overflow: hidden;
}

.req-title  { font-size: 18px; font-weight: 600; color: var(--text); }
.req-subtitle { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

.req-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.req-textarea {
  width: 100%;
  height: 140px;
  padding: 16px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  resize: none;
  outline: none;
  line-height: 1.65;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.req-textarea:focus { border-color: var(--blue); }
.req-textarea::placeholder { color: var(--text-faint); }

.req-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.req-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-faint);
}

.req-result {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.req-result.hidden { display: none; }
.req-result.req-result-compact { flex: 1; min-height: 0; border-radius: var(--radius) var(--radius) 0 0; }

/* ── Chat de ajustes ─────────────────────────────────────────────────────── */

.req-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.req-chat.hidden { display: none; }

.req-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.req-chat-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}

.req-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--navy-card);
}

.req-chat-input-area {
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
  background: var(--navy-mid);
  flex-shrink: 0;
}

.req-chat-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--green);
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.2);
  padding: 7px 12px;
}

.sql-attach-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: rgba(234,179,8,0.07);
  border: 1px solid rgba(234,179,8,0.22);
  color: rgba(234,179,8,0.9);
  font-size: 12.5px;
  line-height: 1.4;
}
.sql-attach-confirm.hidden { display: none; }
.sql-attach-confirm > span { flex: 1; }
.sql-attach-confirm-btns { display: flex; gap: 6px; flex-shrink: 0; }

.btn-sm { padding: 4px 10px; font-size: 11.5px; border-radius: 5px; line-height: 1.4; }

.req-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--navy-mid);
  flex-shrink: 0;
}

.req-result-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}

.req-result-actions { display: flex; gap: 8px; }

.req-result-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.req-code-block {
  margin: 0;
  border: none;
  border-radius: 0;
  min-height: 100%;
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.7;
}

/* ── Assistente SQL — empty state ────────────────────────────────────────── */

.empty-page-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  color: var(--text-dim);
  text-align: center;
  padding: 40px;
}

.empty-page-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  margin-bottom: 4px;
}

.empty-page-layout h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.empty-page-layout p {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 380px;
  line-height: 1.6;
}

.coming-soon-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  background: rgba(245,158,11,0.12);
  color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Spinners ─────────────────────────────────────────────────────────────── */

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal: Análise Detalhada ─────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
  width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yellow);
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-subtitle {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-faint);
  margin-top: 2px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--yellow); }

.modal-error {
  font-size: 12.5px;
  color: #f87171;
  padding: 8px 12px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-detail-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: rgba(245,158,11,0.15);
  color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-detail-confirm:hover { background: rgba(245,158,11,0.25); border-color: var(--yellow); }
.btn-detail-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Page: Novo Campo ────────────────────────────────────────────────────── */

.nc-layout {
  height: 100%;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nc-header { display: flex; flex-direction: column; gap: 4px; }
.nc-title { font-size: 18px; font-weight: 600; color: var(--text); }
.nc-subtitle { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

.nc-upload-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.nc-upload-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nc-upload-badge {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}
.nc-upload-required-badge { color: rgba(239,68,68,0.7); }

.nc-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nc-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 12px;
  background: var(--navy-light);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  color: var(--text-dim);
  min-height: 68px;
}
.nc-upload-zone:hover { border-color: var(--blue); background: rgba(59,130,246,0.05); color: var(--text); }
.nc-upload-zone.has-file { border-style: solid; border-color: var(--green); background: rgba(34,197,94,0.06); color: var(--green); }

.nc-upload-zone-text { font-size: 12px; line-height: 1.4; }
.nc-upload-zone-text strong { font-weight: 600; }
.nc-upload-zone-text em { color: var(--text-faint); font-style: normal; }

body.light-mode .nc-upload-zone { background: #F1F3FA; }
body.light-mode .nc-upload-zone:hover { background: rgba(59,130,246,0.06); }
body.light-mode .nc-upload-zone.has-file { background: rgba(34,197,94,0.06); }

.nc-form {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.nc-field-group { display: flex; flex-direction: column; gap: 6px; }

.nc-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nc-required { color: var(--blue); font-weight: 600; }

.nc-input,
.nc-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.nc-input:focus,
.nc-select:focus { border-color: var(--blue); }
.nc-select option { background: var(--navy-card); }

.nc-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.nc-check-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.nc-check-label { font-size: 13px; color: var(--text-dim); }
.nc-check-wrap input[type="checkbox"] { accent-color: var(--blue); width: 14px; height: 14px; cursor: pointer; }

.nc-result {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.nc-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--navy-light);
  border-bottom: 1px solid var(--border);
}

.nc-result-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}


.nc-tabs { display: flex; flex-direction: column; }

.nc-tab-bar {
  display: flex;
  gap: 2px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.nc-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.nc-tab-btn:hover { color: var(--text); }
.nc-tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.nc-tab-content { display: none; padding: 14px; }
.nc-tab-content.active { display: flex; flex-direction: column; gap: 8px; }

.nc-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.nc-code-hint {
  font-size: 12px;
  color: var(--text-faint);
}
.nc-code-hint strong { color: var(--text-dim); }

.nc-code {
  margin: 0;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  white-space: pre;
  overflow: auto;
  min-height: 180px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text);
  line-height: 1.6;
}

body.light-mode .nc-input,
body.light-mode .nc-select { background: #f1f3fa; border-color: rgba(0,0,0,0.1); color: #111537; }
body.light-mode .nc-result { background: #fff; }
body.light-mode .nc-result-header { background: #F8F9FE; }
body.light-mode .nc-tab-bar { border-color: rgba(0,0,0,0.08); }

/* ── Botão de anexo / chips de arquivo ───────────────────────────────────── */

.btn-attach {
  position: relative;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.btn-attach:hover { border-color: var(--border-hover); color: var(--text-dim); }
.btn-attach.has-files { border-color: var(--blue); color: var(--blue); }

.attach-badge {
  position: absolute;
  top: -5px; right: -5px;
  width: 16px; height: 16px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.delphi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-bottom: 6px;
}

.delphi-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--blue);
  max-width: 180px;
}

.delphi-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delphi-chip-remove {
  background: none;
  border: none;
  color: rgba(59,130,246,0.5);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.1s;
}
.delphi-chip-remove:hover { color: var(--red); }

/* Tags de arquivo nas mensagens do usuário */
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}
.msg-attach-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}
.msg-attach-file {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
}
.msg-attach-img {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
}

/* ── Bolha SQL do assistente ──────────────────────────────────────────────── */

.msg-sql-bubble {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  overflow: hidden;
  max-width: 640px;
}

/* No Assistente SQL o bloco ocupa toda a largura da área de mensagens */
#reqChatMessages .chat-msg        { max-width: 100%; width: 100%; }
#reqChatMessages .msg-sql-bubble  { max-width: 100%; }
#reqChatMessages .msg-sql-code    { max-height: 480px; }

.msg-sql-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
}

.msg-sql-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.msg-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-faint);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.msg-copy-btn:hover { border-color: var(--border-hover); color: var(--text-dim); }

.msg-sql-code {
  margin: 0;
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.65;
  color: #a8b4d8;
  background: var(--navy);
  white-space: pre;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

.msg-sql-text {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

body.light-mode .msg-sql-bubble { background: #fff; }
body.light-mode .msg-sql-hdr { background: #F8F9FE; }
body.light-mode .msg-sql-code { background: #F0F2FA; color: #2a3060; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
