/* Scoped supporting screen styles; the shared shell stays independent. */
@scope (.legacy-content) {
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  html,
  body {
    height: 100%;
  }
  html {
    scroll-behavior: smooth;
  }
  body {
    margin: 0;
    background: radial-gradient(
      circle at top,
      #0b1220 0,
      #020617 45%,
      #000 100%
    );
    color: var(--ink);
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
  a {
    color: inherit;
    text-decoration: none;
  }

  /* HEADER (same pattern as chat.html) */
  header {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--header-h);
    background: linear-gradient(
      180deg,
      rgba(15, 23, 42, 0.96),
      rgba(15, 23, 42, 0.78),
      rgba(15, 23, 42, 0)
    );
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  }
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
  }
  .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
  }
  .logo img {
    height: 80px;
    width: auto;
    display: block;
  }
  .nav-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
  }
  .nav-menu a {
    color: var(--muted);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition:
      background 0.18s ease,
      color 0.18s ease;
  }
  .nav-menu a:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #e5e7eb;
  }
  .nav-menu a.active {
    color: #e5e7eb;
    background: rgba(126, 166, 255, 0.16);
    box-shadow: 0 0 0 1px rgba(126, 166, 255, 0.4);
  }
  .auth-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
  }
  .auth-links a {
    color: var(--muted);
    font-weight: 500;
  }
  .auth-links a:hover {
    color: #e5e7eb;
    text-decoration: underline;
  }
  .menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: var(--ink);
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  @media (max-width: 900px) {
    header {
      background: #020617;
      backdrop-filter: none;
      border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    }
    .menu-toggle {
      display: inline-grid;
      place-items: center;
    }
    .nav-menu {
      position: fixed;
      left: 0;
      right: 0;
      top: var(--header-h);
      bottom: 0;
      display: none;
      flex-direction: column;
      padding: 16px 20px 24px;
      gap: 0.4rem;
      background: #020617;
      border-radius: 0;
      border-top: 1px solid rgba(148, 163, 184, 0.35);
      box-shadow: none;
      z-index: 90;
    }
    .nav-menu.open {
      display: flex;
    }
    .nav-menu a {
      width: 100%;
      text-align: left;
      padding: 0.75rem 0;
      border-radius: 0;
      border-bottom: 1px solid rgba(30, 41, 59, 0.9);
    }
    .nav-menu a:last-child {
      border-bottom: none;
    }
    .auth-links {
      display: none;
    }
  }

  /* PAGE LAYOUT */
  main {
    flex: 1;
    padding: 20px;
  }
  .page {
    max-width: 1000px;
    margin: 0 auto 24px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
  }
  @media (max-width: 900px) {
    .page {
      grid-template-columns: 1fr;
    }
  }

  .card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: var(--shadow);
    padding: 16px 18px 18px;
    transition:
      border-color 0.18s ease,
      transform 0.18s ease,
      box-shadow 0.18s ease;
  }
  .card:hover {
    border-color: rgba(126, 166, 255, 0.52);
    transform: translateY(-1px);
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.92);
  }
  .card + .card {
    margin-top: 12px;
  }

  h1 {
    font-size: 1.4rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
    margin-bottom: 0.5rem;
  }
  .muted {
    color: var(--muted);
  }

  /* LEFT COLUMN – avatar & stats */
  .avatar-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }
  .avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #1e293b;
    border: 2px solid rgba(126, 166, 255, 0.8);
    display: grid;
    place-items: center;
    font-size: 2.2rem;
    font-weight: 800;
    overflow: hidden;
  }
  .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .pill {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
  }
  .pill.ok {
    border-color: rgba(34, 197, 94, 0.8);
    color: #bbf7d0;
  }
  .stats {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    font-size: 0.8rem;
  }
  .stat-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-size: 0.7rem;
  }
  .stat-value {
    font-weight: 600;
  }
  .avatar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
  }
  .profile-meter {
    width: 100%;
    margin-top: 10px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(2, 6, 23, 0.72);
  }
  .meter-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .meter-track {
    margin-top: 6px;
    width: 100%;
    height: 8px;
    background: rgba(30, 41, 59, 0.9);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
  }
  .meter-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #22d3ee);
    transition: width 0.32s ease;
  }
  .info-grid {
    width: 100%;
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .info-item {
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 10px;
    padding: 8px;
    background: rgba(2, 6, 23, 0.72);
    text-align: left;
  }
  .info-label {
    display: block;
    font-size: 0.64rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.13em;
    margin-bottom: 3px;
  }
  .info-value {
    font-size: 0.82rem;
    color: #dce9f9;
    font-weight: 600;
    word-break: break-word;
  }
  .quick-links {
    width: 100%;
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .quick-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.58);
    background: rgba(30, 41, 59, 0.6);
    color: #dce9f9;
    padding: 0.48rem 0.6rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition:
      border-color 0.16s ease,
      background 0.16s ease,
      color 0.16s ease;
  }
  .quick-link:hover {
    border-color: rgba(126, 166, 255, 0.76);
    background: rgba(126, 166, 255, 0.16);
    color: #f4f8ff;
  }
  .quick-link.admin {
    grid-column: 1 / -1;
  }

  /* RIGHT COLUMN */
  .section-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }
  .section-tab {
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    cursor: pointer;
    color: var(--muted);
    background: transparent;
  }
  .section-tab.active {
    background: rgba(126, 166, 255, 0.16);
    color: #e5e7eb;
    box-shadow: 0 0 0 1px rgba(126, 166, 255, 0.4);
  }

  .section {
    display: none;
  }
  .section.active {
    display: block;
  }
  .field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  @media (max-width: 700px) {
    .field-grid {
      grid-template-columns: 1fr;
    }
  }

  .field {
    margin-bottom: 0.75rem;
  }
  .field label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
  }
  .field input,
  .field textarea {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: #020617;
    color: #e5e7eb;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 42px;
  }
  .field textarea {
    min-height: 72px;
  }
  .field input:focus,
  .field textarea:focus {
    outline: none;
    box-shadow: 0 0 0 1px rgba(126, 166, 255, 0.9);
  }

  .button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 0.35rem;
  }
  .btn {
    padding: 0.65rem 0.95rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: #1e293b;
    color: #e5e7eb;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .btn.secondary {
    background: transparent;
  }
  .btn.danger {
    background: var(--danger);
    border-color: #fecaca;
  }
  .btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .msg {
    margin-top: 0.45rem;
    min-height: 1.2rem;
    font-size: 0.8rem;
    white-space: pre-line;
  }
  .msg.error {
    color: #fecaca;
  }
  .msg.ok {
    color: #bbf7d0;
  }

  footer {
    text-align: center;
    padding: 1.3rem 20px 2rem;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    margin-top: 4px;
  }

  /* Unified Header (Chat Style) */
  header {
    background: linear-gradient(
      180deg,
      rgba(17, 24, 39, 0.95),
      rgba(17, 24, 39, 0.83),
      rgba(17, 24, 39, 0.35)
    );
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(157, 176, 197, 0.24);
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 900;
    padding: 6px 0;
    height: auto;
  }
  header .container.nav {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 76px;
  }
  header .logo img {
    height: 68px;
    width: auto;
    display: block;
  }
  header .nav-menu {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  header .nav-menu a {
    color: #9db0c5;
    padding: 0.48rem 0.86rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition:
      background 0.18s ease,
      color 0.18s ease,
      box-shadow 0.18s ease;
    text-decoration: none;
    border: none;
  }
  header .nav-menu a:hover {
    background: rgba(125, 158, 194, 0.16);
    color: #f4f8ff;
  }
  header .nav-menu a.active {
    color: #f4f8ff;
    background: rgba(109, 178, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(109, 178, 255, 0.42);
  }
  header .auth-links {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.84rem;
  }
  header .auth-links a {
    color: #9db0c5;
    font-weight: 600;
    text-decoration: none;
    border: none;
    padding: 0;
  }
  header .auth-links a:hover {
    color: #f4f8ff;
    text-decoration: none;
  }
  header .menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(157, 176, 197, 0.36);
    background: transparent;
    color: #e8eff8;
    font-size: 1.18rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
  }
  @media (max-width: 940px) {
    header {
      background: #111827;
      backdrop-filter: none;
    }
    header .container.nav {
      padding: 0 14px;
      min-height: 72px;
    }
    header .logo img {
      height: 56px;
    }
    header .menu-toggle {
      display: inline-grid;
      place-items: center;
    }
    header .nav-menu {
      position: fixed;
      left: 0;
      right: 0;
      top: 72px;
      display: none;
      flex-direction: column;
      padding: 16px 20px 24px;
      gap: 0.1rem;
      background: #111827;
      border-top: 1px solid rgba(157, 176, 197, 0.36);
      z-index: 90;
    }
    header .nav-menu.open,
    header .nav-menu.active {
      display: flex;
    }
    header .nav-menu a {
      width: 100%;
      text-align: left;
      padding: 0.8rem 0;
      border-radius: 0;
      border-bottom: 1px solid rgba(27, 39, 54, 0.92);
    }
    header .nav-menu a:last-child {
      border-bottom: none;
    }
    header .auth-links {
      display: none;
    }
  }
}
