/* Client document chase demo — page styles. Uses the site palette (styles.css)
   with the dashboard's status colors. */
.chase-page {
  --navy: #1b4f7c;
  --navy-dark: #12243f;
  --muted: #5c6778;
  --cline: #e3d9cb;
  --green: #1f7a4d;  --green-bg: #e5f5ec;
  --amber: #8a5a00;  --amber-bg: #faf0d2;
  --red: #9b2c2c;    --red-bg: #f8e6e6;
  --blue-bg: #e8eef6; --slate-bg: #eef1f4;
}
body { padding-bottom: 2.6rem; }

.chase-hero { background: var(--black); color: #fff; padding: 1.1rem 0 1.2rem; }
.chase-hero .free-flag { margin-bottom: 0.5rem; }
.chase-hero h1 { color: var(--accent); font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 0 0 0.35rem; line-height: 1.15; }
.chase-framing { margin: 0 0 0.45rem; font-size: 1.05rem; max-width: 52rem; color: #f2f2f2; }
.chase-sub { margin: 0; font-size: 0.95rem; max-width: 52rem; color: #d8d8d8; }

.chase-board { padding: 1.1rem 0 2rem; }
.board-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1.5rem; }
.board-eyebrow { margin: 0; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.board-head h2 { margin: 0.1rem 0 0.15rem; font-size: 1.5rem; color: var(--navy-dark); }
.as-of { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.board-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn-outline { background: transparent; color: var(--black); border-color: var(--black); }
.btn-outline:hover { background: var(--black); color: #fff; border-color: var(--black); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.demo-banner-inline {
  margin: 0.8rem 0; padding: 0.5rem 0.85rem; border-radius: var(--radius);
  background: #faf0d2; border: 1px solid #e8d48f; color: #3d2c00; font-size: 0.92rem;
}
.demo-banner-fixed {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  background: #c9a227; color: #1c2330; text-align: center;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.45rem 0.75rem; box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
}

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.7rem; margin-bottom: 0.6rem; }
.kpi { background: var(--paper-2); border: 1px solid var(--cline); border-radius: 0.6rem; padding: 0.6rem 0.85rem; }
.kpi-num { font-family: var(--font-display); font-size: 1.75rem; font-weight: 500; color: var(--navy); line-height: 1.15; }
.kpi-label { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.kpi-alert .kpi-num { color: var(--red); }

.toast { min-height: 1.6em; margin: 0 0 0.5rem; font-weight: 600; color: var(--navy-dark); font-size: 0.95rem; }

.board-panel { background: var(--paper-2); border: 1px solid var(--cline); border-radius: 0.6rem; overflow: hidden; margin-bottom: 1.2rem; }
.chase-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; line-height: 1.4; }
.chase-table th, .chase-table td { text-align: left; vertical-align: top; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--cline); }
.chase-table th { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: #f8f3ea; font-weight: 700; }
.chase-table tr:last-child td { border-bottom: 0; }
.sub { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 0.1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.client-name {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 700; font-size: 0.98rem;
  color: var(--navy); text-align: left; cursor: pointer; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 0.18em;
}
.client-name:hover { color: var(--accent-hover); }
.cell-progress { white-space: nowrap; width: 11rem; }
.pct { font-weight: 600; }
.prog-bar { width: 9rem; height: 8px; background: #e8e0d4; border-radius: 99px; overflow: hidden; margin: 0.3rem 0; }
.prog-bar span { display: block; height: 100%; background: var(--navy); border-radius: 99px; transition: width 0.4s ease; }
tr.status-complete .prog-bar span { background: var(--green); }
tr.status-overdue .prog-bar span, tr.status-due_today .prog-bar span { background: var(--red); }

.badge { display: inline-block; font-size: 0.74rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.badge-complete { background: var(--green-bg); color: var(--green); }
.badge-overdue { background: var(--red-bg); color: var(--red); }
.badge-due_today { background: var(--amber-bg); color: var(--amber); }
.badge-in_progress { background: var(--blue-bg); color: var(--navy); }
.badge-just_started { background: var(--slate-bg); color: var(--navy); }

.cell-missing { min-width: 20rem; }
.missing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.missing-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  background: #f8f3ea; border: 1px solid var(--cline); border-radius: 0.45rem; padding: 0.3rem 0.35rem 0.3rem 0.6rem;
}
.missing-text { min-width: 0; }
.missing-text strong { font-weight: 600; }
.mark-btn {
  flex-shrink: 0; min-height: 2.1rem; padding: 0.2rem 0.65rem; font: inherit; font-size: 0.78rem; font-weight: 700;
  background: var(--paper-2); color: var(--green); border: 1.5px solid var(--green); border-radius: var(--radius); cursor: pointer;
}
.mark-btn:hover { background: var(--green); color: #fff; }
.stopped { display: inline-block; font-weight: 700; color: var(--green); }
.link-btn {
  display: inline-block; margin-top: 0.3rem; background: none; border: 0; padding: 0.15rem 0; font: inherit; font-size: 0.8rem;
  font-weight: 700; color: var(--navy); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer;
}
.new-tag {
  display: inline-block; margin: 0.2rem 0 0 0; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--accent); color: var(--ink); padding: 0.05rem 0.4rem; border-radius: 999px;
}
tr.status-complete { background: #f6fbf8; }

.recent-panel { padding: 1rem 1.1rem 0.4rem; }
.recent-title { font-size: 1.2rem; margin: 0 0 0.25rem; color: var(--navy-dark); }
.recent-panel > .muted { font-size: 0.88rem; margin: 0 0 0.5rem; }
.recent { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 1.5rem; }
.recent li { border-bottom: 1px solid var(--cline); }
.recent-btn { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0.55rem 0.2rem; font: inherit; font-size: 0.88rem; color: var(--ink); cursor: pointer; }
.recent-btn:hover .recent-line strong { text-decoration: underline; }
.recent-line strong { color: var(--navy); }
.recent li.is-new { background: #eef5fc; animation: chase-flash 1.6s ease; }
.recent li.is-new .new-tag { margin-left: 0.4rem; }
@keyframes chase-flash { from { background: #cfe3f7; } to { background: #eef5fc; } }

.chase-steps .card h3 { margin-bottom: 0.3rem; }
.chase-steps { grid-template-columns: repeat(4, 1fr); }
.chase-cta .cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }
.chase-contact { font-weight: 600; }

/* Email dialog */
.email-dialog {
  width: min(44rem, calc(100% - 1.5rem)); max-height: calc(100vh - 3rem); padding: 0; border: 0;
  border-radius: 0.6rem; box-shadow: 0 20px 60px rgba(0,0,0,0.35); background: var(--paper-2); color: var(--ink);
}
.email-dialog::backdrop { background: rgba(17,17,17,0.6); }
.email-dialog-inner { padding: 1rem 1.2rem 1.1rem; }
.email-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.email-dialog-head h2 { margin: 0; font-size: 1.25rem; color: var(--navy-dark, #12243f); }
.dialog-close {
  flex-shrink: 0; width: 2.6rem; height: 2.6rem; font-size: 1.6rem; line-height: 1; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; color: var(--ink);
}
.email-status { margin: 0.3rem 0 0.6rem; font-weight: 600; color: #1f7a4d; }
.email-history { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.hist-btn { font: inherit; font-size: 0.78rem; padding: 0.3rem 0.6rem; min-height: 2.2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; color: var(--ink); }
.hist-btn.is-current { background: #1b4f7c; color: #fff; border-color: #1b4f7c; }
.email-meta { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; margin: 0 0 0.7rem; font-size: 0.85rem; }
.email-meta dt { font-weight: 700; color: #5c6778; }
.email-meta dd { margin: 0; overflow-wrap: anywhere; }
.email-body {
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-sans); font-size: 0.88rem; line-height: 1.5;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.9rem; margin: 0 0 0.6rem;
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .chase-steps { grid-template-columns: repeat(2, 1fr); }
}
/* Phones and narrow tablets: stack each client into a card */
@media (max-width: 860px) {
  .chase-table thead { display: none; }
  .chase-table, .chase-table tbody, .chase-table tr, .chase-table td { display: block; width: 100%; }
  .chase-table tr { border-bottom: 6px solid var(--paper); padding: 0.4rem 0; }
  .chase-table td { border-bottom: 0; padding: 0.35rem 0.85rem; }
  .chase-table td::before {
    content: attr(data-label); display: block; font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); font-weight: 700; margin-bottom: 0.1rem;
  }
  .chase-table td.cell-client::before { display: none; }
  .cell-missing { min-width: 0; }
  .cell-progress { white-space: normal; }
  .prog-bar { width: 100%; }
  .recent { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .kpi-num { font-size: 1.45rem; }
  .board-controls { width: 100%; }
  .board-controls .btn { flex: 1 1 auto; }
  .missing-item { flex-wrap: wrap; }
  .chase-steps { grid-template-columns: 1fr; }
  .chase-cta .btn { width: 100%; }
  .demo-banner-fixed { font-size: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .prog-bar span { transition: none; }
  .recent li.is-new { animation: none; }
}

@media (max-width: 860px) {
  .demo-banner-inline { display: none; }
  .chase-hero { padding: 0.7rem 0 0.85rem; }
  .chase-hero h1 { font-size: 1.45rem; margin-bottom: 0.25rem; }
  .chase-framing, .chase-sub { font-size: 0.92rem; }
  .chase-board { padding-top: 0.7rem; }
  .board-head h2 { font-size: 1.25rem; }
}

.cell-due { white-space: nowrap; }
