:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e6e6e6;
  --line-strong: #d0d0d0;
  --accent: #111111;
  --accent-soft: #f0f0f0;
  --focus: #2563eb;
  --ok: #0a7a5c;
  --ok-soft: #e8f6f1;
  --warn: #a15c00;
  --warn-soft: #fff4e5;
  --danger: #b42318;
  --radius: 2px;
  --font: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Syne", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body::before { display: none; }
#app { position: relative; }

[hidden] { display: none !important; }

.brand, .brand-mark {
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.view { min-height: 100vh; }

/* LOGIN — full-bleed agency entrance */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0;
  align-items: stretch;
  padding: 0;
  animation: fade 0.5s ease both;
}
.login-shell::before { display: none; }
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 5.5rem);
  background:
    linear-gradient(160deg, #111 0%, #1c1c1c 55%, #2a2a2a 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.login-brand::after {
  content: "";
  position: absolute;
  right: -20%;
  bottom: -30%;
  width: 70%;
  height: 80%;
  background: radial-gradient(circle, rgba(255,255,255,0.06), transparent 65%);
  pointer-events: none;
}
.login-brand .brand {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  margin: 0 0 2rem;
  color: #fff;
  position: relative;
}
.login-brand h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin: 0 0 1.25rem;
  max-width: 11ch;
  color: #fff;
  position: relative;
}
.lede {
  color: rgba(255, 255, 255, 0.62);
  font-size: 1.05rem;
  max-width: 34ch;
  line-height: 1.6;
  position: relative;
  margin: 0;
}
.login-card {
  display: grid;
  gap: 1.1rem;
  align-content: center;
  padding: clamp(2rem, 5vw, 4rem);
  background: var(--surface);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: fade 0.5s ease 0.08s both;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
input, textarea, select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  padding: 0.7rem 0;
  font: inherit;
  font-size: 1rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
textarea {
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
}

.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.btn:hover { transform: none; }
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}
.btn.primary:hover { background: #000; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn.ghost:hover {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}
.btn.small {
  padding: 0.45rem 0.75rem;
  font-size: 0.68rem;
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.35);
}
.btn.danger:hover { background: #fff5f5; }

.error { color: var(--danger); margin: 0; font-size: 0.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; line-height: 1.5; }
.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
}
.check input { width: auto; }

