:root {
  /* Clear Deed brand, from the Instagram posts: navy + royal blue, gold accents, warm paper background */
  --violet: #1f3f9e; --violet-dark: #0a2a5c; --violet-soft: #e6ebf7; --gold: #c9a24a; --gold-soft: #f6efdd;
  --navy: #0a2a5c; --navy-deep: #051a3d;
  --bg: #f4f2ed; --panel: #ffffff; --line: #e3e0d8; --text: #14213d; --muted: #66708a;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --green: #138a4f; --green-soft: #e4f6ec; --red: #c4302b; --red-soft: #fde9e8;
  --amber: #a86200; --amber-soft: #fff2dc; --blue: #2457c5; --blue-soft: #e7eefc;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 10, 50, .06), 0 2px 8px rgba(20, 10, 50, .04);
  font-family: "Barlow", "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 700 30px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; color: var(--navy); margin: 0; }
h2 { font: 700 20px/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; color: var(--navy); margin: 0 0 12px; }
h3 { font: 600 13px/1.2 var(--display); margin: 0 0 8px; color: #9a7a2e; text-transform: uppercase; letter-spacing: .14em; }
.boot { padding: 40px; color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%); color: #d8e0f0; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: grid; gap: 6px; color: #fff; padding: 6px 10px 18px; margin-bottom: 10px; border-bottom: 1px solid rgba(201,162,74,.35); }
.wordmark { font-family: "Montserrat", "Segoe UI", sans-serif; font-size: 23px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.wordmark .wl { font-weight: 300; } .wordmark .wb { font-weight: 700; }
.tagline { font: 600 9.5px/1.3 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.brand .crm-tag { font: 600 11px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: #9fb0d6; }
.nav a { display: flex; align-items: center; gap: 10px; color: #d2daf0; border-left: 3px solid transparent; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: var(--gold); font-weight: 600; }
.nav .count { margin-left: auto; background: rgba(255,255,255,.14); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.sidebar .me { margin-top: auto; font-size: 12px; padding: 8px 10px; color: #9fb0d6; }
.sidebar .me button { background: none; border: 0; color: #e8d3a0; padding: 0; cursor: pointer; font-size: 12px; text-decoration: underline; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .menu-btn { display: none; }
.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-wrap input { width: 100%; }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 380px; overflow: auto; z-index: 10; }
.search-results a { display: block; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a.sel { background: var(--violet-soft); text-decoration: none; }
.search-results small { color: var(--muted); margin-left: 6px; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* controls */
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet-soft); border-color: var(--violet); }
textarea { resize: vertical; min-height: 70px; width: 100%; }
button, .btn { font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--text); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: #c4c9d8; text-decoration: none; }
.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.primary:hover { background: var(--violet); border-color: var(--violet); }
.danger { color: var(--red); }
.small { padding: 4px 9px; font-size: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--violet); }
button:disabled { opacity: .5; cursor: default; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--violet-soft); color: var(--violet-dark); font-weight: 600; }

/* cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.kpi { border-top: 3px solid var(--gold); }
.kpi .label { font: 600 12px/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; color: #9a7a2e; }
.kpi .value { font: 700 36px/1 var(--display); color: var(--navy); margin-top: 6px; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.detail { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #faf8f3; white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
tr:last-child td { border-bottom: 0; }
tbody tr.click:hover { background: #f3f5fb; cursor: pointer; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: #eceae3; color: #4a5268; white-space: nowrap; }
.pill.New { background: var(--blue-soft); color: var(--blue); }
.pill.Contacted { background: var(--amber-soft); color: var(--amber); }
.pill.Qualified, .pill.won, .pill.Done { background: var(--green-soft); color: var(--green); }
.pill.Unqualified, .pill.lost, .pill.overdue, .pill.High { background: var(--red-soft); color: var(--red); }
.pill.Converted { background: var(--violet-soft); color: var(--violet-dark); }

.fields { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 13px; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; word-break: break-word; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.status-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.status-row button.on { background: var(--violet); color: #fff; border-color: var(--violet); }

/* timeline */
.composer { display: grid; gap: 8px; margin-bottom: 16px; }
.composer .row { display: flex; gap: 8px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.timeline .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #eceae3; font-size: 14px; }
.timeline .ico.Call { background: var(--green-soft); } .timeline .ico.WhatsApp { background: #dcf8e7; }
.timeline .ico.Email { background: var(--blue-soft); } .timeline .ico.Meeting { background: var(--amber-soft); }
.timeline .ico.Note { background: var(--violet-soft); }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .body { white-space: pre-wrap; margin-top: 2px; }

/* tasks */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--violet); }
.task .t-title { font-weight: 500; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task .t-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.task .t-meta .late { color: var(--red); font-weight: 600; }

/* kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { background: #eae7df; border-radius: var(--radius); padding: 10px; min-height: 300px; }
.col.over { outline: 2px dashed var(--violet); background: var(--violet-soft); }
.col-head { display: flex; justify-content: space-between; font: 700 15px/1.2 var(--display); text-transform: uppercase; letter-spacing: .04em; color: var(--navy); margin-bottom: 2px; }
.col-sum { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.deal-card { background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border: 1px solid var(--line); }
.deal-card:hover { border-color: var(--violet); }
.deal-card .dc-title { font-weight: 600; }
.deal-card .dc-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.deal-card .dc-val { font-weight: 600; margin-top: 6px; }
.bar { height: 8px; background: #eceae3; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--violet); }
.stage-line { display: grid; grid-template-columns: 120px 1fr 110px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(5, 26, 61, .55); display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; }
.modal .mbody { padding: 18px 20px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; font-weight: 400; color: var(--text); }
.error { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); border-left: 3px solid var(--gold); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
#toast.show { opacity: 1; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 22px; padding: 16px; position: relative; overflow: hidden;
  background: radial-gradient(ellipse 60% 70% at 100% 0%, #1f3f9e 0%, transparent 60%), radial-gradient(ellipse 50% 60% at 0% 100%, #16357f 0%, transparent 60%), var(--navy-deep); }
.auth .card { border-top: 4px solid var(--gold); border-radius: 6px; }
.auth-foot { font: 600 12px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.auth .headline { display: inline-block; background: var(--navy); color: #fff; font: 700 28px/1 var(--display); text-transform: uppercase; padding: 6px 10px 4px; margin: 14px 0 8px; }
.auth .card { width: 100%; max-width: 380px; padding: 28px; }
.auth h1 { margin-bottom: 4px; }
.auth-brand { display: grid; gap: 6px; margin-bottom: 4px; color: var(--navy); }
.auth-brand .wordmark { font-size: 30px; }
.auth-brand .tagline { display: none; }
.auth-brand h1 { margin: 0; }
.auth form { display: grid; gap: 12px; margin-top: 18px; }
.auth label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
code, pre { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
pre { background: var(--navy-deep); color: #e3e9f6; padding: 12px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 240px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 60px; }
  .two, .detail { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
a.card { color: inherit; } a.card:hover { text-decoration: none; border-color: var(--violet); }
.form-grid label.check input { width: auto; flex: none; accent-color: var(--violet); }

/* call outcome dialog */
.call-outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.call-choice { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--border, #e3e3ea); border-radius: 10px; cursor: pointer; font-weight: 500; }
.call-choice input { width: auto; accent-color: var(--violet); }
.call-choice:has(input:checked) { border-color: var(--violet); background: var(--violet-soft); }
.modal label.check { display: flex; align-items: center; gap: 8px; }
.modal label.check input { width: auto; accent-color: var(--violet); }
