/* Shack vendor portal.
 *
 * Palette and type are lifted verbatim from the marketing site (website/styles.css)
 * and the app (frontend/tailwind.config.js). Deliberately NOT re-derived: a person
 * crossing from shackmessenger.com to app.shackmessenger.com should not be able to
 * tell they changed servers. Provenance for every value: docs/BRAND_ASSETS.md.
 */

:root {
  --bg: #020617;            /* slate-950 */
  --card: #0F172A;          /* slate-900 */
  --card-hi: #1E293B;       /* slate-800 */
  --border: #1E293B;        /* slate-800 */
  --border-soft: #334155;   /* slate-700 */
  --heading: #F1F5F9;       /* slate-100 */
  --body: #94A3B8;          /* slate-400 */
  --body-strong: #CBD5E1;   /* slate-300 */
  --primary: #6366F1;       /* Electric Indigo */
  --primary-hover: #4F46E5;
  --secondary: #F472B6;     /* Playful Pink */

  /* Semantic state — separate from the brand accent on purpose, so "this is fine"
   * and "this is our accent colour" can never be confused for one another. */
  --ok: #34D399;            /* emerald-400 */
  --warn: #F59E0B;          /* amber-500 */
  --danger: #F87171;        /* red-400 */

  --radius: 1rem;
  --radius-lg: 1.5rem;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--body);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Nunito', sans-serif; color: var(--heading); letter-spacing: -0.025em; line-height: 1.25; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }
a { color: var(--primary); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 1.35rem; height: 1.35rem; }
.brand-name { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--heading); }
.brand-sub {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--body); border-left: 1px solid var(--border-soft); padding-left: 0.6rem; margin-left: 0.15rem;
}

/* ---------- shell ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 64rem; margin: 0 auto; padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar-right { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; }
.whoami { color: var(--body-strong); font-weight: 700; }
@media (max-width: 560px) { .whoami { display: none; } }

main { max-width: 64rem; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }

/* ---------- centred auth card ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.5rem; padding: 2rem 1.5rem;
}
.auth-card {
  width: 100%; max-width: 25rem; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.auth-lede { font-size: 0.9rem; margin-bottom: 1.75rem; }
.auth-alt { font-size: 0.875rem; text-align: center; }
.auth-alt button {
  background: none; border: none; color: var(--primary);
  font: inherit; font-weight: 700; cursor: pointer; padding: 0;
}
.auth-alt button:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
label { font-size: 0.8rem; font-weight: 700; color: var(--body-strong); }
input, select {
  width: 100%; padding: 0.7rem 0.85rem;
  background: var(--bg); color: var(--heading);
  border: 1px solid var(--border-soft); border-radius: 0.7rem;
  font: inherit; font-size: 0.925rem;
  transition: border-color .15s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
input::placeholder { color: #475569; }
.hint { font-size: 0.75rem; color: var(--body); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.7rem 1.25rem; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--body-strong); border-color: var(--border-soft); }
.btn-ghost:hover:not(:disabled) { color: var(--heading); border-color: var(--body); }
.btn-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-link {
  background: none; border: none; color: var(--body); font: inherit;
  font-size: 0.875rem; font-weight: 700; cursor: pointer; padding: 0;
}
.btn-link:hover { color: var(--heading); }

/* ---------- cards & panels ---------- */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.15rem; flex-wrap: wrap;
}
.panel-head p { font-size: 0.85rem; margin-top: 0.2rem; }

/* ---------- org header ---------- */
.org-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.org-domain { font-family: var(--mono); font-size: 0.875rem; color: var(--body); margin-top: 0.15rem; }

/* ---------- the summary strip: state at a glance ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--card); padding: 1.15rem 1.25rem; }
.stat-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--body); }
.stat-value {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.6rem;
  color: var(--heading); line-height: 1.2; margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.stat-value.sm { font-size: 1.15rem; }
.stat-note { font-size: 0.78rem; margin-top: 0.15rem; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid;
}
.pill-owner   { color: var(--primary); border-color: rgba(99,102,241,.4);  background: rgba(99,102,241,.1); }
.pill-billing { color: var(--secondary); border-color: rgba(244,114,182,.4); background: rgba(244,114,182,.1); }
.pill-ok      { color: var(--ok);     border-color: rgba(52,211,153,.4);  background: rgba(52,211,153,.1); }
.pill-warn    { color: var(--warn);   border-color: rgba(245,158,11,.4);  background: rgba(245,158,11,.1); }
.pill-danger  { color: var(--danger); border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.1); }

/* ---------- the license key: this IS the product ---------- */
.keybox { background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1rem; }
.keybox code {
  display: block; font-family: var(--mono); font-size: 0.78rem; line-height: 1.6;
  color: var(--body-strong); word-break: break-all; max-height: 7rem; overflow-y: auto;
}
.keybox-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.85rem; flex-wrap: wrap; }
.keybox-foot .hint { flex: 1; min-width: 12rem; }

/* ---------- lists ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 0; border-top: 1px solid var(--border);
}
.row:first-child { border-top: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { color: var(--heading); font-weight: 700; font-size: 0.925rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }

/* license history rows keep their numbers aligned */
.row-num { font-variant-numeric: tabular-nums; }

/* ---------- org picker ---------- */
.org-list { display: grid; gap: 0.75rem; }
.org-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  font: inherit; color: inherit; transition: border-color .15s, background .15s;
}
.org-card:hover { border-color: var(--border-soft); background: var(--card-hi); }

/* ---------- messages ---------- */
.msg { border-radius: 0.7rem; padding: 0.75rem 0.95rem; font-size: 0.85rem; margin-bottom: 1rem; border: 1px solid; }
.msg-error { color: #FCA5A5; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.09); }
.msg-ok    { color: #6EE7B7; border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.09); }
.msg:empty { display: none; }

.empty { text-align: center; padding: 2rem 1rem; font-size: 0.9rem; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2,6,23,.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal {
  width: 100%; max-width: 24rem; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: 1.75rem;
}
.modal h2 { margin-bottom: 0.35rem; }
.modal-lede { font-size: 0.85rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.6rem; margin-top: 1.5rem; }
.modal-actions .btn { flex: 1; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
