/* Client portal — public brand dashboard.
   Uses the shared public theme variables, while portal-specific tokens are
   overridden at runtime from the brand payload when available. */
:root {
  --portal-primary: #475569;
  --portal-font: var(--font-family);
}

* { box-sizing: border-box; }

/* menu.css (loaded for its theme variables) styles `body` as the centered,
   non-scrolling app shell. Reset that here so the portal is a normal,
   top-aligned, scrollable document. */
html { height: auto; }
body.mydrop-portal-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: none;
  min-height: 100vh;
  max-height: none;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--public-page-bg);
  color: var(--font-black);
  font-family: var(--portal-font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.mydrop-portal-root {
  max-width: 1040px;
  margin: 0 auto;
  padding: 44px 40px 80px;
}

/* ---- loader / states ---- */
.mydrop-portal-loader { display: flex; justify-content: center; padding: 120px 0; }
.mydrop-portal-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--border-color); border-top-color: var(--portal-primary);
  animation: portal-spin 0.8s linear infinite;
}
@keyframes portal-spin { to { transform: rotate(360deg); } }

.mydrop-portal-state {
  text-align: center; padding: 100px 20px; color: var(--font-gray);
}
.mydrop-portal-state h1 { font-size: 22px; color: var(--font-black); margin: 0 0 8px; }

/* ---- password gate ---- */
.mydrop-portal-gate {
  max-width: 360px; margin: 90px auto; background: var(--surface);
  border: 1px solid var(--border-color); border-radius: var(--radius-big);
  box-shadow: var(--shadow-lg); padding: 30px 26px; text-align: center;
}
.mydrop-portal-gate h2 { margin: 0 0 16px; font-size: 18px; }
.mydrop-portal-gate input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-color);
  border-radius: var(--radius-small); font-size: 15px; margin-bottom: 12px; font-family: inherit;
  background: var(--bg-black-2); color: var(--font-black);
}
.mydrop-portal-gate .portal-error { color: var(--error); font-size: 13px; margin: 0 0 10px; }

/* ---- header ---- */
.mydrop-portal-header {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: var(--radius-big); box-shadow: var(--shadow-card);
  padding: 20px 24px; margin-bottom: 18px;
}
.mydrop-portal-logo {
  width: 64px; height: 64px; border-radius: var(--radius-small-medium); object-fit: cover; flex: 0 0 auto;
  background: var(--bg-black-2); border: 1px solid var(--border-color);
}
.mydrop-portal-logo-fallback {
  width: 64px; height: 64px; border-radius: var(--radius-small-medium); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--portal-primary); color: var(--text-on-accent); font-size: 26px; font-weight: 700;
}
.mydrop-portal-title { font-size: 24px; font-weight: 700; margin: 0; }

/* ---- tabs ---- */
.mydrop-portal-tabs {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    flex-wrap: nowrap;
    width: 100%;
    margin-bottom: -1px;
    padding: 0;
    box-sizing: border-box;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.mydrop-portal-tabs::after {
  content: '';
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 0;
  height: 1px;
  background: var(--border-color);
  z-index: -1;
}
.mydrop-portal-tabs::-webkit-scrollbar { height: 4px; }
.mydrop-portal-tabs::-webkit-scrollbar-track { background: transparent; }
.mydrop-portal-tabs::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 999px; }
.mydrop-portal-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
  height: 40px;
  min-width: max-content;
  padding: 0 14px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-bottom-color: transparent;
  border-radius: var(--radius-small) var(--radius-small) 0 0;
  background: var(--bg-blue-dark);
  color: var(--font-gray);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  transition: border-color var(--transition-fast) ease, color var(--transition-fast) ease, background-color var(--transition-fast) ease;
}
.mydrop-portal-tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: inherit;
}
.mydrop-portal-tab { position: relative; }
.mydrop-portal-tab svg { width: 16px; height: 16px; flex: 0 0 auto; }
.mydrop-portal-tab .campaign-icon-mask { width: 16px; height: 16px; }
.mydrop-portal-tab:hover {
  color: var(--font-black);
  border-color: color-mix(in srgb, var(--portal-primary) 24%, var(--border-color));
  border-bottom-color: transparent;
  background: color-mix(in srgb, var(--portal-primary) 6%, var(--surface));
}
.mydrop-portal-tab.active {
  height: 44px;
  background: var(--surface);
  color: var(--font-black);
  border-color: var(--border-color);
  border-bottom-color: var(--surface);
  cursor: default;
}
.mydrop-portal-tab .portal-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; margin-left: auto; padding: 0 6px;
  font-size: 12px; background: var(--bg-blue-clear); color: var(--font-black); border-radius: 999px;
}
.mydrop-portal-tab.active .portal-tab-count { background: var(--bg-blue-clear); }

