:root {
  --blue-dark:#1F4E79;
  --blue-med:#2E75B6;
  --blue-light:#DCE9F7;
  --blue-lighter:#EFF5FC;
  --orange:#ED7D31;
  --orange-dark:#C25700;
  --orange-light:#FCE9DA;
  --gray-text:#333;
  --border:#d7dde3;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Calibri, Arial, sans-serif;
  background: #f2f5f8; color: var(--gray-text); margin: 0; line-height: 1.5;
}
a { color: var(--blue-med); }
.topbar {
  background: var(--blue-dark); color: #fff; padding: 14px 28px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.topbar img { height: 26px; }
.topbar nav a { color: #fff; text-decoration: none; margin-left: 18px; font-size: 14px; opacity: .9; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 24px 26px; margin-bottom: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
h1.page-title { font-size: 22px; color: var(--blue-dark); margin: 0 0 18px; }
h2.card-title { font-size: 16px; color: var(--blue-dark); margin: 0 0 16px; border-bottom: 2px solid var(--blue-light); padding-bottom: 8px; }

.btn {
  display: inline-block; background: var(--orange); color: #fff !important; border: none;
  padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--orange-dark); }
.btn.secondary { background: var(--blue-med); }
.btn.secondary:hover { background: var(--blue-dark); }
.btn.danger { background: #b3392c; }
.btn.danger:hover { background: #8f2c22; }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn.ghost { background: #fff; color: var(--blue-med) !important; border: 1px solid var(--blue-med); }

form.stacked label { display: block; font-size: 13px; font-weight: 600; color: var(--blue-dark); margin: 14px 0 5px; }
form.stacked input[type=text], form.stacked input[type=email], form.stacked input[type=password],
form.stacked input[type=number], form.stacked textarea, form.stacked select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit;
}
form.stacked textarea { resize: vertical; }
form.stacked .hint { font-size: 12px; color: #888; margin-top: 3px; }
form.stacked .row { display: flex; gap: 16px; flex-wrap: wrap; }
form.stacked .row > div { flex: 1; min-width: 220px; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: #667; border-bottom: 2px solid var(--border); padding: 10px 10px; }
table.list td { padding: 12px 10px; border-bottom: 1px solid #eef0f2; font-size: 14px; }
table.list tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 12px; font-size: 11.5px; font-weight: 700; }
.badge.draft { background: #e6e8eb; color: #555; }
.badge.sent { background: var(--blue-light); color: var(--blue-dark); }
.badge.accepted { background: #d9f0df; color: #237a3e; }
.badge.superseded { background: #f3e6e6; color: #8a4a4a; }

.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 18px; font-size: 14px; }
.flash.success { background: #e2f5e8; color: #237a3e; border: 1px solid #b7e3c4; }
.flash.error { background: #fbe4e1; color: #9c2b1f; border: 1px solid #f3c1ba; }
.flash.info { background: var(--blue-lighter); color: var(--blue-dark); border: 1px solid var(--blue-light); }

.login-wrap { max-width: 380px; margin: 10vh auto; }
.login-wrap .card { text-align: left; }
.login-wrap .logo-center { text-align: center; margin-bottom: 20px; }
.login-wrap .logo-center img { height: 40px; }

.steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.steps .step {
  flex: 1; min-width: 90px; text-align: center; padding: 9px 6px; border-radius: 6px;
  background: #eef1f4; color: #889; font-size: 12.5px; font-weight: 600;
}
.steps .step.active { background: var(--blue-med); color: #fff; }
.steps .step.done { background: var(--blue-light); color: var(--blue-dark); }

.wizard-step { display: none; }
.wizard-step.active { display: block; }

.item-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.item-row .desc { flex: 3; }
.item-row .amount { flex: 1; }
.item-row .optional-flag { flex: 0 0 auto; }
.item-row .remove-row { flex: 0 0 auto; }

.totals { text-align: right; font-size: 14px; margin-top: 10px; }
.totals .grand { font-size: 18px; font-weight: 700; color: var(--orange-dark); }

.tpl-choice { display: flex; gap: 16px; flex-wrap: wrap; }
.tpl-choice label {
  flex: 1; min-width: 220px; border: 2px solid var(--border); border-radius: 8px; padding: 14px;
  cursor: pointer; display: block; font-weight: normal;
}
.tpl-choice input { margin-right: 8px; }
.tpl-choice label.selected { border-color: var(--blue-med); background: var(--blue-lighter); }
.tpl-choice .preview-swatch { height: 60px; border-radius: 5px; margin-top: 8px; }
.tpl-choice .swatch-classic { background: linear-gradient(135deg, var(--blue-light) 60%, var(--orange-light)); border-bottom: 4px solid var(--orange); }
.tpl-choice .swatch-compact { background: #fff; border: 1px solid var(--border); border-bottom: 2px solid var(--orange); }

.wizard-actions { margin-top: 26px; display: flex; justify-content: space-between; }

.link-copy { display: flex; gap: 8px; align-items: center; }
.link-copy input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; background: #fafbfc; }

footer.app-footer { text-align: center; font-size: 12px; color: #99a; padding: 20px; }
