/* ===== PROFILE DASHBOARD (layout - not overwritten by static build) ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.profile-route {
  background: var(--bg-secondary, #f3f3f1);
}

body.profile-route .nav-main.profile-nav-back-wrap {
  justify-content: flex-start;
  flex: 1;
}

body.profile-route .profile-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: 999px;
  background: var(--bg-secondary, #f3f3f1);
  color: var(--text-primary, #111);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
}

body.profile-route .profile-nav-back:hover {
  opacity: 0.88;
  background: var(--bg, #fff);
}

body.profile-route .profile-nav-back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.profile-route .profile-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

.profile-page-shell {
  min-height: calc(100dvh - 64px);
  padding: clamp(16px, 3vw, 28px) clamp(12px, 2.5vw, 24px) 48px;
}

.profile-dashboard {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.profile-dashboard.hidden {
  display: none !important;
}

.profile-dash-chat-card {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100dvh - 92px);
  min-height: min(72vh, 720px);
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: var(--radius, 4px);
  overflow: hidden;
}

.profile-dash-chat-card .profile-dash-panel-title {
  padding: 24px 24px 0;
  margin: 0;
}

.profile-dash-chat-card .profile-chat-intro {
  padding: 8px 24px 0;
  margin: 0;
}

.profile-dash-chat-card .profile-chat-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  padding: 16px 24px 24px;
}

.profile-chat-start-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 24px 24px;
}

.profile-chat-start-form.hidden {
  display: none !important;
}

.profile-chat-start-form .profile-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.profile-chat-start-form .profile-field input,
.profile-chat-start-form .profile-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  border-radius: 6px;
  font: inherit;
  background: var(--bg, #fff);
}

.profile-chat-start-form .profile-field textarea {
  resize: vertical;
  min-height: 100px;
}

.profile-chat-start-error {
  margin: 0;
  color: #c0392b;
  font-size: 13px;
}

.profile-chat-start-error.hidden {
  display: none !important;
}

.profile-chat-captcha {
  min-height: 68px;
}

.profile-chat-captcha:empty {
  display: none;
}

.profile-phone-verify {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.profile-phone-verify.hidden {
  display: none !important;
}

.profile-phone-verify-code {
  margin: 0;
}

.profile-phone-verify-hint {
  margin: 0;
  font-size: 13px;
  color: #16a34a;
}

.profile-phone-verify-hint.hidden {
  display: none !important;
}

.profile-btn-secondary {
  align-self: flex-start;
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.profile-btn-secondary:hover {
  background: #e5e7eb;
}

.profile-btn-secondary:disabled {
  opacity: 0.6;
  cursor: wait;
}

body.profile-route .profile-dash-chat-card .client-chat-panel.client-chat-panel--embedded {
  flex: 1;
  height: auto;
  min-height: 0;
  max-height: none;
}

.client-chat-compose.hidden {
  display: none !important;
}

.client-chat-restore {
  display: flex;
  justify-content: center;
  padding: 14px 12px;
  border-top: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  background: var(--bg, #fff);
}

.client-chat-restore.hidden {
  display: none !important;
}

.client-chat-restore button {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  border-radius: 10px;
  background: var(--bg-secondary, #f8f8f8);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.client-chat-restore button:hover {
  background: var(--bg, #fff);
}

.profile-dashboard--no-chat {
  grid-template-columns: 240px minmax(0, 1fr);
}

.profile-dash-sidebar {
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: var(--radius, 4px);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 80px;
}

.profile-dash-logo {
  display: block;
  text-align: center;
  margin-bottom: 8px;
}

.profile-dash-logo img {
  height: 46px;
  width: auto;
  display: inline-block;
}

.profile-dash-user {
  text-align: center;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, rgba(17, 17, 17, 0.08));
}

.profile-dash-user .name {
  font-size: 17px;
  font-weight: 700;
  margin: 12px 0 6px;
  word-break: break-word;
}

.profile-dash-user .handle {
  display: block;
  color: var(--text-secondary, #6b6b6b);
  font-size: 13px;
  margin-bottom: 4px;
}

.profile-dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.profile-dash-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary, #6b6b6b);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.profile-dash-nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-dash-nav-btn:hover {
  background: var(--bg-secondary, #f3f3f1);
  color: var(--text-primary, #111);
}

.profile-dash-nav-btn.profile-tab {
  border-bottom: none;
  margin-bottom: 0;
}

.profile-dash-nav-btn.profile-tab.active {
  background: var(--bg-secondary, #f3f3f1);
  color: var(--text-primary, #111);
  border-bottom-color: transparent;
}

.profile-dash-logout {
  margin-top: auto;
  padding: 10px 14px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: 10px;
  background: var(--bg-secondary, #f3f3f1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary, #111);
}

.profile-dash-logout:hover {
  background: var(--bg, #fff);
}

.profile-dash-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.profile-dash-panel.profile-panel {
  display: none;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.profile-dash-panel.profile-panel.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-dash-current,
.profile-dash-projects,
.profile-dash-panel.active > .profile-dash-panel-title,
.profile-dash-panel.active > form,
.profile-dash-panel.active > .profile-msg,
.profile-dash-panel.active > .profile-chat-intro,
.profile-dash-panel.active > .profile-dash-empty {
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: var(--radius, 4px);
}

.profile-dash-current,
.profile-dash-projects {
  padding: 24px;
}

.profile-dash-panel-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  padding: 24px 24px 0;
}

.profile-dash-panel.active form,
.profile-dash-panel.active > .profile-msg:not(.hidden),
.profile-dash-panel.active > .profile-chat-intro,
.profile-dash-panel.active > .profile-dash-empty {
  padding: 16px 24px 24px;
}

.profile-dash-current-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.profile-dash-current-head h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.profile-dash-tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-secondary, #f3f3f1);
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
}

.profile-dash-current-desc {
  color: var(--text-secondary, #6b6b6b);
  font-size: 14px;
  margin: 0 0 16px;
  line-height: 1.5;
}

.profile-dash-current-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(17, 17, 17, 0.08));
}

.profile-dash-progress-wrap {
  margin-top: 20px;
}

.profile-dash-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.profile-dash-progress-bar {
  height: 6px;
  background: var(--bg-secondary, #f3f3f1);
  border-radius: 999px;
  overflow: hidden;
}

.profile-dash-progress-bar span {
  display: block;
  height: 100%;
  background: var(--text-primary, #111);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.profile-dash-projects h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
}

.profile-dash-project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-dash-project {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: 10px;
  background: var(--bg-secondary, #f3f3f1);
}

.profile-dash-project h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.profile-dash-project p {
  font-size: 13px;
  color: var(--text-secondary, #6b6b6b);
  margin: 0;
}

.profile-dash-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-dash-status.is-progress {
  background: #eef4ff;
  color: #2b5cff;
}

.profile-dash-empty {
  color: var(--text-secondary, #6b6b6b);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.profile-dash-security {
  padding: 24px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: var(--radius, 4px);
}

.profile-dash-security h4 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
}

.profile-dash-rail {
  background: var(--bg, #fff);
  border: 1px solid var(--border, rgba(17, 17, 17, 0.08));
  border-radius: var(--radius, 4px);
  display: flex;
  flex-direction: column;
  min-height: 560px;
  position: sticky;
  top: 80px;
  overflow: hidden;
}

.profile-dash-rail.is-hidden {
  display: none;
}

.profile-dashboard--chat-focus {
  grid-template-columns: 240px minmax(0, 1fr);
}

.profile-dashboard--chat-focus .profile-dash-main {
  display: none;
}

.profile-dashboard--chat-focus .profile-dash-rail {
  display: flex !important;
  flex-direction: column;
  min-height: min(72vh, 720px);
  position: sticky;
  top: 80px;
}

.client-chat-hint {
  font-weight: 600;
  color: var(--text-primary, #111);
  line-height: 1.5;
  padding: 16px;
  border: 1px dashed var(--border, rgba(17, 17, 17, 0.16));
  border-radius: 8px;
  margin-bottom: 12px;
  background: rgba(17, 17, 17, 0.03);
}

.profile-dashboard--no-chat .profile-dash-rail {
  display: none;
}

.profile-dash-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border, rgba(17, 17, 17, 0.08));
}

.profile-dash-rail-head h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.profile-dash-rail-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary, #6b6b6b);
  padding: 0 4px;
}

.profile-dash-rail .profile-chat-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

body.profile-dash-active .profile-guest {
  display: none;
}

@media (max-width: 1100px) {
  .profile-dashboard {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .profile-dash-rail:not(.is-hidden) {
    grid-column: 1 / -1;
    position: static;
    min-height: 480px;
  }
}

@media (max-width: 768px) {
  .profile-page-shell {
    padding: 12px 12px 32px;
  }

  .profile-dashboard,
  .profile-dashboard--no-chat {
    grid-template-columns: 1fr;
  }

  .profile-dash-sidebar,
  .profile-dash-rail {
    position: static;
  }
}
