:root {
  --bg-top: #f9f2ff;
  --bg-bottom: #eef6ff;
  --surface: rgba(255, 255, 255, 0.66);
  --surface-strong: rgba(255, 255, 255, 0.86);
  --line: rgba(255, 255, 255, 0.72);
  --line-soft: rgba(196, 208, 236, 0.78);
  --text: #25314d;
  --muted: #697896;
  --accent: #7f9bff;
  --accent-strong: #6685f4;
  --accent-soft: rgba(127, 155, 255, 0.16);
  --danger: #aa5565;
  --success: #2e6f62;
  --shadow: 0 30px 80px rgba(108, 128, 184, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    "SF Pro Display",
    "SF Pro Text",
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    "Malgun Gothic",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.95), transparent 24%),
    radial-gradient(circle at 78% 14%, rgba(159, 214, 255, 0.36), transparent 22%),
    radial-gradient(circle at 18% 82%, rgba(255, 207, 219, 0.3), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.app-mode {
  align-items: stretch;
  overflow: hidden;
  height: 100dvh;
  padding: 24px;
}

body.app-mode .page-shell {
  width: 100%;
  max-width: none;
  height: 100%;
}

.hidden {
  display: none !important;
}

.page-shell {
  position: relative;
  width: min(100%, 460px);
}

.auth-view,
.app-shell,
.register-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58)),
    var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
}

.auth-view::before,
.auth-view::after,
.register-card::before,
.register-card::after,
.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.auth-view::before,
.register-card::before,
.app-shell::before {
  top: -48px;
  right: -28px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(128, 158, 255, 0.3), transparent 72%);
}

.auth-view::after,
.register-card::after,
.app-shell::after {
  left: -56px;
  bottom: -76px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 201, 214, 0.26), transparent 72%);
}

.register-card,
.auth-view {
  padding: 34px 28px 24px;
}

.app-shell {
  width: 100%;
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 14px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.pane-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58)),
    var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
}

.pane-card::before,
.pane-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.pane-card::before {
  top: -48px;
  right: -28px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(128, 158, 255, 0.3), transparent 72%);
}

.pane-card::after {
  left: -56px;
  bottom: -76px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 201, 214, 0.26), transparent 72%);
}

