/* BudgetBro merchant portal — shared styles for the merchant and admin pages. */

/* Palette lifted from the consumer app (app/styles.css) so the portal, the
   support console and the field app look like the same product as
   budgetbro.co. Light and blue-primary, not a separate dark theme.

   If the main app's palette changes, change these and everything follows —
   every rule below is written against the tokens, never a literal colour. */
:root {
  color-scheme: light;

  --bg: #f4f9ff;
  --surface: #ffffff;
  --border: #d9e8fb;
  --border-strong: #c5dff8;
  --text: #0b1220;
  --muted: #5d6b80;

  /* Blue is the brand and the primary action. */
  --accent: #1677ff;
  --accent-soft: #eaf4ff;
  --accent-border: #b9d7fb;

  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #d99600;
  --warn-soft: #fff8df;
  --success: #13a763;
  --success-soft: #e9f9f1;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --on-accent: #ffffff;
  --shadow: 0 24px 70px rgba(18, 72, 135, 0.14);
}

/* Deliberately no dark-scheme override: the consumer app is light only, and a
   portal that flips to dark on half the staff's phones would not read as the
   same product. */

* { box-sizing: border-box; }

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

.wrap { max-width: 880px; margin: 0 auto; padding: 32px 20px 80px; }
.wrap.wide { max-width: 1080px; }

header.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 28px;
}

header.bar h1 { font-size: 19px; margin: 0; letter-spacing: -0.01em; }
header.bar .who { color: var(--muted); font-size: 13px; }

h2 { font-size: 15px; margin: 32px 0 12px; letter-spacing: -0.01em; }
h2:first-of-type { margin-top: 0; }

p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(18, 72, 135, 0.05);
}

.card h3 { margin: 0 0 4px; font-size: 15px; }

/* --- forms ---------------------------------------------------------------- */

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }

/* `search` and `tel` are easy to forget here, and an input left out falls back
   to the browser default — a white box in a dark interface. */
input[type="text"], input[type="email"], input[type="number"],
input[type="search"], input[type="tel"], input:not([type]), textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

textarea { min-height: 78px; resize: vertical; }

/* iOS gives search inputs rounded native chrome that ignores the above. */
input[type="search"] { -webkit-appearance: none; appearance: none; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.row > button { flex: 0 0 auto; }

button {
  font: inherit;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; filter: none; }

button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
button.danger { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
button.small { padding: 5px 10px; font-size: 13px; }

/* --- feedback ------------------------------------------------------------- */

.note {
  border-radius: 8px;
  padding: 11px 14px;
  margin: 12px 0;
  font-size: 14px;
  border: 1px solid transparent;
}

.note.ok { background: var(--accent-soft); border-color: var(--accent); }
.note.bad { background: var(--danger-soft); border-color: var(--danger); }
.note.warn { background: var(--warn-soft); border-color: var(--warn); }
.note:empty { display: none; }

/* --- data ----------------------------------------------------------------- */

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }

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

.stat .n { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat.flag .n { color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 10px 6px 0; }
td { padding: 8px 10px 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.scroll { overflow-x: auto; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag.live { background: var(--success-soft); color: var(--success); }
.tag.hot { background: var(--danger-soft); color: var(--danger); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* --- the dangerous one ---------------------------------------------------- */

/* Impersonation is visually separated on purpose. It should never be possible
   to click it while believing you are doing something routine. */
.card.danger { border-color: var(--danger); border-width: 1px; }
.card.danger h3 { color: var(--danger); }

.linkout {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  color: var(--text);
}

.hidden { display: none !important; }
