:root { --bg: #f7f3ee; --surface: #fffdf9; --alt: #efe8dc; --text: #1a1e1c; --dim: #5f6a66; --border: #ddd3c2; --accent: #1c3a3a; --brass: #b98a2f; --danger: #b3372f; --ok: #2f7a4f; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.serif { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px 80px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.logo { color: var(--brass); font-weight: 800; letter-spacing: .08em; font-size: .85rem; text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--text); padding: 7px 14px; border-radius: 999px; font-weight: 500; font-size: .92rem; }
.nav a.on { background: var(--accent); color: #fff; }
.who { display: flex; gap: 10px; align-items: center; font-size: .85rem; color: var(--dim); }
.banner { margin-top: 16px; border-radius: 12px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.trial { background: #eef4f1; border: 1px solid #c9ddd3; }
.banner.warn { background: #fff4e5; border: 1px solid #f0c98a; }
.banner.acting { background: #1c3a3a; color: #fff; }
.banner.acting button { background: #fff; color: #1c3a3a; }
.head { margin-top: 28px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.head h1 { font-size: 2rem; line-height: 1.15; }
.head p { color: var(--dim); margin-top: 4px; max-width: 620px; }
.btn { border: 0; border-radius: 999px; padding: 9px 18px; font-weight: 600; cursor: pointer; background: var(--accent); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 2.5rem; }
.btn.brass { background: var(--brass); color: #111; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 5px 12px; font-size: .85rem; min-height: 2rem; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.btn:disabled { opacity: .5; cursor: default; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.stat .n { font-size: 1.8rem; line-height: 1.1; }
.stat .c { font-size: .82rem; color: var(--dim); }
.field { display: grid; gap: 4px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--dim); }
.field input, .field textarea, .field select, .inp { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 8px 10px; min-height: 2.4rem; width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .8rem; color: var(--dim); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1a1e1c; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 500; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); }
.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--border); border-radius: 16px; background: var(--surface); margin-top: 20px; color: var(--dim); }
.empty .t { font-size: 1.4rem; color: var(--text); }

/* leads */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: .85rem; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lead { display: grid; gap: 16px; }
@media (min-width: 800px) { .lead { grid-template-columns: 260px 1fr; } }
.lead .imgs { display: grid; gap: 8px; }
.lead .imgs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--alt); }
.lead .imgs .cap { font-size: .75rem; color: var(--dim); margin-top: -4px; }
.lead .noimg { aspect-ratio: 4/3; border-radius: 10px; background: var(--alt); display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: .85rem; }
.lead-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lead-name { font-size: 1.5rem; line-height: 1.2; }
.lead-meta { font-size: .85rem; color: var(--dim); }
.lead-est { text-align: right; }
.lead-est .amt { font-size: 1.4rem; }
.contact { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.summary { margin-top: 10px; font-size: .9rem; }
.lines { list-style: none; margin: 8px 0 0; padding: 0; font-size: .85rem; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--border); }
.lead-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.status-new { color: var(--brass); font-weight: 700; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--alt); }
.badge.new { background: #f6e7c8; color: #7a5510; }
.badge.won { background: #d9efe2; color: #1f5c39; }
.badge.lost { background: #eee; color: #777; }

/* price book */
.pb-section { margin-top: 18px; }
.pb-section h3 { font-size: 1.25rem; }
.pb-section .hint { margin: 2px 0 8px; }
.pb-table { width: 100%; border-collapse: collapse; }
.pb-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 6px 6px; font-weight: 700; }
.pb-table td { padding: 5px 6px; border-top: 1px solid var(--border); vertical-align: middle; }
.pb-table input[type=text] { width: 100%; }
.pb-table input[type=number] { width: 100px; }
.pb-table input[type=color] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.pb-table tr.off td { opacity: .45; }
.pb-table tr.off td:first-child { opacity: 1; }
.tablewrap { overflow-x: auto; }
.savebar { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--border); padding: 12px 0; margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 5; }
.dirty { color: var(--brass); font-weight: 600; font-size: .9rem; }
.switch { width: 18px; height: 18px; accent-color: var(--accent); }

.codebox { background: #1a1e1c; color: #e8e3d8; border-radius: 10px; padding: 14px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.imgprev { width: 160px; height: 100px; border-radius: 10px; border: 1px solid var(--border); object-fit: cover; background: var(--alt); }
.logoprev { height: 56px; max-width: 220px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 4px; }

/* auth */
.auth { max-width: 440px; margin: 48px auto; }
.auth h1 { font-size: 2.2rem; line-height: 1.1; }
.auth form { display: grid; gap: 12px; margin-top: 20px; }
.err { background: #fbe9e7; color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: .9rem; }

table.admin { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.admin th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 8px; }
table.admin td { padding: 8px; border-top: 1px solid var(--border); vertical-align: middle; }
