@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── FINO Wholesale Portal design system ───────────────────────────── */

:root {
  --white:     #ffffff;
  --bg:        #fbfbfd;
  --line:      #d2d2d7;
  --line-soft: #f5f5f7;
  --ink:       #1d1d1f;
  --ink-soft:  #424245;
  --muted:     #86868b;
  --blue:      #0066cc;
  --blue-hover:#0077ed;
  --green:     #00863d;
  --red:       #a8201a;
  --radius:    12px;
  --radius-pill: 980px;
  --max:       1240px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  font: inherit; cursor: pointer; border: 0;
  background: var(--blue); color: var(--white);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 400; font-size: 15px;
  letter-spacing: -0.01em;
  transition: background 0.18s ease, transform 0.05s ease;
}
button:hover:not(:disabled) { background: var(--blue-hover); }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { background: #d2d2d7; color: #fff; cursor: not-allowed; }
button.link {
  background: transparent; color: var(--blue); padding: 4px 8px;
  border-radius: 4px;
}
button.link:hover { color: var(--blue-hover); background: transparent; text-decoration: underline; }
button.secondary {
  background: var(--ink); color: var(--white);
}
button.secondary:hover:not(:disabled) { background: #000; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"] {
  font: inherit; font-size: 17px; width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
}
input[readonly] { background: var(--line-soft); color: var(--muted); }

label { display: block; margin-bottom: 16px; }
label > span {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px;
  letter-spacing: 0;
}
label.radio, label.checkbox {
  display: inline-flex; align-items: center; gap: 10px; font-size: 15px;
  margin-right: 22px; margin-bottom: 12px; cursor: pointer; color: var(--ink);
}
label.radio span, label.checkbox span { all: unset; }
label.radio small, label.checkbox small { color: var(--muted); }

input[type="radio"], input[type="checkbox"] { accent-color: var(--blue); width: 16px; height: 16px; }

.eyebrow {
  font-size: 12px; font-weight: 500; color: var(--muted);
  margin: 0;
}

.error {
  margin: 14px 0 0; padding: 12px 14px;
  background: #fff3f3; color: var(--red);
  border-radius: var(--radius); font-size: 14px;
  border: 1px solid #fadbdb;
}

/* ── Wordmark (FINO logo image) ────────────────────────────────────── */

.wordmark {
  display: inline-block;
  width: auto;
  height: 36px;
  vertical-align: middle;
}
.wordmark.sm { height: 22px; }
.wordmark.lg { height: 56px; }

/* ── Login / signup / pending shared layout ────────────────────────── */

body.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}

.login-card {
  background: var(--white);
  width: 100%; max-width: 400px;
  padding: 44px 36px 28px;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.login-head { text-align: center; margin-bottom: 28px; }

.login-card form { display: flex; flex-direction: column; gap: 4px; }
.login-card button[type="submit"] { margin-top: 12px; width: 100%; padding: 14px; font-size: 16px; }

.login-foot {
  margin-top: 32px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted);
}

/* ── Catalog page: top bar ─────────────────────────────────────────── */

body.catalog { padding-bottom: 156px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-sub {
  font-size: 14px; color: var(--ink-soft); font-weight: 500;
}
.topbar-moq {
  font-size: 13px; color: var(--ink-soft);
}
.topbar-moq strong { color: var(--ink); font-weight: 600; }

main {
  max-width: var(--max); margin: 0 auto;
  padding: 32px 28px;
}

/* ── Catalog grid ──────────────────────────────────────────────────── */

.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin-bottom: 40px;
}

.hat-card {
  background: var(--white);
  border-radius: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
.hat-card.has-qty { box-shadow: 0 0 0 2px var(--blue), 0 8px 24px rgba(0,113,227,0.12); }

.hat-img {
  aspect-ratio: 1 / 1;
  background: var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.hat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hat-meta { padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 4px; }
.hat-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--ink); }
.hat-sku  { font-size: 12px; color: var(--muted); font-weight: 500; }
.hat-price { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }

.qty {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 10px 18px 18px;
}
.qty button {
  width: 30px; height: 30px; padding: 0;
  background: var(--line-soft); color: var(--ink);
  border-radius: 50%; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.qty button:hover:not(:disabled) { background: var(--line); }
.qty button:active:not(:disabled) { transform: scale(0.95); }
.qty button svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
.qty input {
  width: 64px; text-align: center; padding: 8px;
  font-weight: 600; font-size: 16px;
  border-radius: 8px;
}

/* ── Catalog form blocks ───────────────────────────────────────────── */

.form-block {
  background: var(--white);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}
.form-block h2 {
  margin: 0 0 18px;
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.ship-toggle { margin-bottom: 18px; }

/* ── Sticky MOQ bar ────────────────────────────────────────────────── */

.moq-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 12;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line-soft);
  padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
}
.moq-bar.is-met { background: rgba(225, 245, 232, 0.95); border-top-color: rgba(0, 134, 61, 0.3); }