/* ---- section card ---- */
.mydrop-portal-section { display: none; }
.mydrop-portal-section.active { display: block; }
.portal-card {
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: var(--radius-big); box-shadow: var(--shadow-card);
  padding: 22px; margin-bottom: 16px;
}
.mydrop-portal-section.active > .portal-card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.portal-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px;
}
.portal-card-head h2 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 9px; }
.portal-card-head h2 svg { width: 19px; height: 19px; color: var(--portal-primary); }
.portal-card-head h2 .campaign-icon-mask { width: 19px; height: 19px; color: var(--portal-primary); }
.portal-empty { color: var(--font-gray); font-size: 14px; margin: 6px 0; }

/* ---- buttons ---- */
.portal-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; padding: 9px 15px; border-radius: var(--radius-small);
  border: 1px solid var(--border-color); background: var(--surface); color: var(--font-black);
  transition: background-color var(--transition-fast) ease, filter var(--transition-fast) ease;
}
.portal-btn svg { width: 16px; height: 16px; }
.portal-btn:hover { background: var(--hover-color); }
.portal-btn.primary { background: var(--portal-primary); color: #fff; border-color: transparent; }
.portal-btn.primary:hover { filter: brightness(1.08); background: var(--portal-primary); }
.portal-btn.sm { padding: 6px 11px; font-size: 13px; }
.portal-icon-btn {
  width: var(--height-small); height: var(--height-small); border-radius: var(--radius-small); border: 1px solid var(--border-color);
  background: var(--surface); color: var(--font-black); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.portal-icon-btn:hover { background: var(--hover-color); }
.portal-icon-btn svg { width: 17px; height: 17px; }

/* ---- branding: colors ---- */
.portal-colors { display: flex; flex-wrap: wrap; gap: 12px; }
.portal-color {
  position: relative; width: 64px; height: 64px; border-radius: var(--radius-small-medium);
  border: 1px solid var(--border-color);
}
.portal-color .portal-color-remove {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); color: var(--font-black); border: 1px solid var(--border-color); cursor: pointer; line-height: 1; font-size: 12px;
}
.portal-color-add {
  width: 64px; height: 64px; border-radius: var(--radius-small-medium); border: 1px dashed var(--border-color);
  background: var(--bg-black-2); cursor: pointer; font-size: 24px; color: var(--font-gray);
}

/* ---- branding: files ---- */
.portal-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.portal-file {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-small-medium); overflow: hidden;
  border: 1px solid var(--border-color); background: var(--bg-black-2);
  display: flex; align-items: center; justify-content: center;
}
.portal-file img { width: 100%; height: 100%; object-fit: cover; }
.portal-file .portal-file-name { font-size: 11px; color: var(--font-gray); padding: 6px; text-align: center; word-break: break-word; }
.portal-file .portal-file-remove {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--overlay); color: var(--bg-white); border: none; cursor: pointer; font-size: 13px;
}
.portal-file-add {
  aspect-ratio: 1; border-radius: var(--radius-small-medium); border: 1px dashed var(--border-color);
  background: var(--bg-black-2); cursor: pointer; color: var(--font-gray); font-size: 30px;
  display: flex; align-items: center; justify-content: center;
}

/* ---- inputs ---- */
.portal-field select, .portal-field input, .portal-field textarea,
.portal-conversation-compose textarea, .mydrop-portal-gate input {
  background: var(--bg-black-2); color: var(--font-black);
}
.portal-field select, .portal-field input, .portal-field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-color);
  border-radius: var(--radius-small); font-size: 14px; font-family: inherit;
}
.portal-field select:focus, .portal-field input:focus, .portal-field textarea:focus { outline: none; border-color: var(--portal-primary); }
.portal-branding-grid { display: grid; gap: 22px; }

