:root {
  --bg: #f4f8ff;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --text: #071b43;
  --muted: #52627d;
  --line: #d8e4f4;
  --primary: #145cf5;
  --primary-dark: #0d46c6;
  --danger: #dc2626;
  --green: #07885b;
  --orange: #ec4b22;
  --navy: #061d4f;
  --shadow: 0 16px 42px rgba(26, 64, 116, 0.11);
  --soft-shadow: 0 8px 24px rgba(26, 64, 116, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(229, 240, 255, 0.92) 0, rgba(244, 248, 255, 0.96) 230px, #ffffff 231px),
    var(--bg);
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
}

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

.app-shell {
  width: min(1200px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 132px minmax(360px, 1fr) minmax(450px, 520px);
  gap: 28px;
  align-items: center;
  min-height: 205px;
  padding: 32px 34px 44px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 8% 20%, rgba(20, 92, 245, 0.12), transparent 140px),
    linear-gradient(120deg, rgba(255, 255, 255, 0.93) 0%, rgba(239, 247, 255, 0.96) 100%);
  box-shadow: var(--soft-shadow);
}

.hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 190px;
  height: 170px;
  opacity: 0.32;
  background-image: radial-gradient(#8bb8ef 1.2px, transparent 1.2px);
  background-size: 14px 14px;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  left: 70px;
  top: -80px;
  width: 270px;
  height: 270px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 28px rgba(233, 243, 255, 0.62);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-visual {
  position: relative;
  width: 128px;
  height: 128px;
}

.hero-visual-orbit {
  position: absolute;
  inset: 3px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(210, 226, 249, 0.88);
}

.hero-visual-image {
  width: 82px;
  height: 82px;
  object-fit: contain;
  opacity: 0.86;
  filter: drop-shadow(0 12px 16px rgba(10, 36, 83, 0.2));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 650px;
  font-size: clamp(2.15rem, 4.2vw, 3.65rem);
  line-height: 1.08;
}

h2 {
  font-size: 1rem;
}

.hero-text {
  max-width: 590px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.hero-side {
  display: grid;
  grid-template-columns: 250px 190px;
  gap: 16px;
  align-items: stretch;
  justify-content: end;
  transition: grid-template-rows 0.28s ease;
}

.date-filter {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 18px 18px 20px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--soft-shadow);
  transition: padding 0.28s ease, box-shadow 0.28s ease;
}

.filter-label {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
}

.month-trigger {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  border: 1px solid #b9cff2;
  background: #ffffff;
  color: var(--text);
  padding: 0 13px;
  font-size: 0.9rem;
  text-align: left;
  box-shadow: none;
}

.month-trigger:hover {
  background: #f8fbff;
  color: var(--primary);
  box-shadow: none;
  transform: none;
}

.month-picker {
  position: static;
  display: grid;
  grid-template-rows: 0fr;
  width: 100%;
  max-height: none;
  margin-top: 4px;
  overflow: hidden;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(26, 64, 116, 0.18);
  opacity: 0;
  transform: translateY(-6px);
  transition:
    grid-template-rows 0.3s ease,
    opacity 0.22s ease,
    transform 0.3s ease,
    padding 0.3s ease;
}

.month-picker.show {
  grid-template-rows: 1fr;
  padding: 14px 14px 16px;
  opacity: 1;
  transform: translateY(0);
}

.month-picker-inner {
  min-height: 0;
  overflow: hidden;
}

.month-picker-header {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--text);
  text-align: center;
}

.month-nav {
  min-height: 32px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--primary);
  padding: 0;
  font-size: 1.15rem;
  box-shadow: none;
}

.month-nav:hover {
  background: #eef5ff;
  box-shadow: none;
  transform: none;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  justify-items: center;
}

.month-option {
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  background: #f7faff;
  color: var(--text);
  padding: 0;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: none;
}

.month-option:hover,
.month-option.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.month-picker-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.month-action {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0 4px;
  font-size: 0.8rem;
  box-shadow: none;
}

.month-action.primary {
  font-weight: 800;
}

.month-action:hover {
  background: #eef5ff;
  color: var(--primary-dark);
  box-shadow: none;
  transform: none;
}

.filter-clear {
  display: none;
  min-height: 44px;
  border: 1px solid var(--primary);
  background: #ffffff;
  color: var(--primary);
  font-size: 0.9rem;
}

.filter-clear:hover {
  background: #eef5ff;
  color: var(--primary-dark);
  box-shadow: none;
}

.hero-badge {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 145px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 84% 16%, rgba(255, 255, 255, 0.18), transparent 16px),
    linear-gradient(145deg, #08245d 0%, #001747 100%);
  color: white;
  overflow: hidden;
  padding: 22px;
  box-shadow: var(--soft-shadow);
  transition: min-height 0.3s ease, padding 0.3s ease, transform 0.3s ease;
}

.hero-badge::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 48px;
  opacity: 0.5;
  background:
    linear-gradient(140deg, transparent 0 18%, rgba(30, 111, 255, 0.42) 19% 27%, transparent 28% 36%, rgba(30, 111, 255, 0.32) 37% 48%, transparent 49% 58%, rgba(30, 111, 255, 0.36) 59% 72%, transparent 73%),
    linear-gradient(180deg, transparent, rgba(20, 92, 245, 0.34));
}

.hero-badge span {
  position: relative;
  z-index: 1;
  font-size: 3.8rem;
  font-weight: 800;
  line-height: 1;
}

.hero-badge small {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
}

.summary-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 28px 42px 12px;
}

