:root {
  --bg: #fff;
  --fg: #1f2d3d;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1f73b7;
  --accent-soft: #eaf2fb;
  --ok: #1f7a3d;
  --warn: #9a6a00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
}

#app {
  padding: 12px;
}

.state {
  color: var(--muted);
  padding: 24px 8px;
  text-align: center;
}

.state.error {
  color: #b42318;
}

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

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

.row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 6px;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
}

td.num,
th.num {
  text-align: right;
}

.right {
  text-align: right;
}

button {
  font: inherit;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button:hover {
  filter: brightness(0.97);
}

input[type='search'] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 6px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.pdf-cell {
  white-space: nowrap;
  text-align: right;
}

button.icon {
  padding: 2px 7px;
  margin-left: 4px;
  font-size: 14px;
  line-height: 1;
  border-radius: 5px;
}

button.icon:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.toast {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1f2d3d;
  color: #fff;
  border-radius: 10px;
  padding: 16px 20px 16px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  font-size: 14px;
  max-width: 260px;
  width: calc(100% - 32px);
  z-index: 999;
  line-height: 1.4;
}

.toast.visible {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast.error {
  background: #7f1d1d;
}

.toast-msg {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

.toast-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 998;
}

.toast-overlay.visible {
  display: block;
}