/* ---- infos ---- */
.portal-infos-group { margin-bottom: 22px; }
.portal-infos-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--font-gray); margin: 0 0 12px; }
.portal-infos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.portal-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.portal-field.full { grid-column: 1 / -1; }
.portal-field textarea { resize: vertical; min-height: 44px; }

/* ---- link in bio ---- */
.portal-link-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small-medium); margin-bottom: 10px;
  text-decoration: none; cursor: pointer;
}
.portal-link-row:hover { background: var(--hover-color); }
.portal-link-row svg { width: 18px; height: 18px; color: var(--portal-primary); flex: 0 0 auto; }
.portal-link-row strong { display: block; font-size: 14px; }
.portal-link-row span { font-size: 13px; color: var(--font-gray); }

/* ---- campaigns ---- */
.campaign-icon-mask {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url('/static/images/icons/campaigns.svg') center / contain no-repeat;
  mask: url('/static/images/icons/campaigns.svg') center / contain no-repeat;
}
.brand-campaigns-grid { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.brand-campaign-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 58px; padding: 8px 10px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small);
  background: var(--bg-blue-dark); color: var(--font-black); box-sizing: border-box;
}
.brand-campaign-open { display: flex; align-items: center; min-width: 0; gap: 10px; }
.brand-campaign-row-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; min-width: 34px; border-radius: var(--radius-small);
  background: var(--bg-blue-clear); color: var(--font-gray); overflow: hidden;
}
.campaign-logo {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
}
.campaign-logo-fallback {
  display: inline-flex; align-items: center; justify-content: center;
}
.campaign-logo-fallback .campaign-logo-icon {
  width: 14px; height: 14px; color: var(--bg-white);
}
.brand-campaign-card-copy {
  display: flex; flex-direction: column; min-width: 0; gap: 4px;
}
.brand-campaign-card-copy strong,
.brand-campaign-card-copy span {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-campaign-card-copy strong { color: var(--font-black); font-size: 13px; font-weight: 650; }
.brand-campaign-card-copy span { color: var(--font-gray); font-size: 12px; }
.brand-campaign-card-copy span:empty { display: none; }
.brand-campaign-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.brand-campaign-color {
  width: 14px; height: 14px; border: 1px solid var(--border-color);
  border-radius: 999px; box-sizing: border-box;
}
.brand-campaign-count {
  display: inline-flex; min-height: 24px; align-items: center; justify-content: center;
  color: var(--font-gray); font-size: 12px; white-space: nowrap;
}

/* ---- profiles ---- */
.portal-profiles { display: flex; flex-direction: column; gap: 4px; }
.portal-profile {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  min-height: 60px;
  width: 100%;
  border-radius: var(--radius-small);
  padding: 0 10px;
  overflow: hidden;
  background-color: var(--bg-blue-dark);
  border: 1px solid var(--border-color);
}
.portal-profile:hover { background-color: var(--border-color); }
.portal-profile-description {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding-right: 100px;
}
.portal-profile-pic-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  min-width: 35px;
  height: 35px;
}
.portal-profile-pic {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}
.portal-platform-icon {
  position: absolute;
  bottom: -3px;
  left: -2px;
  width: auto;
  height: 60%;
  border-radius: 50%;
  background: var(--surface);
  padding: 1px;
  box-sizing: border-box;
}
.portal-profile .portal-profile-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.portal-profile strong { display: block; width: 100%; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-profile span { font-size: 12px; color: var(--font-gray); }
.portal-profile.expired strong::after { content: ' · expired'; color: var(--error); font-weight: 600; }
.portal-profile-buttons {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.portal-profile-refresh {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--height-small);
  padding: 0 10px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border-color);
  background-color: var(--bg-black-2);
  color: var(--font-black);
  font-family: inherit;
  cursor: pointer;
}
.portal-profile:hover .portal-profile-refresh { display: flex; }
.portal-profile-refresh svg { width: 14px; height: 14px; flex-shrink: 0; }
.portal-profile-refresh span { font-size: 12px; color: inherit; }

