:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea,
.button-link {
  font: inherit;
}

button,
.button-link {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: #1f7a4d;
  color: white;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

button.secondary,
.button-link.secondary {
  background: #e7ecef;
  color: #1b2733;
}

button.danger {
  background: #b42318;
  color: white;
}

button.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

button.link-button {
  min-height: 0;
  padding: 0;
  background: transparent;
  color: #1f7a4d;
  font-weight: 750;
  text-align: left;
}

button.link-button:hover {
  text-decoration: underline;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  padding: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: #40515f;
  font-size: 14px;
  font-weight: 600;
}

h1 {
  margin: 0 0 18px;
  font-size: 22px;
}

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

.panel {
  background: white;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(20, 35, 45, 0.04);
}

.auth-panel {
  width: min(420px, 100%);
}

.brand {
  margin-bottom: 12px;
  color: #1f7a4d;
  font-weight: 800;
}

.stack {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none !important;
}

.message {
  min-height: 20px;
  margin: 14px 0 0;
  color: #b42318;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid #dce3e8;
  background: white;
}

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

.topbar span {
  color: #64717c;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

.sidebar-stack {
  display: grid;
  gap: 20px;
}

.helper {
  margin: 12px 0 0;
  color: #64717c;
  font-size: 13px;
}

.compact-page {
  width: 100%;
  padding: 0;
  margin: 20px 0 0;
}

.section-gap {
  margin-top: 20px;
}

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

.page-header h1 {
  margin: 0 0 6px;
}

.page-header p {
  margin: 0;
  color: #64717c;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.summary-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #e8edf1;
  border-radius: 6px;
  background: #f8fafb;
}

.summary-item span {
  color: #64717c;
  font-size: 12px;
  text-transform: uppercase;
}

.summary-item strong {
  font-size: 16px;
}

.checkbox-list {
  display: grid;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #e8edf1;
  border-radius: 6px;
}

.checkbox-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #e8edf1;
  color: #17202a;
  font-weight: 500;
}

.checkbox-row:last-child {
  border-bottom: 0;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

.asset-list {
  display: grid;
  gap: 14px;
}

.asset-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e8edf1;
  border-radius: 8px;
  background: #f8fafb;
}

.asset-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #52616d;
}

.asset-preview-wrap {
  white-space: pre-wrap;
}

.asset-preview {
  display: block;
  width: 100%;
  max-width: 360px;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid #dce3e8;
  border-radius: 6px;
  background: white;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #e8edf1;
  text-align: left;
}

th {
  color: #52616d;
  font-size: 12px;
  text-transform: uppercase;
}

.status-line {
  padding: 14px;
  border-radius: 6px;
  background: #eef6f2;
  color: #163f2c;
  font-weight: 650;
}

.qr-wrap {
  margin-top: 18px;
}

.qr-wrap img {
  width: 260px;
  height: 260px;
  border: 1px solid #dce3e8;
  border-radius: 8px;
}

.empty-state {
  color: #64717c;
  padding: 14px 0;
}

.chat-list {
  display: grid;
  gap: 12px;
}

.chat-message {
  width: fit-content;
  max-width: min(680px, 100%);
  padding: 12px;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  background: white;
}

.chat-message.outbound {
  margin-left: auto;
  background: #eef6f2;
  border-color: #c9e6d7;
}

.chat-body {
  white-space: pre-wrap;
  line-height: 1.45;
}

.chat-meta {
  margin-top: 8px;
  color: #64717c;
  font-size: 12px;
}

.chat-media {
  display: block;
  width: 100%;
  max-width: 320px;
  max-height: 420px;
  object-fit: contain;
  margin-top: 10px;
  border: 1px solid #dce3e8;
  border-radius: 6px;
  background: #f8fafb;
}

.media-link {
  display: inline-flex;
  margin-top: 10px;
  color: #1f7a4d;
  font-weight: 650;
}

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

  .topbar {
    padding: 0 14px;
  }

  .page {
    padding: 14px;
  }

  .page-header {
    display: grid;
  }
}
