/*
 * Wera Leads app additions on top of the UI kit (wl-kit.css, unchanged from Ploy).
 * Only things the kit doesn't cover: self-hosted font, phone navigation, toasts,
 * lead detail, groups + businesses pages, and a few phone-width fixes.
 */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* The kit's mask uses a relative URL; from /static it must be absolute */
.wl-mark {
  -webkit-mask-image: url("/static/wera-mark.webp");
  mask-image: url("/static/wera-mark.webp");
}

html, body { margin: 0; background: var(--wl-cloud); }
body { min-height: 100vh; }
a { color: inherit; }
.wl-hidden { display: none !important; }

/* ---------- phone navigation (kit hides .wl-nav under 1024px) ---------- */
.wl-mobile-nav { display: none; }
@media (max-width: 1024px) {
  .wl-mobile-nav {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: var(--wl-white);
    border-bottom: 1px solid var(--wl-border);
    overflow-x: auto;
    position: sticky;
    top: 64px;
    z-index: 9;
  }
  .wl-mobile-nav .wl-nav__link { flex: 1 0 auto; justify-content: center; }
}

/* extension status pill states */
.wl-ext-status--off .wl-dot { background: #c4ccc8; box-shadow: 0 0 0 3px #eef1ef; }

/* ---------- toast ---------- */
.wl-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--wl-forest);
  color: var(--wl-white);
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: var(--wl-shadow-pop);
  font: 500 14px var(--wl-font);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  max-width: calc(100% - 32px);
}
.wl-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- leads page bits ---------- */
.wl-person__name .wl-tag { font-weight: 600; }
.wl-tag--admin { background: #fff4e0; color: #8a5300; }
.wl-tag--phone { background: var(--wl-mint); color: var(--wl-emerald); }
.wl-badge--sm { height: 22px; font-size: 11px; }
.wl-table .wl-col-group { max-width: 220px; }
.wl-group-chip { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.wl-more-groups { color: var(--wl-subtle); font-size: 12px; margin-left: 4px; }
tr.wl-row--admin { background: #fffaf0; }
.wl-btn[disabled], .wl-btn.is-disabled { opacity: .5; cursor: default; pointer-events: none; }
.wl-pager .wl-btn { min-width: 40px; }
.wl-tabs { scrollbar-width: none; }
.wl-tabs::-webkit-scrollbar { display: none; }
.htmx-request.wl-panel, .htmx-request .wl-table { opacity: .6; transition: opacity .15s; }

/* ---------- simple content cards (lead detail, groups, businesses) ---------- */
.wl-section { padding: 20px; display: grid; gap: 14px; }
.wl-section h2 { margin: 0; font-size: 16px; font-weight: 600; }
.wl-section p { margin: 0; }
.wl-kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.wl-kv dt { color: var(--wl-muted); }
.wl-kv dd { margin: 0; overflow-wrap: anywhere; }
.wl-two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.wl-status-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-status-buttons .wl-btn.is-current { background: var(--wl-mint); border-color: var(--wl-emerald); color: var(--wl-emerald); }
.wl-history { list-style: none; margin: 0; padding: 0; display: grid; }
.wl-history li { padding: 10px 0; border-top: 1px solid var(--wl-border); display: grid; gap: 2px; }
.wl-history li:first-child { border-top: 0; }
.wl-history__when { font-size: 12px; color: var(--wl-subtle); }
.wl-notes { white-space: pre-wrap; background: var(--wl-cloud); border: 1px solid var(--wl-border); border-radius: 12px; padding: 12px; font-size: 13px; }
.wl-textarea { width: 100%; min-height: 84px; resize: vertical; border: 1px solid var(--wl-input-border); border-radius: var(--wl-radius-control); padding: 10px 12px; font: 400 14px var(--wl-font); color: var(--wl-forest); }
.wl-textarea:focus { outline: none; border-color: var(--wl-emerald); box-shadow: 0 0 0 4px var(--wl-focus); }
.wl-inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.wl-inline-form .wl-input { flex: 1 1 220px; width: auto; }
.wl-alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px; }
.wl-alert--warn { background: #fff4e0; color: #8a5300; }
.wl-alert--error { background: #fef3f2; color: var(--wl-danger); }
.wl-alert--ok { background: var(--wl-mint); color: var(--wl-forest); }
.wl-secret { display: flex; gap: 8px; align-items: center; background: var(--wl-forest); color: var(--wl-white); border-radius: 12px; padding: 10px 12px; font: 500 13px ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.wl-secret code { flex: 1; }
.wl-secret .wl-icon-btn { color: var(--wl-white); }
.wl-list-table { width: 100%; border-collapse: collapse; }
.wl-list-table th, .wl-list-table td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--wl-border); }
.wl-list-table th { background: var(--wl-cloud); font-size: 12px; font-weight: 600; color: var(--wl-muted); }
.wl-list-table tr:last-child td { border-bottom: 0; }
.wl-num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .wl-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wl-kv { grid-template-columns: 1fr; gap: 2px; }
  .wl-kv dd { margin-bottom: 8px; }
  .wl-section { padding: 16px; }
  /* tables on the groups / businesses pages: let them scroll sideways instead of squashing */
  .wl-scroll-x { overflow-x: auto; }
  .wl-list-table th, .wl-list-table td { padding: 10px 12px; white-space: nowrap; }
  /* lead cards: keep group visible as a small line under the name */
  .wl-table td.wl-col-group { display: block; grid-column: 2 / -1; font-size: 12px; }
  .wl-table__actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .wl-table__actions > * + * { margin-left: 0; }
  .wl-toast { bottom: 16px; }
}
