:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #152033;
  --muted: #68758a;
  --line: #dde5f0;
  --blue: #1687f2;
  --green: #12a15d;
  --amber: #b67204;
  --red: #ca3d3d;
  --shadow: 0 18px 50px rgba(16, 38, 72, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #eaf4ff, var(--bg) 42%);
  color: var(--text);
  overflow: hidden;
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  background: #e8f2ff;
  color: #0758a5;
  cursor: pointer;
  padding: 10px 14px;
  transition: 0.15s ease;
}

button:hover {
  background: #d5eaff;
}

button.primary {
  background: var(--blue);
  color: white;
  box-shadow: 0 10px 22px rgba(22, 135, 242, 0.24);
}

button.action-main {
  width: 100%;
  display: block;
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 16px;
}

.action-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

button.primary:hover {
  background: #0878df;
}

button.danger {
  background: #ffe9e9;
  color: var(--red);
}

button.danger:hover {
  background: #ffd6d6;
}

.shell {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 8px;
  overflow: hidden;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 8px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 26px;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

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

.config {
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.config.ok {
  border-left: 5px solid var(--green);
}

.config.warn {
  border-left: 5px solid var(--amber);
}

.config.error {
  border-left: 5px solid var(--red);
}

.grid {
  display: grid;
  grid-template-columns: minmax(260px, 30%) minmax(0, 70%);
  gap: 10px;
  height: calc(100vh - 92px);
  min-height: 0;
  align-items: start;
  overflow: hidden;
}

.queue,
.details {
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 0;
}

.queue {
  padding: 14px;
  position: sticky;
  top: 10px;
  height: 100%;
  max-height: none;
  overflow: hidden;
}

.details {
  padding: 14px;
  height: 100%;
  overflow: auto;
}

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

#counter {
  background: #eef4fb;
  color: var(--muted);
  border-radius: 999px;
  min-width: 34px;
  padding: 4px 10px;
  text-align: center;
}

.requests {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 4px;
}

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

.filters button {
  padding: 8px 6px;
  font-size: 13px;
  background: #f0f5fb;
  color: var(--muted);
}

.filters button.active {
  background: #dff0ff;
  color: #0758a5;
  font-weight: 700;
}

.request {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  background: #f6f9fd;
  color: var(--text);
  border: 1px solid transparent;
}

.request.active {
  border-color: #8fc8ff;
  background: #edf7ff;
}

.request-title {
  font-weight: 700;
}

.request-meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef4fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.approved,
.badge.sent-to-unf {
  background: #e7f8ef;
  color: var(--green);
}

.badge.needs-info {
  background: #fff4dc;
  color: var(--amber);
}

.badge.rejected,
.badge.paid,
.badge.archived {
  background: #ffe9e9;
  color: var(--red);
}

.empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

.card {
  display: grid;
  gap: 12px;
}

.summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #f7fbff);
}

.amount {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.status {
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef4fb;
  color: var(--muted);
  white-space: nowrap;
}

.cols,
.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(270px, 0.9fr) minmax(360px, 1.35fr);
  gap: 12px;
  align-items: start;
}

.block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: white;
}

.action-block {
  background: linear-gradient(135deg, #fff, #f4f9ff);
}

.decision-grid {
  display: grid;
  gap: 2px;
}

.field {
  display: grid;
  grid-template-columns: minmax(118px, 24%) minmax(0, 1fr);
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed #e5edf6;
  overflow-wrap: anywhere;
}

.field:last-child {
  border-bottom: 0;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.edit-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.edit-grid input,
.edit-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  background: #fbfdff;
}

.edit-grid textarea {
  min-height: 70px;
  grid-column: 1 / -1;
  resize: vertical;
}

.label {
  color: var(--muted);
}

.suggestion-list {
  display: grid;
  gap: 8px;
}

.suggestion {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
  overflow-wrap: anywhere;
}

.suggestion.selected {
  border-color: #8fc8ff;
  background: #edf7ff;
}

.suggestion strong {
  display: block;
  margin-bottom: 4px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.confidence {
  display: inline-flex;
  margin-left: 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.money-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
}

.money-line span {
  border-radius: 10px;
  background: #f1f6fb;
  padding: 7px 8px;
}

.money-line b {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.money-line .negative {
  color: var(--red);
}

.source-picker {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.source-picker h4 {
  margin: 0 0 4px;
}

.source-picker input {
  float: right;
  transform: scale(1.15);
}

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

pre {
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #101928;
  color: #dce8ff;
  font-size: 13px;
}

.footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.compact-actions {
  margin-top: 12px;
  gap: 8px;
}

.compact-actions button {
  padding: 8px 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 20, 35, 0.48);
}

.modal-card {
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(9, 23, 43, 0.34);
  padding: 22px;
}

.notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 20, 35, 0.42);
  backdrop-filter: blur(5px);
}

.notice-card {
  width: min(520px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(135deg, #ffffff, #f7fbff);
  box-shadow: 0 28px 80px rgba(9, 23, 43, 0.34);
  padding: 24px;
}

.notice-card.success {
  border-color: #b9ead3;
}

.notice-card.error {
  border-color: #ffd0d0;
}

.notice-card h2 {
  margin-bottom: 10px;
}

.notice-card p {
  margin: 0;
  color: var(--muted);
}

.notice-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
}

.modal-invoice {
  display: grid;
  gap: 4px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
}

.modal-invoice span {
  color: var(--muted);
}

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

.modal-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modal-form select,
.modal-form .select-search {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdff;
  color: var(--text);
}

.modal-form .select-search {
  margin-bottom: 4px;
  background: #fff;
}

.modal-preview {
  margin: 14px 0;
  padding: 14px;
  border-radius: 18px;
  background: #f7fafc;
  border: 1px solid var(--line);
}

.dialog-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dialog-preview-grid > div {
  padding: 10px;
  border-radius: 12px;
  background: white;
}

.dialog-preview-grid .wide {
  grid-column: 1 / -1;
}

a {
  color: var(--blue);
}

@media (max-width: 1180px) {
  .workbench,
  .support-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .cols,
  .workbench,
  .support-grid,
  .modal-form,
  .dialog-preview-grid {
    grid-template-columns: 1fr;
  }

  .queue {
    position: static;
    max-height: none;
  }

  .requests {
    max-height: none;
  }
}
