* {
  box-sizing: border-box;
}

body {
  font-size: .94rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  color: #121826;
  background: #f8f9fc;
}


/* ------------------------------
   Shadows / Effects
   ------------------------------ */
.shadow-light {
  box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.shadow-medium {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.shadow-heavy {
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.shadow-glow {
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.focus-ring {
  box-shadow: 0 0 0 3px rgb(17 24 39 / 18%);
}

.focus-ring-primary {
  box-shadow: 0 0 0 3px rgba(91, 75, 232, 0.18);
}


/* ------------------------------
   Chat App
   ------------------------------ */
.chat-app {
  max-width: 45rem;
  min-height: 100dvh;
  margin: 0 auto 2rem auto;
  padding: 0;
  border: 1px #0f82c4 solid;
}



/* ------------------------------
   Chat Header
   ------------------------------ */
.chat-header {
  position: sticky;
  top: 0;
  background-color: #0f82c4;
  color: #fff;
  padding: .35rem .75rem .45rem;
  z-index: 99;
}

.chat-header .topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.chat-header h2 {
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0;
}

.chat-header p {
  font-size: .9rem;
  margin: 0;
  padding-left: 1.15rem;
}

.chat-header a {
  display: block;
  color: #eee;
  font-size: 90%;
  padding-top: .33rem;
  text-decoration: none;
}
.chat-header a:hover {
  color: #ff0;
}


.chat-header .me {
  white-space: nowrap;
  padding-top: .15rem;
  text-align: right;
}

.chat-header .you {
  font-size: 1.35rem;
  margin-top: .45rem;
  padding-top: .35rem;
  border-top: 1px solid rgba(255,255,255,.25);
}


main {
  margin: 0;
  padding: 0 1rem;
}


.part {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #d7dce2;
  border-radius: .5rem;
  background: #fafbfc;
}

.part h3 {
  margin: 0 0 .75rem;
  font-size: 1.25rem;
  font-weight: 600;
}




.history {
  max-width: 600px;
  margin: 0 auto;
}

.history-card {
  display: block;
  margin: 0 0 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background-color .15s, border-color .15s;
}

.history-card:hover {
  background: #f8f8f8;
  border-color: #bbb;
}

.history-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.history-card-message {
  color: #666;
  font-size: .95rem;
  margin-bottom: 8px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-card-date {
  font-size: .80rem;
  color: #999;
}




.history small {
  font-size: 80%;
}


.initiate h2 {
  margin: 0 0 1rem;
}

.initiate form {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: .625rem .75rem;
  align-items: center;
  max-width: 26.25rem;
}

.initiate label {
  display: block;
  font-weight: 600;
  margin: 1rem 0 .33rem 0;
}

.initiate input[type="text"],
.initiate input[type="email"],
.initiate input[type="tel"],
.initiate select {
  width: 100%;
  padding: .4375rem .5625rem;
  border: 1px solid #c8ccd4;
  border-radius: .5rem;
  font: inherit;
}

.initiate button {
  border: 0;
  background: #111827;
  color: #fff;
  cursor: pointer;
}

.initiate button:hover {
  opacity: 0.9;
}


.message-form {
  margin-top: 1rem;
}

.message-form textarea {
  width: 100%;
  height: 6rem;
}

.message-form input[type="submit"] {
  width: 100%;
  margin: .33rem 0;
  padding: .5rem;
  border: 1px #0978b9 solid;
  border-radius: .375rem;
  background-color: #0ea5ff;
  color: #fff;
}



/* ------------------------------
   Brand Icon
   ------------------------------ */
.bubble {
  position: absolute;
  width: 4.625rem;
  height: 3.625rem;
  border-radius: 1.125rem;
  color: #fff;
  font-size: 2.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bubble::after {
  content: "";
  position: absolute;
  bottom: -.625rem;
  border-width: 12px 10px 0 0;
  border-style: solid;
}

.bubble-a {
  left: 1rem;
  top: 1.5rem;
  background: linear-gradient(135deg, #0ea5ff, #2563eb);
}

.bubble-a::after {
  left: 1rem;
  border-color: #2563eb transparent transparent transparent;
}

.bubble-b {
  right: .75rem;
  top: 2.25rem;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
}

.bubble-b::after {
  right: 1rem;
  border-width: 12px 0 0 10px;
  border-color: #9333ea transparent transparent transparent;
}

.arrow {
  position: absolute;
  color: #5b4be8;
  font-size: 2.875rem;
  font-weight: 700;
  line-height: 1;
}

.arrow-top {
  top: 0;
  left: 4.75rem;
  transform: rotate(24deg);
}

.arrow-bottom {
  bottom: -.9375rem;
  left: 3.4375rem;
  transform: rotate(70deg);
}



/* ------------------------------
   Chat Layout
   ------------------------------ */
.chat-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 2.5rem;
  margin-top: 0;
  padding: 0 1rem;
}

.conversation {
  margin: 1.25rem 0;
}

.empty-chat-note {
  padding: .5rem 1rem;
  border: 1px #666 dashed;
  border-radius: .375rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}


/* ------------------------------
   Message
   ------------------------------ */
.message {
  display: flex;
  align-items: center;
  gap: .375rem;
  margin: .625rem 0;
}

.message.me {
  justify-content: flex-end;
}

.message.them {
  justify-content: flex-start;
}

.message.me .regret {
  order: -1;
}

.message-bubble {
  min-width: 50%;
  max-width: 70%;
  padding: .625rem .875rem;
  border-radius: .75rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.message.me .message-bubble {
  background: #dff0ff;
  border: 1px solid #bcdfff;
}

.message.them .message-bubble {
  background: #f2f2f2;
  border: 1px solid #dddddd;
}

.message-bubble img {
  display: block;
  max-width: 13.75rem;
  margin-top: .4rem;
  border-radius: .375rem;
}

.message-text {
  white-space: pre-wrap;
}

/* ------------------------------
   Regret / Undo
   ------------------------------ */
.message .regret {
  order: 1;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.message:has(.message-bubble:hover) .regret,
.message .regret:hover {
  opacity: 1;
  transform: scale(1);
}

.message .regret a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  font-size: .8125rem;
  line-height: 1;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.08);
}

.message .regret a:hover {
  background: rgba(0, 0, 0, 0.16);
}



/* ------------------------------
   Timestamp
   ------------------------------ */
.message .timestamp {
  display: block;
  width: fit-content;

  font-size: 80%;
  color: #666;

  margin-top: .25rem;
  opacity: 0;
  transform: translateY(-2px);
  transition:
    opacity .15s ease,
    transform .15s ease;
}

.timestamp > div {
  line-height: 1.35;
}


.timestamp-lines {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: .75ch;
  width: fit-content;
  line-height: 1.35;
}

.timestamp-lines span {
  white-space: nowrap;
}

.timestamp-hint {
  display: block;
  margin-top: .2rem;
}

.timestamp-hint {
  display: block;
  margin-top: .2rem;
}

.message-bubble:hover .timestamp {
  opacity: 1;
  transform: translateY(0);
}


/* ------------------------------
   Message Form
   ------------------------------ */
form.form-message {
  z-index: auto;
}

form.form-message textarea {
  width: 100%;
  height: 6rem;
}

form.form-message input[type="submit"] {
  width: 100%;
  margin: .33rem 0;
  padding: .5rem;
  border: 1px #0978b9 solid;
  border-radius: .375rem;
  background-color: #0ea5ff;
  color: #fff;
}

form.form-message input[type="file"] {
  display: none;
}

form.form-message label {
  display: block;
  width: 100%;
  margin: 0;
  padding: .5rem;
  border-radius: .375rem;
  /* background-color: #ccc; */
  color: #000;
  text-align: left;
}



/* ------------------------------
   Headings
   ------------------------------ */
h2 {
  margin: .5rem 0;
  padding: 0;
  font-size: 1.2rem;
}


/* ------------------------------
   Profile Page
   ------------------------------ */
.profile-panel {
  margin-top: 1rem;
}

.profile-box h2 {
  margin: 0 0 1rem;
}

.profile-box form {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: .625rem .75rem;
  align-items: center;
  max-width: 26.25rem;
}

.profile-box label {
  font-weight: 600;
}

.profile-box input[type="text"],
.profile-box input[type="email"],
.profile-box input[type="tel"],
.profile-box select {
  width: 100%;
  padding: .4375rem .5625rem;
  border: 1px solid #c8ccd4;
  border-radius: .5rem;
  font: inherit;
}

.profile-box button {
  border: 0;
  background: #111827;
  color: #fff;
  cursor: pointer;
}

.profile-box button:hover {
  opacity: 0.9;
}

.profile-actions {
  grid-column: 2;
  display: flex;
  gap: .625rem;
}

.profile-actions.topmargin {
  margin-top: 1.5rem;
}



/* ------------------------------
   Invite panel
   ------------------------------ */

/* ------------------------------
   Buttons
   ------------------------------ */
.button,
.profile-box button {
  padding: .5rem .875rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.secondary-button {
  background: #e5e7eb;
  color: #111827;
}


/* ------------------------------
   Contacts
   ------------------------------ */
button#new-contact {
  background-color: rgb(18, 126, 18);
  color: #eee;
  margin: 1rem 0;
  padding: .33rem .66rem;
  border: none;
  border-radius: 999px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px solid #ddd;
}

.contact-info span {
  margin-right: 1rem;
}


.contact-actions a {
  color: #c00;
  text-decoration: none;
}

.contact-actions a:hover {
  text-decoration: underline;
}


/* ------------------------------
   Navigation Links
   ------------------------------ */
nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px #ccc solid;
}

nav li {
  flex: 1;
  text-align: center;
  position: relative;
  margin: 0;
  padding: 0;
}

nav li:not(:last-child)::after {
  content: "|";
  position: absolute;
  top: 2px;
  right: 0;
}

nav a {
  display: block;
  color: #333;
  text-decoration: none;
  margin: 0;
  padding: .33rem 0;
}

nav li.active a {
  color: #000;
  font-weight: 600;
}

nav i {
  font-style: normal;
  font-weight: 700;
  color: #a10;
  margin-left: .33rem;
}



/* ------------------------------
   Spinner Overlay
   ------------------------------ */
#spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 9998;
}

#spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9999;
  padding: .75rem 1rem;
  border-radius: .5rem;
  background-color: rgba(194, 89, 19, 0.9);
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%);
}

#spinner-overlay.hidden {
  display: none;
}

.spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 3px solid #ddd;
  border-top-color: #555;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}



/* ------------------------------
   Footer
   ------------------------------ */
footer {
  position: fixed;
  bottom: 0;
  width: 45rem;
  background-color: #ffa;
  margin: 0;
  padding: 0;
}


/* ------------------------------
   Toast Info
   ------------------------------ */
.toast-info {
  margin: 0 0 1rem;
  padding: .5rem;
  border: 1px solid #b8dcc8;
  border-left: 5px solid #39a96b;
  border-radius: .75rem;
  background: #eefaf3;
  color: #225c3a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  animation:
    toast-fade-in 0.25s ease-out,
    toast-fade-out 0.5s ease-in 4s forwards;
}


@keyframes toast-fade-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-fade-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}