:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #17191e;
  --panel-2: #20232a;
  --line: #333844;
  --text: #f3f0e8;
  --muted: #a8acb8;
  --dim: #717784;
  --accent: #f0b34b;
  --accent-2: #4bd3c4;
  --danger: #e25c5c;
  --ok: #81c784;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(75, 211, 196, 0.07), transparent 32%),
    linear-gradient(315deg, rgba(240, 179, 75, 0.08), transparent 38%),
    var(--bg);
}

[hidden] {
  display: none !important;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(23, 25, 30, 0.96);
  box-shadow: var(--shadow);
}

.auth-brand {
  padding-bottom: 6px;
}

.auth-card h2 {
  margin: 4px 0 0;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: #ff9c9c;
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  padding: 22px;
  background: rgba(17, 19, 24, 0.94);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(240, 179, 75, 0.55);
  background: #241d14;
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
}

.brand h1,
.panel-title-row h2,
.modal h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 24px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tool-row,
.form-footer,
.modal-actions,
.modal-actions-right,
.panel-title-row,
.comment-actions,
.person-list-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-row .primary-button {
  flex: 1;
}

.field-label,
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(75, 211, 196, 0.14);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.session-card span {
  color: var(--dim);
  font-size: 12px;
}

.session-card strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.logout-button {
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(226, 92, 92, 0.45);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(226, 92, 92, 0.1);
  color: #ffb0b0;
  font-size: 13px;
}

.logout-button:hover {
  border-color: rgba(226, 92, 92, 0.78);
  background: rgba(226, 92, 92, 0.18);
}

.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.stats-grid strong {
  display: block;
  font-size: 24px;
}

.stats-grid span {
  color: var(--dim);
  font-size: 12px;
}

.person-list-header {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.person-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 3px;
}

.person-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  color: inherit;
  text-align: left;
}

.person-card.active {
  border-color: var(--accent);
  background: #221d16;
}

.avatar,
.profile-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #252932;
  color: var(--accent);
  font-weight: 800;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 8px;
}

.avatar img,
.profile-avatar img,
.comment-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-card h3 {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 16px;
}

.person-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.like-mini {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.main-panel {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  padding: 22px;
}

.profile-panel,
.comments-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 25, 30, 0.9);
  box-shadow: var(--shadow);
}

.profile-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}

.profile-hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
}

.profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  font-size: 44px;
}

.profile-title h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 32px;
}

.status-pill,
.tag,
.file-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
}

.status-pill {
  margin-top: 10px;
  background: rgba(75, 211, 196, 0.14);
  color: var(--accent-2);
}

.profile-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.profile-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--accent);
}

.profile-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tag-input {
  flex: 1;
  min-width: 0;
}

.tag {
  background: #252932;
  color: var(--text);
}

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.comments-panel {
  display: flex;
  min-height: calc(100vh - 44px);
  flex-direction: column;
  padding: 20px;
}

.panel-title-row {
  justify-content: space-between;
  margin-bottom: 16px;
}

.eyebrow {
  display: block;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

.comment-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
}

.comment-form textarea {
  min-height: 92px;
  resize: vertical;
}

.form-footer {
  justify-content: space-between;
}

.file-chip {
  border: 1px solid var(--line);
  background: #111318;
  color: var(--muted);
}

.file-chip input {
  display: none;
}

.image-preview {
  width: 112px;
  height: 78px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comments-list {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding-top: 16px;
}

.comment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #121419;
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font-size: 12px;
}

.comment-card p {
  margin: 10px 0;
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.comment-image {
  width: min(100%, 320px);
  height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1115;
}

.comment-actions {
  margin-top: 10px;
}

.reply-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid rgba(75, 211, 196, 0.35);
}

.reply {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.reply-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.danger-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 13px;
  color: var(--text);
}

.primary-button {
  background: var(--accent);
  color: #201305;
  font-weight: 800;
}

.secondary-button,
.icon-button {
  border-color: var(--line);
  background: #171a20;
}

.ghost-button {
  width: 38px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
}

.danger-button,
#deletePerson {
  border-color: rgba(226, 92, 92, 0.5);
  background: rgba(226, 92, 92, 0.1);
  color: #ff9c9c;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(680px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.modal-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .main-panel {
    grid-template-columns: 1fr;
  }

  .comments-panel {
    min-height: 640px;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-panel {
    padding: 14px;
  }

  .profile-hero,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-avatar {
    width: 96px;
    height: 96px;
  }

  .panel-title-row,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions-right {
    width: 100%;
  }
}