.side-pane,
.chat-pane {
  padding: 22px 20px 96px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-header,
.profile-card,
.content-panel,
.bottom-nav,
.dialog-card {
  position: relative;
  z-index: 1;
}

.card-header {
  margin-bottom: 22px;
}

.card-header h1 {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.card-header p,
.field small,
.status-box,
.profile-subtitle,
.list-card__main span,
.empty-card p,
.dialog-header p {
  color: var(--muted);
}

.card-header p,
.dialog-header p,
.empty-card p {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.5;
}

.register-form,
.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-size: 0.9rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 1px solid rgba(202, 214, 241, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font: inherit;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.field input:focus {
  border-color: rgba(102, 133, 244, 0.9);
  box-shadow: 0 0 0 5px rgba(127, 155, 255, 0.18);
  transform: translateY(-1px);
}

.primary-button,
.ghost-button,
.icon-button,
.bottom-nav-button,
.request-banner {
  font: inherit;
}

.primary-button {
  margin-top: 6px;
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 36px rgba(110, 142, 250, 0.28);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 42px rgba(110, 142, 250, 0.34);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary-button--small {
  min-height: 46px;
  padding: 0 16px;
  margin-top: 0;
}

.primary-button--tiny {
  min-height: 36px;
  padding: 0 14px;
  margin-top: 0;
  border-radius: 14px;
}

.ghost-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  cursor: pointer;
}

.ghost-button--small {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 14px;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 180ms ease, opacity 180ms ease;
}

.secondary-link:hover {
  color: var(--text);
}

.status-box {
  margin-top: 4px;
  min-height: 24px;
  padding: 0 2px;
  background: transparent;
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-box[data-tone="error"] {
  color: var(--danger);
}

.status-box[data-tone="success"] {
  color: var(--success);
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.profile-title {
  margin: 10px 0 4px;
  font-size: 1.38rem;
  line-height: 1.08;
  word-break: break-all;
}

.profile-subtitle {
  margin: 0;
}

.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  cursor: pointer;
}

.icon-button svg,
.bottom-nav-button svg {
  width: 22px;
  height: 22px;
}

.request-banner {
  display: flex;
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  border: 0;
  border-radius: 18px;
  background: rgba(127, 155, 255, 0.18);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.content-panel {
  margin-top: 16px;
}

.chat-pane .content-panel {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-header h3,
.empty-card h3,
.dialog-header h3 {
  margin: 0;
  font-size: 1rem;
}

.list-card,
.empty-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.list-card--request {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: start;
}

.list-card--button {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.list-card--button:hover {
  border-color: rgba(127, 155, 255, 0.44);
  background: rgba(255, 255, 255, 0.82);
}

.avatar-slot {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(127, 155, 255, 0.22), rgba(255, 209, 222, 0.42));
  color: var(--text);
  font-weight: 700;
  flex: 0 0 auto;
}

.avatar-slot--profile {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  font-size: 1rem;
}

.avatar-slot--soft {
  background: rgba(127, 155, 255, 0.14);
}

.empty-card {
  display: grid;
  gap: 8px;
  justify-content: flex-start;
}

.list-card__main {
  display: grid;
  gap: 4px;
}

.list-card__main strong {
  font-size: 1.02rem;
  line-height: 1.24;
}

.list-card__main span {
  font-size: 0.95rem;
}

.list-card--button.is-selected {
  border-color: rgba(127, 155, 255, 0.46);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(127, 155, 255, 0.12);
}

.request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  grid-column: 2;
  margin-top: 12px;
}

.bottom-nav {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  z-index: 4;
}

.bottom-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.bottom-nav-button.is-active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
}

.side-nav {
  display: none;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.chat-header h3 {
  margin: 0 0 6px;
}

.chat-stage {
  margin-top: 14px;
  min-height: 0;
  flex: 1 1 auto;
}

.chat-surface {
  display: grid;
  grid-template-rows: auto minmax(240px, 1fr) auto;
  gap: 14px;
  min-height: 100%;
}

.chat-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
}

.chat-panel h3 {
  margin: 0 0 6px;
}

.chat-panel p {
  margin: 0;
  color: var(--muted);
}

.chat-surface__top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-surface__meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.chat-surface__meta strong {
  font-size: 1.05rem;
  line-height: 1.25;
}

.chat-surface__timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.chat-surface__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.chat-surface__input {
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(202, 214, 241, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font: inherit;
}

.dialog-shell {
  width: min(100% - 32px, 420px);
  border: 0;
  padding: 0;
  background: transparent;
}

.dialog-shell::backdrop {
  background: rgba(25, 33, 56, 0.22);
  backdrop-filter: blur(8px);
}

.dialog-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78)),
    var(--surface-strong);
  box-shadow: var(--shadow);
}

.dialog-header {
  display: grid;
  gap: 6px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.custom-select {
  position: relative;
}

.custom-select__trigger {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  border: 1px solid rgba(202, 214, 241, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.custom-select.is-open .custom-select__trigger {
  border-color: rgba(102, 133, 244, 0.9);
  box-shadow: 0 0 0 5px rgba(127, 155, 255, 0.18);
}

.custom-select__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 180ms ease;
}

.custom-select.is-open .custom-select__chevron {
  transform: rotate(-135deg) translateX(-1px);
}

.custom-select__menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.7)),
    var(--surface-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 5;
}

.custom-select.is-open .custom-select__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.custom-select__option {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.custom-select__option.is-selected {
  border-color: rgba(127, 155, 255, 0.3);
  background: rgba(127, 155, 255, 0.14);
}

.custom-select__option:hover {
  border-color: rgba(127, 155, 255, 0.24);
}

.member-picker {
  display: grid;
  gap: 10px;
}

.member-option {
  display: grid;
  grid-template-columns: auto 50px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.member-option input {
  width: 18px;
  height: 18px;
}

.member-option__text {
  display: grid;
  gap: 4px;
}

.member-option__text span {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (min-width: 1024px) {
  body.app-mode {
    padding: 24px;
  }

  .app-shell {
    width: 100%;
    grid-template-columns: minmax(360px, 0.92fr) minmax(0, 1.68fr);
    gap: 20px;
    align-items: stretch;
  }

  .bottom-nav {
    display: none;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.74);
    position: relative;
    z-index: 2;
  }

  .side-pane,
  .chat-pane {
    min-height: 0;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
  }

  .content-panel {
    flex: 1 1 auto;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  body {
    padding: 18px;
  }

  body.app-mode .page-shell {
    height: 100%;
  }

  .register-card,
  .auth-view {
    padding: 26px 18px 18px;
  }

  .app-shell {
    width: 100%;
    padding: 18px 16px 92px;
  }

  .profile-card,
  .list-card {
    align-items: flex-start;
  }

  .profile-card {
    padding: 14px 14px 12px;
  }

  .profile-identity {
    gap: 12px;
  }

  .avatar-slot--profile {
    width: 52px;
    height: 52px;
    border-radius: 18px;
  }

  .profile-title {
    margin-top: 8px;
    font-size: 1.22rem;
  }

  .request-actions,
  .dialog-actions {
    width: 100%;
    justify-content: stretch;
  }

  .request-actions > *,
  .dialog-actions > * {
    flex: 1 1 0;
  }

  .chat-surface__composer {
    grid-template-columns: 1fr;
  }
}
