:root {
  --bg: #f6f4f0;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #b91c1c;
  --border: #ddd5c8;
}

* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); }
header {
  background: #2c2419;
  color: #f5efe6;
  padding: 0.75rem 1.25rem;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}
header a { color: #f5efe6; text-decoration: none; font-weight: 500; }
header .brand { font-weight: 700; margin-right: 0.5rem; }
main { max-width: 1100px; margin: 1.25rem auto; padding: 0 1rem 2rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat .label { font-size: 0.85rem; color: var(--muted); }
.stat .value { font-size: 1.35rem; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
input, select, textarea, button {
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
}
button.secondary { background: #4b5563; }
.status-outstanding { color: #92400e; font-weight: 600; }
.status-purchased { color: #166534; font-weight: 600; }
.status-submitted { color: #0f766e; font-weight: 600; }
.status-disputed { color: #c2410c; font-weight: 600; }
.status-repaid { color: #1d4ed8; font-weight: 600; }
header .header-search { margin-left: auto; }
header .header-search input {
  min-width: 11rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: none;
}
.search-results {
  border: 1px solid var(--border);
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  display: none;
}
.search-results.active { display: block; }
.search-results div {
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}
.search-results div:hover { background: #fef2f2; }
.preview-wrap {
  position: relative;
  text-align: center;
  background: #e8e4dc;
  padding: 0.75rem;
  border-radius: 8px;
}
.preview-wrap img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}
.preview-wrap img:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.preview-nudge-float {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.55rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}
.preview-nudge-float .nudge-row {
  display: flex;
  gap: 0.35rem;
}
.nudge-btn {
  min-width: 2.35rem;
  min-height: 2.35rem;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.35rem;
}
.nudge { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0.5rem 0; align-items: center; }
.nudge-sticky {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: calc(100vw - 2rem);
}
.nudge button.nudge-btn { padding: 0.25rem 0.5rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.desc { max-width: 280px; font-size: 0.85rem; }
.import-picker {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  background: #faf8f5;
}
.picker-label { display: block; cursor: pointer; }
.picker-title { font-weight: 600; display: block; margin-bottom: 0.25rem; }
.picker-input { display: block; margin-top: 0.5rem; max-width: 100%; }
.or-divider { text-align: center; margin: 0.5rem 0; }
.advanced-path { margin: 1rem 0; font-size: 0.9rem; }
.advanced-path summary { cursor: pointer; }
.link-list { margin: 0.75rem 0 0; padding-left: 1.25rem; }
.notes-block {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.92rem;
  background: #faf8f5;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  margin: 0.25rem 0;
}