:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #616e7c;
  --line: #d9e2ec;
  --primary: #1f6f3f;
  --primary-hover: #185a33;
  --danger: #b42318;
  --danger-hover: #912018;
  --success-bg: #ecfdf3;
  --warning-bg: #fff4e5;
  --warning-text: #8a4b00;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header.site,
footer.site {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem;
}

header.site {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header.site .logo {
  max-height: 56px;
  max-width: 200px;
  height: auto;
  width: auto;
}

header.site .tenant {
  font-weight: 600;
  font-size: 1.1rem;
}

footer.site {
  color: var(--muted);
  font-size: 0.85rem;
}

footer.site .contact {
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

footer.site .contact span + span::before {
  content: " \00b7 ";
}

footer.site a {
  color: inherit;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.card.success {
  background: var(--success-bg);
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 0.75rem;
}

dl.quote {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0;
}

dl.quote dt {
  color: var(--muted);
}

dl.quote dd {
  margin: 0;
  font-weight: 500;
}

form {
  margin: 1rem 0 0.5rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

select {
  width: 100%;
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 0.75rem;
  background: #fff;
}

button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  width: 100%;
}

button.primary {
  background: var(--primary);
}

button.primary:hover {
  background: var(--primary-hover);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  color: var(--danger);
  margin: 0 0 0.75rem;
}

.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 0.75rem;
  border-radius: 6px;
}

/* ---- quote lines with a Won / Lost choice ---- */

textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 0.75rem;
  background: #fff;
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 0.75rem;
}

button.link {
  background: none;
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  width: auto;
  font-weight: 500;
  text-decoration: underline;
}

.js-only {
  display: none;
}

.js .js-only {
  display: inline;
}

ol.lines {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0;
  border-top: 1px solid var(--line);
}

/* On a narrow phone the toggle (or the Won/Lost badge) wraps under the description instead of
   squeezing it: .what asks for 11rem and the row is allowed to wrap. */
ol.lines .line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.line .what {
  display: flex;
  flex-direction: column;
  flex: 1 1 11rem;
  min-width: 0;
}

.line .desc {
  overflow-wrap: anywhere;
}

.line .qty {
  color: var(--muted);
  font-size: 0.9rem;
}

/* The toggle: two radio buttons drawn as a green and a red button side by side.
   The chosen one is solid; the other is dimmed. Works without script. */
.toggle {
  display: flex;
  flex: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle label {
  margin: 0;
  padding: 0.45rem 0.9rem;
  border: 2px solid transparent;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.35;
  user-select: none;
}

.toggle label.won {
  color: var(--primary);
  border-color: var(--primary);
  border-radius: 6px 0 0 6px;
}

.toggle label.lost {
  color: var(--danger);
  border-color: var(--danger);
  border-radius: 0 6px 6px 0;
  border-left-width: 0;
}

.toggle input:checked + label {
  opacity: 1;
  color: #fff;
}

.toggle input:checked + label.won {
  background: var(--primary);
}

.toggle input:checked + label.lost {
  background: var(--danger);
}

.toggle input:focus-visible + label {
  outline: 3px solid #1d4ed8;
  outline-offset: 2px;
}

.totals {
  font-size: 1.05rem;
}

/* ---- what was decided ---- */

.badge {
  flex: none;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.badge.won {
  background: var(--primary);
}

.badge.lost {
  background: var(--danger);
}

.line.is-lost .what {
  color: var(--muted);
  text-decoration: line-through;
}

.note-label {
  margin: 0.75rem 0 0.15rem;
  color: var(--muted);
}

.note {
  margin: 0 0 0.75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

/* ---- the Add Notes page ---- */

.card + .card {
  margin-top: 1rem;
}

h2 {
  font-size: 1.1rem;
  margin: 1rem 0 0.25rem;
}

ol.notes {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.notice {
  background: var(--success-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

@media (min-width: 30rem) {
  button {
    width: auto;
  }
}
