:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #d9e0ea;
  --soft: #eef3f8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
}

.ghost {
  background: var(--soft);
  color: var(--text);
}

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

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.top-actions,
.actions,
.panel-head,
.upload-row,
.link-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head,
.link-panel {
  justify-content: space-between;
}

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  align-items: start;
}

.editor-grid {
  display: grid;
  gap: 18px;
}

.panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.login-card {
  display: grid;
  gap: 24px;
  margin: 12vh auto 0;
  max-width: 440px;
  padding: 28px;
}

.stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-panel {
  display: grid;
  gap: 14px;
}

.profile-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 12px;
  text-align: left;
}

.profile-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.profile-card strong {
  overflow-wrap: anywhere;
}

.profile-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.count {
  align-items: center;
  background: var(--soft);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  min-width: 26px;
  padding: 0 9px;
}

.notice {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  border-radius: 8px;
  color: #067647;
  font-weight: 700;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.notice.error {
  background: var(--danger-bg);
  border-color: #fecdca;
  color: var(--danger);
}

.upload-row {
  align-items: end;
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  margin-top: 14px;
}

.admin-feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.feed-admin-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.feed-admin-item img {
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  width: 100%;
}

.feed-admin-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.mini-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mini-actions button {
  min-height: 34px;
  padding: 0 8px;
}

.section-divider {
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

.highlight-admin-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.highlight-chip {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  min-height: 42px;
  padding: 5px 7px 5px 5px;
}

.highlight-chip img,
.highlight-fallback {
  border-radius: 50%;
  height: 32px;
  object-fit: cover;
  width: 32px;
}

.highlight-fallback {
  align-items: center;
  background: var(--soft);
  color: var(--muted);
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
}

.preview-body {
  background: #000;
  color: #f5f5f5;
  min-height: 100vh;
  padding: 0;
}

.phone-frame {
  background: #000;
  color: #f5f5f5;
  margin: 0 auto;
  max-width: 520px;
  min-height: 100vh;
  overflow: hidden;
}

.preview-disclaimer {
  background: #0d1117;
  border-bottom: 1px solid #1f2937;
  color: #d1d5db;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  text-align: center;
}

.preview-loading,
.preview-empty {
  color: #a8a8a8;
  padding: 34px 16px;
  text-align: center;
}

.mock-header {
  align-items: center;
  background: #000;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  min-height: 50px;
  padding: 4px 10px;
}

.mock-header-actions {
  display: flex;
  gap: 4px;
}

.mock-icon {
  align-items: center;
  background: transparent;
  color: #f5f5f5;
  display: inline-flex;
  font-size: 28px;
  font-weight: 500;
  justify-content: center;
  min-height: 38px;
  min-width: 38px;
  padding: 0;
}

.mock-username {
  color: #f5f5f5;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-head {
  align-items: center;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 18px;
  padding: 15px 16px 10px;
}

.avatar,
.avatar-placeholder {
  border-radius: 50%;
  height: 96px;
  width: 96px;
}

.avatar {
  border: 1px solid #262626;
  object-fit: cover;
}

.avatar-placeholder {
  align-items: center;
  background: #262626;
  border: 1px solid #363636;
  color: #a8a8a8;
  display: flex;
  font-size: 30px;
  font-weight: 900;
  justify-content: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  text-align: center;
}

.stats strong {
  color: #f5f5f5;
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.stats span {
  color: #f5f5f5;
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.profile-copy {
  color: #f5f5f5;
  display: grid;
  gap: 3px;
  font-size: 14px;
  line-height: 1.35;
  padding: 0 16px 10px;
}

.display-name {
  font-weight: 800;
}

.profile-category {
  color: #a8a8a8;
}

.bio {
  white-space: pre-wrap;
}

.website {
  color: #4aa3ff;
  font-weight: 700;
}

.preview-highlights {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 16px 12px;
  scrollbar-width: none;
}

.preview-highlights::-webkit-scrollbar {
  display: none;
}

.preview-highlight {
  color: #f5f5f5;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 68px;
}

.preview-highlight img,
.preview-highlight .highlight-fallback {
  border: 2px solid #555;
  border-radius: 50%;
  box-sizing: border-box;
  height: 58px;
  object-fit: cover;
  padding: 3px;
  width: 58px;
}

.preview-highlight span {
  color: #f5f5f5;
  font-size: 12px;
  max-width: 72px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 6px;
  padding: 0 16px 12px;
}

.profile-actions button {
  background: #262626;
  color: #f5f5f5;
  font-size: 14px;
  font-weight: 800;
  min-height: 32px;
  padding: 0 10px;
}

.profile-actions .profile-action-icon {
  font-size: 20px;
  padding: 0;
}

.grid-tabs {
  border-top: 1px solid #262626;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  height: 44px;
}

.grid-tabs button {
  background: transparent;
  border-radius: 0;
  color: #a8a8a8;
  font-size: 22px;
  min-height: 44px;
  padding: 0;
  position: relative;
}

.grid-tabs button.active {
  color: #f5f5f5;
}

.grid-tabs button.active::after {
  background: #f5f5f5;
  bottom: 0;
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
}

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

.preview-tile {
  background: #0d1117;
  margin: 0;
  position: relative;
}

.preview-tile img {
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  width: 100%;
}

.preview-tile figcaption {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  bottom: 0;
  color: #fff;
  font-size: 11px;
  left: 0;
  max-height: 50%;
  opacity: 0;
  overflow: hidden;
  padding: 16px 6px 6px;
  position: absolute;
  right: 0;
  transition: opacity 0.15s ease;
}

.preview-tile:hover figcaption {
  opacity: 1;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .profile-list-panel {
    order: 2;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1400px);
    padding: 14px 0;
  }

  .topbar,
  .top-actions,
  .actions,
  .link-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 26px;
  }

  .form-grid,
  .upload-row {
    grid-template-columns: 1fr;
  }

  .profile-head {
    grid-template-columns: 92px 1fr;
    gap: 12px;
    padding: 14px 14px 9px;
  }

  .avatar,
  .avatar-placeholder {
    height: 90px;
    width: 90px;
  }

  .stats strong {
    font-size: 15px;
  }

  .stats span {
    font-size: 12px;
  }

  .preview-body {
    padding: 0;
  }

  .phone-frame {
    border: 0;
    border-radius: 0;
    min-height: 100vh;
  }
}
