:root {
  --bg: #f4efe7;
  --bg-panel: #fffdfa;
  --bg-panel-soft: #fff7f0;
  --bg-sidebar: #232c38;
  --bg-sidebar-card: #303a47;
  --text: #16202b;
  --text-muted: #5f6b7a;
  --text-light: rgba(247, 249, 252, 0.9);
  --line: #dde3ea;
  --line-soft: #eceff4;
  --shadow: 0 24px 50px rgba(31, 42, 56, 0.12);
  --brand: #ca723f;
  --brand-soft: #fbe2d4;
  --blue: #2b6fe7;
  --blue-soft: #e1ebff;
  --green: #118161;
  --green-soft: #dff5ee;
  --amber: #b9780f;
  --amber-soft: #fff0d4;
  --red: #c44536;
  --red-soft: #fee3dc;
  --gray: #697586;
  --gray-soft: #edf1f5;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 202, 168, 0.45), transparent 28%),
    radial-gradient(circle at bottom right, rgba(182, 230, 215, 0.42), transparent 24%),
    linear-gradient(135deg, #f8f3ea 0%, #f0f5f8 48%, #eef6f0 100%);
}

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

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.background-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.background-orb {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
}

.orb-one {
  top: -120px;
  left: -120px;
  background: rgba(247, 177, 113, 0.55);
}

.orb-two {
  right: -120px;
  bottom: -120px;
  background: rgba(147, 216, 190, 0.52);
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 20px;
}

.eyebrow,
.section-kicker,
.card-kicker,
.session-label,
.metric-label,
.mini-stat-label,
.info-label {
  display: block;
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 24px;
  align-items: center;
  min-height: calc(100vh - 40px);
}

.login-copy,
.sidebar-brand {
  padding: 14px;
}

.login-copy h1,
.sidebar-brand h1 {
  margin: 0 0 16px;
  font-size: clamp(3rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.lead,
.sidebar-copy,
.panel-copy,
.brief-item p,
.text-block p,
.alert-copy,
.queue-copy,
.ticket-summary,
.hint {
  color: var(--text-muted);
  line-height: 1.75;
}

.login-highlight-grid,
.settings-grid,
.hero-grid,
.metric-grid,
.info-grid,
.insight-grid {
  display: grid;
  gap: 18px;
}

.login-highlight-grid,
.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.uneven-grid {
  grid-template-columns: 1.3fr 0.9fr;
}

.info-card,
.login-panel,
.panel,
.metric-card,
.feedback-box,
.loading-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.info-card,
.metric-card {
  padding: 22px;
}

.login-panel,
.panel,
.feedback-box {
  padding: 24px;
}

.login-panel h2,
.panel-title,
.detail-id,
.ticket-card h3,
.alert-card h4 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.app-view {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 40px);
}

.workspace,
.sidebar {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px;
  border-radius: 32px;
  background: linear-gradient(180deg, #242d39 0%, #1d2530 100%);
  box-shadow: 0 28px 60px rgba(18, 24, 34, 0.24);
}

.sidebar .eyebrow,
.sidebar .card-kicker {
  color: rgba(243, 246, 251, 0.72);
}

.sidebar-brand h1,
.sidebar-copy,
.sidebar-note,
.server-chip,
.nav-link,
.quick-actions a,
.quick-actions button {
  color: var(--text-light);
}

.sidebar-panel {
  padding: 20px;
  border-radius: 22px;
  background: var(--bg-sidebar-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.server-chip,
.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
}

.server-chip {
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.server-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #61e6b6;
  box-shadow: 0 0 0 6px rgba(97, 230, 182, 0.14);
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

.nav-link.active {
  color: #29170d;
  background: linear-gradient(135deg, #f5a159, #d57c48);
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(202, 114, 63, 0.28);
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar,
.panel-header,
.ticket-card-header,
.ticket-actions,
.ticket-meta-row,
.alert-top,
.alert-actions,
.detail-hero-head,
.note-head,
.timeline-head,
.status-bar-head,
.queue-item-top,
.queue-toolbar,
.pagination-row,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 8px 10px;
}

.topbar h2 {
  margin: 6px 0 10px;
  font-size: clamp(2.1rem, 3vw, 3rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.page-subtitle {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  line-height: 1.7;
}

.topbar-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.session-chip {
  min-width: 150px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.feedback-box p {
  margin: 8px 0 0;
}

.neutral-box {
  background: #f6f7fb;
}

.success-box {
  background: #ecfbf5;
  border-color: #cfeee0;
}

.warning-box {
  background: #fff7e8;
  border-color: #f0d9ad;
}

.error-box {
  background: #fff0ee;
  border-color: #f0c7c0;
}

.page-root,
.page-stack {
  display: grid;
  gap: 18px;
}

.metric-value,
.detail-id {
  font-size: clamp(2rem, 3vw, 3rem);
}

.metric-note,
.subtle-text {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.status-bar-list,
.alert-list,
.brief-list,
.ticket-grid,
.queue-list,
.note-list,
.attachment-list,
.timeline {
  display: grid;
  gap: 14px;
}

.status-bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.status-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.data-chip,
.pill,
.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.chip-list,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-chip,
.tone-neutral {
  color: #405162;
  background: #f1f4f8;
}

.tone-brand {
  color: #7f411a;
  background: var(--brand-soft);
}

.tone-blue {
  color: #2156b6;
  background: var(--blue-soft);
}

.tone-blue-soft {
  color: #2f5da8;
  background: #e7efff;
}

.tone-green {
  color: var(--green);
  background: var(--green-soft);
}

.tone-amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.tone-red {
  color: var(--red);
  background: var(--red-soft);
}

.tone-gray {
  color: var(--gray);
  background: var(--gray-soft);
}

.filter-form,
.form-grid {
  display: grid;
  gap: 16px;
}

.filter-form {
  grid-template-columns: 2.2fr 1fr 1fr auto;
  align-items: end;
}

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

.field {
  display: grid;
  gap: 8px;
}

.full-span {
  grid-column: 1 / -1;
}

.field span {
  color: var(--text-muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
}

.field textarea {
  min-height: 118px;
  padding: 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(202, 114, 63, 0.55);
  box-shadow: 0 0 0 4px rgba(202, 114, 63, 0.12);
}

.checkbox-row,
.toggle-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

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

.toggle-card {
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
}

.toggle-card input {
  width: 16px;
  height: 16px;
}

.primary-button,
.secondary-button,
.ghost-button,
.page-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button {
  color: #27160d;
  background: linear-gradient(135deg, #f6a25d, #d97f49);
  box-shadow: 0 14px 30px rgba(202, 114, 63, 0.22);
  font-weight: 700;
}

.secondary-button,
.page-button {
  color: var(--text);
  border-color: var(--line);
  background: #fff;
  font-weight: 600;
}

.ghost-button,
.text-button {
  color: var(--text);
  background: transparent;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.page-button:hover,
.text-button:hover,
.nav-link:hover {
  transform: translateY(-1px);
}

.page-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.ticket-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.ticket-card,
.alert-card,
.queue-item,
.attachment-card,
.note-item,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.ticket-card,
.alert-card,
.attachment-card,
.note-item,
.timeline-item {
  padding: 18px;
}

.queue-item {
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.queue-item.active {
  border-color: rgba(202, 114, 63, 0.4);
  background: linear-gradient(180deg, #fff8f2, #fffdfb);
  box-shadow: 0 12px 30px rgba(202, 114, 63, 0.12);
}

.ticket-ticketno {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.workbench-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

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

.detail-column {
  display: grid;
  gap: 18px;
}

.detail-copy {
  margin: 10px 0 0;
}

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

.info-cell {
  padding: 16px;
  border-radius: 16px;
  background: #fbfbfd;
  border: 1px solid var(--line-soft);
}

.info-value {
  display: block;
  font-size: 1.06rem;
}

.emphasis {
  color: #c56b3d;
}

.text-block h4 {
  margin: 0 0 8px;
}

.text-block p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow: auto;
}

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

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.table-empty {
  color: var(--text-muted);
  text-align: center;
}

.empty-state {
  padding: 36px 18px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 10px;
}

.loading-mask {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(244, 239, 231, 0.58);
  z-index: 30;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 220px;
  padding: 28px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(202, 114, 63, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.toast-layer {
  position: fixed;
  top: 24px;
  right: 24px;
  display: grid;
  gap: 10px;
  z-index: 40;
}

.toast {
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 14px;
  color: #fff;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 18px 28px rgba(31, 42, 56, 0.22);
}

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

.toast-info {
  background: #3b4a5d;
}

.toast-success {
  background: #15825f;
}

.toast-warning {
  background: #c07d12;
}

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

@media (max-width: 1360px) {
  .app-view,
  .workbench-layout,
  .hero-grid,
  .uneven-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 20px;
  }

  .workspace {
    min-width: 0;
  }
}

@media (max-width: 1024px) {
  .login-view,
  .app-view,
  .filter-form,
  .form-grid.two-column,
  .checkbox-grid,
  .info-grid,
  .settings-grid,
  .workbench-layout,
  .detail-columns,
  .hero-grid,
  .uneven-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar {
    position: static;
    top: auto;
    width: 100%;
  }

  .app-view {
    gap: 14px;
  }

  .panel-header,
  .ticket-card-header,
  .ticket-actions,
  .ticket-meta-row,
  .alert-top,
  .alert-actions,
  .detail-hero-head,
  .note-head,
  .timeline-head,
  .status-bar-head,
  .queue-item-top,
  .queue-toolbar,
  .pagination-row,
  .button-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-form {
    gap: 14px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .sidebar,
  .panel,
  .login-panel,
  .feedback-box {
    padding: 16px;
    border-radius: 22px;
  }

  .login-copy h1,
  .sidebar-brand h1,
  .topbar h2,
  .metric-value,
  .detail-id {
    font-size: 2rem;
  }

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

  .sidebar {
    position: static;
    top: auto;
    gap: 14px;
  }

  .sidebar-nav {
    gap: 8px;
  }

  .nav-link,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .page-button,
  .text-button {
    width: 100%;
  }

  .topbar-meta,
  .login-highlight-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .session-chip {
    width: 100%;
    min-width: 0;
  }

  .filter-form,
  .form-grid.two-column,
  .checkbox-grid,
  .info-grid,
  .settings-grid {
    gap: 12px;
  }

  .info-cell,
  .metric-card,
  .ticket-card,
  .alert-card,
  .attachment-card,
  .note-item,
  .timeline-item {
    padding: 14px;
  }

  .page-number {
    align-self: center;
  }

  .queue-panel {
    order: 2;
  }

  .workbench-main {
    order: 1;
  }

  .login-view {
    gap: 16px;
  }

  .login-copy,
  .sidebar-brand {
    padding: 0;
  }
}
