.quota-card,
.panel {
  padding: clamp(1rem, 1.5vw, 1.3rem);
}

.work-area {
  display: grid;
  font-size: 0.86rem;
  gap: 1rem;
  grid-template-rows: minmax(0, 1fr);
}

.work-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(251, 252, 249, 0.94)),
    var(--color-panel-solid);
  min-height: 0;
  overflow: auto;
}

.agent-chat {
  background: #ffffff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.floating-chat {
  background: #ffffff;
  border: 0;
  border-left: 1px solid #e4e7ec;
  bottom: 0;
  box-sizing: border-box;
  box-shadow: -16px 0 36px rgba(16, 24, 40, 0.12);
  height: calc(100vh - 3.25rem);
  position: fixed;
  right: 0;
  top: 3.25rem;
  width: min(36rem, 100vw);
  z-index: 35;
}

.chat-toggle {
  align-items: center;
  background: #2563eb;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.18);
  color: #fff;
  display: inline-flex;
  height: 2.75rem;
  justify-content: center;
  padding: 0;
  position: fixed;
  right: 0;
  top: 50%;
  touch-action: none;
  transform: translateY(-50%);
  user-select: none;
  width: 2.75rem;
  z-index: 40;
}

.chat-toggle svg,
.chat-heading-icon svg {
  fill: none;
  height: 1.15rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 1.15rem;
}

.chat-toggle.open {
  display: none;
}

.chat-header {
  align-items: center;
  border-bottom: 1px solid #e4e7ec;
  display: flex;
  justify-content: space-between;
  min-height: 4rem;
  padding: 0 1rem;
}

.chat-heading {
  align-items: center;
  display: flex;
  gap: 0.7rem;
}

