:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-pale: #ccfbf1;
  --ink: #1c2b2a;
  --paper: #f7fafa;
  --error: #9a3412;
  --error-pale: #fff1e7;
  --warn: #b45309;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--teal-dark);
  color: #fff;
  padding: 0.6rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.brand img { display: block; }

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
}

h1 { font-size: 1.4rem; }

label { display: block; font-weight: 600; margin-bottom: 0.3rem; }

input[type="password"] {
  width: 100%;
  max-width: 22rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #b8c9c7;
  border-radius: 6px;
  font-size: 1rem;
}

button {
  font-size: 1rem;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
}

button:hover { background: var(--teal-dark); }

.login-form button { display: block; margin-top: 0.8rem; }

.link-button {
  background: none;
  padding: 0.2rem 0.4rem;
  color: var(--teal-pale);
  text-decoration: underline;
}

.link-button:hover { background: none; color: #fff; }

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  background: var(--teal-pale);
}

.flash-error {
  background: var(--error-pale);
  color: var(--error);
}

code {
  background: #e6efee;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav a { color: #fff; text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }

.button-link {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
}

.button-link:hover { background: var(--teal-dark); }

.button-link.quiet {
  background: none;
  border: 1px solid var(--teal);
  color: var(--teal);
}

.button-link.quiet:hover { background: var(--teal-pale); }

button.secondary {
  background: none;
  border: 1px solid var(--teal);
  color: var(--teal);
  padding: 0.3rem 0.8rem;
}

button.secondary:hover { background: var(--teal-pale); }

.table-wrap { overflow-x: auto; }

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

th, td {
  text-align: left;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid #dbe7e6;
}

th { color: var(--teal-dark); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

td .negative, td.negative { color: var(--error); }

tr.closed td { color: #6b7d7b; }

td.actions { white-space: nowrap; }
td.actions form { display: inline-block; margin-right: 0.3rem; }

form.stacked { max-width: 30rem; }

form.stacked label { margin-bottom: 0.8rem; }
form.stacked label small { font-weight: 400; color: #566a68; }

form.stacked input:not([type="checkbox"]):not([type="radio"]),
form.stacked select {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #b8c9c7;
  border-radius: 6px;
  font-size: 1rem;
  margin-top: 0.15rem;
}

form.stacked fieldset {
  border: 1px solid #b8c9c7;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}

form.stacked legend { font-weight: 600; padding: 0 0.3rem; }

label.check { font-weight: 400; }
label.check input { margin-right: 0.4rem; }

.radio-group { margin: 0.8rem 0; }
.radio-group .indent { margin-left: 1.6rem; }

.hint { color: #566a68; }

.nudge {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

/* link-buttons in the page body; the header's logout keeps the dark-nav colours */
main .link-button { color: #566a68; }
main .link-button:hover { color: var(--teal-dark); }

.report-summary { list-style: none; padding: 0; }
.report-summary li { padding: 0.15rem 0; }

ul.failures { padding-left: 1.2rem; }
ul.failures li { margin-bottom: 0.3rem; }

.empty-state { max-width: 36rem; }

/* Review queue — phone-first cards */
.review-item {
  background: #fff;
  border: 1px solid #dbe7e6;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.7rem;
}

.txn-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.7rem;
}

.txn-date, .txn-account { color: #566a68; white-space: nowrap; }
.txn-desc { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }

.txn-amount {
  margin-left: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.txn-amount.negative { color: var(--error); }

.transfer-suggestion .txn-line + .txn-line { margin-top: 0.3rem; }

.txn-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.txn-controls select, .bulk-bar select {
  flex: 1 1 12rem;
  max-width: 20rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #b8c9c7;
  border-radius: 6px;
  font-size: 1rem;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.remember { margin-top: 0.5rem; }
.remember-fields { margin: 0.5rem 0 0 1.6rem; }
.remember-fields label { font-weight: 400; margin-bottom: 0.4rem; }

.remember-fields input[type="text"] {
  display: block;
  width: 100%;
  max-width: 24rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #b8c9c7;
  border-radius: 6px;
  font-size: 1rem;
  margin-top: 0.15rem;
}

.remember-fields .radio-group { margin: 0.4rem 0 0; }
.remember-fields .radio-group label { margin-bottom: 0.2rem; }

/* Reports */
.period-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin: 0.5rem 0 1rem;
}

.period-modes a { margin-right: 0.8rem; }

.period-nav a.current {
  font-weight: 600;
  color: var(--teal-dark);
  text-decoration: none;
}

.period-label a { text-decoration: none; padding: 0 0.3rem; }

.chart-wrap { position: relative; height: 320px; margin: 1rem 0; }

tr.subtotal td, tr.total td { font-weight: 600; border-top: 2px solid #b8c9c7; }
tr.group-title td { padding-top: 1rem; border-bottom: none; }

.dash-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

/* Plans — what-if inputs and trajectory bars */
.plan-input {
  width: 7rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #b8c9c7;
  border-radius: 6px;
  font-size: 1rem;
  text-align: right;
}

td.warn { color: var(--warn); }

.traj-cell { min-width: 9rem; }

.traj {
  position: relative;
  height: 0.7rem;
  background: #e6efee;
  border-radius: 4px;
}

.traj-fill { height: 100%; background: var(--teal); border-radius: 4px; }
.traj-fill.warn { background: var(--warn); }

.traj-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  border-radius: 2px;
  background: var(--teal-dark);
}

.traj-marker.warn { background: var(--warn); }

.traj-tick {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 1px;
  background: var(--ink);
  opacity: 0.45;
}

.plans-actions { margin: 1rem 0; }

.chart-toggles { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.8rem 0 0.2rem; }
.chart-toggles span { font-weight: 600; }
.chart-toggles span + label { margin-left: -0.2rem; }
.headline { font-size: 1.4rem; }
.sparkline { vertical-align: middle; color: #0f766e; margin-left: 0.4rem; }
