:root {
  --bg: #16110c;
  --bg-2: #221a12;
  --bg-3: #2c2218;
  --ink: #f4ece2;
  --muted: #b6a793;
  --line: #3d3124;
  --orange: #c45c12;
  --orange-2: #e0792a;
  --green: #6f9a4e;
  --red: #c44a3a;
  --gold: #d4a24a;
  --safe: env(safe-area-inset-bottom, 16px);
  --top: env(safe-area-inset-top, 12px);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(72px + var(--safe)); }

.topbar {
  padding: calc(var(--top) + 10px) 16px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(180deg, #2a1c10, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--orange);
  display: grid; place-items: center; font-weight: 800; letter-spacing: -0.04em;
}
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 14px; background: var(--bg-3);
  color: var(--ink); font-weight: 650;
}
.btn.primary { background: var(--orange); color: white; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.full { width: 100%; }
.btn.danger { background: #4a221c; color: #ffd4cc; }
.btn:disabled { opacity: 0.45; }

.screen { padding: 0 16px 24px; }
.hero-card, .card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 16px;
}
.hero-card { background: linear-gradient(160deg, #3a2414, #22180f 55%); }
.hero-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.04em; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #0003; border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 20px; }

.job-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.job {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
}
.job h3 { margin: 0 0 4px; font-size: 16px; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: #3a2a1c; color: var(--gold);
}
.pill.sent { background: #243318; color: #b6d48c; }
.pill.invoice { background: #1c2d3a; color: #9ec7e8; }
.pill.won { background: #2a3a1c; color: #c7e39a; }
.job { cursor: pointer; }
.money { font-weight: 750; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #120e0aee; backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + var(--safe));
}
.nav button {
  background: none; border: 0; color: var(--muted); padding: 8px 4px; font-size: 11px; font-weight: 650;
}
.nav button.on { color: var(--orange-2); }

label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; font-weight: 650; }
input, textarea, select {
  width: 100%; background: #100c09; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 12px; outline: none;
}
textarea { min-height: 88px; resize: vertical; }
.mic {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--orange); color: white; font-size: 18px;
}
.mic.live { animation: pulse 1s infinite; background: var(--red); }
@keyframes pulse { 50% { transform: scale(1.08); } }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photos img, .photos .add-photo {
  aspect-ratio: 1; object-fit: cover; border-radius: 12px; width: 100%; background: #100c09; border: 1px dashed var(--line);
}
.add-photo { display: grid; place-items: center; color: var(--muted); font-size: 28px; margin: 0; cursor: pointer; }

.line { display: grid; grid-template-columns: 1.4fr 0.6fr 0.7fr auto; gap: 6px; align-items: center; margin-bottom: 8px; }
.line input { padding: 8px; }
.total-box {
  margin-top: 14px; padding: 14px; border-radius: 14px; background: #100c09; border: 1px solid var(--line);
}
.total-box div { display: flex; justify-content: space-between; margin: 4px 0; }
.total-box .grand { font-size: 20px; font-weight: 800; color: var(--orange-2); }

.assembly {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 12px; border-bottom: 1px solid var(--line);
}
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(86px + var(--safe));
  background: #3a2a14; border: 1px solid var(--gold); color: #ffe7b8;
  padding: 12px 14px; border-radius: 12px; z-index: 20;
}

.print-sheet { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-sheet, .print-sheet * { visibility: visible; }
  .print-sheet { display: block; position: absolute; inset: 0; background: white; color: #111; padding: 24px; }
  .nav, .topbar, .app-shell { display: none !important; }
}
