/* Influencer Registry — clean, Apple-like: neutral canvas, white boxes,
   system typography, one blue accent. */

:root {
  --canvas: #F5F5F7;
  --box: #FFFFFF;
  --fill: #F5F5F7;          /* gray fills inside boxes (inputs, tags) */
  --ink: #1D1D1F;
  --secondary: #6E6E73;
  --tertiary: #AEAEB2;
  --hairline: rgba(0, 0, 0, 0.08);
  --blue: #0071E3;
  --blue-deep: #0060C2;
  --blue-tint: #EAF3FE;
  --red: #FF3B30;
  --red-tint: #FFF0EF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.05), 0 14px 36px rgba(0, 0, 0, 0.09);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

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

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

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

/* ---------- wordmark ---------- */

.wordmark {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.wordmark.small { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
a.wordmark { color: inherit; text-decoration: none; }
a.wordmark:hover { opacity: 0.7; }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  background: var(--box);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 3rem 2.5rem 2.5rem;
  width: 100%;
  max-width: 24rem;
  text-align: center;
}
.login-sub { color: var(--secondary); margin: 0.4rem 0 2rem; font-size: 0.95rem; }
.login-card form { text-align: left; }
.login-card label {
  display: block;
  margin: 1rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--secondary);
}
.login-card input { width: 100%; }

/* ---------- inputs ---------- */

input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
input:hover, select:hover, textarea:hover { background: #EFEFF1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--box);
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(0, 113, 227, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--tertiary); }
textarea { resize: vertical; width: 100%; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-weight: 500;
  border: none;
  border-radius: 980px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  background: none;
  color: var(--ink);
  transition: background 140ms ease, opacity 140ms ease, transform 140ms ease;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { color: var(--blue); }
.btn-ghost:hover { background: var(--blue-tint); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-tint); }
.btn-block { width: 100%; margin-top: 1.75rem; padding: 0.7rem; font-size: 1rem; }

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem 1.75rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.on-file { font-size: 0.85rem; color: var(--secondary); }
.on-file #count-num { font-weight: 600; color: var(--ink); }
.on-file-label { }

/* segmented control */
.tabs {
  display: flex;
  gap: 0;
  margin-left: auto;
  background: rgba(0, 0, 0, 0.055);
  border-radius: 980px;
  padding: 2.5px;
}
.tab {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.38rem 1.05rem;
  border-radius: 980px;
  color: var(--ink);
  transition: background 160ms ease, box-shadow 160ms ease;
}
.tab.active {
  background: var(--box);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.whoami { display: flex; align-items: center; gap: 0.15rem; }
.whoami .mono { font-size: 0.84rem; color: var(--secondary); margin-right: 0.5rem; }
.whoami .btn { padding: 0.35rem 0.8rem; font-size: 0.86rem; }

/* ---------- panels & boxes ---------- */

.tab-panel { max-width: 46rem; margin: 2.25rem auto 5rem; padding: 0 1.25rem; }

.entry-card {
  background: var(--box);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.entry-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.5rem; }
.entry-head h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }

.field { margin-bottom: 1.15rem; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 0.4rem;
}
.field .req { color: var(--blue); }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1 1 10rem; }
.field-row .field.grow { flex: 2 1 14rem; }
.field-row .field input { width: 100%; }

/* chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  background: var(--fill);
  border-radius: 980px;
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  color: var(--ink);
  transition: background 120ms ease, color 120ms ease;
}
.chip:hover { background: #EAEAEC; }
.chip[aria-pressed="true"] { background: var(--blue); color: #fff; }
.chip-group.mini .chip { font-size: 0.76rem; padding: 0.16rem 0.65rem; }

/* accounts group */
.accounts-fieldset {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem 1.1rem;
  margin-bottom: 1.4rem;
}
.accounts-fieldset legend {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--secondary);
  padding: 0 0.5rem;
}
.account-row { border-bottom: 1px solid var(--hairline); padding: 0.8rem 0; display: grid; gap: 0.6rem; }
.account-row:last-of-type { border-bottom: none; }
.account-main { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.account-main select { min-width: 8.5rem; }
.account-main input { flex: 1 1 8rem; }
.account-langs { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.account-langs .hint { font-size: 0.76rem; color: var(--tertiary); white-space: nowrap; }
.row-remove { margin-left: auto; color: var(--tertiary); }
.row-remove:hover { color: var(--red); background: var(--red-tint); }

.entry-actions { display: flex; justify-content: flex-end; margin-top: 0.5rem; }

.form-error {
  background: var(--red-tint);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  margin: 0.85rem 0;
  font-size: 0.88rem;
}

/* ---------- browse ---------- */

#tab-browse { max-width: 58rem; }
.browse-controls { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.browse-controls input[type="search"] {
  flex: 2 1 12rem;
  border-radius: 980px;
  padding-left: 1.05rem;
  background: rgba(0, 0, 0, 0.045);
}
.browse-controls select { flex: 1 1 8rem; border-radius: 980px; background: rgba(0, 0, 0, 0.045); }

.browse-list { display: grid; gap: 0.85rem; }

.inf-card {
  background: var(--box);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.5rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.inf-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.inf-top { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.inf-name { font-size: 1.18rem; font-weight: 600; letter-spacing: -0.015em; }
.inf-region { color: var(--secondary); font-size: 0.85rem; }
.inf-actions { margin-left: auto; display: flex; gap: 0.15rem; }
.inf-actions .btn { padding: 0.25rem 0.75rem; font-size: 0.85rem; }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.tag {
  font-size: 0.76rem;
  font-weight: 500;
  background: var(--fill);
  color: var(--secondary);
  border-radius: 980px;
  padding: 0.16rem 0.65rem;
}
.tag.lang { background: var(--blue-tint); color: var(--blue-deep); }

.inf-notes { color: var(--secondary); font-size: 0.88rem; margin-top: 0.6rem; max-width: 62ch; }

.acct-list { margin-top: 0.75rem; display: grid; gap: 0.4rem; }
.acct-line { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; font-size: 0.87rem; }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.acct-line .handle { font-family: var(--mono); font-size: 0.8rem; }
.acct-line a { color: var(--blue); text-decoration: none; }
.acct-line a:hover { text-decoration: underline; }
.acct-line .followers { font-size: 0.82rem; color: var(--secondary); font-variant-numeric: tabular-nums; }
.acct-line .acct-lang { color: var(--tertiary); font-size: 0.78rem; }
.acct-line .btn { padding: 0.08rem 0.6rem; font-size: 0.8rem; }

.empty-state { text-align: center; color: var(--secondary); padding: 4.5rem 1rem; font-size: 1rem; }

/* ---------- detail view ---------- */

#tab-detail { max-width: 46rem; }
.detail-card { cursor: default; }
.detail-name { font-size: 2rem; font-weight: 700; letter-spacing: -0.025em; margin-top: 0.9rem; line-height: 1.15; }
.detail-card > .inf-region { margin-top: 0.15rem; }
.detail-card .tag-row { margin-top: 0.9rem; }
.detail-card .inf-notes { margin-top: 0.9rem; }
.detail-accounts { display: grid; gap: 0.9rem; margin-top: 1.5rem; }
.detail-account {
  background: var(--fill);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--hairline);
  padding: 0.8rem 1rem;
}
.detail-account .acct-line strong { font-weight: 600; }
.snap-list { list-style: none; margin-top: 0.4rem; }
.snap-line {
  font-size: 0.82rem;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  padding: 0.1rem 0;
}
.detail-account > .acct-lang { color: var(--tertiary); font-size: 0.8rem; margin-top: 0.3rem; }
.detail-meta { margin-top: 1.5rem; font-size: 0.8rem; color: var(--tertiary); }
.detail-card .entry-actions { margin-top: 0.75rem; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(10px);
  color: #fff;
  border-radius: 980px;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  z-index: 50;
}
.toast.err { background: rgba(255, 59, 48, 0.95); }

/* ---------- dialog ---------- */

dialog {
  border: none;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  padding: 1.75rem;
  max-width: 24rem;
  width: calc(100vw - 2rem);
  margin: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(3px); }
dialog h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 1.1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.6rem; }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .topbar { gap: 0.7rem; padding: 0.65rem 1rem; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tab { flex: 1; text-align: center; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .on-file { display: none; }
  .entry-card { padding: 1.25rem; }
  .detail-name { font-size: 1.6rem; }

  /* 16px inputs stop iOS Safari from auto-zooming on focus */
  input, select, textarea { font-size: 16px; }

  /* thumb-sized touch targets */
  .btn, .chip { min-height: 40px; }
  .acct-line .btn, .inf-actions .btn { min-height: 36px; padding: 0.3rem 0.8rem; font-size: 0.85rem; }
  .account-main input, .account-main select { flex-basis: 100%; }
  .whoami { margin-left: auto; }
  .tab-panel { margin-top: 1.25rem; }
  .inf-card { padding: 1rem 1.1rem; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

  .browse-list .inf-card { animation: settle 280ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
  .browse-list .inf-card:nth-child(2) { animation-delay: 40ms; }
  .browse-list .inf-card:nth-child(3) { animation-delay: 80ms; }
  .browse-list .inf-card:nth-child(4) { animation-delay: 120ms; }
  .browse-list .inf-card:nth-child(5) { animation-delay: 160ms; }
  @keyframes settle { from { opacity: 0; transform: translateY(6px); } }

  .detail-card { animation: settle 240ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
}
