:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  line-height: 1.5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.page-shell {
  width: min(980px, calc(100vw - 24px));
  display: grid;
  gap: 18px;
  padding: 16px 0 24px;
}
.brand-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.brand-logo {
  font-size: 1.4rem;
  font-weight: 700;
}
.brand-copy {
  color: #94a3b8;
}
.card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}
.auth-card,
.chat-card {
  min-height: 420px;
}
.card-header h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}
.card-header p {
  margin: 0;
  color: #94a3b8;
}
.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #111827;
  color: #e2e8f0;
  padding: 12px 14px;
  font: inherit;
}
textarea {
  resize: vertical;
}
.button {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
}
.button.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
}
.button.secondary {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}
.helper-text,
.small-text {
  color: #94a3b8;
  font-size: 0.9rem;
}
.message {
  min-height: 22px;
  color: #f8fafc;
  font-size: 0.95rem;
}
.hidden {
  display: none !important;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}
.chat-title {
  font-size: 1.3rem;
  font-weight: 700;
}
.chat-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
}
.chat-body {
  min-height: 360px;
  max-height: 60vh;
  overflow: auto;
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.message-block {
  padding: 14px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.12);
}
.message-block.self {
  border-color: rgba(59, 130, 246, 0.4);
}
.message-block strong {
  display: block;
  margin-bottom: 8px;
  color: #f8fafc;
}
.message-block time {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.82rem;
  color: #94a3b8;
}
.message-attachment {
  margin-top: 12px;
  display: block;
  color: #38bdf8;
  text-decoration: none;
  word-break: break-all;
}
.message-image {
  display: block;
  width: 100%;
  max-width: 360px;
  border-radius: 14px;
  margin-top: 12px;
  object-fit: cover;
}
.file-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.preview-frame {
  position: relative;
}
.preview-image {
  width: 100%;
  max-height: 240px;
  border-radius: 14px;
  object-fit: cover;
}
.preview-clear-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.24);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  z-index: 2;
}
.button.small {
  padding: 10px 14px;
  font-size: 0.9rem;
}
.compose-form {
  display: grid;
  gap: 14px;
}
.file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #111827;
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}
.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.page-footer {
  color: #94a3b8;
  text-align: center;
}
@media (max-width: 680px) {
  .page-shell {
    width: calc(100vw - 16px);
  }
}
