
:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --ink: #111111;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #111111;
  --accent-soft: #f3f4f6;
  --danger: #b42318;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --body: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --shadow: 0 12px 40px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell {
  min-height: 100vh;
  padding: 24px;
}

.frame {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 48px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.brand__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand__title {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  margin: 0;
}

.brand__meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
}

.control:focus,
.textarea:focus {
  border-color: var(--line-strong);
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  color: var(--ink);
}

.btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.btn--accent {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn--ghost {
  background: #ffffff;
}

.btn--dark {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.sessions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  max-height: 100%;
}

.session-card {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.session-card.is-active {
  border-color: var(--ink);
  background: var(--panel-soft);
}

.session-card__title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
}

.session-card__preview {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.session-card__meta {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.workspace {
  border-radius: 22px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.thread,
.composer,
.notice,
.login-card {
  border-radius: 18px;
}

.topbar {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.thread {
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.thread__body {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 4px 0;
}

.message {
  display: block;
  width: 100%;
}
.message--user { text-align: right; }

.bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 56px;
  max-width: min(78%, 760px);
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble__text {
  width: 100%;
}

.bubble__images {
  display: grid;
  gap: 8px;
  width: 100%;
}

.bubble__images:not(:first-child) {
  margin-top: 8px;
}

.bubble__image {
  display: block;
  max-width: min(100%, 320px);
  max-height: 360px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #ffffff;
}

.bubble__image img {
  display: block;
  width: 100%;
  height: auto;
}

.bubble__image--omitted {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.message--user .bubble {
  background: #111111;
  color: #ffffff;
  max-width: min(36%, 320px);
  border-bottom-right-radius: 6px;
}

.message--assistant .bubble,
.message--system .bubble {
  background: #f8fafc;
  color: var(--ink);
  border: 1px solid var(--line);
  max-width: min(76%, 760px);
  border-bottom-left-radius: 6px;
}

.message__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
}

.streaming {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.streaming__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ink);
}

.empty {
  margin: auto;
  max-width: 460px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
  padding: 24px;
}

.topbar__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
}

.topbar__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.composer {
  padding: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 14px;
}

.composer__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.composer__attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  min-height: 84px;
  padding: 0 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: #ffffff;
  color: var(--muted);
}

.composer__attachments input[type="file"] {
  display: none;
}

.attachment-chip {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ffffff;
}

.attachment-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-chip__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.88);
  color: #ffffff;
  padding: 0;
  line-height: 1;
}

.composer__row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: end;
}

.notice {
  padding: 14px 16px;
  border: 1px solid #f5c2c7;
  background: #fff6f7;
  color: var(--danger);
  line-height: 1.65;
}

.notice[data-tone="warn"] {
  border-color: #fde68a;
  background: #fffbe6;
  color: #92400e;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(560px, 100%);
  padding: 32px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card__title {
  margin: 0 0 10px;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.25;
  font-weight: 700;
}

.login-card__copy {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 20px;
}

.login-card__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.mono { font-family: var(--mono); }

@media (max-width: 1120px) {
  .frame {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell { padding: 12px; }
  .composer__row,
  .login-card__row {
    flex-direction: column;
  }
  .thread {
    padding: 12px;
  }
  .thread__body {
    padding-right: 0;
  }
  .bubble,
  .message--user .bubble,
  .message--assistant .bubble,
  .message--system .bubble {
    max-width: calc(100% - 8px);
  }
  .bubble__image {
    max-width: 100%;
  }
}