/* ---- posts ---- */
.portal-posts-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.calendar-period-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-period-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--font-gray);
}
.calendar-period-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--font-black);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}
.calendar-period-select:focus {
  border-color: var(--portal-primary);
}
.portal-posts-period-filter {
  margin-bottom: 14px;
}
.portal-posts-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--surface);
}
.portal-posts-footer.is-empty {
  display: none;
}
.calendar-list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-big);
  flex-wrap: wrap;
  width: 100%;
}
.calendar-list-pagination-size,
.calendar-list-pagination-nav {
  display: flex;
  align-items: center;
  gap: var(--gap-small);
}
.calendar-list-pagination-hint {
  font-size: 12px;
  color: var(--font-gray-clair);
}
.calendar-list-pagination-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--font-gray);
  min-width: 96px;
  text-align: center;
}
.calendar-list-pagination-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small);
  background: var(--bg-blue-clear);
  color: var(--font-black);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}
.calendar-list-pagination-select:focus {
  border-color: var(--portal-primary);
}
.calendar-list-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--font-gray);
  font-size: 11px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.calendar-list-page-btn:hover:not(:disabled) {
  border-color: var(--portal-primary);
  color: var(--font-black);
  background: var(--hover-color);
}
.calendar-list-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.portal-post {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small-medium); margin-bottom: 10px;
}
.portal-post input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--portal-primary); }
.portal-post-avatars { display: flex; }
.portal-post-avatars img {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); margin-left: -10px;
}
.portal-post-avatars img:first-child { margin-left: 0; }
.portal-post-main { flex: 1; min-width: 0; }
.portal-post-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-post-main .portal-post-sub { font-size: 12px; color: var(--font-gray); display: flex; gap: 10px; flex-wrap: wrap; }
.portal-post-status { font-weight: 600; }
.portal-post-status.pending { color: var(--pending); }
.portal-post-status.posted { color: var(--success); }
.portal-post-status.scheduled, .portal-post-status.waiting { color: var(--waiting); }
.portal-post-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---- conversation ----
   Markup + look come from the shared conversations.css (same as the in-app
   embed). We only give the embed a bounded, scrollable height and style the
   "replying to" banner. Mentions render as @Name via the library's class. */
.portal-conversation-embed { height: 560px; max-width: 100%; }
.portal-reply-banner {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--font-gray);
  padding: 6px 4px 8px; border-bottom: 1px solid var(--border-color); margin-bottom: 8px;
}
.portal-reply-cancel {
  margin-left: auto; border: none; background: transparent; color: var(--font-gray);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.portal-reply-cancel:hover { color: var(--font-black); }

/* ---- reports ---- */
.portal-report {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small-medium); margin-bottom: 10px;
}
.portal-report-meta { flex: 1; }
.portal-report-meta strong { display: block; font-size: 14px; }
.portal-report-meta span { font-size: 12px; color: var(--font-gray); }
.portal-report-actions { display: flex; gap: 8px; }

