@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&display=swap');

:root {
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --border: #d9e2ee;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #5b6b80;
  --primary: #1d4ed8;
  --primary-600: #1e40af;
  --primary-soft: #e8efff;
  --primary-soft-2: #f2f6ff;
  --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 10px 24px rgba(15, 23, 42, 0.08);
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px rgba(15, 23, 42, 0.05);
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
}

html {
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.09), transparent 35%), linear-gradient(180deg, #f8fafc 0%, #eef3f9 100%);
}

body {
  color: var(--text);
  font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.07), transparent 28%),
    radial-gradient(circle at top right, rgba(29, 78, 216, 0.05), transparent 24%),
    var(--bg);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Sora', 'Manrope', ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.03em;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

input:not([type='checkbox']):not([type='radio']):not([type='file']),
select,
textarea,
input[type='file'] {
  width: 100%;
  min-height: 3rem;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  color: var(--text);
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

select {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  background-position:
    calc(100% - 1.15rem) 50%,
    calc(100% - 0.8rem) 50%,
    0 0;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem, 100% 100%;
  background-repeat: no-repeat;
  padding-left: 1.35rem !important;
  padding-right: 3rem !important;
  line-height: 1.45 !important;
  text-indent: 0.05rem;
}

select.w-full,
label select,
form select {
  padding-left: 1.35rem !important;
  padding-right: 3rem !important;
}

select option {
  padding: 0.65rem 1rem;
}

input:not([type='checkbox']):not([type='radio']):not([type='file'])::placeholder,
textarea::placeholder {
  color: #94a3b8;
  font-weight: 600;
}

input:not([type='checkbox']):not([type='radio']):not([type='file']):hover,
select:hover,
textarea:hover,
input[type='file']:hover {
  border-color: #94a3b8;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input:not([type='checkbox']):not([type='radio']):not([type='file']):focus,
select:focus,
textarea:focus,
input[type='file']:focus {
  outline: none;
  border-color: rgba(29, 78, 216, 0.68);
  background: #fff;
  box-shadow: var(--focus-ring);
}

input[type='checkbox'],
input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  border: 1.5px solid #94a3b8;
  accent-color: var(--primary);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

input[type='checkbox'] {
  border-radius: 0.35rem;
}

input[type='radio'] {
  border-radius: 999px;
}

input[type='checkbox']:hover,
input[type='radio']:hover {
  transform: scale(1.06);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

input[type='checkbox']:focus,
input[type='radio']:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input[type='file'] {
  padding: 0.72rem 0.85rem;
  border-style: dashed;
  background: #f8fbff;
}

input[type='file']::file-selector-button {
  margin-right: 0.9rem;
  border: 0;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--primary) 0%, #2f67ff 100%);
  color: #fff;
  font-weight: 800;
  padding: 0.75rem 1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.16);
}

::selection {
  background: rgba(29, 78, 216, 0.2);
}

[x-cloak] {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(203, 213, 225, 0.8);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.app-container {
  width: min(100% - 2rem, 80rem);
  margin-inline: auto;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, #5b7cff 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.22);
  flex: none;
}

.brand-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

.brand-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link,
.nav-link-ghost,
.nav-link-primary,
.menu-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 0.95rem;
  font-size: 0.94rem;
  font-weight: 700;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.nav-link,
.nav-link-ghost,
.menu-link {
  padding: 0.75rem 0.95rem;
  color: #334155;
}

.nav-link:hover,
.nav-link-ghost:hover,
.menu-link:hover {
  background: #eff4fb;
  color: #0f172a;
}

.nav-link-active,
.menu-link-active {
  background: linear-gradient(180deg, #eef4ff 0%, #e8efff 100%);
  color: var(--primary-600);
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.14), 0 8px 18px rgba(29, 78, 216, 0.08);
}

.nav-link-active i,
.menu-link-active i {
  color: var(--primary);
}

.nav-link-primary {
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, #2f67ff 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.16);
}

.nav-link-primary:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(29, 78, 216, 0.2);
}

.nav-link-primary-active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16), 0 14px 30px rgba(29, 78, 216, 0.24);
}

.mobile-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.95rem;
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  box-shadow: var(--shadow-soft);
}

