:root {
  color-scheme: light;
  --blue: #165dff;
  --blue-hover: #0e42d2;
  --blue-soft: #e8f3ff;
  --cyan: #0fc6c2;
  --green: #00b42a;
  --green-soft: #e8ffea;
  --orange: #ff7d00;
  --orange-soft: #fff7e8;
  --red: #f53f3f;
  --red-soft: #ffece8;
  --text-1: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --line: #e5e6eb;
  --line-strong: #c9cdd4;
  --fill: #f7f8fa;
  --surface: #ffffff;
  --shadow: 0 10px 30px rgba(29, 33, 41, 0.08);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--fill);
}

body {
  margin: 0;
  color: var(--text-1);
  background: var(--fill);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.dropzone:focus-within {
  outline: 2px solid rgba(22, 93, 255, 0.32);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid rgba(229, 230, 235, 0.95);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  display: block;
}

.brand div {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 15px;
  line-height: 18px;
}

.brand span {
  color: var(--text-3);
  font-size: 11px;
  line-height: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button,
.icon-button,
.text-button {
  border: 0;
  cursor: pointer;
  transition:
    color 0.18s,
    border-color 0.18s,
    background 0.18s,
    transform 0.18s;
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
}

.button-primary {
  color: #fff;
  background: var(--blue);
}

.button-primary:hover {
  background: var(--blue-hover);
}

.button-secondary {
  border-color: var(--line);
  color: var(--text-1);
  background: #fff;
}

.button-secondary:hover {
  border-color: #94bfff;
  color: var(--blue);
  background: #f5f9ff;
}

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

.button svg {
  width: 16px;
  height: 16px;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-2);
  background: #fff;
}

.icon-button:hover {
  border-color: #94bfff;
  color: var(--blue);
}

.icon-button.is-spinning svg {
  animation: rotate 0.8s linear infinite;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--blue);
  background: transparent;
  white-space: nowrap;
}

.text-button svg {
  width: 15px;
  height: 15px;
}

.health-badge,
.reply-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid #b8e0bd;
  border-radius: 4px;
  color: #00851d;
  background: var(--green-soft);
  font-size: 12px;
}

.health-badge.is-loading {
  border-color: var(--line);
  color: var(--text-3);
  background: var(--fill);
}

.health-badge.is-down {
  border-color: #ffb9b0;
  color: #cb272d;
  background: var(--red-soft);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: 0.75;
}

.page-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.page-heading h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.3;
}

.page-heading > div > p:last-child {
  max-width: 720px;
  margin: 9px 0 0;
  color: var(--text-2);
  line-height: 1.7;
}

.account-summary {
  display: grid;
  min-width: 250px;
  gap: 4px;
  padding: 12px 15px;
  border-left: 3px solid var(--blue);
  background: rgba(255, 255, 255, 0.7);
}

.account-summary span,
.account-summary small {
  color: var(--text-3);
  font-size: 12px;
}

.account-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagnostic-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 12px 18px;
  border: 1px solid #b8e0bd;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #f2fff4;
}

.diagnostic-banner.has-warning {
  border-color: #ffcf8b;
  border-left-color: var(--orange);
  background: #fffaf0;
}

.diagnostic-banner.has-danger {
  border-color: #ffb9b0;
  border-left-color: var(--red);
  background: #fff5f2;
}

.banner-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #00851d;
  background: #d9f7df;
}

.has-warning .banner-icon {
  color: #c36200;
  background: #ffedc7;
}

.has-danger .banner-icon {
  color: #cb272d;
  background: #ffdcd6;
}

.diagnostic-banner strong {
  font-size: 14px;
}

