:root {
  color-scheme: light;
  --ink: #18231f;
  --ink-soft: #5c6762;
  --forest: #132620;
  --forest-2: #1d3a30;
  --cream: #f4f1e9;
  --paper: #fffef9;
  --line: #dcded8;
  --line-dark: #c6cbc4;
  --orange: #de6a35;
  --orange-dark: #b84c21;
  --green: #28785d;
  --shadow: 0 14px 36px rgba(24, 35, 31, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--cream);
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(222, 106, 53, .45);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: 72px;
  padding: 0 clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: var(--forest);
  border-bottom: 3px solid var(--orange);
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup > span:last-child { display: grid; gap: 1px; }
.brand-lockup strong { font-size: 14px; letter-spacing: .02em; }
.brand-lockup small { color: #b9c4bf; font-size: 12px; }

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--orange);
  border-radius: 9px 2px 9px 2px;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: -.02em;
  transform: skew(-3deg);
}

.top-actions, .heading-actions, .board-tools { display: flex; align-items: center; gap: 12px; }
.topbar .text-button, .topbar .icon-button { color: #d7dfdb; }
.icon-button, .text-button, .text-link {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  font-size: 13px;
  text-decoration: none;
}
.icon-button:hover, .text-button:hover, .text-link:hover { color: var(--orange); }

.sync-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #d7dfdb;
  font-size: 12px;
  font-weight: 700;
}
.sync-pill span { width: 8px; height: 8px; border-radius: 50%; background: #d4a23a; box-shadow: 0 0 0 3px rgba(212, 162, 58, .15); }
.sync-pill.sync-connected span { background: #57be8e; box-shadow: 0 0 0 3px rgba(87, 190, 142, .16); }

.app-shell { padding: 42px clamp(18px, 4vw, 56px) 72px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin: 0 auto 28px; max-width: 1700px; }
.eyebrow { margin: 0 0 8px; color: var(--orange-dark); font-size: 11px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.page-heading h1, .login-card h1 { margin: 0; font: 700 clamp(30px, 4vw, 48px)/1.02 Georgia, serif; letter-spacing: -.035em; }
.page-heading > div:first-child > p:last-child { margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; }

.button {
  min-height: 42px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px 2px 8px 2px;
  font-weight: 850;
  font-size: 13px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--orange); box-shadow: 0 7px 16px rgba(184, 76, 33, .18); }
.button-primary:hover:not(:disabled) { background: var(--orange-dark); }
.button-secondary { color: var(--forest); background: var(--paper); border-color: var(--line-dark); }
.button-secondary:hover:not(:disabled) { border-color: var(--forest); }
.button-quiet { color: var(--ink-soft); background: transparent; }
.button-small { min-height: 34px; padding: 0 12px; }
.button-full { width: 100%; min-height: 48px; }

.results-panel {
  max-width: 1700px;
  margin: 0 auto 34px;
  padding: 24px;
  color: #fff;
  background: var(--forest);
  border-radius: 15px 4px 15px 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.results-panel::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -100px;
  top: -140px;
  border: 24px solid rgba(222, 106, 53, .12);
  border-radius: 50%;
  pointer-events: none;
}
.results-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 20px; }
.results-head h2 { margin: 0; font: 700 22px/1.2 Georgia, serif; }
.results-panel .eyebrow { color: #ef9a72; }
.period-select { display: grid; gap: 5px; color: #adbbb5; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.period-select select { min-width: 150px; padding: 8px 30px 8px 10px; color: #fff; background: #1c342c; border: 1px solid #3b5149; border-radius: 6px; }
.metrics-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 1px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.13); border-radius: 9px 2px 9px 2px; overflow: hidden; }
.metric-card { min-height: 110px; padding: 17px; display: flex; flex-direction: column; justify-content: center; background: #1b332b; }
.metric-card span { color: #aebbb6; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.metric-card strong { margin: 7px 0 4px; color: #fff; font: 700 clamp(22px, 2vw, 30px)/1 Georgia, serif; }
.metric-card small { color: #82938c; font-size: 11px; }
.metric-green strong { color: #73d3a7; }
.metric-orange strong { color: #f29a70; }

.board-section { max-width: 1700px; margin: 0 auto; }
.board-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.board-toolbar h2 { margin: 0 0 4px; font: 700 24px/1.1 Georgia, serif; }
.board-toolbar p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.search-box input { width: min(280px, 28vw); height: 39px; padding: 0 13px; background: var(--paper); border: 1px solid var(--line-dark); border-radius: 7px; }
.search-box input:focus { border-color: var(--orange); outline: 3px solid rgba(222, 106, 53, .13); }

.kanban-board { display: grid; grid-template-columns: repeat(6, minmax(255px, 1fr)); gap: 12px; overflow-x: auto; padding: 2px 2px 16px; scroll-snap-type: x proximity; }
.kanban-lane { min-width: 255px; background: rgba(255,255,255,.45); border: 1px solid var(--line); border-radius: 11px 3px 11px 3px; scroll-snap-align: start; }
.stage-new { --stage-color: #de6a35; }
.stage-contacted { --stage-color: #4f83a1; }
.stage-qualifying { --stage-color: #d4a23a; }
.stage-won { --stage-color: #28785d; }
.stage-lost { --stage-color: #6f7881; }
.stage-junk { --stage-color: #9c6f66; }
.lane-head { min-height: 75px; padding: 15px 15px 12px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.lane-head h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.lane-head h3 span { width: 9px; height: 9px; background: var(--stage-color); border-radius: 50%; }
.lane-head p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.lane-head > strong { min-width: 27px; height: 27px; display: grid; place-items: center; background: #e8e8e1; border-radius: 50%; font-size: 12px; }
.lane-dropzone { min-height: 440px; padding: 10px; transition: background .15s ease; }
.lane-dropzone.is-drag-over { background: color-mix(in srgb, var(--stage-color) 10%, transparent); box-shadow: inset 0 0 0 2px var(--stage-color); }
.empty-lane { min-height: 100px; display: grid; place-items: center; color: #9ca49f; border: 1px dashed var(--line-dark); border-radius: 8px; font-size: 11px; }

.lead-card { margin-bottom: 9px; padding: 13px; background: var(--paper); border: 1px solid #d8dbd5; border-radius: 9px 3px 9px 3px; box-shadow: 0 3px 9px rgba(24,35,31,.04); cursor: grab; transition: border .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease; }
.lead-card:hover { border-color: #aeb6b0; box-shadow: 0 7px 18px rgba(24,35,31,.09); transform: translateY(-1px); }
.lead-card.is-dragging { opacity: .4; transform: rotate(1deg); }
.lead-card-top { display: flex; align-items: center; gap: 9px; }
.avatar { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--forest-2); border-radius: 50% 50% 50% 20%; font-size: 11px; font-weight: 900; }
.lead-name { min-width: 0; flex: 1; }
.lead-name h3 { margin: 0 0 2px; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.lead-name p { margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.lead-detail { min-height: 31px; margin: 11px 0 10px; color: #3d4b45; font-size: 12px; line-height: 1.35; }
.lead-meta { display: flex; align-items: center; gap: 6px; min-height: 20px; }
.lead-meta time { margin-left: auto; color: #8a938f; font-size: 10px; }
.source-tag, .sync-warning, .sale-chip { padding: 3px 6px; color: #405048; background: #edf0ed; border-radius: 4px; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.source-tiktok { color: #673a27; background: #fce8de; }
.sync-warning { color: #7e5a14; background: #fff1c9; }
.sale-chip { color: #146145; background: #dff4e9; white-space: nowrap; }
.card-stage-select { display: block; margin-top: 10px; }
.card-stage-select select { width: 100%; height: 32px; padding: 0 8px; color: #52605a; background: #f4f4ef; border: 1px solid #e1e3df; border-radius: 5px; font-size: 10px; font-weight: 750; }

.dialog { width: min(620px, calc(100vw - 24px)); max-height: min(90vh, 900px); padding: 0; color: var(--ink); background: var(--paper); border: 0; border-radius: 15px 4px 15px 4px; box-shadow: 0 30px 90px rgba(12,25,20,.3); overflow: auto; }
.dialog-wide { width: min(980px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(10,23,18,.66); backdrop-filter: blur(3px); }
.dialog-head { padding: 22px 24px; display: flex; justify-content: space-between; align-items: start; color: #fff; background: var(--forest); border-bottom: 3px solid var(--orange); }
.dialog-head h2 { margin: 0; font: 700 25px/1.1 Georgia, serif; }
.dialog-head .eyebrow { color: #ef9a72; }
.dialog-close { width: 35px; height: 35px; color: #c7d2cd; background: rgba(255,255,255,.08); border: 0; border-radius: 50%; font-size: 24px; line-height: 1; }
.dialog-body { padding: 24px; }
.dialog-foot { padding: 16px 24px; display: flex; justify-content: flex-end; gap: 10px; background: #f2f1eb; border-top: 1px solid var(--line); }
.lead-dialog-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, .8fr); gap: 28px; }
.lead-fields { min-width: 0; }
.form-grid { display: grid; gap: 14px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-form label, .stack-form label { display: grid; gap: 6px; margin-bottom: 14px; color: #46534e; font-size: 11px; font-weight: 850; letter-spacing: .025em; }
.dialog-form input, .dialog-form select, .dialog-form textarea, .stack-form input {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}
.dialog-form input, .dialog-form select, .stack-form input { min-height: 42px; }
.dialog-form textarea { resize: vertical; line-height: 1.45; }
.dialog-form input:focus, .dialog-form select:focus, .dialog-form textarea:focus, .stack-form input:focus { border-color: var(--orange); outline: 3px solid rgba(222,106,53,.12); }
.optional { color: #929a96; font-weight: 500; }
.form-intro { margin: 0 0 20px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.form-error { margin: 0 0 14px; padding: 10px; color: #8c2b22; background: #fde9e6; border-radius: 6px; font-size: 12px; }
.attribution-box { margin-top: 6px; padding: 14px; display: grid; gap: 3px; background: #eef2ee; border-left: 3px solid var(--green); border-radius: 4px; }
.attribution-box span, .custom-answers h3, .activity-list h3 { color: var(--ink-soft); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.attribution-box strong { font-size: 13px; }
.attribution-box small { color: var(--ink-soft); }
.custom-answers { margin-top: 20px; }
.custom-answers h3, .activity-list h3 { margin: 0 0 10px; }
.custom-answers div { padding: 8px 0; display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.custom-answers div span { color: var(--ink-soft); font-size: 11px; text-transform: capitalize; }
.custom-answers div strong { text-align: right; font-size: 12px; }
.activity-list { padding-left: 4px; border-left: 1px solid var(--line); }
.activity-list > div { display: grid; grid-template-columns: 10px 1fr; gap: 9px; margin: 0 0 14px -5px; }
.activity-list > div > span { width: 9px; height: 9px; margin-top: 3px; background: var(--orange); border: 2px solid var(--paper); border-radius: 50%; box-shadow: 0 0 0 1px var(--line-dark); }
.activity-list p { margin: 0; color: #425049; font-size: 11px; line-height: 1.4; }
.activity-list small { display: block; margin-top: 3px; color: #929a96; }

.settings-body { display: grid; gap: 14px; }
.connection-card { padding: 16px; display: grid; grid-template-columns: 34px 1fr; gap: 13px; background: #f4f3ed; border: 1px solid var(--line); border-radius: 9px; }
.connection-card.is-ready { background: #eff7f2; border-color: #c6dfd1; }
.connection-icon { width: 32px; height: 32px; display: grid; place-items: center; color: #fff; background: var(--forest); border-radius: 8px 2px 8px 2px; font-weight: 900; }
.connection-card h3 { margin: 1px 0 6px; font-size: 14px; }
.connection-card h3 span { margin-left: 6px; padding: 3px 6px; color: #146145; background: #d6eee1; border-radius: 4px; font-size: 9px; text-transform: uppercase; }
.connection-card h3 span.not-ready { color: #805413; background: #fae9bd; }
.connection-card p { margin: 0 0 9px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.copy-field { padding: 5px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.copy-field code { min-width: 0; flex: 1; padding-left: 5px; overflow: hidden; color: #3f4d47; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.setup-note { padding: 8px; background: #fff4d8; border-radius: 5px; }
.sync-detail { font-size: 10px !important; }
.recent-spend { margin-top: 5px; padding-top: 18px; border-top: 1px solid var(--line); }
.account-settings { margin-top: 5px; padding-top: 18px; border-top: 1px solid var(--line); }
.account-settings > p { margin: 7px 0 14px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.account-settings .stack-form { gap: 10px; }
.account-settings .button { justify-self: start; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; }
.section-title-row h3 { margin: 0; font: 700 17px Georgia, serif; }
.spend-list { margin-top: 10px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.spend-list > div { padding: 9px 11px; display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; border-bottom: 1px solid var(--line); font-size: 11px; }
.spend-list > div:last-child { border-bottom: 0; }
.spend-list time { color: var(--ink-soft); }
.empty-copy { color: var(--ink-soft); font-size: 12px; }

.login-shell { min-height: 100vh; padding: 40px 20px; display: grid; place-content: center; background: var(--forest); position: relative; overflow: hidden; }
.login-shell::before, .login-shell::after { content: ""; position: absolute; border: 45px solid rgba(222,106,53,.10); border-radius: 50%; }
.login-shell::before { width: 340px; height: 340px; left: -210px; top: -190px; }
.login-shell::after { width: 260px; height: 260px; right: -150px; bottom: -160px; }
.login-card { width: min(460px, calc(100vw - 32px)); padding: clamp(28px, 5vw, 46px); background: var(--paper); border-radius: 18px 5px 18px 5px; box-shadow: 0 35px 90px rgba(0,0,0,.35); position: relative; z-index: 1; }
.login-brand { margin-bottom: 38px; }
.login-brand small { color: var(--ink-soft); }
.login-card h1 { font-size: clamp(32px, 8vw, 44px); }
.login-copy { margin: 16px 0 28px; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.stack-form { display: grid; }
.login-footnote { margin: 20px 0 0; color: #81918a; text-align: center; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; position: relative; z-index: 1; }

.toast-region { position: fixed; top: 20px; left: 50%; z-index: 1000; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 260px; padding: 12px 16px; color: #fff; background: var(--forest); border-left: 4px solid #57be8e; border-radius: 7px; box-shadow: var(--shadow); font-size: 12px; font-weight: 750; opacity: 0; transform: translateY(-10px); transition: .2s ease; }
.toast-error { border-color: #e06c5f; }
.toast-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
  .metric-card { min-height: 95px; }
  .kanban-board { grid-template-columns: repeat(6, 280px); }
}

@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 16px; }
  .topbar .brand-lockup small, .topbar .text-button, .sync-pill { display: none; }
  .app-shell { padding: 26px 14px 50px; }
  .page-heading, .board-toolbar, .results-head { align-items: stretch; flex-direction: column; }
  .page-heading { gap: 20px; }
  .heading-actions .button { flex: 1; }
  .results-panel { padding: 18px 14px; }
  .results-head { gap: 14px; }
  .period-select select { width: 100%; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card:last-child { grid-column: span 2; }
  .board-tools { flex-wrap: wrap; gap: 9px; }
  .search-box { width: 100%; }
  .search-box input { width: 100%; }
  .lead-dialog-grid, .two-col { grid-template-columns: 1fr; }
  .activity-list { padding-top: 18px; padding-left: 4px; border-top: 1px solid var(--line); border-left: 0; }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 17px; padding-right: 17px; }
  .spend-list > div { grid-template-columns: 72px 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
