
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #f0f3f7;
  --border: #d8dde5;
  --text: #17202a;
  --muted: #647184;
  --accent: #166d59;
  --accent-strong: #0f4f41;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(32, 43, 54, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

a {
  color: inherit;
}

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

.login-panel {
  width: min(100%, 380px);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

h1,
h2,
p {
  margin: 0;
}

.login-panel h1 {
  margin-top: 14px;
  font-size: 24px;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 109, 89, 0.12);
}

button,
.ghost-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.ghost-button {
  background: #ffffff;
  color: var(--accent-strong);
}

.form-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.product {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product h1 {
  font-size: 18px;
  line-height: 1.2;
}

.product p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 14px;
}

.status-panel,
.chat-surface {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-panel {
  padding: 16px;
}

.status-panel h2 {
  font-size: 15px;
  line-height: 1.2;
}

.status-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--panel-soft);
  padding-bottom: 8px;
}

.status-list dt,
.status-list dd {
  margin: 0;
  font-size: 13px;
}

.status-list dt {
  color: var(--muted);
}

.status-list dd {
  max-width: 55%;
  text-align: right;
  overflow-wrap: anywhere;
  font-weight: 700;
}

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

.messages {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  overflow: auto;
}

.message {
  width: min(780px, 100%);
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.message.user {
  justify-self: end;
  background: #edf7f4;
  border-color: #c7e3db;
}

.message.error {
  border-color: #f3b4ad;
  color: var(--danger);
}

.message-meta {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.message p,
.message pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.5;
}

.composer {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.composer-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.composer-row label {
  width: min(220px, 100%);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.status-json {
  min-height: 320px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  background: #101820;
  color: #d8f3e8;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 800px) {
  .topbar,
  .top-actions,
  .composer-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 14px;
  }

  .workspace,
  .admin-layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .chat-surface {
    min-height: 70vh;
  }

  .composer-row label {
    width: 100%;
  }
}
