:root {
  --bg: #0f1419;
  --surface: #1a2027;
  --surface-2: #232b34;
  --border: #2e3742;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #2ea043;
  --accent-2: #58a6ff;
  --danger: #f0883e;
  --radius: 10px;
  --maxw: 880px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent-2); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
header.site { border-bottom: 1px solid var(--border); padding: 16px 0; }
header.site .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
header.site .brand { font-weight: 700; color: var(--text); text-decoration: none; }
header.site nav a { margin-left: 16px; font-size: 14px; }

main { padding: 32px 0 48px; }
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 32px 0 12px; }
.lede { color: var(--muted); margin: 0 0 24px; }

/* Calculator */
.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
@media (max-width: 680px) { .calc { grid-template-columns: 1fr; } }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; font-size: 16px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
}
.field .inline { display: flex; gap: 10px; }
.field .inline > * { flex: 1; }

.results { background: var(--surface-2); border-radius: 8px; padding: 20px; }
.net-big { font-size: 32px; font-weight: 700; color: var(--accent); margin: 0; }
.net-sub { color: var(--muted); font-size: 14px; margin: 2px 0 18px; }
.line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.line:last-child { border-bottom: 0; }
.line .lbl { color: var(--muted); }
.line.total { font-weight: 700; color: var(--text); }
.rate-row { display: flex; gap: 16px; margin-top: 14px; font-size: 13px; color: var(--muted); }

/* Ad slots */
.ad-slot {
  margin: 28px 0; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: 8px;
  color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}

/* State grid (home) */
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.state-grid a, .state-grid span {
  display: block; padding: 12px 14px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); text-decoration: none;
}
.state-grid span { color: var(--muted); opacity: .55; }

.prose { color: var(--text); }
.prose p { margin: 0 0 14px; }
.note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--border); padding: 4px 0 4px 14px; margin: 18px 0; }

/* Invoice generator */
.inv { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .inv { grid-template-columns: 1fr; } }
.inv-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.inv-form h2 { font-size: 15px; margin: 20px 0 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.inv-form h2:first-child { margin-top: 0; }
.inv-form textarea { width: 100%; padding: 10px 12px; font: inherit; font-size: 15px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.inv-side { position: sticky; top: 16px; }

.item-row { display: grid; grid-template-columns: 1fr 56px 80px 80px 28px; gap: 6px; margin-bottom: 6px; align-items: center; }
.item-row input { padding: 8px; font-size: 14px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; width: 100%; }
.item-row .rm { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 18px; line-height: 1; }
.item-head { display: grid; grid-template-columns: 1fr 56px 80px 80px 28px; gap: 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }

.btn-primary { width: 100%; padding: 12px; font-size: 16px; font-weight: 700; color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; margin-bottom: 8px; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { padding: 8px 12px; font-size: 14px; color: var(--accent-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.muted-small { font-size: 12px; color: var(--muted); min-height: 14px; margin: 0 0 12px; }

.inv-preview { background: #fff; color: #1a1a1a; border-radius: 8px; padding: 22px; font-size: 13px; line-height: 1.45; }
.inv-preview h3 { margin: 0 0 2px; font-size: 20px; color: #111; }
.inv-preview .pv-row { display: flex; justify-content: space-between; gap: 16px; }
.inv-preview .pv-parties { display: flex; justify-content: space-between; gap: 16px; margin: 16px 0; }
.inv-preview .pv-parties .lbl { color: #888; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.inv-preview table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.inv-preview th { text-align: left; border-bottom: 2px solid #222; padding: 6px 4px; font-size: 11px; text-transform: uppercase; color: #555; }
.inv-preview th.num, .inv-preview td.num { text-align: right; }
.inv-preview td { padding: 6px 4px; border-bottom: 1px solid #eee; }
.inv-preview .pv-totals { margin-left: auto; width: 60%; }
.inv-preview .pv-totals .pv-row { padding: 3px 0; }
.inv-preview .pv-totals .grand { font-weight: 700; font-size: 15px; border-top: 2px solid #222; margin-top: 4px; padding-top: 6px; }
.inv-preview .pv-notes { margin-top: 16px; color: #555; white-space: pre-wrap; }
.inv-preview .pv-meta { color: #555; white-space: pre-wrap; }

/* Image editor (circle-crop etc.) */
.dropzone { display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 120px; padding: 20px; border: 2px dashed var(--border); border-radius: 8px;
  color: var(--muted); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--surface-2); color: var(--text); }
.editor-wrap { display: inline-block; border-radius: 8px; overflow: hidden;
  background-image: linear-gradient(45deg,#2a2a2a 25%,transparent 25%),linear-gradient(-45deg,#2a2a2a 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#2a2a2a 75%),linear-gradient(-45deg,transparent 75%,#2a2a2a 75%);
  background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
.editor-wrap canvas { display: block; width: 320px; height: 320px; max-width: 100%; }

footer.site { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 13px; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