/* ---- automations ---- */
.portal-automation {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small-medium); margin-bottom: 10px;
}
.portal-automation-main { flex: 1; min-width: 0; }
.portal-automation-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-automation-main span { display: block; margin-top: 3px; font-size: 12px; color: var(--font-gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-automation-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.portal-btn.danger { color: var(--error); }
.portal-btn.danger:hover { background: color-mix(in srgb, var(--error) 10%, transparent); border-color: color-mix(in srgb, var(--error) 22%, transparent); }
.portal-btn.danger svg { width: 14px; height: 14px; }

/* ---- inbox rules ---- */
.portal-rule {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small-medium); margin-bottom: 10px;
}
.portal-rule-main { flex: 1; min-width: 0; }
.portal-rule-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-rule-main span { display: block; margin-top: 3px; font-size: 12px; color: var(--font-gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-rule-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; color: var(--font-gray); font-size: 12px; }
.portal-rule-status {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px;
  border-radius: 999px; background: var(--bg-blue-clear); color: var(--font-black); font-weight: 600;
}
.portal-rule-status.paused { color: var(--font-gray); }

/* ---- modal ---- */
.portal-modal-overlay {
  position: fixed; inset: 0; background: var(--overlay-blur); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.portal-modal {
  background: var(--surface); border: 1px solid var(--border-color); border-radius: var(--radius-big); width: 100%; max-width: 440px;
  max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow-lg); padding: 24px;
}
.portal-modal h3 { margin: 0 0 4px; font-size: 18px; }
.portal-modal p.portal-modal-sub { margin: 0 0 18px; color: var(--font-gray); font-size: 14px; }
.portal-platform-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.portal-platform-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--height-small);
    padding: 0 12px;
    cursor: pointer;
    border: none;
    border-radius: var(--radius-small);
    color: var(--bg-white);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    box-shadow: var(--shadow-sm);
}
.portal-platform-btn:hover { filter: brightness(1.08); }
.portal-platform-btn img:not(.portal-platform-more) { width: 15px; height: 15px; object-fit: contain; flex: 0 0 auto; }
.portal-platform-btn span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.portal-platform-more { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.9; }
.portal-candidate {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border: 1px solid var(--border-color); border-radius: var(--radius-small-medium); margin-bottom: 9px; cursor: pointer;
}
.portal-candidate input { width: 18px; height: 18px; accent-color: var(--portal-primary); }
.portal-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- toast ---- */
.portal-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--font-black); color: var(--bg-black-2); padding: 12px 20px; border-radius: var(--radius-small-medium); font-size: 14px;
  box-shadow: var(--shadow-lg); z-index: 1100; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.portal-toast.show { opacity: 1; }
.portal-toast.error { background: var(--error); color: var(--bg-white); }

.mydrop-portal-footer { text-align: center; color: var(--font-gray); font-size: 12px; padding: 28px; }
.mydrop-portal-footer a { color: var(--portal-primary); text-decoration: none; }

/* ---- dashboard shell refresh ---- */
body.mydrop-portal-body {
  background: var(--bg-black-2);
}

body.mydrop-portal-body > .mydrop-approval-topbar,
body.mydrop-portal-body > .mydrop-approval-footer {
  display: none;
}

.mydrop-portal-root {
  width: 100%;
  max-width: none;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.mydrop-portal-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  background: var(--surface);
}

.mydrop-portal-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg-black-2));
}

.mydrop-portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 26px;
  color: var(--font-black);
}

.mydrop-portal-brand .mydrop-portal-logo,
.mydrop-portal-brand .mydrop-portal-logo-fallback {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-small);
}

.mydrop-portal-brand strong {
  min-width: 0;
  overflow: hidden;
  color: var(--font-black);
  font-size: 16px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mydrop-portal-tabs {
  position: static;
  z-index: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  overflow: visible;
}

.portal-sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

.portal-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--font-gray);
  font-size: 12px;
}

.portal-theme-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 650;
}

.portal-theme-label svg {
  width: 16px;
  height: 16px;
  color: var(--font-gray);
}

.portal-theme-state {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small);
  background: var(--bg-black-2);
}

.portal-theme-option {
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-mini);
  background: transparent;
  color: var(--font-gray);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.portal-theme-option:hover,
.portal-theme-option.is-active {
  background: var(--surface);
  color: var(--font-black);
}

.mydrop-portal-tabs::after,
.mydrop-portal-tab::after {
  display: none;
}

.mydrop-portal-tab {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--font-gray);
  font-size: 14px;
  font-weight: 650;
}

.mydrop-portal-tab:hover {
  border-color: var(--border-color);
  background: var(--hover-color);
  color: var(--font-black);
}

.mydrop-portal-tab.active {
  height: 44px;
  border-color: color-mix(in srgb, var(--portal-primary) 16%, var(--border-color));
  background: color-mix(in srgb, var(--portal-primary) 10%, var(--surface));
  color: var(--font-black);
}

.mydrop-portal-tab svg,
.mydrop-portal-tab .campaign-icon-mask {
  width: 18px;
  height: 18px;
  color: var(--portal-primary);
}

.mydrop-portal-main-panel {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-black-2);
}

.mydrop-portal-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 28px 40px 22px;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  box-shadow: none;
  background: color-mix(in srgb, var(--bg-black-2) 92%, transparent);
  backdrop-filter: blur(14px);
}

.mydrop-portal-title {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0;
}

.mydrop-portal-header p {
  margin: 7px 0 0;
  color: var(--font-gray);
  font-size: 14px;
}

