/* ClientFinder CRM — single stylesheet for admin + client portal */
* { box-sizing: border-box; }
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2330;
  --muted: #6b7480;
  --line: #e3e6ea;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 60px; }

/* Top bar */
.topbar { background: #101828; color: #fff; }
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-sub { font-weight: 400; opacity: .6; font-size: .85rem; }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: #cdd5e0; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar nav a.muted { opacity: .6; }

/* Cards & grids */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Stat tiles */
.stat { text-align: left; }
.stat .num { font-size: 1.7rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: .85rem; }

/* Progress bar (MRR goal) */
.bar { background: #e8ebef; border-radius: 999px; height: 14px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #16a34a); }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8f9fb; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfd; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.prospect    { background: #eef1f5; color: #475062; }
.badge.pitched     { background: #fef3c7; color: #92400e; }
.badge.negotiating { background: #e0e7ff; color: #3730a3; }
.badge.active      { background: #dcfce7; color: #166534; }
.badge.delivered   { background: #cffafe; color: #155e75; }
.badge.lost        { background: #fee2e2; color: #991b1b; }
.badge.pA { background: #dcfce7; color: #166534; }
.badge.pB { background: #fef3c7; color: #92400e; }
.badge.pC { background: #eef1f5; color: #475062; }
.badge.open     { background: #fef3c7; color: #92400e; }
.badge.paid     { background: #dcfce7; color: #166534; }
.badge.canceled { background: #eef1f5; color: #475062; }
.badge.draft    { background: #eef1f5; color: #475062; }
.badge.sent     { background: #e0e7ff; color: #3730a3; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.changes  { background: #fee2e2; color: #991b1b; }

/* Forms */
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number],
input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form > div { flex: 1; min-width: 140px; }
.inline-form .narrow { flex: 0 0 150px; }

button, .btn {
  display: inline-block; padding: 8px 16px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-sm { padding: 3px 10px; font-size: .8rem; }
.btn-ghost { background: #eef1f5; color: var(--ink); }
.btn-danger { background: var(--bad); }
.btn-ok { background: var(--ok); }

/* Flash */
.flash { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-weight: 500; }
.flash-ok  { background: #dcfce7; color: #166534; }
.flash-err { background: #fee2e2; color: #991b1b; }

/* Misc */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.overdue { color: var(--bad); font-weight: 700; }
.due-today { color: var(--warn); font-weight: 700; }
.done { text-decoration: line-through; color: var(--muted); }
.token-box {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem;
  background: #f8f9fb; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px;
  word-break: break-all;
}
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters select, .filters input { width: auto; }

/* Login */
.login-box { max-width: 380px; margin: 10vh auto; }

/* ---------- Client portal ---------- */
.portal-hero { background: #101828; color: #fff; padding: 34px 16px; text-align: center; }
.portal-hero h1 { margin: 0 0 4px; font-size: 1.6rem; }
.portal-hero p { margin: 0; opacity: .7; }
.mockup-frame {
  width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.mockup-img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pay-amount { font-size: 1.3rem; font-weight: 700; }
