﻿:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #19201f;
  --muted: #66706d;
  --panel: #fffdf7;
  --line: #d9d1c3;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --warm: #c76b3a;
  --shadow: 0 18px 55px rgba(35, 31, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 36%),
    radial-gradient(circle at 85% 15%, rgba(199, 107, 58, 0.18), transparent 28%),
    var(--bg);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.chat-panel,
.file-panel {
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: calc(100vh - 32px);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--warm);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}


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

.device-button,
.copy-message {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 8px;
  color: var(--accent-dark);
  background: #f4fbf8;
  font-size: 13px;
  font-weight: 700;
}

.device-button:hover,
.copy-message:hover {
  border-color: var(--accent);
  background: #e8f7f2;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.message.own .copy-message {
  border-color: rgba(255, 255, 255, 0.4);
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.device-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.device-dialog::backdrop {
  background: rgba(17, 24, 22, 0.45);
}

.device-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.device-dialog h2 {
  font-size: 20px;
}

.device-dialog p {
  color: var(--muted);
  font-size: 14px;
}

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

.dialog-actions button {
  min-height: 36px;
  padding: 8px 14px;
}
.status {
  min-width: 72px;
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: var(--muted);
  text-align: center;
  font-size: 13px;
}

.status.ok {
  background: var(--accent);
}

.status.bad {
  background: #b42318;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.message {
  max-width: 78%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 8px;
  background: #ece7db;
  border: 1px solid rgba(25, 32, 31, 0.08);
}

.message.own {
  margin-left: auto;
  color: white;
  background: var(--accent);
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  opacity: 0.78;
}

.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.file-link {
  display: inline-flex;
  max-width: 100%;
  margin-top: 8px;
  color: inherit;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}


.file-panel {
  height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}
#uploadHint {
  color: var(--muted);
  font-size: 13px;
}

.upload-progress {
  position: relative;
  min-height: 30px;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: #eff8f5;
}

.upload-progress-bar {
  width: 0;
  height: 100%;
  min-height: 30px;
  background: rgba(15, 118, 110, 0.24);
  transition: width 120ms ease;
}

.upload-progress span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.files {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
}

.file-item {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.file-preview {
  margin-bottom: 10px;
}

.thumb-button {
  display: block;
  width: 100%;
  height: 116px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f4ed;
}


.thumb-error {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-name {
  margin-bottom: 5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-size {
  color: var(--muted);
  font-size: 13px;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.file-actions a,
.plain-action,
.danger-action {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 8px;
  color: var(--accent-dark);
  background: #f4fbf8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.plain-action,
.danger-action {
  cursor: pointer;
}

.file-actions a:hover,
.plain-action:hover {
  border-color: var(--accent);
  background: #e8f7f2;
}

.danger-action {
  border-color: rgba(180, 35, 24, 0.25);
  color: #9f1d14;
  background: #fff5f3;
}

.danger-action:hover {
  border-color: #b42318;
  background: #ffe8e4;
}

.preview-modal[hidden] {
  display: none;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 22, 0.72);
}

.preview-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.preview-panel header {
  padding: 12px 14px;
}

.preview-panel h2 {
  max-width: min(680px, calc(100vw - 140px));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.preview-close {
  min-height: 34px;
  padding: 7px 12px;
}

.preview-panel img {
  max-width: 100%;
  max-height: calc(100vh - 118px);
  object-fit: contain;
  display: block;
  margin: auto;
  background: #111816;
}

@media (max-width: 860px) {
  .shell {
    height: auto;
    grid-template-columns: 1fr;
  }

  .chat-panel,
  .file-panel {
    height: auto;
    min-height: auto;
  }

  .chat-panel {
    min-height: 70vh;
  }

  .files {
    max-height: none;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 92%;
  }
}








