/* =========================================================================
   Influencerpedia — editor desk
   Same light system as the public site, tuned for dense work.
   ========================================================================= */

:root {
  --paper:   #FFFFFF;
  --wash:    #F4F4F7;
  --wash-2:  #ECECF1;
  --night:   #131316;

  --ink:     #121216;
  --ink-2:   #4A4A55;
  --ink-3:   #7C7C8A;
  --ink-4:   #A6A6B2;

  --line:    #E5E5EB;
  --line-2:  #D6D6DE;

  --red:     #F0301B;
  --red-dark:#C41F0D;
  --red-wash:#FFEEEB;
  --green:   #12946A;
  --green-wash:#E6F6F0;
  --amber:   #B8781A;
  --amber-wash:#FDF2E0;

  --sans:  'Jakarta', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'New Kansas', 'Fraunces', ui-serif, Georgia, serif;
  /* kept so older markup that asked for these still resolves sensibly */
  --ui: var(--sans);
  --display: var(--serif);
  --mono: var(--sans);

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --radius: var(--r-md);

  --ease: cubic-bezier(.22,.8,.28,1);
  --shadow-1: 0 1px 2px rgba(18,18,22,.05), 0 4px 14px rgba(18,18,22,.05);
  --shadow-2: 0 2px 6px rgba(18,18,22,.06), 0 16px 40px rgba(18,18,22,.11);
  --rail: 262px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2.5px solid var(--red); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--red); color: #fff; }

