.users-panel {
  overflow: hidden;
}

.users-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.users-stat-card {
  min-height: 108px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--blue);
}

.users-stat-card.ok {
  border-left-color: var(--accent);
}

.users-stat-card.warn {
  border-left-color: var(--amber);
}

.users-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.users-stat-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 24px;
  line-height: 1.1;
}

.users-stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.user-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1.2fr) repeat(5, minmax(110px, 0.7fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-toolbar label {
  display: grid;
  gap: 6px;
}

.user-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.user-toolbar input,
.user-toolbar select,
.users-table select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

.user-toolbar input:focus,
.user-toolbar select:focus,
.users-table select:focus {
  border-color: var(--accent);
}

.user-list-meta {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.user-list-meta strong {
  font-size: 13px;
}

.user-list-meta .success {
  color: var(--accent);
}

.user-list-meta .warn {
  color: var(--amber);
}

.user-list-meta .error {
  color: var(--red);
}

.users-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.users-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  background: var(--surface);
}

.users-view .users-table {
  min-width: 760px;
}

.users-table th,
.users-table td {
  padding: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  border-top: 0;
  background: #f1f5f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.users-table td {
  font-size: 13px;
}

.user-cell {
  display: grid;
  gap: 3px;
}

.user-identity {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.user-identity > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  object-fit: cover;
}

.user-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 900;
}

.user-cell strong,
.user-cell em,
.user-cell small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-cell strong {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
}

.user-cell em,
.user-cell small,
.muted-cell {
  color: var(--muted);
  font-style: normal;
}

.user-cell small {
  font-size: 11px;
}

.self-badge,
.status-badge,
.group-badge,
.session-count,
.level-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.level-badge {
  display: inline-flex;
  background: #eef3ea;
  color: var(--accent-strong);
}

.self-badge {
  background: #e6eef7;
  color: var(--blue);
}

.status-badge.active {
  background: #e4f0ed;
  color: var(--accent-strong);
}

.status-badge.suspended {
  background: #fff4df;
  color: var(--amber);
}

.status-badge.disabled {
  background: #fdeceb;
  color: var(--red);
}

.status-badge.deleted {
  background: #f3f4f6;
  color: #6b7280;
}

.email-verification.deleted {
  background: #f3f4f6;
  color: #6b7280;
}

.user-email-cell,
.copyable-id span {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge.visible,
.status-badge.resolved {
  background: #e4f0ed;
  color: var(--accent-strong);
}

.status-badge.hidden,
.status-badge.open {
  background: #fff4df;
  color: var(--amber);
}

.status-badge.new {
  background: #fff4df;
  color: var(--amber);
}

.status-badge.replied {
  background: #e4f0ed;
  color: var(--accent-strong);
}

.status-badge.dismissed,
.status-badge.read,
.status-badge.archived {
  background: #eef2f4;
  color: var(--muted);
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.group-badge.member {
  background: #eef2f4;
  color: var(--muted);
}

.group-badge.admin {
  background: #e6eef7;
  color: var(--blue);
}

.group-badge.deleted {
  background: #f3f4f6;
  color: #6b7280;
}

.user-content-list {
  display: grid;
  gap: 10px;
}

.user-content-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-content-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f4;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.user-content-head a {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.user-content-head a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.user-content-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.user-content-item small {
  color: var(--muted);
  font-weight: 800;
}

.session-count {
  display: block;
  margin-bottom: 4px;
  background: #e4f0ed;
  color: var(--accent-strong);
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.users-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.users-pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.contact-messages-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.contact-messages-table {
  min-width: 760px;
}

.contact-messages-table tr.selected td {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.contact-message-detail {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.contact-message-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.contact-message-detail-body {
  display: grid;
  gap: 16px;
}

.contact-message-detail-head {
  display: grid;
  gap: 8px;
}

.contact-message-detail-head h3 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.contact-message-meta,
.contact-message-reply-history dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.contact-message-meta div,
.contact-message-reply-history dl div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
}

.contact-message-meta dt,
.contact-message-reply-history dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.contact-message-meta dd,
.contact-message-reply-history dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.contact-message-original h4,
.contact-message-reply-history h4,
.contact-reply-form h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.contact-message-content {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--text);
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.contact-message-reply-history {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.contact-reply-form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.contact-reply-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.contact-reply-form input,
.contact-reply-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 0 11px;
}

.contact-reply-form input {
  min-height: 40px;
}

.contact-reply-form textarea {
  min-height: 150px;
  padding-block: 10px;
  line-height: 1.65;
  resize: vertical;
}

.contact-reply-form input:focus,
.contact-reply-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 116, 95, 0.12);
}

.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 34, 0.42);
  z-index: 40;
}

.modal-backdrop {
  z-index: 80;
  overflow: auto;
}

.drawer-backdrop[hidden],
.modal-backdrop[hidden],
.user-drawer[hidden] {
  display: none;
}

.user-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(480px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(25, 34, 40, 0.12);
}

.drawer-head,
.drawer-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-foot {
  margin-top: auto;
  border-bottom: 0;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.user-detail-panel {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.user-detail-head,
.user-detail-foot {
  padding: 18px;
}

.user-detail-body {
  padding: 18px;
}

.user-detail-foot {
  margin-top: 0;
}

.drawer-head h2 {
  margin-bottom: 4px;
}

.drawer-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 18px;
}

.drawer-loading {
  margin: 0;
  color: var(--muted);
}

.drawer-section {
  margin-bottom: 18px;
}

.drawer-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.drawer-form {
  display: grid;
  gap: 12px;
}

.drawer-form label {
  display: grid;
  gap: 6px;
}

.drawer-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.drawer-form input,
.drawer-form select,
.drawer-form textarea {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

.user-cell .email-verification {
  margin-left: 4px;
  vertical-align: middle;
}

.drawer-form textarea {
  min-height: 76px;
  padding: 9px 10px;
  resize: vertical;
}

.drawer-form input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.drawer-form input:disabled,
.drawer-form select:disabled {
  opacity: 0.72;
  background: var(--surface-soft);
}

.readonly-field {
  display: block;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.drawer-meta {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.drawer-meta div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  min-height: 42px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.drawer-meta div:first-child {
  border-top: 0;
}

.drawer-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.drawer-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.drawer-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  object-fit: cover;
}

.drawer-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-size: 21px;
  font-weight: 900;
}

.drawer-profile strong {
  display: block;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.email-verification {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

.email-verification.verified {
  background: #e4f0ed;
  color: var(--accent-strong);
}

.email-verification.unverified {
  background: #fff1df;
  color: #9b5d08;
}

.session-list {
  display: grid;
  gap: 8px;
}

.session-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.session-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.session-item p,
.session-item em {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  font-style: normal;
  overflow-wrap: anywhere;
}

.session-item .session-state {
  display: inline-block;
  margin-bottom: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

.session-item .session-state.active {
  background: #e4f0ed;
  color: var(--accent-strong);
}

.session-item .session-state.revoked,
.session-item .session-state.expired {
  background: #eef2f4;
  color: var(--muted);
}

.session-actions,
.punishment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.session-detail,
.punishment-item {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.session-detail-head,
.punishment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.session-detail-head h4 {
  margin: 0;
  font-size: 14px;
}

.session-fingerprint {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.session-fingerprint strong {
  font-size: 12px;
}

.session-fingerprint code {
  display: block;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.punishment-list {
  display: grid;
  gap: 10px;
}

.punishment-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.punishment-fieldset {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.punishment-fieldset legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.drawer-form .punishment-fieldset label,
.drawer-form .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-form .punishment-fieldset input,
.drawer-form .checkbox-label input {
  width: auto;
}

.growth-ledger-list {
  display: grid;
  gap: 8px;
}

.growth-ledger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.growth-ledger-actions .active {
  border-color: var(--accent);
  background: #e4f0ed;
  color: var(--accent-strong);
}

.growth-ledger-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.growth-ledger-head,
.growth-ledger-pagination,
.growth-ledger-pagination > div {
  display: flex;
  align-items: center;
}

.growth-ledger-head {
  justify-content: space-between;
  gap: 12px;
}

.growth-ledger-head strong {
  font-size: 13px;
}

.growth-ledger-head b {
  font-variant-numeric: tabular-nums;
}

.growth-ledger-head .positive {
  color: var(--accent-strong);
}

.growth-ledger-head .negative {
  color: #b23a3a;
}

.growth-ledger-item p,
.growth-ledger-item em,
.growth-ledger-item small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.growth-ledger-pagination {
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.growth-ledger-pagination > div {
  gap: 6px;
}

.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 90;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-modal h2 {
  margin-bottom: 8px;
}

.confirm-modal p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
}

.confirm-prompt-field {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.confirm-prompt-field textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.confirm-prompt-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 116, 95, 0.12);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
  animation: toast-in 0.2s ease;
}

.toast.success {
  border-color: #b9ddd4;
  color: var(--accent-strong);
}

.toast.warn {
  border-color: #f0d7a8;
  color: var(--amber);
}

.toast.error {
  border-color: #f0cbc8;
  color: var(--red);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.copyable-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.copyable-id button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.table-button {
  min-width: 72px;
}

.empty-cell {
  height: 86px;
  color: var(--muted);
  text-align: center !important;
}
