/* Trickency dashboard — v2
   One accent (--accent, the logo lime) used only for primary actions,
   active nav and selection. Everything else is calm neutrals. Status
   colors are soft tints with dark text so rows stay readable. */
:root {
  --accent: #C7FD7E;
  --accent-ink: #0D0D0D;
  --accent-soft: #E3F4CF;

  --bg: #F4F5F0;
  --surface: #FFFFFF;
  --surface-2: #FBFBFA;
  --border: #E8EAE2;
  --border-strong: #C3C4C7;

  --ink: #0D0D0D;
  --text: #1E211B;
  --muted: #4E5448;
  --faint: #A3A99B;

  --danger: #B3402F;
  --danger-bg: #FBE9E6;
  --warning: #9A6A16;
  --warning-bg: #FCF0D2;
  --success: #2F7448;
  --success-bg: #E3F3E8;
  --info: #3B5E8C;
  --info-bg: #E8EFF8;
  --closed-bg: #F0F0EE;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-pop: 0 12px 40px rgba(28, 28, 26, 0.16);
  --font: Roboto, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bar-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
a.btn { text-decoration: none; }
.status-select { width: auto; min-height: 32px; padding: 4px 30px 4px 10px; font-size: 13px; font-weight: 600; border-radius: 999px; }
.status-select.replied { background-color: var(--success-bg); color: var(--success); border-color: #CFE8D7; }
.status-select.action { background-color: var(--warning-bg); color: var(--warning); border-color: #F1DFB0; }
.status-select.closed { background-color: var(--closed-bg); color: var(--muted); }
.status-select.warming { background-color: var(--info-bg); color: var(--info); border-color: #CBD9EC; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: #7AC62E; border-color: #7AC62E; color: #0D0D0D; font-weight: 600; border-radius: 999px; }
.btn-primary:hover { background: #6BB424; border-color: #6BB424; }
.btn-primary:hover { background: #B9F52A; border-color: #B9F52A; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--border); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--danger); border-color: #E7B5AC; background: var(--danger-bg); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* Inputs ------------------------------------------------------------- */
input[type=text], input[type=email], input[type=url], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 15px;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(198, 255, 61, .55); }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.error { color: var(--danger); font-size: 13px; margin: 10px 0 0; }

/* Chips (segmented choices) --------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-weight: 500; opacity: .7; margin-left: 4px; }

/* Login -------------------------------------------------------------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; background: #0A0A0A; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow-pop); }
.login-card h1 { margin: 14px 0 2px; font-size: 22px; color: var(--ink); letter-spacing: -.01em; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card .btn { margin-top: 8px; }

/* App shell ---------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); font-size: 15px; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: #0A0A0A; display: grid; place-items: center; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav button { border: 0; background: none; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 600; color: var(--muted); cursor: pointer; }
.nav button:hover { color: var(--ink); background: var(--bg); }
.nav button[aria-current="page"] { color: var(--ink); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.top-actions { display: flex; gap: 8px; align-items: center; }

.banner { background: var(--warning-bg); color: #5E410A; padding: 10px 20px; font-size: 13.5px; border-bottom: 1px solid #F0DCA8; }
.banner strong { color: #3F2B06; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; color: var(--ink); letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.stat b { color: var(--ink); font-size: 14px; }
.stat.red b { color: var(--danger); }
.stat.amber b { color: var(--warning); }

/* Sections + cards on Today ---------------------------------------- */
.section { margin-top: 26px; }
.section:first-of-type { margin-top: 6px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.section-head h2 { margin: 0; font-size: 15px; color: var(--ink); }
.count { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--border); color: var(--muted); }
.section.red h2 { color: var(--danger); } .section.red .count { background: var(--danger-bg); color: var(--danger); }
.section.amber h2 { color: var(--warning); } .section.amber .count { background: var(--warning-bg); color: var(--warning); }
.section-hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 8px; }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-top: 1px solid var(--border); min-height: 60px;
}
.row:first-child { border-top: 0; }
.row.overdue { box-shadow: inset 3px 0 0 var(--danger); }
.row.today { box-shadow: inset 3px 0 0 #E2A73A; }
.row.decide { box-shadow: inset 3px 0 0 var(--ink); }
.row-main { min-width: 0; }
.row-title { font-weight: 650; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-size: 14.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row-title:hover { text-decoration: underline; }
.row-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; text-align: right; }
.row-meta.red { color: var(--danger); font-weight: 600; }
.row-actions { display: flex; gap: 6px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.dot.Critical { background: var(--danger); } .dot.High { background: #E2A73A; }
.dot.Medium { background: #A7B07A; } .dot.Low { background: var(--border-strong); }

.empty { text-align: center; padding: 36px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* Pills -------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--border); color: var(--text); white-space: nowrap; }
.pill.replied { background: var(--success-bg); color: var(--success); }
.pill.action { background: var(--warning-bg); color: var(--warning); }
.pill.closed { background: var(--closed-bg); color: var(--faint); }
.pill.warming { background: var(--info-bg); color: var(--info); }
.pill.channel { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 500; }

/* Follow-up progress dots */
.fu { display: inline-flex; gap: 4px; align-items: center; }
.fu i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); display: inline-block; }
.fu i.sent { background: var(--success); } .fu i.overdue { background: var(--danger); }
.fu i.soon { background: #E2A73A; } .fu i.none { background: transparent; border: 1px dashed var(--border-strong); }
.fu i.stopped { background: var(--border); }

/* Prospects table ----------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 220px; max-width: 360px; }
.toolbar select { width: auto; min-width: 150px; }
.filters { margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chips { flex-wrap: nowrap; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFAF8; }
tr.t-replied td { background: #F2FAF4; } tr.t-action td { background: #FEF8EA; }
tr.t-closed td { background: #F7F7F6; color: var(--faint); }
tr.t-closed .row-title { color: var(--muted); }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.cards { display: none; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; }
.card.t-replied { background: #F2FAF4; border-color: #CFE8D7; }
.card.t-action { background: #FEF8EA; border-color: #F1DFB0; }
.card.t-closed { background: #F7F7F6; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; font-size: 13px; }
.card-line > span:first-child { color: var(--muted); }

/* Modal / sheet ------------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 20, 18, .42); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; animation: fade .12s ease; }
.modal { width: 100%; max-width: 580px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 22px 22px 18px; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 18px; color: var(--ink); }
.modal-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.x { border: 0; background: none; width: 36px; height: 36px; border-radius: 8px; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; flex: none; }
.x:hover { background: var(--bg); color: var(--ink); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal-foot.split { justify-content: space-between; }
.disclose { border: 0; background: none; padding: 6px 0; color: var(--muted); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 -22px 16px; padding: 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 10px 10px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.panel { display: none; } .panel.active { display: block; }

.fu-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.fu-row:last-of-type { border-bottom: 0; }
.fu-label { font-weight: 600; font-size: 13.5px; }
.fu-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.status { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--border); color: var(--muted); white-space: nowrap; }
.status.sent { background: var(--success-bg); color: var(--success); }
.status.overdue { background: var(--danger-bg); color: var(--danger); }
.status.soon { background: var(--warning-bg); color: var(--warning); }

.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 14px; font-size: 13.5px; }
.callout.info { background: var(--info-bg); border-color: #CBD9EC; color: #2C4A72; }
.callout.muted { color: var(--muted); }

.gaps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.gaps label { font-weight: 500; color: var(--muted); font-size: 12px; margin-bottom: 3px; }

.timeline { margin-top: 14px; }
.t-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.t-item:first-child { border-top: 0; }
.t-icon { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.t-icon.note { background: var(--accent-soft); border-color: #DDF5A8; }
.t-title { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.t-time { color: var(--faint); font-size: 12px; }
.t-text { white-space: pre-wrap; font-size: 13.5px; margin-top: 2px; }

.h-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; align-items: center; }
.h-item:first-child { border-top: 0; }
.h-what { overflow-wrap: anywhere; }
.h-meta { color: var(--faint); font-size: 12px; }

.msg { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; }
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.msg-preview { color: var(--muted); font-size: 13px; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.import-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.import-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: start; }
.import-row:first-child { border-top: 0; }
.import-row input { width: 18px; height: 18px; margin-top: 2px; }
.import-row .flag { display: inline-block; margin: 4px 6px 0 0; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--danger-bg); color: var(--danger); }
.import-row .flag.dup { background: var(--warning-bg); color: var(--warning); }

/* Bottom bar + more sheet (mobile) ------------------------------------ */
.bottombar { display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-pop); padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }
.sheet button { width: 100%; text-align: left; border: 0; background: none; padding: 14px 12px; font-weight: 600; font-size: 15px; border-radius: 10px; cursor: pointer; }
.sheet button:hover { background: var(--bg); }

/* Toast -------------------------------------------------------------- */
.toast { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-pop); }
.toast.error { background: #6E2318; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px; }

.skeleton { height: 60px; border-radius: var(--radius); background: linear-gradient(90deg, #EFEEEA, #F7F6F3, #EFEEEA); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; margin-bottom: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Tablet ------------------------------------------------------------- */
@media (max-width: 1080px) {
  .hide-md { display: none; }
}

/* Phone -------------------------------------------------------------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { height: 56px; padding: 0 14px; gap: 10px; }
  .nav, .top-actions .desk { display: none; }
  .top-actions { margin-left: auto; }
  main { padding: 16px 14px calc(var(--bar-h) + 28px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 20px; }
  .banner { padding: 10px 14px; }

  .bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--border);
  }
  .bottombar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; }
  .bottombar button[aria-current="page"] { color: var(--ink); }
  .bottombar button[aria-current="page"] svg { stroke: var(--ink); }
  .bottombar .add-btn span.circle { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; margin-top: -8px; }
  .bottombar svg { width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .bottombar .add-btn svg { stroke: var(--accent-ink); }

  .row { grid-template-columns: 8px minmax(0, 1fr); grid-template-areas: "dot main" "dot meta" "dot actions"; row-gap: 4px; }
  .row > .dot { grid-area: dot; align-self: start; margin-top: 7px; }
  .row > .row-main { grid-area: main; }
  .row > .row-meta { grid-area: meta; text-align: left; white-space: normal; }
  .row > .row-actions { margin-top: 6px; }
  .stat { padding: 4px 10px; font-size: 12.5px; }
  .row > .row-actions { grid-area: actions; }
  .row-actions .btn { flex: 1; min-height: 38px; }

  .table-wrap { display: none; }
  .cards { display: flex; }
  .toolbar input[type=search] { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1; min-width: 0; }

  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 94vh; overflow-y: auto; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .tabs { margin: 0 -16px 14px; padding: 0 16px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot.split > div { display: flex; gap: 8px; width: 100%; }

  .fu-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .fu-row .fu-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .gaps { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  .toast { bottom: calc(var(--bar-h) + 12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; transform: none; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Backdrop click no longer closes windows; give a small shake so it's clear the × closes it. */
@keyframes trk-nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.modal.nudge { animation: trk-nudge .22s ease; }
.modal-head .x { font-size: 26px; width: 40px; height: 40px; }
