/* CustomFind Filters & Search — merchant dashboard.
 *
 * Light surfaces, generous radii and a single vivid blue that carries every
 * active state: the nav pill, the primary button, links, chips and the selected
 * row. Everything else stays neutral so the blue always means "this one".
 */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --blue: #2f5bff;
  --blue-strong: #1f47e6;
  --blue-tint: #e9effe;
  --blue-tint-strong: #dbe5ff;

  --page: #f1f2f4;
  --surface: #ffffff;
  --surface-sunken: #f7f8fa;

  --text: #14161a;
  --muted: #6b7280;
  --border: #e8e9ec;
  --border-strong: #d3d6db;

  --ok-bg: #e6f6ec; --ok-fg: #0d6b38; --ok-br: #b7e3c8;
  --warn-bg: #fff3e2; --warn-fg: #8a5a00; --warn-br: #ffdcab;
  --bad-bg: #feecec; --bad-fg: #b3261e; --bad-br: #f7c3c0;

  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 10px;

  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
}

body {
  margin: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 21px; font-weight: 680; }
h2 { font-size: 15px; font-weight: 660; }
h3 { font-size: 13px; font-weight: 660; }
p { margin: 0; }
.sub { color: var(--muted); }
.hidden { display: none !important; }

/* The internal console is a plain page rather than the merchant shell. */
.shell { max-width: 1180px; margin: 0 auto; padding: 24px 18px 72px; display: grid; gap: 16px; }

/* ─── Shell ───────────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 18px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 18px 72px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  display: grid;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 0;
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #0b1220; /* the customfind.co mark */
  display: grid;
  place-items: center;
  flex: none;
}

.brand__name { font-weight: 680; letter-spacing: -0.02em; font-size: 15px; }

.nav { display: grid; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
}

.nav a svg { width: 18px; height: 18px; flex: none; stroke-width: 1.7; }
.nav a:hover { background: var(--surface-sunken); color: var(--text); }
.nav a.is-active { background: var(--blue-tint); color: var(--blue); }

.sidebar__foot {
  border-top: 1px solid var(--border);
  padding: 14px 12px 4px;
  display: grid;
  gap: 4px;
}

.sidebar__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.sidebar__value { font-weight: 600; overflow-wrap: anywhere; }

.content { display: grid; gap: 16px; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 2px 4px;
}

.topbar__meta { color: var(--muted); font-size: 13px; }

.view { display: grid; gap: 16px; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-sunken);
}

.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 19px; font-weight: 680; margin-top: 3px; letter-spacing: -0.02em; }

/* ─── Controls ────────────────────────────────────────────────────────────── */

button {
  font: inherit;
  font-weight: 580;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
}

button:hover:not(:disabled) { background: var(--blue-strong); border-color: var(--blue-strong); }
button:disabled { opacity: 0.5; cursor: default; }

button.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
button.secondary:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--muted); }
button.critical { background: var(--bad-fg); border-color: var(--bad-fg); }

button.plain {
  background: none; border: 0; padding: 4px 6px; color: var(--blue);
  text-decoration: underline; font-weight: 500;
}

button.icon {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 10px; font-size: 13px; border-radius: 8px;
}
button.icon:hover:not(:disabled) { background: var(--surface-sunken); color: var(--text); }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  width: 100%;
}

textarea {
  resize: vertical; min-height: 96px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-tint);
}

label.field { display: grid; gap: 5px; font-size: 13px; }
label.field .hint { color: var(--muted); font-size: 12px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.toggle { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.toggle input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
.toggle__text { display: grid; gap: 1px; }
.toggle__label { font-size: 13px; font-weight: 500; }
.toggle__hint { color: var(--muted); font-size: 12px; }

/* ─── Lists ───────────────────────────────────────────────────────────────── */

.list { display: grid; gap: 8px; }

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* An enabled filter is the selected state, so it carries the blue. Scoped to the
   filter list: every other list in the app uses rows for content, not selection. */
#filter-list .item:not(.is-off) { background: var(--blue-tint); border-color: var(--blue-tint-strong); }
.item.is-off { opacity: 0.72; }
.item__title { font-weight: 580; }
.item__meta { color: var(--muted); font-size: 12px; }
.item__actions { display: flex; align-items: center; gap: 8px; }
.item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); }

.drag { cursor: grab; color: var(--muted); user-select: none; padding: 2px 4px; line-height: 1; }
.item.dragging { opacity: 0.4; }
.item.drop-target { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 550; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-sunken); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ─── Feedback ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge.info { background: var(--blue-tint); color: var(--blue); }

.chip {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  background: var(--blue-tint); color: var(--blue);
  font-size: 12px; font-weight: 560;
}

.banner { border-radius: var(--radius); padding: 13px 15px; display: grid; gap: 4px; font-size: 13px; border: 1px solid; }
.banner strong { font-weight: 660; }
.banner.ok { background: var(--ok-bg); border-color: var(--ok-br); color: var(--ok-fg); }
.banner.warn { background: var(--warn-bg); border-color: var(--warn-br); color: var(--warn-fg); }
.banner.bad { background: var(--bad-bg); border-color: var(--bad-br); color: var(--bad-fg); }
.banner.info { background: var(--blue-tint); border-color: var(--blue-tint-strong); color: var(--blue-strong); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty__title { font-weight: 620; color: var(--text); margin-bottom: 4px; }

.skeleton { height: 12px; border-radius: 6px; background: #e9eaee; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

.spinner {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button.secondary .spinner { border-color: var(--border-strong); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 11px 18px; border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.25);
  z-index: 50; font-size: 13px;
}
.toast.bad { background: var(--bad-fg); }

/* A sticky bar so a merchant never loses an edit by navigating away. */
.savebar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px;
  width: min(760px, calc(100% - 36px)); z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 4px 0 0;
  padding: 13px 16px;
  background: var(--text); color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.28);
}
.savebar button.secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.savebar button.secondary:hover { background: rgba(255, 255, 255, 0.12); }
.savebar .primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.savebar .primary:hover:not(:disabled) { background: var(--blue-strong); }

code {
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-sunken); border: 1px solid var(--border);
  border-radius: 7px; padding: 2px 6px;
}

pre {
  margin: 0; padding: 14px; overflow-x: auto;
  background: #141824; color: #e6e9f0; border-radius: var(--radius);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; padding: 12px 12px 72px; }
  .sidebar { position: static; }
  .nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .sidebar__foot { display: none; }
}

@media (max-width: 600px) {
  .item { grid-template-columns: auto 1fr; }
  .item__actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* What each plan includes, straight from the plan the merchant is shown before
   they pay — so the two can be compared without leaving the app. */
.plan__includes {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan__includes li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted, #6b7280);
}

.plan__includes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}

/* A long line must never widen the page. Grid children default to
   min-width:auto, which lets one wide <pre> or input push the whole layout
   sideways and hand the merchant a horizontal scrollbar. */
.app, .app > *, .view, .view > *, .card, .card > * { min-width: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
input[type="text"], input[type="number"], input[type="url"], textarea, select { max-width: 100%; box-sizing: border-box; }

/* A value with its Copy button on one line. */
.copyrow { display: flex; gap: 8px; align-items: center; }
.copyrow input { flex: 1; min-width: 0; }
.copyrow button { flex: none; }
