* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0; background: #f5f7fa; color: #1f2937;
}
.nav {
  background: #1f4e78; color: #fff;
  padding: 12px 20px; display: flex; gap: 18px; align-items: center;
  position: sticky; top: 0; z-index: 5;
}
.nav a { color: #fff; text-decoration: none; font-weight: 500; }
.nav a:hover { text-decoration: underline; }
.nav .brand { font-weight: 700; font-size: 1.15em; margin-right: 18px; }
.nav .danger { color: #ffd2d2; }
.nav .warn   { color: #ffe699; }

.container { max-width: 1500px; margin: 22px auto; padding: 0 22px; }
h1 { margin-top: 0; }
h2 { margin-top: 28px; border-bottom: 1px solid #e5e7eb; padding-bottom: 6px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); margin: 16px 0 28px; }
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,.05); display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 4px; font-size: 1.1em; color: #111827; font-weight: 700; }
.card .big { font-size: 1.9em; font-weight: 700; }
.bucket-label { font-size: 0.75em; font-weight: 700; letter-spacing: .05em; color: #6b7280; margin-bottom: 12px; }
.stats-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.stats-row .count { font-size: 1.4em; font-weight: 600; color: #374151; }
.stats-row .money { font-size: 1.8em; font-weight: 800; color: #059669; }
.card.danger .money { color: #dc2626; }
.card.warn .money { color: #d97706; }
.desc { font-size: 0.85em; color: #4b5563; line-height: 1.4; flex-grow: 1; margin-bottom: 16px; }

.card.ok      { border-left: 4px solid #16a34a; }
.card.danger  { border-left: 4px solid #dc2626; }
.card.warn    { border-left: 4px solid #f59e0b; }
.btn {
  display: inline-block; margin-top: auto; text-align: center;
  background: #1f4e78; color: #fff; padding: 8px 12px; border-radius: 6px;
  text-decoration: none; font-size: 0.95em; font-weight: 500;
}

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
th, td { padding: 8px 12px; text-align: left; font-size: 0.92em; border-bottom: 1px solid #f0f1f4; vertical-align: top; }
th { background: #eef2f7; font-weight: 600; }
tr:hover { background: #fafbff; }
tr.phantom    { background: #fff6f6; }
tr.duplicate  { background: #fff7ed; }
tr.ambiguous  { background: #f5f3ff; }
tr.orphan     { background: #fffbeb; }

code { background: #f1f5f9; padding: 1px 6px; border-radius: 3px; font-size: 0.9em; }
.muted { color: #6b7280; font-size: 0.88em; }
.danger { color: #dc2626; font-weight: 600; }
.warn   { color: #b45309; font-weight: 600; }

.filter { margin: 12px 0; display: flex; gap: 8px; }
.filter input, .filter select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 4px; }
.filter button { padding: 6px 12px; background: #1f4e78; color: #fff; border: 0; border-radius: 4px; cursor: pointer; }

form.inline { display: flex; gap: 4px; }
form.inline input { padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 3px; font-size: 0.85em; }
form.inline button { background: #4b5563; color: #fff; border: 0; padding: 4px 10px; border-radius: 3px; cursor: pointer; font-size: 0.85em; }

pre { background: #1f2937; color: #d1d5db; padding: 12px; border-radius: 6px; overflow-x: auto; }

.nav .spacer { flex: 1; }
.nav a.upload {
  background: #16a34a; padding: 6px 14px; border-radius: 5px;
}
.nav a.upload:hover { background: #15803d; text-decoration: none; }

.flash {
  padding: 10px 14px; border-radius: 6px; margin: 0 0 14px;
  border-left: 4px solid #1f4e78; background: #eef4fb;
}
.flash.ok     { border-color: #16a34a; background: #ecfdf5; }
.flash.warn   { border-color: #f59e0b; background: #fff7ed; }
.flash.danger { border-color: #dc2626; background: #fef2f2; }

.upload-form { background: #fff; padding: 18px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.drop {
  display: block; border: 2px dashed #94a3b8; border-radius: 8px;
  padding: 30px; text-align: center; cursor: pointer; background: #f8fafc;
  transition: background .15s, border-color .15s;
}
.drop:hover { background: #eef2f7; border-color: #1f4e78; }
.drop input[type=file] { display: block; margin: 0 auto 14px; }
.drop-hint { color: #4b5563; }

.btn-row { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }
.btn, .btn-secondary, .btn-danger, .btn-link {
  border: 0; padding: 8px 16px; border-radius: 5px; cursor: pointer; font-size: 0.95em;
}
.btn          { background: #1f4e78; color: #fff; }
.btn:hover    { background: #163e63; }
.btn-secondary{ background: #e5e7eb; color: #1f2937; }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-link     { background: transparent; color: #1f4e78; text-decoration: underline; padding: 0; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8em; font-weight: 600; }
.tag.ok     { background: #dcfce7; color: #166534; }
.tag.warn   { background: #fef3c7; color: #92400e; }
.tag.danger { background: #fee2e2; color: #991b1b; }

.report-list { list-style: none; padding: 0; }
.report-list li { padding: 6px 0; border-bottom: 1px dashed #e5e7eb; }
.report-list a { color: #1f4e78; text-decoration: none; }
.report-list a:hover { text-decoration: underline; }
