@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  /* The Productivity Queen palette */
  --ground: #FFEADA;      /* Pale Peach - the app floor */
  --lane: #FFF5EC;        /* lifted peach for pipeline lanes */
  --paper: #FFFFFF;
  --ink: #3D3D3D;         /* Charcoal */
  --ink-soft: #66605C;
  --green: #63BFB4;       /* Beach Green - primary action, won */
  --green-ink: #2C7168;
  --yellow: #F3C543;      /* Juice Yellow - due today */
  --sun: #FFE781;         /* Sun Yellow - active nav */
  --peach: #FF9A84;       /* Beach House Peach - overdue, lost */
  --blue: #315B8F;        /* Digital Blue - focus */
  --link: #0B5FD3;        /* clear blue for links */
  --red: #E0101A;         /* bright red - anything overdue */
  --line: #3D3D3D;
  --line-soft: #3D3D3D;

  --display: "Poppins", -apple-system, "Helvetica Neue", sans-serif;
  --body: "Poppins", -apple-system, "Helvetica Neue", sans-serif;
  --t-xs: 12.5px; --t-sm: 13.5px; --t-md: 15px; --t-lg: 18px; --t-xl: 24px; --t-2xl: 34px; --t-3xl: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body); font-size: var(--t-md); line-height: 1.55; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; padding: 28px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--ink); color: var(--paper); }
.rail :focus-visible { outline-color: var(--sun); }
.brand { font-family: var(--body); font-weight: 900; font-size: 21px; line-height: 1.15; padding: 0 12px 22px; color: var(--paper); }
.brand small { display: block; font-family: var(--body); font-weight: 400; font-size: var(--t-xs); color: #E6DCD4; margin-top: 4px; }
.rail a { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 999px; color: var(--paper); text-decoration: none; font-weight: 500; }
.rail a:hover { background: rgba(255, 255, 255, .1); }
.rail a[aria-current="page"] { background: var(--green); color: var(--ink); }
.rail .count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--paper); color: var(--ink); font-size: var(--t-xs); text-align: center; line-height: 22px; }
.rail .count.hot { background: var(--peach); color: var(--ink); }
.rail .rail-foot { margin-top: auto; padding: 12px; font-size: var(--t-xs); color: #E6DCD4; }

main { min-width: 0; padding: 22px 36px 64px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.search { position: relative; flex: 0 1 460px; }
.search input { width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-family: var(--body); font-size: var(--t-xs); color: var(--ink-soft); }
.search-results { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px; max-height: 70vh; overflow: auto; box-shadow: 0 18px 40px -20px rgba(61, 61, 61, .45); }
.search-results h4 { margin: 8px 10px 2px; font-size: var(--t-xs); font-weight: 600; color: var(--ink-soft); }
.search-results a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--link); text-decoration: none; }
.search-results a:hover, .search-results a.active { background: var(--lane); }
.search-results .sub { color: var(--ink-soft); font-size: var(--t-sm); }
.topbar .spacer { flex: 1; }

/* ---------- headings & text */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-family: var(--display); font-weight: 600; font-size: var(--t-2xl); line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h2 { font-family: var(--display); font-weight: 600; font-size: var(--t-xl); line-height: 1.2; margin: 0 0 12px; }
h3 { font-size: var(--t-md); font-weight: 600; margin: 0 0 8px; }
.lede { color: var(--ink-soft); margin: 6px 0 0; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--t-sm); }
.money { font-family: var(--display); font-weight: 600; font-variant-numeric: lining-nums; }