.mobile-panel {
  border-top: 1px solid rgba(203, 213, 225, 0.7);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.surface,
.surface-soft,
.table-card,
.message-card,
.stat-card,
.input-panel,
.prompt-card,
.chart-card {
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: var(--radius-2xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.surface-soft,
.input-panel,
.prompt-card,
.chart-card {
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
}

.page-hero {
  display: grid;
  gap: 1.25rem;
}

.page-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary-600);
}

.page-title {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.98;
}

.page-lead {
  max-width: 60rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.stat-grid {
  display: grid;
  gap: 1rem;
}

.stat-card {
  padding: 1.1rem 1.15rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

.stat-value {
  margin-top: 0.55rem;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-delta-positive {
  color: #059669;
}

.stat-delta-negative {
  color: #b91c1c;
}

.section-card {
  padding: 1.15rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.15rem;
  line-height: 1.2;
}

.section-subtitle {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.responsive-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #334155;
}

.responsive-table thead th {
  background: #f8fbff;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(226, 232, 240, 1);
}

.responsive-table th,
.responsive-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(226, 232, 240, 1);
  vertical-align: middle;
}

.responsive-table tbody tr:hover {
  background: #f8fbff;
}

.responsive-table tbody tr.empty-row:hover {
  background: transparent;
}

.responsive-table tbody tr:last-child td {
  border-bottom: 0;
}

.responsive-table .empty-row td {
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--muted);
  font-weight: 600;
}

.table-cell-right {
  text-align: right;
}

.table-cell-strong {
  font-weight: 800;
  color: #0f172a;
}

.table-cell-accent {
  color: var(--primary-600);
  font-weight: 800;
}

.table-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary-600);
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  padding: 0.9rem 1.05rem;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn::after,
.btn-primary::after,
.btn-secondary::after,
.btn-ghost::after,
.btn-danger::after,
.nav-link-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 45%);
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #2f67ff 100%);
  color: #fff;
  border-color: rgba(29, 78, 216, 0.25);
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 15px 34px rgba(29, 78, 216, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fff;
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-danger:active,
.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible,
.btn-danger:focus-visible,
.btn:focus-visible,
.btn-table-primary:focus-visible,
.btn-table-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16), 0 10px 24px rgba(15, 23, 42, 0.1);
}

.btn-secondary {
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  color: #1e293b;
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.btn-secondary:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e9f0f8 100%);
  border-color: #94a3b8;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.65);
  color: #475569;
  border-color: #d7e0eb;
}

.btn-ghost:hover {
  background: #f8fbff;
  color: #0f172a;
  border-color: #b8c6d8;
}

.btn-danger {
  background: linear-gradient(180deg, #fff7f7 0%, #fff1f2 100%);
  color: var(--danger);
  border-color: #fecdd3;
  box-shadow: 0 6px 16px rgba(180, 35, 24, 0.07);
}

.btn-danger:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.btn-sm {
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
}

.form-note,
.help-text,
.empty-state,
.muted-copy {
  color: var(--muted);
}

.callout {
  border-radius: 1.1rem;
  border: 1px solid #dbe4f0;
  background: #f7faff;
  color: #183153;
  padding: 0.95rem 1rem;
}

.prompt-card pre {
  overflow-x: auto;
  border-radius: 1rem;
  background: #0f172a;
  color: #dbeafe;
}

.message-card {
  width: min(100%, 34rem);
  padding: 1.25rem;
}

.message-pill {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.95rem;
}

@media (min-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .app-container {
    width: min(100% - 1rem, 80rem);
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tbody tr {
    padding: 0.9rem 0;
  }

  .responsive-table tbody tr + tr {
    border-top: 1px solid rgba(226, 232, 240, 1);
  }

  .responsive-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 0;
    padding: 0.45rem 1rem;
    text-align: right;
  }

  .responsive-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    text-align: left;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .responsive-table td[data-label='Ações'] {
    display: block;
    text-align: left;
  }

  .responsive-table td[data-label='Ações']::before {
    display: block;
    margin-bottom: 0.55rem;
  }

  .responsive-table td[data-label='Ações'] > div {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .responsive-table .empty-row td {
    display: block;
    text-align: center;
  }

  .table-cell-right {
    text-align: right;
  }
}

.btn-table-primary,
.btn-table-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  padding: 0.58rem 0.78rem;
  font-size: 0.78rem;
  font-weight: 800;
  transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.btn-table-primary:hover,
.btn-table-danger:hover {
  transform: translateY(-1px);
}

.btn-table-primary {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.btn-table-primary:hover {
  background: #dbeafe;
}

.btn-table-danger {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

.btn-table-danger:hover {
  background: #ffe4e6;
}

.btn-table-danger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-red {
  background: #ffe4e6;
  color: #be123c;
}

.empty-cell {
  padding: 3rem 1.25rem;
  text-align: center;
  color: #64748b;
}
