/* Custom Support Stack — design system + components.
   A refined, restrained SaaS look (generous whitespace, quiet borders, a considered type scale).
   Loaded by every template. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f3f6;
  --surface-3: #e9ebef;
  --border: #e5e7eb;
  --border-strong: #d3d6dc;
  --text: #14161a;
  --text-2: #565a66;
  --muted: #93969f;

  /* Brand teal — matches the Strapify website / contact form (#0e7c7b). Kept brand-locked; only
     the supporting hover/soft shades were refined for contrast against the new neutrals. */
  --primary: #0e7c7b;
  --primary-hover: #0a6362;
  --primary-soft: #e4f2f1;
  --primary-soft-text: #0a5f5e;

  --success: #16a34a;
  --success-soft: #e3f8ea;
  --warning: #d97706;
  --warning-soft: #fdf1dc;
  --danger: #dc2626;
  --danger-soft: #fceaea;
  --purple: #7c3aed;
  --purple-soft: #f2e9fe;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(20, 22, 30, .05);
  --shadow-sm: 0 1px 2px rgba(20, 22, 30, .04), 0 2px 5px rgba(20, 22, 30, .05);
  --shadow-md: 0 6px 16px rgba(20, 22, 30, .07), 0 1px 3px rgba(20, 22, 30, .04);
  --shadow-lg: 0 20px 48px rgba(20, 22, 30, .14), 0 4px 12px rgba(20, 22, 30, .06);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  letter-spacing: -.006em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); font-size: .85em; }

/* A visible, consistent focus ring everywhere (buttons, links, custom controls) - relies on
   :focus-visible so mouse clicks stay quiet and keyboard/AT users still get a clear ring. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- buttons --- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem .95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s var(--ease), box-shadow .12s var(--ease), border-color .12s var(--ease), transform .06s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); padding: .4rem .6rem; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  width: 2rem; height: 2rem; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }

/* --- form controls --- */
.input, .select, textarea.input {
  font: inherit; font-size: .88rem;
  padding: .5rem .68rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder { color: var(--muted); }
.select { cursor: pointer; }
label { font-size: .82rem; color: var(--text-2); font-weight: 500; }

/* --- chips / tags / badges --- */
.tag {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .68rem; font-weight: 600; letter-spacing: .01em;
  padding: .14rem .55rem; border-radius: var(--radius-pill);
  background: var(--primary-soft); color: var(--primary-soft-text);
  margin: .12rem .15rem 0 0; cursor: pointer; white-space: nowrap;
  transition: background .12s var(--ease);
}
.tag:hover { background: color-mix(in srgb, var(--primary) 22%, var(--primary-soft)); }
.tag .x { cursor: pointer; opacity: .55; font-weight: 700; }
.tag .x:hover { opacity: 1; }

.badge {
  display: inline-flex; align-items: center;
  font-size: .66rem; font-weight: 700; letter-spacing: .02em;
  padding: .16rem .55rem; border-radius: var(--radius-pill);
}
.badge.p-top { background: var(--danger-soft); color: var(--danger); }
.badge.p-urgent { background: var(--warning-soft); color: var(--warning); }
.badge.p-angry { background: var(--purple-soft); color: var(--purple); }
.badge.p-low { background: var(--surface-3); color: var(--text-2); }

.channel-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; font-weight: 600; color: var(--text-2);
}
.verified { color: var(--success); font-size: .72rem; font-weight: 600; }

/* --- avatar --- */
.avatar {
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: #fff; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

/* --- status pill (delivery) --- */
.status-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; }
.status-sent { background: var(--success); }
.status-failed { background: var(--danger); }
.status-queued { background: var(--warning); }

/* --- card / auth pages --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(120% 100% at 50% -10%, color-mix(in srgb, var(--primary) 6%, var(--bg)), var(--bg)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 2rem;
}
.auth-card { width: 22rem; max-width: 100%; }
.auth-card h1 { font-size: 1.3rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
.auth-card .brand { font-size: 1.6rem; margin-bottom: 1rem; font-weight: 700; letter-spacing: -.02em; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .35rem; font-weight: 600; color: var(--text); }
.form-error { background: var(--danger-soft); color: var(--danger); padding: .6rem .8rem;
  border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 1rem; }

/* --- generic page shell (settings, reports) --- */
.page { max-width: 60rem; margin: 0 auto; padding: 1.5rem; }
.page-narrow { max-width: 42rem; }
.page h1 { font-size: 1.45rem; margin: 0 0 .25rem; letter-spacing: -.015em; font-weight: 700; }
.page h2 { font-size: 1.05rem; margin: 1.8rem 0 .6rem; letter-spacing: -.01em; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
table.tbl { border-collapse: collapse; width: 100%; font-size: .85rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.tbl th, table.tbl td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
table.tbl th { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .03em; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- stat cards (reports/insights tiles) --- */
.stat-cards { display: flex; flex-wrap: wrap; gap: .7rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .85rem 1rem; min-width: 8rem; box-shadow: var(--shadow-xs); }
.stat .v { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.stat .k { font-size: .74rem; color: var(--text-2); margin-top: .1rem; }

/* --- toasts --- */
#toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; display: flex; flex-direction: column;
  gap: .5rem; z-index: 100; }
.toast {
  background: #1c1e24; color: #fff; padding: .7rem .95rem; border-radius: var(--radius-sm);
  max-width: 20rem; font-size: .82rem; cursor: pointer; box-shadow: var(--shadow-lg);
  animation: toast-in .18s var(--ease);
}
.toast strong { display: block; margin-bottom: .15rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Rendered (sanitised) email HTML inside a message bubble — keep it contained + readable. */
.email-html { overflow-wrap: anywhere; }
.email-html img { max-width: 100%; height: auto; }
.email-html table { max-width: 100%; border-collapse: collapse; }
.email-html a { color: var(--primary); }
.email-html blockquote { margin: .4rem 0; padding-left: .6rem; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.email-html p { margin: .3rem 0; }
