:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #5f6f6b;
  --line: #d9e1de;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d8f3ef;
  --warn: #b45309;
  --warn-soft: #fff0d6;
  --danger: #b91c1c;
  --shadow: 0 18px 48px rgba(23, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 24px;
  align-items: start;
}

.panel,
.empty-state,
.loading-state,
.no-results,
.boleto-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(23, 33, 31, 0.04);
}

.query-panel {
  position: sticky;
  top: 24px;
  padding: 24px;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  flex: 0 0 auto;
}

svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.14;
  letter-spacing: 0;
}

.search-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  background: #fbfcfc;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

button,
.action-link {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.action-link:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.form-message {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.error {
  color: var(--danger);
}

.content-area {
  min-width: 0;
}

.empty-state,
.loading-state,
.no-results {
  min-height: 360px;
  padding: 32px;
  display: grid;
  place-items: center;
  text-align: center;
}

.empty-state h2,
.no-results h2 {
  max-width: 560px;
  margin: 20px auto 0;
  font-size: 1.25rem;
}

.no-results p {
  max-width: 560px;
  margin: 10px auto 0;
  color: var(--muted);
}

.document-preview {
  width: min(280px, 100%);
  height: 180px;
  position: relative;
}

.document-preview span {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.14), transparent 34%),
    repeating-linear-gradient(#fff, #fff 18px, #eef3f2 19px, #eef3f2 20px);
  box-shadow: var(--shadow);
}

.document-preview span:nth-child(1) {
  transform: rotate(-7deg) translate(-18px, 8px);
}

.document-preview span:nth-child(2) {
  transform: rotate(3deg) translate(12px, 0);
}

.document-preview span:nth-child(3) {
  transform: rotate(-1deg) translate(0, -8px);
}

.loading-state {
  gap: 18px;
  color: var(--muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.results {
  display: grid;
  gap: 16px;
}

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

.summary-item {
  min-width: 0;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.summary-item strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.boleto-list {
  display: grid;
  gap: 12px;
}

.boleto-card {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.9fr) auto;
  gap: 18px;
  align-items: center;
}

.boleto-main {
  min-width: 0;
}

.status {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-overdue {
  background: var(--warn-soft);
  color: var(--warn);
}

.boleto-card h2 {
  margin: 10px 0 4px;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.boleto-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.boleto-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.boleto-meta span {
  min-width: 0;
  color: var(--ink);
  font-size: 0.93rem;
  overflow-wrap: anywhere;
}

.boleto-meta b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action-link {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.9rem;
}

.action-link.secondary {
  background: #e8eeee;
  color: var(--ink);
}

.action-link.secondary:hover {
  background: #dbe4e2;
}

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

  .query-panel {
    position: static;
  }

  .boleto-card {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
    gap: 10px;
  }

  .query-panel,
  .empty-state,
  .loading-state,
  .no-results,
  .boleto-card {
    padding: 16px;
  }

  .brand-row {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  h1 {
    font-size: 1.35rem;
  }

  .input-row,
  .summary-grid,
  .boleto-meta {
    grid-template-columns: 1fr;
  }

  button,
  .action-link {
    width: 100%;
  }

  .document-preview {
    height: 150px;
  }
}