.diagnostic-banner p {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.55;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.tool-panel,
.diagnostics-panel,
.history-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.tool-panel {
  padding: 24px;
}

.diagnostics-panel {
  position: sticky;
  top: 76px;
  overflow: hidden;
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.55;
}

.reply-chip .status-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

form {
  margin-top: 24px;
}

.form-field {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.form-field > span,
.form-field > legend {
  color: var(--text-1);
  font-size: 13px;
  font-weight: 600;
}

.form-field b {
  color: var(--red);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text-1);
  background: #fff;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 90px;
  padding: 10px 12px;
  line-height: 1.65;
  resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #94bfff;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #a9aeb8;
}

.field-hint {
  position: absolute;
  right: 9px;
  bottom: 8px;
  padding: 2px 4px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.category-option {
  display: grid;
  min-width: 0;
  min-height: 66px;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
  transition:
    border-color 0.18s,
    background 0.18s;
}

.category-option:hover {
  border-color: #94bfff;
}

.category-option.is-selected {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
  background: #f5f9ff;
}

.category-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.category-option span {
  font-weight: 600;
}

.category-option small {
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-actions {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 12px;
  margin: -12px 0 20px;
}

.analysis-result {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}

.analysis-result.is-warning {
  color: #b54708;
}

.analysis-result.is-danger {
  color: var(--red);
}

.dropzone {
  display: grid;
  min-height: 132px;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px dashed #a9b9d2;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-2);
  background: #f8faff;
  text-align: center;
  transition:
    border-color 0.18s,
    background 0.18s;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
}

.dropzone strong {
  font-size: 13px;
}

.dropzone small {
  color: var(--text-3);
  font-size: 11px;
}

.attachment-preview {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.attachment-preview img {
  width: 52px;
  height: 42px;
  border-radius: 3px;
  object-fit: cover;
}

.attachment-preview div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.attachment-preview strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview small {
  color: var(--text-3);
}

.privacy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
}

.privacy-row > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.privacy-row svg {
  width: 15px;
  height: 15px;
  color: var(--green);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.checkbox-label > span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: transparent;
  background: #fff;
}

.checkbox-label input:checked + span {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.checkbox-label svg {
  width: 13px;
  height: 13px;
  color: inherit;
}

.submit-row {
  display: flex;
  min-height: 48px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.submit-row p {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.submit-row p.is-error {
  color: var(--red);
}

.button-submit {
  min-width: 150px;
  min-height: 42px;
}

.number-tag {
  display: inline-grid;
  min-width: 35px;
  height: 28px;
  place-items: center;
  padding: 0 8px;
  border-radius: 4px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
}

.diagnostic-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 18px -20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--fill);
}

.diagnostic-stats div {
  display: grid;
  gap: 5px;
  padding: 13px 8px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.diagnostic-stats div:last-child {
  border-right: 0;
}

.diagnostic-stats span {
  color: var(--text-3);
  font-size: 10px;
}

.diagnostic-stats strong {
  font-size: 18px;
}

.diagnostic-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.diagnostic-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.diagnostic-item:last-child {
  border-bottom: 0;
}

.diagnostic-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diagnostic-item-head strong {
  font-size: 13px;
}

.diagnostic-item-head span {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 3px;
  color: #b54708;
  background: var(--orange-soft);
  font-size: 11px;
  text-align: center;
}

.diagnostic-item.is-danger .diagnostic-item-head span {
  color: #cb272d;
  background: var(--red-soft);
}

.diagnostic-item p {
  margin: 5px 0 0;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.55;
}

.diagnostic-empty {
  display: grid;
  justify-items: center;
  padding: 30px 10px 24px;
  text-align: center;
}

.diagnostic-empty > svg {
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  color: var(--green);
}

.diagnostic-empty p {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.55;
}

.quick-checks {
  margin: 16px -20px -20px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.quick-checks h3 {
  margin: 0 0 12px;
  font-size: 13px;
}

.quick-checks ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-checks li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 7px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.55;
}

.quick-checks li span {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 10px;
  font-weight: 700;
}

.history-section {
  margin-top: 18px;
  padding: 24px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-3);
  font-size: 11px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.open {
  background: var(--orange);
}

.legend-dot.answered {
  background: var(--green);
}

.legend-dot.closed {
  background: var(--text-3);
}

.ticket-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.ticket-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.ticket-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 14px;
  border: 0;
  cursor: pointer;
  color: inherit;
  background: #fff;
  text-align: left;
}

.ticket-summary:hover {
  background: #fafbfc;
}

.ticket-status {
  width: 7px;
  height: 34px;
  border-radius: 2px;
  background: var(--orange);
}

.ticket-item.is-answered .ticket-status {
  background: var(--green);
}

.ticket-item.is-closed .ticket-status {
  background: var(--text-3);
}

.ticket-title {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.ticket-title strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-title small,
.ticket-meta {
  color: var(--text-3);
  font-size: 11px;
}

.ticket-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.ticket-summary > svg {
  color: var(--text-3);
  transition: transform 0.18s;
}

.ticket-item.is-expanded .ticket-summary > svg {
  transform: rotate(90deg);
}

.ticket-body {
  padding: 0 18px 18px 41px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.ticket-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0 4px;
}

.context-tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-2);
  background: #fff;
  font-size: 10px;
}

.ticket-description {
  margin: 11px 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.thread {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.thread-message {
  max-width: 82%;
  padding: 9px 11px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.thread-message.user {
  justify-self: end;
  border: 1px solid #bedaff;
  background: #eef7ff;
}

.thread-message.operator {
  justify-self: start;
  border: 1px solid #c4ebca;
  background: #f0fff2;
}

.thread-message.system {
  justify-self: center;
  padding: 4px 8px;
  color: var(--text-3);
  background: transparent;
  font-size: 10px;
}

.thread-message small {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 9px;
}

.ticket-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ticket-attachments a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue);
  font-size: 11px;
  text-decoration: none;
}

.ticket-attachments svg {
  width: 14px;
  height: 14px;
}

.followup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.followup-form textarea {
  min-height: 62px;
  resize: vertical;
}

.ticket-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.ticket-actions .button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
}

.ticket-logs {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 12px;
}

.ticket-logs summary {
  cursor: pointer;
  color: var(--blue);
}

.ticket-logs pre {
  max-height: 240px;
  overflow: auto;
  margin: 9px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #f2f3f5;
  background: #1d2129;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.ticket-conversation {
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.conversation-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.conversation-heading > div {
  display: grid;
  gap: 2px;
}

.conversation-heading strong {
  font-size: 13px;
}

.conversation-heading span {
  color: var(--text-3);
  font-size: 10px;
}

.conversation-state {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 3px;
  color: var(--orange) !important;
  background: var(--orange-soft);
  font-size: 11px !important;
  font-weight: 500;
}

.conversation-state.is-answered {
  color: var(--green) !important;
  background: var(--green-soft);
}

.conversation-state.is-closed {
  color: var(--text-2) !important;
  background: var(--fill);
}

.thread {
  min-height: 120px;
  display: grid;
  gap: 18px;
  margin-top: 0;
  padding: 18px 16px 20px;
  background: #fafbfc;
}

.thread-row {
  max-width: min(78%, 720px);
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.thread-row.user {
  justify-self: end;
  flex-direction: row-reverse;
}

.thread-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid #94bfff;
  border-radius: 4px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 600;
}

.thread-row.operator .thread-avatar {
  border-color: #9edfaa;
  color: #078817;
  background: var(--green-soft);
}

.thread-content {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.thread-meta {
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  font-size: 10px;
}

.thread-row.user .thread-meta {
  justify-content: flex-end;
}

.thread-meta strong {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
}

.thread-meta time {
  white-space: nowrap;
}

.initial-tag {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
}

.thread-bubble {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.thread-row.user .thread-bubble {
  border-color: #bedaff;
  background: #eef7ff;
}

.thread-row.operator .thread-bubble {
  border-color: #c4ebca;
  background: #f0fff2;
}

.thread-text {
  padding: 10px 12px;
  color: var(--text-1);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-event {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 3px;
  color: var(--text-3);
  background: var(--fill);
  font-size: 10px;
}

.thread-event time {
  opacity: 0.8;
}

.thread-bubble .ticket-attachments {
  margin-top: 0;
  padding: 0 12px 10px;
}

.thread-bubble .ticket-attachments a {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(22, 93, 255, 0.2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.72);
}

.followup-form {
  display: block;
  margin-top: 10px;
}

.followup-compose {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.followup-compose:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.followup-form .followup-compose textarea {
  min-height: 78px;
  padding: 11px 12px 7px;
  border: 0;
  border-radius: 0;
  resize: vertical;
}

.followup-form .followup-compose textarea:focus {
  box-shadow: none;
}

.followup-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 7px 6px 11px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.followup-attachment {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 11px;
}

.followup-attachment:hover {
  color: var(--blue);
}

.followup-attachment svg {
  width: 15px;
  height: 15px;
}

.followup-file-label {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.followup-hint {
  flex: 1;
  color: var(--text-3);
  font-size: 10px;
}

.followup-toolbar .button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 11px;
}

.followup-toolbar .button svg {
  width: 14px;
  height: 14px;
}

.history-empty {
  display: grid;
  justify-items: center;
  padding: 50px 16px 34px;
  color: var(--text-3);
  text-align: center;
}

.history-empty svg {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
}

.history-empty strong {
  color: var(--text-2);
}

.history-empty p {
  margin: 6px 0 0;
  font-size: 12px;
}

.state-panel {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
}

.state-panel p {
  margin: 0;
  color: var(--text-3);
}

.state-panel > svg {
  width: 42px;
  height: 42px;
  color: var(--blue);
}

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

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #dbe5f5;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100% - 32px));
  padding: 11px 15px;
  border-radius: 4px;
  color: #fff;
  background: rgba(29, 33, 41, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: #cb272d;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

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

  .diagnostics-panel {
    position: static;
  }

  .diagnostic-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
  }

  .topbar .health-badge {
    display: none;
  }

  .topbar .button {
    padding: 0 10px;
  }

  .page-shell {
    width: calc(100% - 24px);
    padding: 22px 0 40px;
  }

  .page-heading {
    display: grid;
    align-items: start;
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .account-summary {
    min-width: 0;
  }

  .diagnostic-banner {
    grid-template-columns: auto 1fr;
  }

  .diagnostic-banner .text-button {
    grid-column: 2;
    justify-self: start;
  }

  .tool-panel,
  .diagnostics-panel,
  .history-section {
    padding: 16px;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .privacy-row {
    align-items: start;
    flex-direction: column;
  }

  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .button-submit {
    width: 100%;
  }

  .diagnostic-stats {
    margin-right: -16px;
    margin-left: -16px;
  }

  .diagnostic-list {
    grid-template-columns: 1fr;
  }

  .quick-checks {
    margin-right: -16px;
    margin-bottom: -16px;
    margin-left: -16px;
    padding: 16px;
  }

  .history-section > .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .ticket-summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .ticket-meta {
    display: none;
  }

  .ticket-body {
    padding: 0 12px 14px;
  }

  .thread-row {
    max-width: 94%;
  }

  .thread {
    padding: 14px 10px 16px;
  }

  .thread-avatar {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .followup-hint {
    display: none;
  }

  .followup-file-label {
    max-width: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
