:root {
  --bg: #e5e8ed;
  --surface: #f4f6f9;
  --surface-2: #eef1f5;
  --line: #d8dde5;
  --line-strong: #c9cfda;
  --text: #1b1f24;
  --text-sub: #55606f;
  --shadow: 0 14px 32px rgba(20, 28, 40, 0.08);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

body {
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Pretendard", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.bmd-app {
  min-height: 100vh;
  display: flex;
}

.bmd-sidebar-backdrop {
  display: none;
}

.bmd-sidebar {
  width: 280px;
  border-right: 1px solid var(--line);
  background: #dfe4ec;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 14px;
}

.bmd-sidebar.is-collapsed {
  display: none;
}

.bmd-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bmd-side-title {
  font-size: 12px;
  color: #556171;
  letter-spacing: 0.02em;
}

.bmd-side-close {
  border: 1px solid var(--line-strong);
  background: #f1f4f8;
  color: #2f3844;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.bmd-side-new,
.bmd-side-clear {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #f1f4f8;
  padding: 10px 12px;
  font-size: 13px;
  color: #2e3641;
  text-align: left;
  cursor: pointer;
}

.bmd-side-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bmd-conv-item {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #2f3844;
  text-align: left;
  padding: 10px 11px;
  cursor: pointer;
}

.bmd-conv-item:hover {
  background: #edf1f6;
  border-color: #d5dce7;
}

.bmd-conv-item.is-active {
  background: #f7f9fc;
  border-color: #cfd8e5;
}

.bmd-conv-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.bmd-conv-date {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #677587;
}

.bmd-shell {
  flex: 1;
  min-width: 0;
  position: relative;
  padding-bottom: 182px;
}

.bmd-topbar {
  height: 62px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bmd-topbar-left,
.bmd-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bmd-icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.bmd-icon-btn span {
  width: 14px;
  height: 1.8px;
  background: #3a4453;
  border-radius: 99px;
  display: block;
}

.bmd-brand {
  color: #3b4554;
  text-decoration: none;
  font-size: 33px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bmd-home-link {
  color: #3f4855;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.bmd-auth-btn {
  height: 32px;
  border: 1px solid var(--line-strong);
  background: #f2f5f9;
  color: #2f3846;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
}

.bmd-login-indicator {
  height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #c5ccd7;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  background: #edf0f4;
  color: #435163;
}

.bmd-login-indicator.is-in {
  background: #e8f0e8;
  border-color: #a9c2a9;
  color: #2d5b2d;
}

.bmd-login-indicator.is-out {
  background: #f2f3f6;
  border-color: #c9cfda;
  color: #546273;
}

.bmd-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font-size: 13px;
  font-weight: 700;
}

.bmd-auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: rgba(11, 16, 23, 0.34);
}

.bmd-auth-backdrop.is-hidden {
  display: none;
}

.bmd-auth-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 59;
  width: min(420px, calc(100% - 24px));
  border: 1px solid #cfd4dc;
  border-radius: 18px;
  background: #f3f4f6;
  box-shadow: 0 18px 42px rgba(15, 20, 28, 0.2);
  padding: 18px 16px 14px;
}

.bmd-auth-panel.is-hidden {
  display: none;
}

.bmd-auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bmd-auth-title {
  margin: 0;
  font-size: 40px;
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.bmd-auth-subtitle {
  margin: 12px 0 0;
  color: #495465;
  font-size: 20px;
  line-height: 1.45;
}

.bmd-auth-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1f2530;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.bmd-auth-status {
  margin: 8px 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #4d596b;
}

.bmd-auth-status.is-error {
  color: #8e2a2a;
}

.bmd-auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bmd-auth-label {
  font-size: 14px;
  color: #2d3541;
  font-weight: 600;
}

.bmd-auth-input {
  border: 1px solid #9aa4b2;
  border-radius: 999px;
  background: #fff;
  min-height: 48px;
  padding: 0 18px;
  font-size: 16px;
  color: #1f2934;
}

.bmd-auth-submit,
.bmd-auth-logout {
  margin-top: 8px;
  min-height: 50px;
  border-radius: 999px;
  border: 1px solid #05070a;
  background: #05070a;
  color: #fff;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.bmd-auth-logout {
  background: #e7eaef;
  color: #26313f;
  border-color: #b6c0cd;
  font-size: 15px;
  min-height: 42px;
}

.bmd-auth-divider {
  display: flex;
  align-items: center;
  margin: 14px 0 6px;
  color: #5b6674;
  font-size: 13px;
}

.bmd-auth-divider::before,
.bmd-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #c8ced8;
}

.bmd-auth-divider span {
  margin: 0 12px;
}

.bmd-main {
  max-width: 860px;
  margin: 64px auto 0;
  padding: 0 20px;
}

.bmd-hero {
  max-width: 560px;
}

.bmd-hero.is-hidden {
  display: none;
}

.bmd-greeting {
  margin: 0;
  font-size: 39px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.bmd-title {
  margin: 10px 0 22px;
  font-size: 60px;
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.bmd-chip-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.bmd-chip {
  width: fit-content;
  border: 1px solid #d7dde6;
  background: #f4f6f9;
  color: #3f4956;
  border-radius: var(--radius-pill);
  padding: 11px 16px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.bmd-chip:hover {
  background: #eef2f6;
}

.bmd-thread {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bmd-msg {
  max-width: 780px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.bmd-msg.user {
  align-self: flex-end;
  background: #f8fafc;
}

.bmd-msg.assistant {
  align-self: flex-start;
  background: #eef2f7;
}

.bmd-msg-meta {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: #6b7787;
}

.bmd-msg-loading {
  font-style: italic;
  color: #5d6877;
}

.bmd-composer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px 18px 12px;
}

.bmd-composer textarea {
  width: 100%;
  resize: none;
  border: 0;
  background: transparent;
  color: #212832;
  font: inherit;
  font-size: 30px;
  line-height: 1.22;
  outline: none;
  overflow: hidden;
}

.bmd-composer textarea::placeholder {
  color: #6f7885;
}

.bmd-file-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bmd-file-chip {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: #eef2f7;
  color: #2f3846;
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: 12px;
}

.bmd-file-chip-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bmd-file-chip-remove {
  border: 0;
  background: transparent;
  color: #4d5969;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.bmd-compose-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bmd-compose-left,
.bmd-compose-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bmd-tool-btn,
.bmd-send-btn,
.bmd-model-select {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: #2f3846;
  border-radius: var(--radius-pill);
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.bmd-tool-btn {
  cursor: pointer;
  min-width: 92px;
}

.bmd-model-select {
  min-width: 152px;
  max-width: 188px;
}

.bmd-send-btn {
  background: #20242b;
  border-color: #20242b;
  color: #fff;
  cursor: pointer;
}

.bmd-send-btn:disabled {
  background: #6f7783;
  border-color: #6f7783;
  cursor: default;
}

.bmd-tool-btn:disabled,
.bmd-model-select:disabled,
.bmd-composer textarea:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 1024px) {
  .bmd-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 24;
    background: rgba(30, 38, 50, 0.24);
  }

  .bmd-sidebar-backdrop.is-visible {
    display: block;
  }

  .bmd-sidebar {
    position: fixed;
    z-index: 25;
    left: 0;
    top: 0;
    bottom: 0;
    width: 255px;
    box-shadow: 8px 0 26px rgba(12, 20, 32, 0.12);
  }

  .bmd-sidebar.is-collapsed {
    display: none;
  }

  .bmd-main {
    margin-top: 42px;
  }

  .bmd-title {
    font-size: 48px;
  }

  .bmd-composer textarea {
    font-size: 24px;
  }
}

@media (min-width: 1025px) {
  .bmd-side-close {
    display: none;
  }
}

@media (max-width: 640px) {
  .bmd-topbar {
    padding: 0 10px;
  }

  .bmd-login-indicator {
    display: none;
  }

  .bmd-brand {
    font-size: 26px;
  }

  .bmd-main {
    padding: 0 12px;
  }

  .bmd-greeting {
    font-size: 26px;
  }

  .bmd-title {
    font-size: 34px;
    margin: 8px 0 16px;
  }

  .bmd-auth-panel {
    padding: 16px 14px 12px;
  }

  .bmd-auth-title {
    font-size: 32px;
  }

  .bmd-auth-subtitle {
    font-size: 17px;
  }

  .bmd-auth-submit {
    font-size: 22px;
  }

  .bmd-chip {
    font-size: 13px;
  }

  .bmd-composer {
    width: calc(100% - 12px);
    bottom: 6px;
    border-radius: 24px;
    padding: 10px 11px 9px;
  }

  .bmd-composer textarea {
    font-size: 20px;
  }

  .bmd-tool-btn,
  .bmd-send-btn,
  .bmd-model-select {
    height: 30px;
    font-size: 12px;
  }

  .bmd-compose-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .bmd-compose-left,
  .bmd-compose-right {
    width: 100%;
    justify-content: space-between;
  }

  .bmd-compose-right {
    gap: 6px;
  }

  .bmd-model-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .bmd-file-chip-name {
    max-width: 140px;
  }

}
