:root {
  --sage: #5f7356; --sage-dark: #3f4f39; --sage-soft: #e6ebdf; --cream: #f8f4ec; --paper: #fffdf8;
  --pink: #e4a3b1; --pink-soft: #f9e6ea; --gold: #b9975b; --gold-soft: #efe4cc;
  --ink: #2e3329; --muted: #6f7468; --line: #e7dfcf; --danger: #b4443e; --ok: #4e8a4b;
  --radius: 14px; --shadow: 0 1px 2px rgba(63,79,57,.06), 0 6px 18px rgba(63,79,57,.06);
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--sage-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .2px; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--sage-dark) 236px, transparent 236px); }
.shell > div { min-width: 0; }
h3 .btn, h3 .row, h3 .legend { font-family: var(--sans); font-size: 13px; font-weight: 500; }
.side { background: var(--sage-dark); color: #eef1e8; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 14px; }
.mono { font-family: var(--serif); font-size: 30px; line-height: 1; color: #fff; position: relative; letter-spacing: -2px; }
.mono svg { position: absolute; top: -9px; left: 15px; width: 13px; }
.brand b { font-family: var(--serif); font-size: 19px; letter-spacing: 1.5px; font-weight: 600; display: block; }
.brand small { color: #c9d1bf; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #dfe5d6; text-decoration: none; margin-bottom: 2px; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.on { background: var(--paper); color: var(--sage-dark); font-weight: 600; }
.nav .sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 6px; }
.nav .badge { margin-left: auto; background: var(--pink); color: #4a2530; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.who { margin-top: 18px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 13px; }
.who button { background: none; border: 0; color: var(--gold-soft); padding: 0; cursor: pointer; text-decoration: underline; font-size: 12px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.head p { margin: 2px 0 0; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card > h3 { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card > h3 a { font-family: var(--sans); font-size: 13px; font-weight: 500; }
.kpi { padding: 14px 16px; }
.kpi span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.kpi b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.15; margin-top: 4px; color: var(--sage-dark); }
.kpi.pink { background: var(--pink-soft); border-color: #f0cdd5; }
.kpi.gold { background: #fbf5e6; border-color: var(--gold-soft); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; }
.list .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 36px; height: 36px; border-radius: 50%; background: var(--sage-soft); color: var(--sage-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.clickable { cursor: pointer; } .clickable:hover .t { color: var(--sage); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 8px 14px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--sage); }
.btn.primary { background: var(--sage); border-color: var(--sage); color: #fff; }
.btn.primary:hover { background: var(--sage-dark); }
.btn.wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn svg { width: 16px; height: 16px; }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
textarea { resize: vertical; min-height: 80px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 14px; }
.fields .full { grid-column: 1 / -1; }
.search { max-width: 280px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--sage-soft); color: var(--sage-dark); white-space: nowrap; }
.pill.enquiry { background: #eef0ff; color: #3d4a8f; } .pill.quote_sent { background: #fff3dc; color: #8a5a00; }
.pill.advance_paid { background: #e2f3e1; color: #2f6b2c; } .pill.event_done { background: var(--pink-soft); color: #8a3a4c; }
.pill.album_pending { background: #f3e8ff; color: #6b3fa0; } .pill.final_payment { background: #dff0ec; color: #1f6656; }
.pill.lost { background: #eee; color: #777; }
.money { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .danger-t { color: var(--danger); } .ok-t { color: var(--ok); }

/* funnel */
.funnel { display: grid; gap: 8px; }
.funnel div { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.bar { height: 10px; background: var(--sage-soft); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sage), #8fa684); border-radius: 6px; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #f1ebde; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col.over { outline: 2px dashed var(--sage); background: var(--sage-soft); }
.col h4 { margin: 2px 4px 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--sage-dark); display: flex; justify-content: space-between; }
.col h4 span { color: var(--muted); font-weight: 500; }
.lc { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); }
.lc:hover { border-color: var(--sage); }
.lc.drag { opacity: .4; }
.lc .t { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.lc .s { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.lc .meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.stale { color: var(--danger); font-weight: 600; }

/* table */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }

/* lead page */
.lead-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.lead-head .av { width: 54px; height: 54px; font-size: 18px; background: var(--pink-soft); color: #8a3a4c; }
.lead-head .grow { flex: 1; min-width: 200px; }
.stages { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; }
.stages button { border: 1px solid var(--line); background: var(--paper); border-radius: 20px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.stages button.on { background: var(--sage); color: #fff; border-color: var(--sage); }
.stages button.done { background: var(--sage-soft); border-color: var(--sage-soft); }
.lead-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); gap: 16px; align-items: start; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.sum div { background: var(--cream); border-radius: 10px; padding: 9px 10px; }
.sum span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.sum b { display: block; font-size: 17px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding: 6px 2px; }
.chat.tall { max-height: none; flex: 1; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { background: #dcefd6; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble .tm { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.compose { display: flex; gap: 8px; margin-top: 10px; }
.compose textarea { min-height: 44px; height: 44px; }
.inbox { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 130px); min-height: 480px; padding: 0; overflow: hidden; }
.inbox .threads { border-right: 1px solid var(--line); overflow-y: auto; }
.inbox .threads li { padding: 12px 14px; cursor: pointer; }
.inbox .threads li.on { background: var(--sage-soft); }
.inbox .conv { display: flex; flex-direction: column; padding: 14px 16px; min-width: 0; background: #f6f1e6; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 6px; }
.cal .dow { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); text-align: center; padding: 4px 0; }
.day { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; min-height: 104px; padding: 6px; font-size: 12px; }
.day.off { opacity: .35; }
.day.today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.day.clash { background: #fff1f1; border-color: #efc0c0; }
.day .n { font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; }
.ev { display: block; background: var(--sage-soft); color: var(--sage-dark); border-radius: 6px; padding: 3px 6px; margin-bottom: 3px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.bd { background: var(--pink-soft); color: #8a3a4c; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 10px; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .pair i { width: 42%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .inc { background: var(--sage); } .bars .exp { background: var(--pink); }
.bars small { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(46,51,41,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--paper); border-radius: 18px; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--sage-dark); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); }

/* package editor */
.pkg-items { display: grid; gap: 6px; }
.pkg-item { display: grid; grid-template-columns: 1fr 120px 34px; gap: 8px; align-items: center; }
.pkg-item input { padding: 6px 9px; }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--sage); }
.check span { flex: 1; }
.notice { background: #fbf5e6; border: 1px solid var(--gold-soft); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, var(--pink-soft), transparent 40%), radial-gradient(circle at 90% 90%, var(--sage-soft), transparent 45%), var(--cream); }
.auth .card { width: min(400px, 100%); padding: 30px; }
.auth .mono { color: var(--sage-dark); font-size: 54px; margin: 0 auto 6px; width: max-content; }
.auth .mono svg { top: -14px; left: 26px; width: 20px; }
.auth h1 { text-align: center; font-size: 26px; letter-spacing: 3px; text-transform: uppercase; }
.auth .tag { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 22px; }
.auth form { display: grid; gap: 12px; }

/* mobile */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } .lead-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--sage-dark); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; }
  .topbar b { font-family: var(--serif); font-size: 19px; letter-spacing: 1.5px; }
  .main { padding: 18px 16px 50px; }
  h1 { font-size: 26px; }
  .g2, .g3, .fields { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .inbox.has-conv .threads { display: none; } .inbox:not(.has-conv) .conv { display: none; }
  .cal { gap: 3px; } .day { min-height: 64px; padding: 4px; font-size: 11px; } .ev { padding: 2px 4px; font-size: 10.5px; }
  .cal .dow { font-size: 10px; }
  .funnel div { grid-template-columns: 96px 1fr 28px; }
  .search { max-width: none; flex: 1; }
}
