:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --bg: #f6f8f4;
  --card: #ffffff;
  --text: #1c2419;
  --muted: #6b7568;
  --line: #dde4d9;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 64px; }

/* top bar */
.topbar {
  background: var(--green-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; gap: 8px; }
.logo-icon { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.login-logo { display: flex; justify-content: center; margin-bottom: 12px; }
.login-logo .logo-icon { width: 64px; height: 64px; }
.topbar nav { display: flex; align-items: center; gap: 14px; }
.topbar nav a { color: #d7e8d4; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #fff; }
.linklike {
  background: none; border: none; color: #d7e8d4; font-size: 14px;
  cursor: pointer; padding: 0; font-family: inherit;
}
.topbar form { display: inline; }

.flash {
  background: #e3f1e1; color: var(--green-dark);
  padding: 10px 16px; text-align: center; font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 24px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* buttons */
.btn, button[type="submit"] {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover, button[type="submit"]:hover { background: var(--green-dark); }
.btn.ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
.btn.ghost:hover { background: #eef3ec; }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.danger:hover { background: #fbeae9; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* search + tabs */
.search input {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: var(--card);
}
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab {
  padding: 6px 12px; border-radius: 999px; font-size: 14px;
  text-decoration: none; color: var(--muted); border: 1px solid var(--line); background: var(--card);
}
.tab.on { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }

/* customer cards */
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
}
.card:active { background: #f0f4ee; }
.card-title { font-weight: 650; font-size: 16px; }
.card-sub { font-size: 14px; margin-top: 2px; }
.muted { color: var(--muted); font-weight: 400; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* badges */
.badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 10px; border-radius: 999px;
}
.badge.active { background: #e3f1e1; color: var(--green-dark); }
.badge.prospect { background: #fdf3d7; color: #7a5b00; }
.badge.inactive { background: #ece9e6; color: #6f665e; }

.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

/* invoices */
.badge.inv-paid { background: #e3f1e1; color: var(--green-dark); }
.badge.inv-unpaid { background: #fde4e2; color: #a3271f; }
.badge.inv-draft { background: #ece9e6; color: #6f665e; }
.badge.inv-void { background: #ece9e6; color: #6f665e; text-decoration: line-through; }
.inv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inv-main { min-width: 0; }
.inv-amount { font-weight: 700; font-size: 16px; white-space: nowrap; }
.summary-row { display: flex; gap: 10px; margin: 4px 0 12px; }
.summary-tile {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.summary-tile span { font-size: 12px; }
.summary-tile strong { font-size: 20px; }
table.lines th, table.lines td { white-space: normal; }
table.lines .num { text-align: right; white-space: nowrap; }
table.lines tr.sub td { border-bottom: none; padding-top: 4px; padding-bottom: 4px; }
table.lines tr.grand td { border-top: 2px solid var(--line); font-weight: 700; font-size: 16px; }
.inv-message { background: #f0f4ee; border-radius: 8px; padding: 12px; color: var(--muted); font-style: italic; }

/* new invoice line items */
.line-row { display: grid; grid-template-columns: 1fr 56px 84px 32px; gap: 6px; margin-bottom: 8px; align-items: center; }
.line-row input { margin-top: 0; }
.line-x { background: transparent; color: var(--danger); border: 1px solid var(--line); border-radius: 8px; padding: 8px 0; font-size: 18px; line-height: 1; cursor: pointer; }
.line-x:hover { background: #fbeae9; }
.inv-total-live { text-align: right; font-size: 18px; margin: 16px 0; }
.inv-total-live strong { font-size: 22px; color: var(--green-dark); }
.row form { display: inline; }

/* email compose */
.radio { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; margin-bottom: 8px; text-transform: none; }
.radio input { width: auto !important; margin: 0 !important; }
.email-result { background: #e3f1e1; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.email-result ul { margin: 8px 0 0; padding-left: 18px; color: var(--danger); font-size: 14px; }

/* forms */
.form { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.form input, .form select, .form textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
.form fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 12px; }
.form legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* properties */
.property {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 10px;
}
.property summary {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 14px; cursor: pointer; font-weight: 600; list-style: none;
}
.property summary::-webkit-details-marker { display: none; }
.property .form { border: none; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.add-property summary { color: var(--green-dark); }

/* import */
.steps { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 16px 36px; }
.steps li { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; margin: 0; background: var(--bg); font-family: system-ui, sans-serif; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: min(90vw, 360px); text-align: center; }
.login-card h1 { font-size: 20px; margin: 0 0 16px; color: var(--green-dark); }
.login-card input { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.login-card button { width: 100%; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: #3c4043; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.google-btn:hover { background: #f7f8f6; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.error { color: var(--danger); font-size: 14px; margin-bottom: 12px; }

/* public pay page */
.pay-btn { width: 100%; font-size: 17px; padding: 14px; }
.pay-status.paid { text-align: center; font-size: 24px; font-weight: 700; color: var(--green-dark); background: #e3f1e1; border-radius: 10px; padding: 16px; margin-bottom: 8px; }
.pay-divider { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 13px; margin: 22px 0 16px; }
.pay-divider::before, .pay-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pay-divider span { padding: 0 12px; }
.p2p { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.p2p-method { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 150px; }
.qr { position: relative; display: inline-block; line-height: 0; background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 10px; }
.qr img, .qr canvas { display: block; border-radius: 4px; }
.qr-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 9px; color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px #fff; font-family: Arial, sans-serif;
}
.p2p-btn { width: 100%; text-align: center; }
.p2p-method .muted { font-size: 12px; }
.zelle-box { margin-top: 16px; padding: 14px; background: #f0f4ee; border: 1px solid var(--line); border-radius: 10px; text-align: center; font-size: 14px; line-height: 1.5; }
.zelle-box strong { color: var(--green-dark); }