.mydrop-portal-content {
  padding: 28px 40px 56px;
}

.mydrop-portal-section.active > .portal-card {
  border-top-left-radius: var(--radius-big);
  border-top-right-radius: var(--radius-big);
}

.portal-card,
.portal-dashboard-block,
.portal-metric {
  box-shadow: none;
}

.portal-profile-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small-medium);
  background: var(--surface);
}

.portal-profile-selector-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--bg-black-2);
  color: var(--font-black);
  font-size: 12px;
  font-weight: 750;
}

.portal-profile-selector-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-profile-selector-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.portal-profile-selector-copy span {
  color: var(--font-gray);
  font-size: 11px;
  font-weight: 650;
}

.portal-profile-select {
  max-width: 160px;
  border: 0;
  background: transparent;
  color: var(--font-black);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.portal-dashboard {
  display: grid;
  gap: 22px;
}

.portal-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.portal-metric {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small-medium);
  background: var(--surface);
  color: var(--font-black);
  text-align: left;
  cursor: pointer;
}

.portal-metric:hover {
  border-color: color-mix(in srgb, var(--portal-primary) 28%, var(--border-color));
  background: color-mix(in srgb, var(--portal-primary) 5%, var(--surface));
}

.portal-metric-icon {
  grid-row: 1 / 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-small);
  background: color-mix(in srgb, var(--portal-primary) 12%, var(--surface));
  color: var(--portal-primary);
}

.portal-metric-icon svg,
.portal-metric-icon .campaign-icon-mask {
  width: 19px;
  height: 19px;
}

.portal-metric strong {
  align-self: end;
  font-size: 24px;
  line-height: 1;
}

.portal-metric span:last-child {
  color: var(--font-gray);
  font-size: 12px;
  font-weight: 650;
}

.portal-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr);
  gap: 18px;
}

.portal-dashboard-block {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-big);
  background: var(--surface);
}

.portal-dashboard-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.portal-dashboard-block-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
}

.portal-dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-dashboard-card-list {
  display: grid;
  gap: 10px;
}

/* Latest conversation preview — mirror the real in-app message layout
   (avatar + name + inline body with glowing mention tags). */
.portal-dashboard-conversation {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.portal-dashboard-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.portal-dashboard-message .conversation-message-avatar {
  flex: 0 0 auto;
}

.portal-dashboard-message-content {
  min-width: 0;
  flex: 1 1 auto;
}

.portal-dashboard-message-content strong {
  display: block;
  color: var(--font-black);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-dashboard-message-body {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: var(--font-gray);
  font-size: 12px;
  line-height: 1.45;
}

.portal-dashboard-card-list .portal-post,
.portal-dashboard-card-list .portal-report,
.portal-dashboard-card-list .portal-profile {
  margin: 0;
  border-radius: var(--radius-small);
  background: var(--bg-black-2);
}

.portal-dashboard-card-list .portal-post {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
}

.portal-dashboard-card-list .portal-post-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.portal-social-connect-block {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  align-items: center;
  gap: 26px;
}

.portal-social-orbit {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto;
}

.portal-social-orbit::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
}

.portal-social-orbit-center,
.portal-social-orbit-icon {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--surface);
}

.portal-social-orbit-center {
  top: 50%;
  left: 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  background: var(--portal-primary);
  color: #fff;
  cursor: pointer;
}

.portal-social-orbit-center svg {
  width: 26px;
  height: 26px;
}

.portal-social-orbit-icon {
  width: 42px;
  height: 42px;
  box-shadow: var(--shadow-sm);
}

.portal-social-orbit-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
    border-radius: 50%;
}

.portal-social-orbit-icon.icon-0 { top: 6px; left: 74px; }
.portal-social-orbit-icon.icon-1 { top: 32px; right: 18px; }
.portal-social-orbit-icon.icon-2 { top: 94px; right: 2px; }
.portal-social-orbit-icon.icon-3 { right: 32px; bottom: 14px; }
.portal-social-orbit-icon.icon-4 { left: 32px; bottom: 14px; }
.portal-social-orbit-icon.icon-5 { top: 94px; left: 2px; }
.portal-social-orbit-icon.icon-6 { top: 32px; left: 18px; }

