:root {
  --green: #2aa342;
  --dark: #051201;
  --bg: #f5f6f8;
  --card: #fff;
  --border: #dde1e6;
  --warn: #e8a300;
  --danger: #d1342f;
  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: #1a1a1a;
  line-height: 1.5;
}

header {
  background: var(--green);
  color: #fff;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-brand { display: flex; align-items: center; gap: 0.75rem; }
header h1 { font-size: 1.25rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.header-user { font-size: 0.82rem; color: rgba(255,255,255,0.85); }
.header-user a { color: #fff; text-decoration: none; font-weight: 500; }
.header-user a:hover { text-decoration: underline; }
.header-logo { height: 40px; width: auto; border-radius: 4px; }

main { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }

footer {
  text-align: center;
  padding: 1.5rem;
  color: #888;
  font-size: 0.85rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 { margin-bottom: 0.75rem; }
.card h3 { margin: 1rem 0 0.5rem; }

label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
input[type=date],
input[type=text],
input[type=email],
input[type=password],
input[type=number] {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}
input[type=number].amount-input { width: 140px; display: inline-block; margin-left: 0.5rem; }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row label { flex: 1; min-width: 180px; }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}
legend { font-weight: 600; padding: 0 0.5rem; }
.radio { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 1rem; font-weight: 400; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--dark);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s;
}
.btn:hover { background: #eee; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.primary:hover { background: #239438; }
.btn.small { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

.actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.88rem; }
th, td { padding: 0.45rem 0.6rem; border: 1px solid var(--border); text-align: left; }
th { background: var(--dark); color: #fff; font-weight: 600; }
tr:nth-child(even) { background: #fafafa; }
tr.needs-review { background: #fff8e1; }
.col-check { width: 36px; text-align: center !important; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.warn { background: #fff0c2; color: #8a6d00; }
.badge-count { font-size: 0.85rem; color: #666; margin-left: 0.5rem; }

details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 600; font-size: 1rem; padding: 0.3rem 0; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
}
.flash.success { background: #e6f7ea; color: #1a7a32; }
.flash.warning { background: #fff5d6; color: #8a6d00; }
.flash.error   { background: #fde8e8; color: #b91c1c; }

.review-section { background: #fffbe6; border-color: var(--warn); }
.review-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e8d88a;
  margin-bottom: 0.5rem;
}
.review-actions { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; }

.login-card { max-width: 400px; margin: 3rem auto; }
.forgot-link { margin-top: 0.75rem; text-align: center; font-size: 0.88rem; }
.forgot-link a { color: var(--green); text-decoration: none; }
.forgot-link a:hover { text-decoration: underline; }

/* Select all bar */
.select-all-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

/* Multi-select org picker */
.multiselect-container {
  margin-top: 0.75rem;
  position: relative;
}
.multiselect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.ms-tag {
  background: var(--green);
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.ms-tag button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.multiselect-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.multiselect-dropdown {
  display: none;
  position: absolute;
  z-index: 100;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.ms-option {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.ms-option:hover { background: #e8f5e9; }
.ms-no-match { color: #999; cursor: default; }
.ms-no-match:hover { background: transparent; }

/* Invoice checkboxes */
.select-invoices { margin: 1rem 0; }
.select-all-row { margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.invoice-checkboxes { display: flex; flex-direction: column; gap: 0.3rem; max-height: 250px; overflow-y: auto; }
.invoice-check { font-size: 0.9rem; }
