:root {
  color-scheme: light;
  --color-primary: #21a0ff;
  --color-secondary: #477cf5;
  --color-text: #283142;
  --color-bg: #f0f5ff;
  --color-white: #ffffff;
  --color-light-accent: #9ab9fa;
  --color-input-shadow: rgba(40, 49, 66, 0.15);
  --gradient-primary: linear-gradient(269deg, #21a0ff 13%, #477cf5 87%);

  --bg: var(--color-bg);
  --surface: var(--color-white);
  --border: #c8d7f5;
  --text: var(--color-text);
  --muted: #5c6b86;
  --accent: var(--color-primary);
  --accent-dark: var(--color-secondary);
  --ok-bg: #e8f4ef;
  --ok-border: #7dccb0;
  --ok-text: #0d5c2e;
  --danger: #c02626;
  --shadow: 0 4px 24px var(--color-input-shadow);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.topbar-spacer {
  flex: 1;
  min-width: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-decoration: none;
}

.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--color-secondary);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand-title {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 16px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

label {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

select,
input[type="password"],
input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"] {
  width: 100%;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-light-accent);
  background: var(--color-white);
  font: inherit;
  color: var(--color-text);
  box-shadow: 0 1px 4px var(--color-input-shadow);
}

select:focus-visible,
input[type="password"]:focus-visible,
input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
input[type="date"]:focus-visible {
  outline: 2px solid rgba(33, 160, 255, 0.55);
  outline-offset: 2px;
  border-color: var(--color-primary);
}

input[type="search"]:focus-visible:not(.filter-search-input) {
  outline: 2px solid rgba(33, 160, 255, 0.55);
  outline-offset: 2px;
  border-color: var(--color-primary);
}

input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  width: 14px;
  margin-right: 2px;
  cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235c6b86'%3E%3Cpath d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E")
    center / 14px 14px no-repeat;
}

/** Filterkaart: zoekveld met icoon, sluit visueel aan bij selects */
.filter-search {
  flex: 1;
  min-width: 200px;
  max-width: 380px;
}

.filter-search-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 8px;
  padding: 0 4px 0 12px;
  max-width: none;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--color-light-accent);
  background: var(--color-white);
  box-shadow: 0 1px 4px var(--color-input-shadow);
}

.filter-search-inner:focus-within {
  outline: 2px solid rgba(33, 160, 255, 0.55);
  outline-offset: 2px;
  border-color: var(--color-primary);
}

.filter-search-glyph {
  width: 18px;
  height: 18px;
  color: var(--muted);
  opacity: 0.9;
  flex-shrink: 0;
  grid-column: 1;
}

.filter-search-inner .filter-search-input {
  grid-column: 2;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 10px 12px 10px 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.filter-search-inner .filter-search-input:focus-visible {
  outline: none;
}

.filter-search-inner:focus-within .filter-search-glyph {
  color: var(--color-secondary);
  opacity: 1;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  background: var(--gradient-primary);
  color: var(--color-white);
  font-weight: 600;
  box-shadow: 0 2px 8px var(--color-input-shadow);
}

.btn:hover {
  filter: brightness(1.06);
}

.btn.secondary {
  background: rgba(154, 185, 250, 0.35);
  color: var(--color-secondary);
  border: 1px solid var(--color-light-accent);
  box-shadow: none;
}

.btn.secondary:hover {
  background: rgba(154, 185, 250, 0.5);
  filter: none;
}

.btn.ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-light-accent);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(154, 185, 250, 0.15);
  filter: none;
}

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

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.85);
}

.stat strong {
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.drop {
  border: 2px dashed var(--color-light-accent);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.drop.drag {
  border-color: var(--color-primary);
  background: rgba(33, 160, 255, 0.08);
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  background: rgba(154, 185, 250, 0.2);
}

tr.ok td {
  background: var(--ok-bg);
}

.tr-desc {
  min-width: min(320px, 100%);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  vertical-align: top;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.col-date {
  width: 1%;
  min-width: 7.25rem;
  white-space: nowrap;
}

.col-fd {
  min-width: 7.25rem;
  white-space: nowrap;
}

.invoice-zone {
  border: 2px dashed var(--color-light-accent);
  border-radius: 10px;
  padding: 10px;
  min-height: 52px;
  font-size: 13px;
  color: var(--muted);
  background: var(--color-white);
}

.invoice-zone.active {
  border-color: var(--color-primary);
  background: rgba(33, 160, 255, 0.07);
  color: var(--text);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(154, 185, 250, 0.35);
  color: var(--color-secondary);
  font-size: 13px;
  font-weight: 600;
}

.pill.ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
}

a.inline {
  color: var(--color-secondary);
  font-weight: 600;
  text-decoration: none;
}

a.inline:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.inbox-upload-card {
  max-width: 100%;
}

.inbox-compact-drop {
  padding: 14px 16px;
  text-align: left;
}

.inbox-expanded-block {
  margin-top: 0;
}

.inbox-preview-box--tight {
  min-height: 0;
}

.inbox-split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 840px) {
  .inbox-split {
    grid-template-columns: 1fr;
  }
}

.inbox-preview-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.75);
  min-height: 320px;
}

.inbox-preview-box.drag {
  border-color: var(--color-primary);
  background: rgba(33, 160, 255, 0.08);
}

.inbox-pdf-frame {
  width: 100%;
  height: 420px;
  border: 0;
  display: block;
  background: #525659;
}

.inbox-preview-placeholder {
  padding: 48px 20px;
  text-align: center;
}

.inbox-form label {
  margin-bottom: 4px;
}

.inbox-form input,
.inbox-form select {
  max-width: 100%;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.col-suggest {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.suggest-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: none;
  border-radius: 10px;
  background: rgba(154, 185, 250, 0.45);
  color: var(--color-secondary);
  cursor: pointer;
  box-shadow: 0 1px 3px var(--color-input-shadow);
}

.suggest-btn:hover {
  background: rgba(33, 160, 255, 0.25);
  color: var(--color-primary);
}

.suggest-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(40, 49, 66, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  z-index: 50;
  overflow-y: auto;
}

.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: min(88vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.match-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.login-brand .brand-logo {
  height: 48px;
}