/* TOPBAR — quiet agency bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem clamp(1.25rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(12px);
  z-index: 10;
  animation: fade 0.35s ease both;
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  gap: 1rem;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 1.25rem; }
.brand-mark {
  font-size: 0.78rem;
  margin-right: 0.5rem;
  white-space: nowrap;
  color: var(--ink);
  padding-left: 0;
}
.brand-mark::before { display: none; }
nav { display: flex; gap: 0.15rem; }
.nav-btn {
  background: transparent;
  border: 0;
  color: var(--faint);
  font: inherit;
  font-weight: 650;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.01em;
}
.nav-btn:hover { color: var(--ink); background: transparent; }
.nav-btn.active {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--ink);
  border-radius: 0;
}
#user-chip {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.topbar .btn.ghost {
  border-color: var(--line-strong);
  color: var(--ink);
  text-transform: uppercase;
  font-size: 0.68rem;
  padding: 0.45rem 0.85rem;
}
.topbar .btn.ghost:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

main {
  padding: 2.25rem clamp(1.25rem, 4vw, 2rem) 3.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  animation: fade 0.4s ease both;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}
.panel-head::after { display: none; }
.panel-title h2 {
  margin: 0 0 0.4rem;
}
.panel-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  letter-spacing: -0.045em;
  margin: 0 0 0.4rem;
  color: var(--ink);
  line-height: 1.05;
}
.panel-head .muted {
  margin: 0;
  max-width: 42ch;
  font-size: 0.95rem;
  color: var(--muted);
}

.workspace-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2.25rem;
  padding-top: 0.15rem;
  justify-content: flex-end;
}
.workspace-bar[hidden] { display: none !important; }
.metric {
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
  animation: fade 0.35s ease both;
}
.metric:nth-child(1) { animation-delay: 0.02s; }
.metric:nth-child(2) { animation-delay: 0.05s; }
.metric:nth-child(3) { animation-delay: 0.08s; }
.metric:nth-child(4) { animation-delay: 0.11s; }
.metric::before { display: none; }
.metric b {
  display: block;
  font-family: var(--display);
  font-size: 2.15rem;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}
.metric span {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  font-weight: 700;
}
.metric.ready b { color: #0a7a5c; }
.metric.need b { color: #a15c00; }
.metric.live-visitors b {
  color: var(--ink);
  animation: liveTick 1.4s ease infinite;
}
@keyframes liveTick {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.panel-head.has-live-metrics .panel-title h2::after {
  content: "Live";
  display: inline-block;
  margin-left: 0.65rem;
  padding: 0.18rem 0.45rem;
  font-size: 0.58rem;
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  vertical-align: middle;
  color: #0a7a5c;
  border: 1px solid rgba(10, 122, 92, 0.35);
  border-radius: 2px;
  animation: liveTick 1.4s ease infinite;
}

.signin-banner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding: 1rem 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.signin-banner strong { display: block; margin-bottom: 0.2rem; }
.signin-banner p { margin: 0; }
.signin-pulse {
  width: 7px;
  height: 7px;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--ink);
  animation: pulse 1.6s ease infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}
.optional { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Profile list — editorial rows */
.profile-grid {
  display: block;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ink);
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  backdrop-filter: none;
}
.profile-table-head,
.profile-card {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(160px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 1.25rem;
  align-items: start;
  padding: 1.15rem 0;
}
.profile-grid.has-select .profile-table-head,
.profile-grid.has-select .profile-card {
  grid-template-columns: 36px minmax(160px, 1.1fr) minmax(160px, 1fr) minmax(180px, 1.2fr) auto;
}
.profile-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.15rem;
}
.btn-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.btn-eye:hover {
  color: var(--ink);
  background: transparent;
  border: 0;
}
.profile-card.is-hidden .btn-eye {
  color: var(--ink);
  background: transparent;
  border: 0;
  opacity: 1;
}
.profile-card.is-hidden h3,
.profile-card.is-hidden .profile-meta,
.profile-card.is-hidden .note-text {
  letter-spacing: 0.08em;
  user-select: none;
}
.profile-notes-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.4rem;
  min-width: 0;
  text-align: left;
  padding-top: 0.1rem;
}
.profile-notes-cell .note-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  max-width: 28ch;
}
.profile-notes-cell .note-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--faint);
  font-style: italic;
  text-align: left;
}
.profile-notes-cell .btn {
  width: fit-content;
  margin: 0;
}
.profile-table-head {
  align-items: center;
}
.profile-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  cursor: pointer;
}
.profile-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--ink);
  cursor: pointer;
}
.select-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.bulk-bar-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.bulk-bar-label {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--danger);
}
.check-col-spacer { width: 15px; }
.profile-card.is-selected {
  background: transparent;
}
.profile-table-head {
  background: transparent;
  border-bottom: 1px solid var(--line);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.profile-card {
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background 0.15s ease;
  /* No fade on list refresh — only workspace stats (liveTick) should pulse */
  position: relative;
}
.profile-card:last-child { border-bottom: 1px solid var(--line); }
.profile-card:hover {
  background: #f3f3f3;
}
.profile-card.is-selected {
  background: #f5f5f5;
}
.profile-card.is-selected:hover { background: #efefef; }
.profile-card::before { display: none; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.profile-card h3 {
  margin: 0.35rem 0 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.profile-meta {
  display: grid;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.profile-meta .exit-ip,
.profile-meta .fp-line {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.profile-meta .exit-ip.is-on,
.profile-meta .fp-line.is-on {
  color: #16a34a;
  font-weight: 650;
  opacity: 1;
}
.profile-meta .exit-ip.is-off,
.profile-meta .fp-line.is-off {
  color: var(--ink);
  font-weight: 500;
  opacity: 0.88;
}
.profile-meta .fp-line {
  font-size: 0.8rem;
}
.profile-meta .fp-line[title] {
  cursor: help;
  border-bottom: 1px dotted var(--line-strong);
  width: fit-content;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0;
  width: fit-content;
  padding: 0;
  border-radius: 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent !important;
}
.badge::before { display: none; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  justify-content: stretch;
  min-width: 11.5rem;
}
.actions .btn {
  width: 100%;
  min-width: 0;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}
.actions .btn.primary {
  min-width: 0;
}

.table-wrap {
  border: 0;
  border-top: 1px solid var(--ink);
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
th {
  color: var(--faint);
  font-weight: 750;
  background: transparent;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.65rem;
}
tr:last-child td { border-bottom: 1px solid var(--line); }
tr:hover td { background: #f3f3f3; }

dialog {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  padding: 0;
  width: min(480px, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}
dialog::backdrop {
  background: rgba(17, 17, 17, 0.45);
  backdrop-filter: blur(2px);
}
dialog form {
  display: grid;
  gap: 1rem;
  padding: 1.75rem;
}
dialog h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--ink);
  color: #fff;
  padding: 0.8rem 1.15rem;
  border-radius: var(--radius);
  font-weight: 650;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  z-index: 50;
  border-left: 0;
  animation: fade 0.25s ease;
}

.empty {
  border: 0;
  padding: 4rem 0;
  text-align: left;
  color: var(--muted);
  background: transparent;
}
.empty p:first-child {
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}
.empty a { color: var(--ink); font-weight: 700; text-decoration: underline; }

.share-hint {
  margin: 0 0 1.25rem;
  max-width: 40rem;
}
.share-create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: end;
  margin: 0 0 1rem;
}
.share-field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.share-field select,
.share-field input {
  min-width: 5.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
}
.share-field-grow {
  flex: 1 1 14rem;
}
.share-field-grow input { width: 100%; }
.share-hint code {
  font-size: 0.85em;
}
.share-kind {
  text-transform: capitalize;
  font-weight: 600;
}
.share-status {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  font-weight: 700;
}
.share-status.is-active { color: #0a7a5c; }
.share-status.is-used { color: #a15c00; }
.share-status.is-expired,
.share-status.is-revoked { color: #8a8a8a; }
.share-url-cell {
  max-width: 16rem;
}
.share-url {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 42vh; }
  .login-brand h1 { max-width: none; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
  .workspace-bar { gap: 1.5rem; }
  .profile-table-head { display: none; }
  .profile-card {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.85rem;
  }
  .profile-grid.has-select .profile-card {
    grid-template-columns: 36px 1fr;
  }
  .profile-grid.has-select .profile-card > .profile-side {
    grid-row: 1 / span 5;
    align-self: start;
  }
  .actions {
    justify-content: stretch;
    min-width: 0;
    max-width: 16rem;
  }
  .topbar { flex-wrap: wrap; gap: 0.75rem; }
}
