:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5c6370;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --max: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 0;
  flex-wrap: wrap;
}
.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--accent); }
nav {
  display: flex;
  gap: .25rem .85rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: .92rem;
}
nav a { color: var(--muted); }
nav a:hover, nav a.active { color: var(--accent); text-decoration: none; }

main { flex: 1; padding: 2rem 0 3rem; }

.hero { text-align: center; padding: 1.5rem 0 2rem; }
.hero h1 {
  font-size: clamp(1.55rem, 4.5vw, 2.1rem);
  line-height: 1.25;
  margin: 0 0 .75rem;
  letter-spacing: -.02em;
}
.hero .tagline {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 .5rem;
  font-size: 1rem;
}
.hero .sub {
  color: var(--muted);
  margin: 0 auto 1.5rem;
  max-width: 40rem;
  font-size: 1.02rem;
}
.actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: #c5cad3; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: .35rem .5rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-sm {
  padding: .45rem .85rem;
  font-size: .88rem;
}

.features {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 2rem 0;
}
@media (min-width: 560px) {
  .features { grid-template-columns: repeat(3, 1fr); }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 .4rem; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }

.how { margin-top: 2rem; }
.how h2 { font-size: 1.2rem; margin: 0 0 1rem; text-align: center; }
.how ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: .75rem;
}
.how li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem .9rem 3rem;
  position: relative;
  counter-increment: step;
}
.how li::before {
  content: counter(step);
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-title { margin: 0 0 1.25rem; font-size: 1.5rem; }

.privacy-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  margin: 0 0 1.25rem;
}

.tool-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 860px) {
  .tool-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 .85rem;
  font-size: 1.05rem;
}
.field {
  margin-bottom: .85rem;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: .3rem;
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  padding: .55rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}
.field textarea { min-height: 4rem; resize: vertical; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.items-table-wrap { overflow-x: auto; margin: .5rem 0 0; }
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.items-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: .35rem .4rem;
  border-bottom: 1px solid var(--border);
}
.items-table td {
  padding: .35rem .25rem;
  vertical-align: middle;
}
.items-table input {
  width: 100%;
  font: inherit;
  padding: .4rem .5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.items-table .item-amount-cell { white-space: nowrap; color: var(--muted); font-size: .85rem; min-width: 4.5rem; }

.toolbar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 1rem 0 .5rem;
  align-items: center;
}
.toolbar-secondary {
  margin-top: .25rem;
}

.status {
  margin-top: .75rem;
  font-size: .92rem;
  min-height: 1.4em;
  color: var(--muted);
}
.status.ok { color: #059669; }
.status.err { color: var(--danger); }

.preview-panel {
  position: sticky;
  top: 4.5rem;
}
.preview-title {
  font-size: .95rem;
  font-weight: 600;
  margin: 0 0 .75rem;
  color: var(--muted);
}

/* Quote sheet (also captured for PDF) */
.quote-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem 1.75rem;
  box-shadow: var(--shadow);
  color: #111;
}
.quote-h {
  text-align: center;
  margin: 0 0 1.25rem;
  font-size: 1.45rem;
  letter-spacing: .35em;
  font-weight: 700;
}
.quote-meta {
  display: grid;
  gap: .35rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}
.quote-meta .k,
.quote-totals .k,
.quote-notes .k {
  color: #4b5563;
  font-weight: 600;
}
.quote-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-bottom: 1rem;
}
.quote-table th,
.quote-table td {
  border: 1px solid #d1d5db;
  padding: .45rem .55rem;
}
.quote-table th {
  background: #f3f4f6;
  font-weight: 600;
}
.quote-table .c { text-align: center; }
.quote-table .r { text-align: right; }
.quote-table .empty-row {
  text-align: center;
  color: #9ca3af;
  padding: 1rem;
}
.quote-totals {
  text-align: right;
  font-size: .95rem;
  display: grid;
  gap: .25rem;
  margin-bottom: .75rem;
}
.quote-totals .total {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: .15rem;
}
.quote-notes {
  font-size: .9rem;
  color: #374151;
  border-top: 1px dashed #e5e7eb;
  padding-top: .75rem;
  white-space: pre-wrap;
}

.privacy-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.privacy-body p {
  margin: 0 0 1rem;
  color: var(--muted);
}
.privacy-body p:last-child { margin-bottom: 0; }

footer.site {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 0;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}

.keywords-note {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  margin-top: 2rem;
}
