﻿:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #687078;
  --line: #dcded8;
  --accent: #276f64;
  --accent-strong: #1f5a51;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a.button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 10px 16px;
  text-decoration: none;
}

button:hover,
a.button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: .6;
}

button.secondary,
button.ghost {
  background: #e8ebe4;
  color: var(--ink);
}

button.ghost {
  padding: 8px 12px;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

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

.auth-panel,
.panel,
.chat-panel,
.sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 28px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

.muted,
.hint {
  color: var(--muted);
  margin: 8px 0 0;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #384047;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.form-message {
  color: var(--danger);
  min-height: 20px;
  margin: 0;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar nav {
  align-items: center;
  display: flex;
  gap: 10px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

.sidebar {
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(430px, 1fr) auto auto;
  min-height: calc(100vh - 130px);
  overflow: hidden;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
}

.message {
  border-radius: 8px;
  line-height: 1.6;
  max-width: 82%;
  padding: 12px 14px;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #dbeee9;
}

.message.assistant {
  align-self: flex-start;
  background: #f0f1ed;
}

.composer {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 14px;
}

.composer-input {
  display: grid;
  gap: 8px;
}

.composer-actions {
  align-content: end;
  display: grid;
  gap: 8px;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.attachment-chip {
  align-items: center;
  background: #eef1ea;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px;
}

.attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip button {
  background: transparent;
  color: var(--danger);
  padding: 0 4px;
}
.image-attachment {
  align-items: flex-start;
  display: grid;
  grid-template-columns: 88px minmax(90px, 1fr) auto;
  max-width: min(360px, 100%);
  padding: 8px;
}

.image-attachment img {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 66px;
  object-fit: cover;
  width: 88px;
}

.image-attachment span {
  align-self: center;
  white-space: normal;
  word-break: break-word;
}

.image-attachment button {
  align-self: start;
}


.history-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.history-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.conversation-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.conversation-item {
  background: #f4f6f1;
  border: 1px solid var(--line);
  color: var(--ink);
  overflow: hidden;
  padding: 8px 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item.active {
  background: #dbeee9;
  border-color: #b8d8d0;
}

.conversation-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 2px;
}
.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.panel.narrow {
  grid-column: 1 / -1;
}

.stacked-form {
  display: grid;
  gap: 12px;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.check-row input {
  width: auto;
}
.search-toggle {
  background: #f4f6f1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}


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

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button {
  padding: 7px 10px;
}
@media (max-width: 820px) {
  .chat-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: calc(100vh - 260px);
  }

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

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