:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e5;
  --text: #111111;
  --muted: #666666;
  --accent: #E84A3A;
  --accent-hover: #d13d2e;
  --accent-soft: rgba(232, 74, 58, 0.08);
  --danger: #b33a3a;
  --success: #1f7a45;
  --success-bg: #edf8f1;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body,
button,
input,
textarea {
  font-family: var(--font);
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

code {
  font-family: "SFMono-Regular", Menlo, monospace;
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.875rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Fixed Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(250, 250, 250, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.app-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.app-header-controls {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu-trigger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 45px;
  height: 45px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 11px;
  cursor: pointer;
}

.user-menu-trigger:hover {
  background: var(--accent-soft);
  border-color: var(--text);
}

.user-menu-trigger span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.user-menu[open] .user-menu-trigger {
  background: var(--accent-soft);
  border-color: var(--text);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  text-decoration: none;
  font-weight: 500;
}

.user-menu-item:hover {
  background: var(--accent-soft);
  border-color: var(--text);
  text-decoration: none;
}

.user-menu-compact-only {
  display: none;
}

.user-menu-submit {
  justify-content: flex-start;
  font: inherit;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: block;
  flex: none;
  transition: transform 0.2s ease;
}

.brand:hover .brand-logo {
  transform: rotate(-8deg);
}

.brand-wordmark {
  white-space: nowrap;
}

.masthead-nav {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.masthead-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.masthead-nav-link .count-pill {
  flex: none;
}

.masthead-nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

/* App Shell */
.app-shell {
  width: 100%;
  flex: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 88px 24px 60px;
}

.site-footer {
  width: 100%;
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--border);
}

.site-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-footer-copy {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer-copy a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer-copy a:hover {
  text-decoration: underline;
}

.site-footer-label {
  font-weight: 500;
}

/* Link form in header */
.masthead-link-form {
  --masthead-link-form-inset: 5px;
  position: relative;
  flex: 1;
  max-width: 480px;
}

.masthead-link-form input {
  width: 100%;
  height: 45px;
  padding: 0 110px 0 16px;
}

.masthead-link-form button {
  position: absolute;
  right: var(--masthead-link-form-inset);
  top: var(--masthead-link-form-inset);
  bottom: var(--masthead-link-form-inset);
  padding: 0 14px;
  background: #bbb;
  border-color: #bbb;
  border-radius: calc(var(--radius) - var(--masthead-link-form-inset));
}

.masthead-link-form button:hover {
  background: #999;
  border-color: #999;
}

.masthead-link-form:has(input:not(:placeholder-shown)) button {
  background: var(--accent);
  border-color: var(--accent);
}

.masthead-link-form:has(input:not(:placeholder-shown)) button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.masthead-result:empty {
  display: none;
}

.masthead-result {
  margin-bottom: 24px;
}

.save-link-modal-form {
  display: grid;
  gap: 12px;
}

.save-link-modal-form button {
  justify-self: flex-start;
}

/* Cards & Surfaces */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

/* Page Grid */
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}

/* Spacing utilities */
.stack-xs > * + * {
  margin-top: 4px;
}

.stack-sm > * + * {
  margin-top: 8px;
}

.stack-md > * + * {
  margin-top: 16px;
}

.stack-lg > * + * {
  margin-top: 24px;
}

/* Typography */
h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.5rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dashboard-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1;
  flex-wrap: wrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* min-width: 1.25rem;
  min-height: 1.25rem; */
  padding: 0.085rem 0.4rem;
  border-radius: 0.325rem;
  background: #c86054bb;
  color: #ffffff;
  font-size: 0.6125rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.profile-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.count-pill-link {
  text-decoration: none;
}

.count-pill-link:hover {
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
}

.follow-switch {
  display: inline-flex;
  align-items: center;
  align-self: center;
  margin-left: 0.75rem;
  flex: none;
  line-height: 1;
}

.follow-switch__control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.follow-switch__label {
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.follow-switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.follow-switch__input:focus-visible + .follow-switch__slider {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.follow-switch__slider {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2rem;
  height: 1.15rem;
  padding: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #efe7e5;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.follow-switch__slider::after {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}

.follow-switch__input:checked + .follow-switch__slider {
  background: var(--accent);
  border-color: var(--accent);
}

.follow-switch__input:checked + .follow-switch__slider::after {
  transform: translateX(0.8rem);
}

.muted,
.meta-text {
  color: var(--muted);
}

.profile-list {
  display: grid;
  gap: 12px;
}

.profile-list-item {
  display: grid;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.profile-list-item:hover {
  border-color: var(--text);
  background: var(--accent-soft);
}

.profile-list-item__profile {
  display: grid;
  gap: 2px;
  color: var(--text);
  text-decoration: none;
}

.profile-list-item__profile:hover {
  text-decoration: none;
}

.profile-list-item__username {
  font-weight: 600;
}

.profile-list-item__name {
  color: var(--muted);
  font-size: 0.95rem;
}

.profile-list-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Forms */
.auth-panel,
.inline-form {
  display: grid;
  gap: 12px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

input,
button,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  padding: 12px 16px;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button {
  width: auto;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 500;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  height: 45px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  padding: 0 20px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease;
}

.button-link-button {
  width: fit-content;
}

.button-link:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  text-decoration: none;
}

.button-link-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.button-link-secondary:hover {
  background: var(--accent-soft);
  border-color: var(--text);
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 45px;
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  padding: 0 20px;
}

.text-button:hover {
  background: var(--accent-soft);
  border-color: var(--text);
}

/* Notices */
.notice {
  border-radius: var(--radius);
  padding: 12px 16px;
}

.notice-error {
  background: #fff2f2;
  color: var(--danger);
}

.notice-success {
  background: var(--success-bg);
  color: var(--success);
}

.membership-shell {
  max-width: 960px;
  margin: 0 auto;
}

.membership-hero {
  background:
    radial-gradient(circle at top right, rgba(232, 74, 58, 0.12), transparent 30%),
    var(--surface);
}

.membership-intro {
  max-width: 42rem;
}

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

.membership-card {
  min-height: 100%;
}

.membership-price {
  color: var(--accent);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.membership-summary {
  color: var(--text);
  font-weight: 600;
}

.membership-quote {
  border-left: 4px solid var(--accent);
  padding-left: 20px;
}

.membership-quote p {
  max-width: 48rem;
}

.membership-coupon {
  align-items: start;
}

.membership-coupon-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.membership-footnote {
  font-size: 0.9375rem;
}

/* Link List */
.link-list {
  display: grid;
  gap: 24px;
}

.link-list--masonry.is-masonry-ready {
  align-items: start;
}

/* ===== LINK CARD ===== */
.link-card {
  position: relative;
}

.link-card:hover,
.link-card:focus-within {
  z-index: 2;
}

.link-card__surface {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.link-card--with-claw .link-card__surface {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.link-card__main-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.link-card__main-link:hover,
.link-card__main-link:hover *,
.link-card__main-link:focus-visible,
.link-card__main-link:focus-visible * {
  text-decoration: none;
}

.link-card__main-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.link-card:hover .link-card__surface,
.link-card:focus-within .link-card__surface {
  transform: translateY(-2px);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Header (Provenance Strip) */
.link-card__header {
  background: #fafaf9;
  padding: 12px 20px;
  border-bottom: 1px solid #f0eeec;
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-card__favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
}

.link-card__favicon-fallback {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #e7e5e4;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-card__favicon-fallback svg {
  width: 10px;
  height: 10px;
  color: #a8a29e;
}

.link-card__meta {
  font-size: 12px;
  color: #78716c;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.link-card__meta-separator {
  color: #d6d3d1;
}

.link-card__meta-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #d6d3d1;
  text-underline-offset: 0.12em;
}

.link-card__meta-link:hover,
.link-card__meta-link:focus-visible {
  color: #57534e;
  text-decoration-color: currentColor;
}

/* Body (Primary Content) */
.link-card__body {
  padding: 24px 20px;
  max-width: 33em;
}

.link-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

.link-card__main-link:hover .link-card__title,
.link-card__main-link:focus-visible .link-card__title {
  color: #0c0a09;
}

.link-card__title--unedited,
.link-card__summary--unedited {
  opacity: 0.65;
  font-family: "SFMono-Regular", Menlo, monospace;
}

.link-card__subheadline {
  font-size: 0.9rem;
  color: #57534e;
  margin-bottom: 8px;
}

.link-card__summary {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #78716c;
  margin-bottom: 20px;
}

.link-card__image-link {
  display: block;
}

.link-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #f5f5f4;
}

/* Tags (Classification Footer) */
.link-card__tags {
  background: #fafaf9;
  padding: 14px 20px;
  border-top: 1px solid #f0eeec;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-card__tag {
  font-size: 12px;
  color: #57534e;
  background: #f0eeec;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.link-card__tag:hover {
  background: #e7e5e4;
  color: #44403c;
  text-decoration: none;
}

.link-card__notes-button {
  border: none;
  font-family: inherit;
  cursor: pointer;
  color: #7c2d12;
  background: #fed7aa;
  box-shadow: inset 0 0 0 1px #fdba74;
}

.link-card__notes-button:hover {
  background: #fdba74;
  color: #9a3412;
  text-decoration: none;
}

.link-card__notes-button:focus-visible {
  outline: 2px solid #57534e;
  outline-offset: 2px;
}

/* Claw Action Row */
.link-card__claw {
  width: 100%;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafaf9;
  opacity: 0.6;
  transition:
    opacity 0.2s ease,
    background 0.15s ease,
    border-radius 0.15s ease;
  cursor: pointer;
  border: none;
  border-top: 1px solid #f0eeec;
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: inherit;
  list-style: none;
}

.link-card__claw::-webkit-details-marker {
  display: none;
}

.link-card__claw-menu {
  position: relative;
}

.link-card__claw-actions {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  z-index: 3;
  display: grid;
  gap: 0;
  padding: 8px 0;
  background: #f5f5f4;
  border: 1px solid #f0eeec;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.08),
    0 4px 8px rgba(0, 0, 0, 0.06);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.link-card__claw-menu:hover .link-card__claw-actions,
.link-card__claw-menu:focus-within .link-card__claw-actions,
.link-card__claw-menu[open] .link-card__claw-actions,
.link-card__claw-menu:hover .link-card__claw,
.link-card__claw-menu:focus-within .link-card__claw,
.link-card__claw-menu[open] .link-card__claw,
.link-card__claw:hover,
.link-card__claw:focus-visible {
  opacity: 1;
}

.link-card__claw-menu:hover .link-card__claw,
.link-card__claw-menu:focus-within .link-card__claw,
.link-card__claw-menu[open] .link-card__claw {
  background: #f5f5f4;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.link-card__claw-menu:hover .link-card__claw-actions,
.link-card__claw-menu:focus-within .link-card__claw-actions,
.link-card__claw-menu[open] .link-card__claw-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.link-card__claw:hover {
  background: #f5f5f4;
}

.link-card__claw-prompt {
  font-size: 13px;
  color: #78716c;
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-card__claw:hover .link-card__claw-prompt {
  color: #57534e;
}

.link-card__claw-prompt svg {
  width: 14px;
  height: 14px;
  color: #a8a29e;
}

.link-card__claw-action {
  width: 100%;
  border: none;
  background: transparent;
  color: #57534e;
  text-align: left;
  padding: 10px 20px;
  font-size: 0.875rem;
  line-height: 1.4;
  font-family: inherit;
}

.link-card__claw-action:hover,
.link-card__claw-action:focus-visible {
  background: #ece9e6;
  border-color: transparent;
}

.link-card__claw-label {
  font-size: 11px;
  color: #a8a29e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.link-note {
  padding: 16px 18px;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  background: #fafaf9;
}

.link-note__meta {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #78716c;
}

.link-note__body {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.6;
  color: #292524;
}

/* Tags (legacy support) */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-soft);
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.tag-pill:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  text-decoration: none;
}

.active-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.active-filter a {
  text-decoration: none;
  color: var(--accent);
}

/* Extension Connect */
.extension-connect {
  max-width: 760px;
}

.extension-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.extension-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
}

.onboarding-step-number {
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
}

.extension-connect-button {
  width: fit-content;
}

.connect-bookmarklet-link {
  cursor: grab;
}

.connect-bookmarklet-link:active {
  cursor: grabbing;
}

.connect-captured-url {
  overflow-wrap: anywhere;
}

.connect-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.onboarding-soon-box {
  border: 1px solid rgba(232, 74, 58, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(232, 74, 58, 0.06), rgba(232, 74, 58, 0.03));
  padding: 16px;
}

.onboarding-soon-eyebrow {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.onboarding-soon-button[disabled] {
  cursor: default;
  opacity: 0.75;
}

/* Responsive */
@media (max-width: 800px) {
  .page-grid,
  .membership-grid,
  .extension-card-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .masthead-link-form {
    max-width: none;
  }

  .onboarding-step {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .connect-actions > * {
    width: 100%;
  }

  .membership-coupon-form {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 801px) {
  .link-list--masonry.is-masonry-ready {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 8px;
  }
}

.byoclaw-modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  border: 0;
  margin: auto;
  padding: 0;
  background: transparent;
  inset: 0;
}

#byoclaw-modal {
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

.byoclaw-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.byoclaw-modal-shell {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 24px;
}

#byoclaw-modal .byoclaw-modal-shell {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

#byoclaw-modal .byoclaw-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

#byoclaw-modal .byoclaw-modal-close {
  position: static;
  top: auto;
  right: auto;
  z-index: auto;
}

.byoclaw-modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 1;
}

#byoclaw-modal-content,
#byoclaw-modal .byoclaw-modal-body {
  min-height: 0;
}

#byoclaw-modal-content {
  flex: 1;
  overflow: auto;
}

#byoclaw-modal .byoclaw-modal-body {
  display: flex;
  flex-direction: column;
}

.byoclaw-modal-body > .stack-sm:first-child {
  padding-right: 112px;
}

.byoclaw-tab-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 20px;
}

.byoclaw-tabs-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.byoclaw-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.byoclaw-tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
}

.byoclaw-tab-button:hover,
.byoclaw-tab-button:focus-visible {
  border-color: var(--text);
  background: var(--accent-soft);
  outline: none;
}

.byoclaw-tab-button.is-active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.byoclaw-tab-panels {
  min-height: 0;
  overflow: auto;
}

.prompt-actions {
  display: flex;
  justify-content: flex-end;
}

.prompt-footer {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.prompt-expiry {
  color: #8a8a8a;
  font-size: 0.875rem;
  line-height: 1.4;
}

.prompt-box {
  min-height: 400px;
  height: clamp(280px, 52dvh, 640px);
  max-width: 100%;
  resize: vertical;
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 0.74rem;
  line-height: 1.5;
}

.prompt-box-inline {
  min-height: 220px;
}

/* Mobile Responsive */
@media (max-width: 840px) {
  .page-grid,
  .inline-form,
  .app-header-controls {
    grid-template-columns: 1fr;
  }

  .link-card__body {
    padding: 20px 16px;
  }

  .link-card__header,
  .link-card__tags,
  .link-card__claw {
    padding-left: 16px;
    padding-right: 16px;
  }

  .link-card__claw-action {
    padding-left: 16px;
    padding-right: 16px;
  }

  .link-card__title {
    font-size: 1rem;
  }

  .app-header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 16px 24px;
    gap: 12px;
  }

  .prompt-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .prompt-footer .text-button {
    align-self: flex-end;
  }

  .byoclaw-modal-body > .stack-sm:first-child {
    padding-right: 0;
  }

  #byoclaw-modal {
    width: min(960px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  #byoclaw-modal .byoclaw-modal-shell {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 20px;
  }

  .prompt-box {
    min-height: 220px;
    height: clamp(220px, 42dvh, 420px);
  }

  .brand-cluster {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-wordmark {
    display: none;
  }

  .masthead-nav {
    width: 100%;
  }

  .app-header-controls {
    width: 100%;
    flex-direction: column;
  }

  .app-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .masthead-link-form {
    width: 100%;
  }

  .masthead-button,
  .app-header-actions form,
  .app-header-actions form button,
  .user-menu {
    width: 100%;
  }

  .user-menu-panel {
    position: static;
    min-width: 0;
    margin-top: 12px;
  }

  .user-menu-trigger {
    width: 100%;
  }

  .app-shell {
    padding-top: 140px;
  }

  body:not(.is-signed-in) .app-header-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    height: 56px;
    padding: 0 12px;
    gap: 10px;
  }

  body:not(.is-signed-in) .brand-cluster {
    width: auto;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  body:not(.is-signed-in) .brand {
    gap: 0;
    font-size: 0.875rem;
  }

  body:not(.is-signed-in) .masthead-nav {
    width: auto;
    flex-wrap: nowrap;
    gap: 2px;
  }

  body:not(.is-signed-in) .masthead-nav-link {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.875rem;
  }

  body:not(.is-signed-in) .app-header-actions {
    width: auto;
    flex: none;
    flex-wrap: nowrap;
    gap: 8px;
  }

  body:not(.is-signed-in) .app-header-actions .button-link-secondary {
    display: none;
  }

  body:not(.is-signed-in) .app-header-actions .button-link {
    width: auto;
    height: 38px;
    padding: 0 14px;
    font-size: 0.875rem;
  }

  body:not(.is-signed-in) .app-shell {
    padding-top: 88px;
  }

  body.is-signed-in .app-header-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    height: 56px;
    padding: 0 12px;
    gap: 10px;
  }

  body.is-signed-in .brand-cluster {
    width: auto;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  body.is-signed-in .brand {
    gap: 0;
    font-size: 0.875rem;
  }

  body.is-signed-in .masthead-nav {
    width: auto;
    flex-wrap: nowrap;
    gap: 2px;
  }

  body.is-signed-in .masthead-nav-link {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.875rem;
  }

  body.is-signed-in .app-header-controls {
    width: auto;
    flex: none;
    flex-direction: row;
    gap: 8px;
  }

  body.is-signed-in .masthead-link-form-inline {
    display: none;
  }

  body.is-signed-in .masthead-button {
    display: none;
  }

  body.is-signed-in .app-header-actions {
    width: auto;
    flex: none;
    flex-wrap: nowrap;
    gap: 8px;
  }

  body.is-signed-in .user-menu {
    width: auto;
  }

  body.is-signed-in .user-menu-trigger {
    width: 45px;
    height: 38px;
  }

  body.is-signed-in .user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 280px;
    width: min(320px, calc(100vw - 24px));
    margin-top: 0;
  }

  body.is-signed-in .user-menu-compact-only {
    display: flex;
  }

  body.is-signed-in .app-shell {
    padding-top: 88px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-left: 0;
    padding-right: 0;
  }

  .surface {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-left: 20px;
    padding-right: 20px;
  }
}