.portal-social-connect-copy {
  min-width: 0;
}

.portal-social-connect-copy h2 {
  margin: 0 0 10px;
  color: var(--font-black);
  font-size: 22px;
  line-height: 1.2;
}

.portal-social-connect-copy p {
  max-width: 520px;
  margin: 0 0 18px;
  color: var(--font-gray);
  font-size: 15px;
  line-height: 1.5;
}

.portal-social-connect-copy > span {
  display: block;
  margin-top: 12px;
  color: var(--font-gray);
  font-size: 12px;
}

.portal-social-connect-btn {
  min-height: 42px;
  padding: 0 18px;
}

.portal-dashboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
}

.portal-dashboard-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.portal-dashboard-row.compact {
  align-items: flex-start;
}

.portal-dashboard-row div {
  min-width: 0;
}

.portal-dashboard-row strong,
.portal-dashboard-profile strong {
  display: block;
  overflow: hidden;
  color: var(--font-black);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-dashboard-row span,
.portal-dashboard-profile span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--font-gray);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-dashboard-profile-stack {
  display: grid;
  gap: 10px;
}

.portal-dashboard-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.portal-dashboard-profile > div:last-child {
  min-width: 0;
}

@media (max-width: 1100px) {
  .mydrop-portal-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .portal-dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-dashboard-grid {
    grid-template-columns: 1fr;
  }
  .portal-social-connect-block {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .mydrop-portal-root {
    height: auto;
    overflow-y: auto;
  }
  .mydrop-portal-shell {
    display: block;
    min-height: 100vh;
  }
  .mydrop-portal-sidebar {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 0;
    padding: 14px 16px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
  .mydrop-portal-brand {
    min-height: 42px;
    margin-bottom: 12px;
  }
  .mydrop-portal-brand .mydrop-portal-logo,
  .mydrop-portal-brand .mydrop-portal-logo-fallback {
    width: 36px;
    height: 36px;
  }
  .mydrop-portal-tabs {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .portal-sidebar-footer {
    margin-top: 12px;
    padding-top: 12px;
  }
  .portal-theme-row {
    display: none;
  }
  .portal-theme-options {
    max-width: 320px;
  }
  .mydrop-portal-tab {
    width: auto;
    flex: 0 0 auto;
  }
  .mydrop-portal-main-panel {
    height: auto;
    overflow: visible;
  }
  .mydrop-portal-header {
    position: static;
    flex-direction: column;
    align-items: stretch;
    padding: 22px 18px 18px;
  }
  .mydrop-portal-title {
    font-size: 23px;
  }
  .mydrop-portal-content {
    padding: 18px;
  }
  .portal-dashboard-metrics {
    grid-template-columns: 1fr;
  }
  .portal-profile-selector {
    width: 100%;
  }
  .portal-profile-select {
    max-width: none;
  }
  .portal-post,
  .portal-report,
  .portal-automation,
  .portal-rule {
    align-items: flex-start;
    flex-direction: column;
  }
  .portal-dashboard-card-list .portal-post {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .portal-dashboard-card-list .portal-post-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    width: 100%;
  }
  .portal-post-actions,
  .portal-report-actions {
    flex-wrap: wrap;
  }
  .portal-infos-grid,
  .portal-platform-list {
    grid-template-columns: 1fr;
  }
  .portal-social-connect-block {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .portal-social-orbit {
    width: 170px;
    height: 170px;
  }
  .portal-social-orbit-icon {
    width: 38px;
    height: 38px;
  }
  .portal-social-orbit-center {
    width: 56px;
    height: 56px;
  }
  .portal-social-orbit-icon.icon-0 { top: 4px; left: 66px; }
  .portal-social-orbit-icon.icon-1 { top: 28px; right: 16px; }
  .portal-social-orbit-icon.icon-2 { top: 84px; right: 0; }
  .portal-social-orbit-icon.icon-3 { right: 28px; bottom: 12px; }
  .portal-social-orbit-icon.icon-4 { left: 28px; bottom: 12px; }
  .portal-social-orbit-icon.icon-5 { top: 84px; left: 0; }
  .portal-social-orbit-icon.icon-6 { top: 28px; left: 16px; }
}