.mono { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ================================================================== shell */
.desk { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }

.rail {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 20px 18px;
}
.rail__glyph {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  font-size: 0;
  color: transparent;
  flex: none;
}
.rail__name { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.rail__name em { font-style: italic; font-weight: 400; color: var(--red); }

.rail__group { padding: 6px 12px; }
.rail__label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 12px 10px 7px;
}

.rail a.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.rail a.nav-item:hover { background: var(--wash); color: var(--ink); }
.rail a.nav-item.is-on { background: var(--ink); color: #fff; }

.nav-item__n {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--wash-2);
  border-radius: 999px;
  padding: 1px 8px;
}
.rail a.nav-item.is-on .nav-item__n { background: rgba(255,255,255,.18); color: #fff; }

.rail__foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--wash-2);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  color: var(--ink-2);
  flex: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.rail__me { min-width: 0; flex: 1; }
.rail__me b { display: block; font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__me span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }

/* ================================================================= topbar */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  background: rgba(244,244,247,.86);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.topbar__title { font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.topbar__crumb { font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-3); }
.topbar__spacer { margin-left: auto; }

.deskburger {
  display: none;
  width: 40px; height: 38px;
  border-radius: var(--r-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
}
.deskburger span { display: block; width: 15px; height: 1.6px; background: var(--ink); margin: 3px auto; border-radius: 2px; }

.wrap { padding: 26px clamp(20px, 3vw, 44px); max-width: 1400px; width: 100%; }

/* ================================================================ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover { border-color: var(--ink-4); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }

.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn--ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--wash-2); border-color: transparent; box-shadow: none; }

.btn--danger { color: var(--red); border-color: rgba(240,48,27,.3); background: var(--paper); }
.btn--danger:hover { background: var(--red-wash); border-color: var(--red); }

.btn--sm { padding: 7px 13px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ================================================================== cards */
.panel {
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel__head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.panel__title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.panel__hint { font-size: 13.5px; color: var(--ink-3); margin: 4px 0 0; }
.panel__body { padding: 22px; }
.panel__body--flush { padding: 0; }

/* ================================================================== stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat { background: var(--paper); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-1); }
.stat dt { font-size: 10.5px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-3); }
.stat dd { margin: 9px 0 0; font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.stat dd small { font-family: var(--sans); font-size: 12px; color: var(--ink-3); margin-left: 6px; font-weight: 600; }

/* ================================================================== table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .16s var(--ease); }
.table tbody tr:hover { background: var(--wash); }
.table tbody tr:last-child td { border-bottom: 0; }

.table__name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table__name b { font-weight: 700; font-size: 15px; }
.table__name small { display: block; color: var(--ink-3); font-size: 12.5px; }

.thumb {
  width: 42px; height: 42px; flex: none;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--wash-2);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--ink-3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ================================================================== chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--wash-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip--draft     { background: var(--wash-2); color: var(--ink-3); }
.chip--in_review { background: var(--amber-wash); color: var(--amber); }
.chip--published { background: var(--green-wash); color: var(--green); }
.chip--archived  { background: var(--wash-2); color: var(--ink-4); }
.chip--role      { background: var(--ink); color: #fff; }
.chip--own       { background: var(--red-wash); color: var(--red); }
.chip--assigned  { background: var(--amber-wash); color: var(--amber); }
.chip--locked    { background: var(--wash-2); color: var(--ink-3); }
.chip--locked::before { content: '🔒'; background: none; font-size: 9px; width: auto; height: auto; }

/* ================================================================== forms */
.field { margin-bottom: 18px; }

.field > label:not(.check), .field__label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.field__note { font-size: 12.5px; color: var(--ink-3); margin: 7px 0 0; }

.input, .select, .textarea {
  width: 100%;
  background: var(--wash);
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.input:hover, .select:hover, .textarea:hover { background: var(--wash-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  background: var(--paper);
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(240,48,27,.14);
}
.input:disabled, .textarea:disabled, .select:disabled { color: var(--ink-3); cursor: not-allowed; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }

.textarea { min-height: 120px; resize: vertical; line-height: 1.65; }
.textarea--tall { min-height: 230px; }

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 51%, calc(100% - 13px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--wash);
  cursor: pointer;
  margin-bottom: 10px;
  transition: background .18s var(--ease);
}
.check:hover { background: var(--wash-2); }
.check input { margin: 3px 0 0; accent-color: var(--red); flex: none; width: 17px; height: 17px; }
.check b { display: block; font-weight: 700; font-size: 14.5px; }
.check small { color: var(--ink-3); font-size: 13px; }

.filebox { display: flex; align-items: center; gap: 14px; }
.filebox__preview {
  width: 72px; height: 72px;
  border-radius: var(--r-sm);
  background: var(--wash-2);
  overflow: hidden;
  flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--ink-3);
}
.filebox__preview img { width: 100%; height: 100%; object-fit: cover; }

input[type=file] { font-size: 13px; color: var(--ink-3); }
input[type=file]::file-selector-button {
  font-size: 12.5px; font-weight: 700;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-2);
  padding: 8px 14px; border-radius: 999px; margin-right: 12px; cursor: pointer;
}

/* =============================================================== repeater */
.rep { border-radius: var(--r-md); overflow: hidden; }
.rep__item { padding: 18px; border-bottom: 1px solid var(--line); background: var(--paper); }
.rep__item:last-of-type { border-bottom: 0; }
.rep__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.rep__no {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: var(--ink); border-radius: 999px; padding: 3px 10px;
}
.rep__tools { display: flex; gap: 5px; }
.rep__tool {
  background: var(--wash); border: 0; color: var(--ink-3);
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer;
  font-size: 13px; line-height: 1; display: grid; place-items: center;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.rep__tool:hover { background: var(--ink); color: #fff; }
.rep__tool--del:hover { background: var(--red); color: #fff; }
.rep__add { padding: 16px 18px; background: var(--wash); }
.rep__empty { padding: 30px 18px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* ================================================================ notices */
.notice {
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-1);
  border-left: 4px solid var(--ink-4);
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 14.5px;
}
.notice--ok   { border-left-color: var(--green); background: var(--green-wash); box-shadow: none; }
.notice--warn { border-left-color: var(--amber); background: var(--amber-wash); box-shadow: none; }
.notice--err  { border-left-color: var(--red);   background: var(--red-wash);   box-shadow: none; }
.notice b { font-weight: 700; }

.lock {
  background: var(--red-wash);
  border-radius: var(--r-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.lock__mark { flex: none; font-size: 18px; }
.lock b { display: block; margin-bottom: 3px; font-weight: 700; }
.lock p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ================================================================== login */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: var(--wash); }
.gate__card { width: 100%; max-width: 410px; }
.gate__brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 14px; }
.gate__title { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -.03em; text-align: center; line-height: 1.05; margin-bottom: 7px; }
.gate__sub { text-align: center; color: var(--ink-3); font-size: 14.5px; margin-bottom: 26px; }
.gate__box { background: var(--paper); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-2); }
.gate__foot { text-align: center; margin-top: 22px; font-size: 13px; color: var(--ink-3); }
.gate__foot a { color: var(--ink-2); font-weight: 600; text-decoration: underline; }

/* =================================================================== misc */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .input, .toolbar .select { width: auto; min-width: 180px; padding: 10px 14px; font-size: 14px; background: var(--paper); }

.tabs {
  display: flex;
  gap: 3px;
  background: var(--wash-2);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tabs a {
  font-size: 13px; font-weight: 700;
  color: var(--ink-3);
  padding: 8px 15px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.tabs a:hover { color: var(--ink); }
.tabs a.is-on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1); }

.empty-state { padding: 58px 24px; text-align: center; }
.empty-state h3 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--ink-3); max-width: 44ch; margin-inline: auto; font-size: 14.5px; }

.log__row {
  display: grid;
  grid-template-columns: 160px 1fr 130px;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  align-items: baseline;
}
.log__row:last-child { border-bottom: 0; }
.log__who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log__what { color: var(--ink-2); }
.log__what b { color: var(--ink); font-weight: 700; }
.log__when { font-size: 12.5px; color: var(--ink-3); text-align: right; font-weight: 600; }

.pagelinks { display: flex; gap: 6px; padding: 18px; flex-wrap: wrap; }
.pagelinks a, .pagelinks span {
  min-width: 36px; padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700;
  color: var(--ink-2); background: var(--wash);
  text-align: center;
}
.pagelinks a:hover { background: var(--wash-2); }
.pagelinks .is-on { background: var(--ink); color: #fff; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: rgba(244,244,247,.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 14px 26px;
  margin: 26px -26px -26px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.sticky-actions__note {
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); margin-right: auto;
}

/* ============================================================ responsive */
@media (max-width: 980px) {
  .desk { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 90;
    transform: translateX(-100%); transition: transform .28s var(--ease);
  }
  .rail.is-open { transform: none; box-shadow: var(--shadow-2); }
  .deskburger { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wrap { padding: 18px; }
  .sticky-actions { margin: 20px -18px -18px; padding: 12px 18px; }
  .sticky-actions__note { display: none; }
  .log__row { grid-template-columns: 1fr; gap: 3px; }
  .log__when { text-align: left; }

  .table thead { display: none; }
  .table tbody tr { display: grid; gap: 8px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 0; }
  .table td.right { text-align: left; }
  .table td[data-label]::before {
    content: attr(data-label);
    font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-4);
    display: block; margin-bottom: 3px;
  }
}

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