.account-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem;
  max-width: 100%;
  margin: 0.15rem 0 0.85rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.account-tab {
  appearance: none;
  flex: none;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.account-tab:hover,
.account-tab.active {
  color: var(--accent);
  background: rgba(255, 140, 0, 0.08);
}

.account-tab.active {
  border-bottom-color: var(--accent);
}

.account-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.account-tab-count {
  display: inline-block;
  margin-left: 0.4rem;
  min-width: 1.2rem;
  padding: 0.05rem 0.38rem;
  border-radius: 999px;
  background: rgba(255, 140, 0, 0.2);
  color: var(--accent-bright);
  font-size: 0.72rem;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: center;
  text-transform: none;
  vertical-align: 1px;
}

.account-friends-wrap {
  max-width: 100%;
  min-width: 0;
  overscroll-behavior-x: contain;
}

.account-friends-table {
  min-width: 640px;
}

.account-friends-table th:nth-child(1),
.account-friends-table td:nth-child(1) {
  width: 28%;
}

.account-friends-table th:nth-child(2),
.account-friends-table td:nth-child(2) {
  width: 14%;
}

.account-friends-table th:nth-child(3),
.account-friends-table td:nth-child(3) {
  width: 22%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.account-friends-table th:nth-child(4),
.account-friends-table td:nth-child(4) {
  width: 36%;
  white-space: normal;
}

.account-friend-id {
  font-family: var(--mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.account-friend-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.account-friend-actions .btn {
  white-space: nowrap;
}

.account-friend-form {
  display: block;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 1rem;
}

.account-friend-form > label {
  display: block;
  width: 100%;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.account-friend-form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.account-friend-form-row input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 48px;
  margin: 0;
  padding: 0 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
}

.account-friend-form-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.15);
}

.account-friend-form-row .btn {
  flex: 0 0 auto;
  height: 48px;
  margin: 0;
  padding: 0 1.15rem;
  white-space: nowrap;
}

.account-friend-form-row .btn:hover {
  transform: none;
}

@media (max-width: 520px) {
  .account-friend-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .account-friend-form-row input,
  .account-friend-form-row .btn {
    width: 100%;
    max-width: 100%;
  }
}

.account-site-doc {
  margin: 0.95rem 0 0;
  text-align: right;
}

.account-site-doc a {
  color: var(--accent-bright);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 32rem;
}

.clan-main:has(.chat-app) {
  max-width: 1080px;
}

.chat-app {
  padding: 1.25rem 1.35rem 1.4rem;
}

.chat-side {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.chat-rooms {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #161914;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.chat-room.active {
  border-color: var(--accent);
  background: rgba(255, 140, 0, 0.1);
  color: var(--text);
}

.chat-new,
.chat-send,
.chat-head-row,
.chat-tools {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.chat-new {
  margin-top: 0.35rem;
}

.chat-new input,
.chat-send textarea {
  flex: 1 1 8rem;
  min-width: 0;
  margin: 0;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.chat-new input:focus,
.chat-send textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.15);
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.chat-main h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chat-log {
  flex: 1 1 auto;
  height: 28rem;
  margin: 0.75rem 0;
  padding: 0.85rem 0.95rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #10120e;
}

.chat-line {
  margin: 0 0 0.65rem;
  line-height: 1.45;
}

.chat-line a {
  color: var(--accent-bright);
}

.chat-system {
  color: #ff5c5c;
}

.chat-system b {
  color: #ff8080;
}

.chat-send textarea {
  min-height: 3.2rem;
  resize: vertical;
}

.chat-invite {
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.chat-invite-act {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.chat-new,
.chat-send,
.chat-head-row,
.chat-tools {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.chat-mute {
  display: inline-flex;
  gap: 0.25rem;
  margin-left: 0.4rem;
}

.chat-mute button {
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.chat-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chat-people {
  margin-top: 0.6rem;
}

.chat-person,
.chat-src-title {
  margin: 0.35rem 0;
}

.account-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin: 0.8rem 0 0.2rem;
}

.account-stat-grid div {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.account-stat-grid b {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.account-stat-grid span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.account-stat-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.account-stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.account-stats th,
.account-stats td {
  padding: 0.4rem 0.35rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.account-stats th {
  color: var(--text-muted);
  font-weight: 600;
}

.account-stats th:nth-child(1),
.account-stats td:nth-child(1),
.account-stats th:nth-child(2),
.account-stats td:nth-child(2) {
  text-align: left;
}

.account-stats td:nth-child(2) {
  white-space: normal;
}

.account-stat-note td {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: normal;
}

@media (max-width: 720px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-log {
    height: 16rem;
  }
}