.moq-bar-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.moq-stats { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.moq-line { font-size: 15px; color: var(--ink); }
.moq-line strong { font-weight: 600; }
.moq-sep { color: var(--muted); margin: 0 6px; }
.moq-hint { font-size: 13px; color: var(--ink-soft); }
.moq-bar.is-met .moq-hint { color: var(--green); font-weight: 600; }

#submit-btn { padding: 14px 28px; font-size: 15px; font-weight: 500; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .topbar-sub { display: none; }
  main { padding: 22px 16px; }
  .moq-bar-inner { flex-direction: column; align-items: stretch; }
  #submit-btn { width: 100%; }
  .moq-line { font-size: 14px; }
}

/* ── Apply page (signup) channel buttons ───────────────────────────── */

.apply-card { max-width: 580px; padding: 44px 36px 28px; }

.channel-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
@media (max-width: 480px) { .channel-row { grid-template-columns: 1fr; } }

.channel-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 16px; font: inherit; font-weight: 500; font-size: 15px;
  border-radius: var(--radius-pill); text-decoration: none; cursor: pointer;
  text-align: center; line-height: 1.2;
  border: 1px solid transparent;
  background: var(--ink); color: var(--white);
  transition: background 0.18s ease, transform 0.05s ease;
}
.channel-btn:hover { background: #000; text-decoration: none; }
.channel-btn:active { transform: scale(0.98); }
.channel-btn svg { width: 18px; height: 18px; }
.channel-btn.disabled {
  background: var(--line-soft); color: var(--muted); cursor: not-allowed; pointer-events: none;
  border: 1px solid var(--line);
}

.divider {
  display: flex; align-items: center; gap: 14px; margin: 8px 0 26px;
  font-size: 12px; color: var(--muted);
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.form-section h2 {
  font-size: 14px; font-weight: 600;
  color: var(--ink-soft); margin: 0 0 16px;
  letter-spacing: 0;
}

/* ── Admin approval queue ──────────────────────────────────────────── */

.admin-table {
  width: 100%; border-collapse: collapse;
  background: var(--white);
  border-radius: 18px;
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 14px 18px; text-align: left; font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.admin-table th {
  background: var(--line-soft); color: var(--ink-soft);
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .badge {
  display: inline-block; padding: 3px 10px; border-radius: 980px;
  font-size: 12px; font-weight: 500;
}
.admin-table .badge.pending { background: #fff3cd; color: #6e4d00; }
.admin-table .badge.active  { background: #d4edda; color: #00863d; }
.admin-table .actions button {
  padding: 6px 14px; font-size: 13px;
}
.admin-table .actions button.deny {
  background: var(--white); color: var(--red); border: 1px solid var(--line);
}
.admin-table .actions button.deny:hover { background: #fff3f3; }

/* ── Inline icons ──────────────────────────────────────────────────── */

.icon { display: inline-block; vertical-align: middle; }
.icon-stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; }

/* ── Signup page: textured bg (signup-scoped, no bleed to login/dashboard) ─ */

body.signup-page {
  background-image: url('/textures/texture-light.jpg');
  background-repeat: repeat;
}

/* ── Signup form: IG handle prefix (visual @, real value sent unprefixed) ── */

.input-prefix-wrap {
  position: relative;
  display: block;
}
.input-prefix-wrap .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--muted);
  pointer-events: none;
  font-family: var(--font);
  line-height: 1;
}
.input-prefix-wrap input.with-prefix {
  padding-left: 28px;
}

/* ── Signup form: verification spinner (CSS-only, no image asset) ─────── */

.verify-spinner {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: verify-spin 0.7s linear infinite;
  pointer-events: none;
}
.input-spinner-wrap {
  position: relative;
  display: block;
}
@keyframes verify-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* ── Signup form: partner-match confirmation card ─────────────────────── */

.partner-card {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--ink);
}
.partner-card-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.partner-card-text strong {
  font-weight: 600;
  color: var(--ink);
}
.partner-card-actions {
  display: inline-flex;
  gap: 6px;
}
.partner-card-actions button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.05s ease;
}
.partner-card-actions button.confirm:hover { background: rgba(0, 134, 61, 0.12); color: var(--green); }
.partner-card-actions button.dismiss:hover { background: rgba(168, 32, 26, 0.10); color: var(--red); }
.partner-card-actions button:active { transform: scale(0.94); }
.partner-card-actions button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Not-found variant: shown after debounced lookup with no Notion match.
   Soft, informational — NOT a red error. Lets the user know they're not on
   file before they click submit.                                          */
.partner-card.not-found {
  background: #fff8ec;            /* warm cream, not error-red */
  border-color: #f0d999;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.partner-card.not-found .partner-card-text strong {
  color: #8a5a00;                 /* muted amber, signals "info" not "fail" */
  font-weight: 600;
}
