* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f7fb;
  color: #172033;
}

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

.app {
  display: grid;
  grid-template-columns: 300px 420px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #132238 0%, #0d1829 100%);
  color: #dbe5f3;
  padding: 22px 16px;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 48px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1 {
  margin: 0 0 4px;
  font-size: 18px;
}

.brand p {
  margin: 0;
  color: #8ca1bc;
  font-size: 12px;
}

.brand-copy {
  flex: 1;
}

.channel-switch {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.channel-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  color: #9fb1c8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.channel-button {
  appearance: none;
  cursor: pointer;
}

.channel-link.active {
  color: #ffffff;
  background: rgba(45, 110, 248, 0.35);
  border-color: rgba(85, 147, 255, 0.65);
}

.sidebar-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}

.sync-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

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

.lang-btn {
  color: #dbe5f3;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sync-status {
  font-size: 13px;
  line-height: 1.6;
}

.sync-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.sync-user {
  color: #91a5bf;
  font-size: 12px;
}

.auth-panel {
  display: grid;
  gap: 10px;
}

.auth-title {
  font-size: 15px;
  font-weight: 700;
}

.auth-subtitle {
  color: #91a5bf;
  font-size: 12px;
}

.auth-form,
.user-form {
  display: grid;
  gap: 10px;
}

.auth-form label,
.user-form label,
.modal-form label {
  display: grid;
  gap: 6px;
}

.auth-form span,
.user-form span,
.modal-form span {
  color: #91a5bf;
  font-size: 12px;
}

.auth-form input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(8, 17, 28, 0.32);
  color: #fff;
}

.auth-submit {
  width: 100%;
}

.auth-message,
.user-form-message,
.modal-message {
  min-height: 18px;
  font-size: 12px;
}

.auth-message,
.user-form-message.error,
.modal-message.error {
  color: #fca5a5;
}

.user-form-message.success,
.modal-message.success {
  color: #16a34a;
}

