:root {
  --navy: #0b2540;
  --navy-2: #123256;
  --teal: #189ab4;
  --teal-dark: #127f95;
  --teal-soft: #e5f5f8;
  --orange: #f0812e;
  --orange-soft: #fdf0e5;
  --ink: #0b2540;
  --muted: #5c7189;
  --bg: #f3f6f9;
  --card: #ffffff;
  --line: #e1e8ef;
  --ok: #178a5b;
  --ok-soft: #e3f6ee;
  --warn: #b97800;
  --warn-soft: #fff3d9;
  --bad: #c93c3c;
  --bad-soft: #fde8e8;
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.5; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; line-height: 1.25; }
a { color: var(--teal-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* top bar */
.topbar { background: var(--navy); color: #fff; }
.topbar-in { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.topbar img { height: 30px; }
.topbar .sp { flex: 1; }
.topbar .who { font-size: 14px; color: #cfe0ee; }
.topbar a { color: #cfe0ee; text-decoration: none; font-size: 14px; }
.topbar a:hover { color: #fff; }
.topbar { position: relative; }
.topnav { display: flex; align-items: center; gap: 18px; }
.menu-btn {
  display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); color: #fff; font-weight: 600; font-size: 14px;
}
.menu-btn:hover { background: rgba(255,255,255,.16); }

/* phones: the links collapse into a Menu button instead of running off the screen */
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .topnav {
    display: none; position: absolute; left: 12px; right: 12px; top: calc(100% + 4px); z-index: 30;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px;
    background: #0f2c4b; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; box-shadow: 0 24px 50px -12px rgba(0,0,0,.55);
  }
  .topnav.open { display: flex; }
  .topnav a { display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: 10px; font-size: 15px; color: #e3f0f8; }
  .topnav a:hover { background: rgba(255,255,255,.08); }
  .topnav .who { padding: 10px 14px 12px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 14px; overflow-wrap: anywhere; }
  .topnav .who:empty { display: none; }
  .topnav #logout { color: #ffb4b4; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.1); border-radius: 0 0 10px 10px; }
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; }
.page-title { font-size: 26px; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin: 0 0 22px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; text-decoration: none;
  background: var(--teal); color: #fff; transition: background .15s, transform .1s; }
.btn:hover { background: var(--teal-dark); }
.btn:active { transform: translateY(1px); }
.btn.orange { background: var(--orange); }
.btn.orange:hover { background: #d96d1f; }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: #fff; border-color: #c6d3df; }
.btn.danger { background: var(--bad); }
.btn.green { background: #25d366; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .6; cursor: default; }

/* cards + forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 16px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 12px; }
label.f input, label.f select, label.f textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid #cfdbe6; border-radius: 9px; background: #fff; font-weight: 400; }
label.f textarea { min-height: 80px; resize: vertical; }
label.f input:focus, label.f select:focus, label.f textarea:focus, .search:focus { outline: 2px solid rgba(24,154,180,.35); border-color: var(--teal); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 0 0 10px; }
.ok-msg { color: var(--ok); font-size: 14px; }

/* badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--teal-soft); color: var(--teal-dark); }
.badge.on_hold, .badge.contacted { background: var(--warn-soft); color: var(--warn); }
.badge.completed, .badge.converted { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled, .badge.closed { background: #eceff3; color: #5c6b7a; }
.badge.new { background: var(--orange-soft); color: #c4601a; }

/* login card */
.login-wrap { max-width: 420px; margin: 70px auto; padding: 0 20px; }
.login-wrap .card { padding: 28px; }
.login-wrap h1 { font-size: 22px; margin-bottom: 6px; }

/* progress */
.bar { height: 8px; background: #e6edf3; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #3ec1da); border-radius: 99px; transition: width .6s; }

/* stepper */
.steps { list-style: none; margin: 0; padding: 0; }
.step { position: relative; display: flex; gap: 14px; padding-bottom: 20px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: #dbe5ee; }
.step:last-child::before { display: none; }
.step.done::before { background: var(--teal); }
.dot { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #cbd7e2; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #8ea1b3; z-index: 1; }
.step.done .dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.step.current .dot { border-color: var(--orange); background: var(--orange); color: #fff; box-shadow: 0 0 0 5px rgba(240,129,46,.18); }
.step .st-title { font-weight: 600; font-size: 15px; }
.step.upcoming .st-title { color: #7d8fa1; font-weight: 500; }
.days { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: #eef3f7; color: var(--muted); font-family: var(--font-body); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.step.current .days { background: var(--orange-soft); color: #c4601a; }
.step .st-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.step .st-tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--orange); }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 12px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed .fh { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.feed .ft { font-weight: 600; font-size: 14px; color: var(--ink); }
.feed .fm { font-size: 14px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.feed .internal { background: var(--warn-soft); margin: 0 -10px; padding: 12px 10px; border-radius: 8px; }

/* customer app card */
.app-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.app-head h2 { font-size: 20px; }
.app-cols { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; margin-top: 20px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.empty { text-align: center; padding: 50px 20px; }
.empty h2 { margin-bottom: 8px; }

/* ---------- admin layout ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #cfe0ee; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side img { height: 30px; align-self: flex-start; margin: 4px 8px 18px; }
.side a.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 9px; color: #cfe0ee; text-decoration: none; font-size: 14.5px; font-weight: 500; }
.side a.nav:hover { background: rgba(255,255,255,.07); }
.side a.nav.on { background: rgba(24,154,180,.28); color: #fff; }
.side .pill { background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.side .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.side .foot button { margin-top: 8px; }
.main { padding: 26px 28px 60px; min-width: 0; }
.main h1 { font-size: 24px; margin-bottom: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { padding: 9px 12px; border: 1px solid #cfdbe6; border-radius: 9px; min-width: 240px; background: #fff; }
select.sel { padding: 9px 10px; border: 1px solid #cfdbe6; border-radius: 9px; background: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat.link { text-decoration: none; color: inherit; border-color: #f3c9a6; background: var(--orange-soft); }
.stat.link:hover { border-color: var(--orange); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat b { display: block; font-family: var(--font-head); font-size: 28px; }
.stat span { color: var(--muted); font-size: 13px; }
.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafcfd; white-space: nowrap; }
.t td { padding: 12px 14px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #f7fbfc; }
.t .sub { color: var(--muted); font-size: 12.5px; }
.bars .row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.bars .row span:first-child { flex: 0 0 200px; }
.bars .row .bar { flex: 1; }
.bars .row b { width: 28px; text-align: right; }
.detail { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
.back { background: none; border: 0; color: var(--teal-dark); cursor: pointer; font-weight: 600; padding: 0; margin-bottom: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 99; }
.toast.bad { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(11,37,64,.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 90; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 18px; margin-bottom: 14px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 4px; }
  .side img { margin: 0 10px 0 4px; }
  .side .foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 8px; align-items: center; }
  .side .foot .small { display: none; }
  .side .foot button { margin: 0; }
  .main { padding: 18px 14px 50px; }
  .detail, .app-cols, .grid2 { grid-template-columns: 1fr; }
  .bars .row span:first-child { flex-basis: 120px; }
}
.stat.bad { text-decoration: none; color: inherit; border-color: #f1b7b7; background: var(--bad-soft); }
.stat.bad:hover { border-color: var(--bad); }
.side .pill.bad { background: var(--bad); }
code { background: #eef3f7; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

.page-foot { text-align: center; font-size: 13px; margin: 0 0 30px; }
.page-foot a { color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.chk .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.chk.ok .mark { background: var(--ok-soft); color: var(--ok); }
.chk.bad .mark { background: var(--bad-soft); color: var(--bad); }
.fixhint { color: #9a3a3a; margin-top: 2px; }
.card h3 .badge { margin-left: 8px; vertical-align: 2px; }