.chat-heading-icon {
  align-items: center;
  background: #eff4ff;
  border-radius: 5px;
  color: #2563eb;
  display: inline-flex;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.chat-heading h2 {
  color: #182230;
  font-size: 0.9rem;
  line-height: 1.2;
  margin: 0;
}

.chat-heading p {
  color: #667085;
  font-size: 0.7rem;
  margin: 0.18rem 0 0;
}

.chat-close {
  background: transparent;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  color: #667085;
  font-size: 1.2rem;
  height: 2rem;
  min-height: 2rem;
  padding: 0;
  width: 2rem;
}

.chat-close:hover {
  background: #f2f4f7;
  box-shadow: none;
  color: #182230;
  transform: none;
}

.chat-log {
  align-content: start;
  background: #f8fafc;
  display: grid;
  gap: 0.75rem;
  overflow: auto;
  padding: 1rem;
}

.chat-message {
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  color: #344054;
  font-size: 0.8rem;
  line-height: 1.55;
  max-width: 88%;
  padding: 0.55rem 0.8rem;
  white-space: pre-wrap;
}

.chat-message.user {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  justify-self: end;
}

.chat-message.assistant {
  background: #ffffff;
  justify-self: start;
}

.chat-form {
  background: #ffffff;
  border-top: 1px solid #e4e7ec;
  display: block;
  padding: 0.8rem;
}

.chat-composer {
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  display: grid;
  gap: 0.5rem;
  padding: 0.45rem;
}

.chat-composer textarea {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  min-height: 3.25rem;
  outline: none;
  padding: 0.45rem 0.5rem;
  resize: none;
}

.chat-actions,
.actions,
.overview-grid,
.admin-grid {
  display: grid;
  gap: 1rem;
}

.chat-actions {
  align-items: center;
  gap: 0.45rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.chat-actions button {
  background: #2563eb;
  border: 1px solid #2563eb;
  border-radius: 5px;
  box-shadow: none;
  height: 2.25rem;
  padding: 0.45rem 0.7rem;
  white-space: nowrap;
}

.chat-message .inline-actions button {
  border-radius: 5px;
  box-shadow: none;
  min-height: 2rem;
  padding: 0.4rem 0.65rem;
}

.chat-message .inline-actions .chat-action-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.chat-message .inline-actions .chat-action-secondary {
  background: #ffffff;
  border-color: #d0d5dd;
  color: #344054;
}

.file-control {
  align-items: center;
  background: #f9fafb;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  color: #344054;
  font-size: 1.1rem;
  font-weight: 500;
  height: 2.25rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 2.25rem;
}

.file-control input {
  display: none;
}

.pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pending-file {
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e4e7ec;
  border-radius: 5px;
  display: inline-flex;
  gap: 0.45rem;
  max-width: 14rem;
  padding: 0.45rem 1.6rem 0.45rem 0.55rem;
  position: relative;
}

.pending-file-icon {
  align-items: center;
  background: #344054;
  border-radius: 4px;
  color: #fff;
  display: inline-flex;
  font-size: 0.62rem;
  height: 1.8rem;
  justify-content: center;
  text-transform: uppercase;
  width: 1.8rem;
}

.pending-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-file-remove {
  align-items: center;
  background: #344054;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.72rem;
  height: 1.25rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: -0.25rem;
  top: -0.25rem;
  width: 1.25rem;
}

.overview-grid,
.admin-grid,
.site-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.overview-grid article,
.admin-grid article,
.site-card,
.event-log {
  padding: 1rem;
}

.site-summary article {
  padding: 0.95rem;
}

.site-summary {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-top: 0;
}

.site-summary h3 {
  color: #69775f;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.site-summary p {
  margin: 0;
  overflow-wrap: anywhere;
}

.site-list {
  display: grid;
  gap: 0.75rem;
}

.site-card {
  border: 1px solid transparent;
  display: grid;
  gap: 0.75rem;
}

.site-card.selected {
  border-color: #17251e;
}

.inline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  grid-template-columns: none;
}

.review-panel {
  background: #f1f6ef;
  border: 1px solid rgba(19, 32, 26, 0.1);
  border-radius: 1.25rem;
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding: 1rem;
}

.compact-heading {
  gap: 0.25rem;
}

.compact-heading h3 {
  margin: 0;
}

.review-state {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-state article {
  background: #f7f8f3;
  border-radius: 0.9rem;
  padding: 0.8rem;
}

.review-state h4 {
  color: #69775f;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.review-state p {
  margin: 0;
  overflow-wrap: anywhere;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  grid-template-columns: none;
}

.review-change-form {
  gap: 0.65rem;
}

.event-log {
  color: #405047;
  line-height: 1.5;
  margin-top: 0.8rem;
  overflow: auto;
  white-space: pre-wrap;
}

.eyebrow {
  color: #69775f;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
}

.form-grid,
.section-heading {
  display: grid;
  gap: 1rem;
}

.site-summary h3,
.review-state h4,
.eyebrow {
  color: var(--color-subtle);
  letter-spacing: 0.09em;
}

.site-summary p,
.review-state p {
  color: var(--color-ink);
  font-size: 0.98rem;
  font-weight: 700;
}

.site-summary-actions {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  grid-column: 1 / -1;
  grid-template-columns: none;
  margin-top: 0.25rem;
  padding-top: 0.85rem;
}

.actions {
  gap: 0.55rem;
}

#site-agent-events:empty {
  display: none;
}

@media (max-width: 900px) {
  .topbar,
  .workspace,
  .overview-grid,
  .admin-grid,
  .site-summary,
  .inquiry-layout,
  .inquiry-form,
  .review-state {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace {
    height: auto;
  }

  .geo-actions-list li,
  .geo-review-item {
    align-items: stretch;
    display: grid;
  }

  .floating-chat {
    height: calc(100vh - 3.25rem);
    width: min(100vw, 36.25rem);
  }

}

@media (max-width: 720px) {
  .console-mode .floating-chat {
    height: calc(100vh - 5.4rem);
    top: 5.4rem;
  }

  .site-summary {
    grid-template-columns: 1fr;
  }

  .chat-toggle {
    bottom: 1rem;
    height: 2.75rem;
    top: auto;
    transform: none;
    width: 2.75rem;
  }
}