.text-link {
  border: 0;
  background: transparent;
  color: #8fb2ff;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

.sync-meta {
  margin-top: 8px;
  color: #91a5bf;
  font-size: 12px;
  line-height: 1.5;
}

.section {
  margin-top: 18px;
}

.section-title {
  color: #91a5bf;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 8px 10px;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(45, 110, 248, 0.18);
}

.count {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
}

.platform-pills {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.platform-pill {
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #dbe5f3;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.platform-pill span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.platform-pill.active {
  background: #2d6ef8;
  color: white;
}

.platform-pill b {
  opacity: 0.8;
}

.filter-option-label {
  min-width: 0;
}

.filter-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-panel {
  background: white;
  border-right: 1px solid #e5ebf4;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.list-header {
  padding: 20px 22px 12px;
  border-bottom: 1px solid #e5ebf4;
}

.list-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.list-header p {
  margin: 0;
  color: #738199;
  font-size: 13px;
}

.search-bar {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid #e5ebf4;
}

.search-bar input,
.search-bar select,
.status-select,
.reply-box textarea {
  width: 100%;
  border: 1px solid #d8e0ec;
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
}

.search-bar select {
  width: 150px;
}

.ticket-list {
  overflow-y: auto;
  flex: 1;
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid #e5ebf4;
  background: #fff;
}

.pagination-meta {
  color: #738199;
  font-size: 12px;
}

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

.ticket-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  background: white;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}

.ticket-card:hover,
.ticket-card.active {
  background: #eff5ff;
}

.row1,
.row3,
.headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-id,
.detail-id,
.value.mono,
.order-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ticket-status,
.time,
.muted,
.order-status {
  color: #738199;
  font-size: 12px;
}

.meta-hint {
  color: #738199;
  font-size: 12px;
  margin-top: 6px;
}

.empty-data {
  display: grid;
  gap: 4px;
}

.customer {
  font-size: 15px;
  font-weight: 700;
  margin: 8px 0 6px;
}

.summary,
.summary-text,
.timeline .text,
.transcript {
  line-height: 1.65;
}

.summary {
  color: #4e5d78;
}

.row3 {
  margin-top: 10px;
  justify-content: flex-start;
}

.row3 .time {
  margin-left: auto;
}

.detail-panel {
  background: #f5f7fb;
  min-height: 100vh;
  overflow-y: auto;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid #e3e9f2;
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.detail-header h3 {
  margin: 0;
  font-size: 24px;
}

.header-tags,
.detail-actions,
.reply-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-body,
.detail-layout {
  padding: 20px 28px 28px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.main-col,
.side-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: white;
  border: 1px solid #e4ebf4;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 12px 30px rgba(16, 36, 70, 0.05);
}

.card h4 {
  margin: 0 0 14px;
  color: #5d6e86;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ai-card {
  background: linear-gradient(135deg, #eff5ff 0%, #f5fbff 100%);
  border-color: #cfe0ff;
}

.ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ai-card-header h4 {
  margin: 0;
}

.meta-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  grid-template-columns: 1fr;
}

.meta-item .k,
.label {
  color: #7f8ea4;
  font-size: 12px;
}

.meta-item .v,
.value {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.sentiment-bar {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d9e1ec;
  overflow: hidden;
}

.sentiment-fill {
  height: 100%;
}

.sentiment-negative {
  background: linear-gradient(90deg, #dc2626, #fb923c);
}

.sentiment-positive {
  background: linear-gradient(90deg, #059669, #4ade80);
}

.sentiment-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
}

.sentiment-inline-value {
  color: #415269;
  font-size: 12px;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

.sentiment-inline-bar {
  width: 52px;
  height: 8px;
  border-radius: 999px;
  background: #d9e1ec;
  overflow: hidden;
}

audio {
  width: 100%;
}

.transcript {
  background: #f6f8fc;
  border-radius: 12px;
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 13px;
}

.email-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: #223047;
}

.line {
  margin-bottom: 8px;
}

.agent {
  color: #2364eb;
  font-weight: 700;
}

.customer {
  color: inherit;
}

.transcript .customer {
  color: #7c3aed;
  font-weight: 700;
}

.timeline {
  position: relative;
  padding-left: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 8px;
  left: 5px;
  width: 2px;
  background: #dce5f0;
}

.timeline-item {
  position: relative;
  padding: 0 0 16px 10px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  border: 2px solid #2d6ef8;
}

.timeline-item.system::before {
  border-color: #64748b;
}

.timeline-item .time {
  margin-bottom: 2px;
}

.timeline-item .who {
  font-weight: 700;
  margin-bottom: 4px;
}

.reply-box textarea {
  min-height: 96px;
  resize: vertical;
  margin-top: 8px;
}

.action-card {
  border-color: #d8e4f4;
}

.action-form {
  display: grid;
  gap: 14px;
}

.action-form label {
  display: grid;
  gap: 6px;
}

.action-form span {
  color: #7f8ea4;
  font-size: 12px;
}

.action-form select,
.action-form input,
.action-form textarea {
  width: 100%;
  border: 1px solid #d8e0ec;
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
}

.action-form textarea {
  resize: vertical;
}

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

.address-grid .wide {
  grid-column: 1 / -1;
}

.action-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e6edf6;
  border-radius: 12px;
  background: #f8fbff;
}

.action-message {
  min-height: 18px;
  color: #dc2626;
  font-size: 12px;
}

.reply-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

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

.field {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
}

.order-box {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e4ebf4;
  background: #fafcfe;
  margin-bottom: 10px;
}

.order-box.shipped {
  background: #ebfbf4;
  border-color: #b8ebd1;
}

.order-box.returned {
  background: #fff2f2;
  border-color: #f3c1c1;
}

.order-box.pending {
  background: #fff8e9;
  border-color: #f0deaa;
}

.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 8px;
}

.priority-dot-p1 {
  background: #ef4444;
}

.priority-dot-p2 {
  background: #f59e0b;
}

.priority-dot-p3 {
  background: #3b82f6;
}

.status-pill {
  background: #fff0c5;
  color: #8f5c00;
}

.priority-p1,
.category-投诉,
.category-complaint {
  background: #ffe5e5;
  color: #a12525;
}

.priority-p2,
.category-退换货,
.category-return_exchange {
  background: #fff2cc;
  color: #946200;
}

.priority-p3,
.category-inquiry,
.category-logistics,
.category-other,
.category-咨询,
.category-物流,
.category-其他 {
  background: #e7efff;
  color: #2d4db2;
}

.tag-amazon {
  background: #fff3d5;
  color: #9b5f00;
}

.tag-homedepot {
  background: #ffe8d9;
  color: #b64700;
}

.tag-lowes {
  background: #dce8ff;
  color: #1d4fa8;
}

.tag-wayfair {
  background: #efe4ff;
  color: #5e2aa0;
}

.tag-overstock {
  background: #e8f5e4;
  color: #2b6a1d;
}

.tag-parrotuncle {
  background: #fff1d8;
  color: #8f5f00;
}

.tag-vaczon {
  background: #ddeff5;
  color: #0e5e73;
}

.tag-ipluslighting {
  background: #f8e6d9;
  color: #8a4b1d;
}

.tag-unknown {
  background: #edf1f6;
  color: #5c6a80;
}

.btn {
  border: 1px solid #d6deeb;
  background: white;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn-primary {
  background: #2d6ef8;
  border-color: #2d6ef8;
  color: white;
}

.btn-small {
  padding: 7px 10px;
  font-size: 12px;
}

.detail-empty,
.ticket-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: #738199;
  text-align: center;
  padding: 40px 20px;
}

.empty-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #d8e4fb, #edf3ff);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #3b5cc9;
  margin-bottom: 12px;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 36, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #dce5f0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  padding: 18px 18px 16px;
}

.modal-header,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h3,
.card-head h2 {
  margin: 0;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #63748d;
}

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

.modal-form input,
.user-form input,
.user-form select {
  width: 100%;
  border: 1px solid #d8e0ec;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: #172033;
}

.modal-actions,
.user-form-actions,
.user-table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.user-page {
  min-height: 100vh;
  background: #f4f7fb;
}

.user-header {
  padding: 24px 28px 0;
}

.user-brand {
  width: min(1100px, calc(100vw - 56px));
  margin: 0 auto;
  background: linear-gradient(180deg, #132238 0%, #0d1829 100%);
  color: #dbe5f3;
  border-radius: 18px;
  border-bottom: 0;
}

.user-main {
  width: min(1100px, calc(100vw - 56px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.user-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 18px;
  margin-top: 18px;
}

.user-card {
  background: #fff;
  border: 1px solid #dfe7f1;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 28px rgba(16, 36, 70, 0.06);
}

.user-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.user-note {
  margin: 0;
  color: #738199;
  font-size: 13px;
}

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

.user-table th,
.user-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #e9eef5;
  font-size: 14px;
}

.user-table th {
  color: #738199;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-danger {
  border-color: #fecaca;
  color: #b91c1c;
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: 280px 360px 1fr;
  }

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

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

  .list-panel,
  .detail-panel {
    min-height: auto;
  }

  .detail-body {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar select {
    width: 100%;
  }

  .user-header {
    padding: 18px 18px 0;
  }

  .user-main,
  .user-brand {
    width: calc(100vw - 36px);
  }
}

/* EG design system shell, adapted from eg-design-system-mockup.html. */
:root {
  --brand-navy: #0e1a33;
  --brand-navy-2: #162241;
  --brand-blue: #2f6bff;
  --brand-blue-soft: #eaf1ff;
  --surface-app: #f5f7fb;
  --surface-card: #ffffff;
  --surface-muted: #f8f9fb;
  --surface-ai: linear-gradient(135deg, #eef3ff 0%, #f4f0ff 100%);
  --border: #e6e9f0;
  --border-strong: #d6dbe6;
  --text-1: #0e1a33;
  --text-2: #3f4a60;
  --text-3: #6b7588;
  --text-muted: #9aa3b5;
  --text-on-dark: #e7ecf7;
  --text-on-dark-mute: #8b95ae;
  --p1: #e5484d;
  --p1-bg: #fcebec;
  --p2: #e5a623;
  --p2-bg: #fcf3dd;
  --p3: #2f6bff;
  --p3-bg: #e7efff;
  --ok: #1fad68;
  --ok-bg: #e4f6ec;
  --tag: #f1f3f8;
  --tag-text: #4d5870;
  --shadow-sm: 0 1px 2px rgba(14, 26, 51, 0.04);
  --shadow-md: 0 4px 16px rgba(14, 26, 51, 0.06);
}

body {
  font-family: Inter, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--surface-app);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
}

.app {
  grid-template-columns: 240px 380px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--brand-navy);
  color: var(--text-on-dark);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  gap: 12px;
  margin-bottom: 0;
  padding: 2px 4px 4px;
  border-bottom: 0;
  align-items: flex-start;
}

.brand-mark {
  width: 72px;
  height: 44px;
  flex: 0 0 72px;
  background: transparent;
  overflow: hidden;
}

.brand-logo {
  object-fit: contain;
  object-position: left center;
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
  color: #ffffff;
}

.channel-switch {
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.channel-link {
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--text-on-dark-mute);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  line-height: 1.2;
}

.channel-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-card.sync-card {
  background: var(--brand-navy-2);
  border: 0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 0;
  color: var(--text-on-dark-mute);
  box-shadow: none;
}

.sync-title-row {
  margin-bottom: 8px;
}

.sync-title-row strong {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.sync-status {
  color: var(--text-on-dark-mute);
  font-size: 12px;
}

.sync-user-row {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.sync-user {
  color: var(--text-on-dark-mute);
}

.section {
  margin-top: 0;
}

.section-title {
  margin: 0;
  padding: 6px 10px;
  color: var(--text-on-dark-mute);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item,
.platform-pill {
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-on-dark);
  font-size: 13px;
}

.nav-item:hover,
.platform-pill:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active,
.platform-pill.active {
  background: rgba(47, 107, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
}

.count,
.platform-pill b {
  min-width: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-on-dark-mute);
  font-size: 12px;
  font-weight: 600;
}

.nav-item.active .count,
.platform-pill.active b {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

.platform-pills {
  gap: 2px;
}

.filter-option-label {
  color: inherit;
}

.list-panel {
  background: var(--surface-card);
  border-right: 1px solid var(--border);
  min-width: 0;
}

.list-header {
  padding: 18px 18px 12px;
  border-bottom: 0;
}

.list-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}

.list-header p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 13px;
}

.search-bar {
  gap: 8px;
  padding: 0 18px 12px;
  border-bottom: 0;
}

.search-bar input,
.search-bar select,
.status-select,
.reply-box textarea,
.action-form select,
.action-form input,
.action-form textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text-1);
  font-size: 13px;
}

.search-bar select {
  width: 120px;
}

.ticket-list {
  border-top: 1px solid var(--border);
}

.ticket-card {
  padding: 14px 18px;
  border-bottom: 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticket-card:first-child {
  border-top: 0;
}

.ticket-card:hover {
  background: var(--surface-muted);
}

.ticket-card.active {
  background: var(--brand-blue-soft);
  border-left: 3px solid var(--brand-blue);
  padding-left: 15px;
}

.row1 {
  color: var(--text-3);
  font-size: 12px;
}

.ticket-id {
  color: var(--text-muted);
  font-size: 11px;
}

.ticket-status,
.status-pill {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.customer,
.ticket-title {
  margin: 0;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
}

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

.ticket-ico {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex: 0 0 16px;
}

.ticket-sub {
  color: var(--text-3);
  font-size: 12px;
}

.row3,
.ticket-tags {
  margin-top: 2px;
  gap: 6px;
  flex-wrap: wrap;
  display: flex;
  align-items: center;
}

.row3 .time,
.ticket-tags .time {
  margin-left: auto;
}

.list-pagination {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.detail-panel {
  background: var(--surface-app);
  min-width: 0;
  overflow-y: auto;
}

.detail-header {
  position: static;
  background: transparent;
  backdrop-filter: none;
  border-bottom: 0;
  padding: 20px 24px 0;
}

.detail-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}

.detail-id {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
}

.header-tags {
  margin-top: 8px;
  flex-wrap: wrap;
}

.detail-actions {
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-body {
  padding: 16px 24px 24px;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
}

.main-col,
.side-col {
  gap: 16px;
  min-width: 0;
}

.side-col {
  align-self: start;
}

.card,
.action-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.card h4 {
  margin: 0 0 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-card {
  background: var(--surface-ai);
  border-color: #dce3f5;
  padding: 18px;
}

.ai-card-header {
  margin-bottom: 8px;
}

.ai-card-header h4 {
  color: #5b47c9;
}

.summary-text {
  color: var(--text-1);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
}

.meta-grid {
  margin-top: 14px;
}

.meta-item .k,
.label,
.action-form span {
  color: var(--text-3);
}

.meta-item .v,
.value {
  color: var(--text-1);
}

.sentiment-inline {
  min-width: 120px;
}

.sentiment-inline-value {
  color: var(--text-3);
}

.sentiment-inline-bar {
  width: 80px;
  height: 6px;
  background: #e1e5ee;
}

.sentiment-positive {
  background: linear-gradient(90deg, var(--brand-blue), #7c5cff);
}

.sentiment-negative {
  background: linear-gradient(90deg, var(--p1), #e5a623);
}

audio {
  border-radius: 10px;
}

.transcript {
  max-height: none;
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-1);
}

.line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.agent,
.transcript .customer {
  min-width: 64px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent {
  color: #6e45d6;
}

.transcript .customer {
  color: var(--brand-blue);
}

.timeline {
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline::before {
  display: none;
}

.timeline-item {
  display: grid;
  grid-template-columns: 8px 54px 1fr;
  gap: 10px;
  padding: 0;
  align-items: start;
}

.timeline-item::before {
  position: static;
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border: 0;
  background: var(--brand-blue);
}

.timeline-item.system::before {
  background: var(--text-muted);
}

.timeline-item .time {
  color: var(--text-3);
  font-size: 11px;
}

.timeline-item .who {
  display: none;
}

.timeline-item .text {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.field {
  grid-template-columns: 84px 1fr;
  padding: 2px 0;
  font-size: 13px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), #7c5cff);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 28px;
}

.customer-avatar {
  background: linear-gradient(135deg, #ff7c5c, var(--p2));
}

.customer-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.customer-profile-name {
  color: var(--text-1);
  font-weight: 700;
}

.customer-profile-meta {
  color: var(--text-3);
  font-size: 12px;
}

.side-card .row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  padding: 6px 0;
  color: var(--text-2);
  font-size: 13px;
}

.side-card .row .k {
  color: var(--text-3);
  font-size: 12px;
}

.side-card .row .v {
  color: var(--text-1);
  font-weight: 600;
  min-width: 0;
  word-break: break-word;
}

.linked-card h4,
.side-card h4 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
  font-size: 13px;
}

.order-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.order-row .num {
  color: var(--brand-blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.order-desc {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}

.entity-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.entity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dce3f5;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-2);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.order-box {
  border: 0;
  border-top: 1px dashed var(--border);
  border-radius: 0;
  background: transparent;
  padding: 10px 0;
  margin-bottom: 0;
}

.order-box:first-child {
  border-top: 0;
}

.order-id {
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 700;
}

.tag,
.status-pill {
  border-radius: 999px;
  padding: 2px 8px;
  gap: 5px;
  min-height: 22px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

.priority-p1 {
  background: #fcebec;
  color: var(--p1);
}

.priority-p2 {
  background: var(--p2-bg);
  color: var(--p2);
}

.priority-p3 {
  background: var(--p3-bg);
  color: var(--p3);
}

.category-complaint,
.category-return_exchange {
  background: #fcebec;
  color: var(--p1);
}

.category-inquiry,
.category-logistics,
.category-other {
  background: var(--tag);
  color: var(--tag-text);
}

.tag-amazon,
.tag-homedepot,
.tag-lowes,
.tag-wayfair,
.tag-overstock,
.tag-parrotuncle,
.tag-vaczon,
.tag-ipluslighting,
.tag-unknown {
  background: var(--tag);
  color: var(--tag-text);
  font-weight: 500;
}

.status-new {
  background: #e7efff;
  color: var(--brand-blue);
}

.status-processing {
  background: var(--p2-bg);
  color: #9a7000;
}

.status-closed {
  background: #edeff3;
  color: var(--text-3);
}

.btn {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.btn:hover {
  background: var(--surface-muted);
}

.btn-primary {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: #2558d8;
}

.btn-small {
  padding: 6px 10px;
  font-size: 12px;
}

.action-section {
  border-color: var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.modal-card,
.user-card {
  border-radius: 14px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #d6dbe6;
  border-radius: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px 340px minmax(0, 1fr);
  }

  .detail-body {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar,
  .list-panel,
  .detail-panel {
    min-height: auto;
  }

  .detail-header {
    padding: 18px 18px 0;
  }

  .detail-body {
    padding: 14px 18px 24px;
  }
}