/* ---------- buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--ink); background: transparent; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--green); border-color: var(--green); }
.btn.primary:hover { background: #55b0a5; }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); }
.btn.add-contact { background: var(--yellow); border-color: var(--yellow); color: var(--paper); font-weight: 600; }
.btn.add-contact:hover { background: #E2B230; border-color: #E2B230; }
.btn.add-deal { color: var(--paper); font-weight: 600; }
.btn.quiet { border-color: transparent; padding: 6px 10px; }
.btn.quiet:hover { background: var(--lane); }
.btn.danger { border-color: transparent; color: #8f2f1c; }
.btn.danger:hover { background: #ffe1d9; }
.btn.small { padding: 4px 12px; font-size: var(--t-sm); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label.field { display: grid; gap: 4px; font-size: var(--t-sm); font-weight: 500; }
label.field .hint { font-weight: 400; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: var(--t-md);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters select, .filters input:not([type=checkbox]) { width: auto; min-width: 150px; padding: 7px 12px; border-radius: 999px; }
.filters input[type=search] { min-width: 240px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: var(--t-sm); }

/* ---------- panels, tables */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.panel-head h2, .panel-head h3 { margin: 0; }
table.list { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: 12px; overflow: hidden; }
table.list th { text-align: left; font-size: var(--t-sm); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: #FFFBF7; }
table.list tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.name-cell strong { font-weight: 600; }
.name-cell span { display: block; font-size: var(--t-sm); color: var(--ink-soft); }

.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 500; background: var(--lane); border: 1px solid var(--line); white-space: nowrap; }
.pill.green { background: #DDF2EF; }
.pill.yellow { background: #FFF3C4; }
.pill.peach { background: #FFE1D9; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: var(--t-xs); padding: 0 8px; border-radius: 6px; background: var(--ground); }

.empty { padding: 28px; text-align: center; color: var(--ink-soft); }
.empty .btn { margin-top: 10px; }

/* ---------- pipeline: the one loud thing */
.board { display: grid; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.lane { background: var(--lane); border-radius: 14px; padding: 16px 12px 12px; min-height: 60vh; display: flex; flex-direction: column; }
.lane.closed { background: transparent; border: 1.5px dashed var(--line); }
.lane.closed .lane-total { font-size: 24px; }
.lane-head { padding: 0 6px 12px; }
.lane-head .name { font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lane-total { font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; margin-top: 2px; }
.lane.won .lane-total { color: var(--green-ink); }
.lane-meta { font-size: var(--t-xs); color: var(--ink-soft); }
.lane-cards { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 80px; border-radius: 10px; transition: background .12s; }
.lane.drop-target .lane-cards { background: rgba(99, 191, 180, .16); }
.deal-card { background: var(--paper); border-radius: 8px; padding: 10px 12px 10px 14px; cursor: grab; position: relative; border: 1px solid var(--line); }
.deal-card:hover { box-shadow: 0 0 0 1px var(--line); }
.deal-card.dragging { opacity: .35; }
.deal-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; }
.deal-card.soon::before { background: var(--yellow); }
.deal-card.late::before { background: var(--red); }
.deal-card .t { font-weight: 500; line-height: 1.35; }
.deal-card .who { font-size: var(--t-sm); color: var(--ink-soft); }
.deal-card .row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; gap: 8px; }
.deal-card .money { font-size: 17px; }
.deal-card .when { font-size: var(--t-xs); color: var(--ink-soft); }
.deal-card.late .when { color: var(--red); font-weight: 600; }
.placeholder { height: 56px; border-radius: 8px; border: 2px dashed var(--green); }
.lane-add { margin-top: 8px; width: 100%; justify-content: center; border-style: dashed; border-color: var(--line); color: var(--ink-soft); }
.board-key { display: flex; gap: 18px; font-size: var(--t-xs); color: var(--ink-soft); margin: -6px 0 14px; }
.board-key i { display: inline-block; width: 4px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---------- today */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.reminder { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.reminder:last-child { border-bottom: 0; }
.reminder input[type=checkbox] { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--green); }
.reminder .due { font-size: var(--t-xs); }
.reminder .due.late { color: var(--red); font-weight: 600; }
.reminder .due.now { font-weight: 600; }
.reminder .snooze { display: flex; gap: 2px; }
.date-line { font-family: var(--display); font-weight: 500; font-size: var(--t-lg); color: var(--ink-soft); margin-top: 4px; }
.mini-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.mini-row:last-child { border-bottom: 0; }

/* ---------- record pages */
.record { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.record-head .sub { color: var(--ink-soft); margin-top: 4px; }
dl.facts { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; margin: 0; font-size: var(--t-sm); }
dl.facts dt { color: var(--ink-soft); }
dl.facts dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 10px 0; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--line); }
.timeline li.note .dot { background: var(--yellow); }
.timeline li.stage .dot { background: var(--green); }
.timeline li.email .dot { background: var(--blue); }
.timeline .body { white-space: pre-wrap; }
.timeline li.note .body { background: #FFFBEF; border-radius: 8px; padding: 8px 12px; }
.timeline .when { font-size: var(--t-xs); color: var(--ink-soft); display: flex; gap: 10px; align-items: center; }
.composer { display: grid; gap: 8px; margin-bottom: 12px; }
.composer textarea { min-height: 70px; }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.item-row:last-child { border-bottom: 0; }
.item-row.done { opacity: .55; text-decoration: line-through; }

/* ---------- emails */
.notice { background: #EAF5F3; border-radius: 10px; padding: 10px 14px; font-size: var(--t-sm); margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 500; }
.tabs a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.email-preview { white-space: pre-wrap; font-size: var(--t-sm); color: var(--ink-soft); max-height: 3.2em; overflow: hidden; }
.merge-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.merge-chips button { border: 1px solid var(--line); background: var(--lane); border-radius: 6px; padding: 1px 8px; font-size: var(--t-xs); cursor: pointer; }
.warn { color: #8f2f1c; font-size: var(--t-sm); }
.overdue { color: var(--red); font-weight: 600; }

/* ---------- dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat.lead { border-color: var(--ink); }
.stat .label { font-size: var(--t-sm); color: var(--ink-soft); }
.stat .value { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.15; margin: 2px 0; }
.stat .foot { font-size: var(--t-xs); color: var(--ink-soft); }
.stat.lead { background: var(--ink); color: var(--paper); }
.stat.lead .label, .stat.lead .foot { color: #E6DCD4; }
.stat.lead .value { font-size: var(--t-3xl); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; position: relative; }
.hbar .track { height: 18px; position: relative; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #67BADE; border: 1px solid var(--ink); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { font-variant-numeric: tabular-nums; font-size: var(--t-sm); min-width: 70px; text-align: right; }
.hbar .lbl { font-size: var(--t-sm); }
.hbar:hover .fill { filter: brightness(.88); }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 190px; border-bottom: 1px solid var(--line); padding-top: 10px; }
.vbars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.vbars .bar { width: 70%; max-width: 44px; background: #67BADE; border: 1px solid var(--ink); border-bottom: 0; border-radius: 4px 4px 0 0; min-height: 2px; }
.vbars .col:hover .bar { filter: brightness(.88); }
.vbars-labels { display: flex; gap: 10px; }
.vbars-labels span { flex: 1; text-align: center; font-size: var(--t-xs); color: var(--ink-soft); padding-top: 6px; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--paper); font-size: var(--t-sm); padding: 6px 10px; border-radius: 8px; max-width: 260px; }
.chart-foot { margin-top: 10px; }
table.mini { width: 100%; border-collapse: collapse; font-size: var(--t-sm); margin-top: 10px; }
table.mini th, table.mini td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line-soft); }

/* ---------- data page */
.data-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.export-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.export-row:last-child { border-bottom: 0; }
.map-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); margin: 12px 0; }
.map-table th, .map-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.map-table select { padding: 4px 8px; font-size: var(--t-sm); }
.drop-zone { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; }
.drop-zone.over { border-color: var(--green); background: #EAF5F3; }

/* ---------- settings */
.stage-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 0; }
.offer-row { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; padding: 6px 0; }

/* ---------- dialog & toast */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(61, 61, 61, .55); }
dialog::backdrop { background: rgba(61, 61, 61, .38); }
dialog.wide { width: min(820px, calc(100vw - 32px)); }
.dlg { padding: 24px 26px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dlg-head h2 { margin: 0; }
.dlg-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.err { color: #8f2f1c; font-size: var(--t-sm); min-height: 1em; margin-top: 10px; }
.toast { position: fixed; z-index: 80; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: var(--t-sm); display: flex; gap: 12px; align-items: center; }
.toast.bad { background: #8f2f1c; }
.toast button { background: none; border: 0; color: var(--sun); font-weight: 600; cursor: pointer; padding: 0; }

@media (max-width: 1100px) {
  .today-grid, .record, .data-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { width: 100%; padding-bottom: 8px; }
  .rail .rail-foot { display: none; }
  main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(8, 80vw) !important; }
  h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