.summary-toolbar .eyebrow,
.summary-toolbar h2 {
  margin: 0;
}

.summary-toolbar h2,
.table-header h2,
.section-title h2 {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 7px;
  font-size: 0.9rem;
}

.small-button span {
  font-size: 1.3rem;
  line-height: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0 42px 18px;
}

.summary-card {
  position: relative;
  min-height: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.summary-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: auto auto;
  column-gap: 18px;
  align-items: center;
  padding: 14px 52px 14px 18px;
}

.summary-icon-tile {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 14px;
}

.summary-card-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  opacity: 0.72;
}

.summary-card.token .summary-icon-tile {
  background: rgba(37, 99, 235, 0.14);
}

.summary-card.cartao .summary-icon-tile {
  background: rgba(16, 185, 129, 0.16);
}

.summary-card.leitora .summary-icon-tile {
  background: rgba(236, 75, 34, 0.13);
}

.summary-card span {
  display: block;
  align-self: end;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  align-self: start;
  margin-top: 4px;
  font-size: 2.35rem;
  line-height: 1;
  color: #063a91;
}

.summary-card.cartao strong {
  color: var(--green);
}

.summary-card.leitora strong {
  color: var(--orange);
}

.summary-arrow {
  position: absolute;
  right: 20px;
  top: 50%;
  color: #98abc8;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(290px, 340px) 1fr;
  gap: 14px;
  align-items: stretch;
  margin: 0 42px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--soft-shadow);
}

.form-panel {
  padding: 20px;
}

.section-title {
  margin-bottom: 18px;
}

.title-with-icon {
  display: flex;
  gap: 10px;
  align-items: center;
}

.title-with-icon span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--primary);
  border-radius: 7px;
  color: var(--primary);
  font-size: 0.95rem;
  line-height: 1;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.other-field {
  display: none;
}

.other-field.show {
  display: grid;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cddbed;
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 0 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

textarea {
  min-height: 84px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(20, 92, 245, 0.12);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #1768ff 0%, var(--primary) 100%);
  color: white;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

button:hover {
  background: linear-gradient(180deg, #0d59ec 0%, var(--primary-dark) 100%);
  box-shadow: 0 12px 24px rgba(20, 92, 245, 0.2);
  transform: translateY(-1px);
}

.secondary-button {
  min-height: 38px;
  border: 1px solid var(--primary);
  background: #ffffff;
  color: var(--primary);
  white-space: nowrap;
}

.secondary-button:hover {
  background: #fff5f5;
  color: var(--danger);
  box-shadow: none;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 22px 22px 0;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  padding: 0 22px 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

th,
td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #263d63;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: #243047;
  font-size: 0.92rem;
}

.item-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #1d4ed8;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.term-button {
  min-height: 34px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0 12px;
  font-size: 0.82rem;
  box-shadow: none;
}

.term-button:hover {
  background: #dbeafe;
  color: #1e40af;
  box-shadow: none;
}

.delete-button {
  min-height: 34px;
  background: #fee2e2;
  color: #b91c1c;
  padding: 0 12px;
  font-size: 0.82rem;
}

.delete-button:hover {
  background: #fecaca;
  color: #991b1b;
  box-shadow: none;
}

.empty-state {
  display: none;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.empty-state::before {
  content: "";
  display: block;
  width: 86px;
  height: 70px;
  margin-bottom: 8px;
  background:
    linear-gradient(150deg, transparent 0 28%, #4c8ff7 29% 58%, transparent 59%),
    linear-gradient(30deg, transparent 0 28%, #74a9ff 29% 58%, transparent 59%),
    linear-gradient(#eaf3ff, #cde0ff);
  clip-path: polygon(15% 34%, 50% 16%, 85% 34%, 85% 78%, 50% 96%, 15% 78%);
}

.empty-state strong {
  color: var(--text);
  font-size: 1.1rem;
}

.empty-state.show {
  display: grid;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 18px;
}

.modal-overlay.show {
  display: grid;
}

.modal-card {
  width: min(460px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.26);
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

.modal-header .eyebrow {
  margin-bottom: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.icon-button:hover {
  background: #f8fafc;
  color: var(--text);
  box-shadow: none;
}

.stock-form {
  gap: 14px;
}

.clear-stock-button {
  justify-self: start;
  min-height: 32px;
  border: 1px solid #fecaca;
  background: #fff7f7;
  color: var(--danger);
  padding: 0 12px;
  font-size: 0.78rem;
  box-shadow: none;
}

.clear-stock-button:hover {
  background: #fee2e2;
  color: #991b1b;
  box-shadow: none;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

@media (max-width: 1060px) {
  .hero {
    grid-template-columns: 110px 1fr;
  }

  .hero-side {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .hero-visual {
    display: none;
  }

  .hero-side {
    grid-template-columns: 1fr;
  }

  .date-filter {
    overflow: visible;
  }

  .hero-badge {
    min-height: auto;
  }

  .summary-toolbar,
  .table-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-toolbar,
  .summary-grid,
  .content-grid {
    margin-left: 0;
    margin-right: 0;
  }

  .summary-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1200px);
    padding: 12px 0 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .date-filter,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .month-picker {
    margin-top: 2px;
  }

  .month-picker.show .month-picker-inner {
    max-height: 320px;
    overflow-y: auto;
  }

  .month-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero,
  .form-panel,
  .table-header {
    padding: 18px;
  }

  .table-wrap {
    padding: 0 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .date-filter,
  .hero-badge,
  .hero-side,
  .month-picker {
    transition: none;
  }
}
