:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --ink: #172033;
  --muted: #647084;
  --line: #d9e0ea;
  --green: #2563eb;
  --green-dark: #1d4ed8;
  --amber: #b45309;
  --red: #c24136;
  --teal: #0f766e;
  --violet: #6554c0;
  --shadow: 0 18px 44px rgba(24, 36, 56, 0.11);
  --primary: #2563eb;
  --primary-weak: #eaf1ff;
  --success: #15803d;
  --success-weak: #e8f7ee;
  --warning: #b45309;
  --warning-weak: #fff4df;
  --danger: #c24136;
  --danger-weak: #fff0ed;
  --info: #0f766e;
  --info-weak: #e6f6f4;
  --sidebar: #fbfcff;
  --topbar: rgba(245, 247, 251, 0.88);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

[hidden] {
  display: none !important;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 26px;
  border-right: 1px solid var(--line);
  background: #fbfcf8;
  padding: 22px 18px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
}

.brand-mark svg {
  fill: currentColor;
  stroke-width: 0;
}

.brand strong,
.brand span {
  display: block;
}

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

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.language-switch {
  display: flex;
  min-height: 40px;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 11px;
}

.language-switch span {
  font-size: 13px;
  font-weight: 700;
}

.language-switch:hover {
  border-color: rgba(40, 124, 91, 0.55);
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 11px 12px;
  text-align: left;
}

.nav-item[hidden] {
  display: none !important;
}

.nav-item:hover,
.nav-item.is-active {
  background: #e8eee4;
  color: var(--ink);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(40, 124, 91, 0.12);
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.account-menu {
  position: relative;
}

.account-trigger {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.account-trigger.is-simple svg,
.account-trigger.is-simple .avatar-dot {
  display: none;
}

.account-trigger.is-avatar-only {
  width: 42px;
  padding: 0;
  justify-content: center;
}

.account-trigger.is-avatar-only svg,
.account-trigger.is-avatar-only #accountLabel {
  display: none;
}

.avatar-dot {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  background-position: center;
  background-size: cover;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.avatar-dot::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, #ffffff 0 18%, transparent 19%),
    radial-gradient(circle at 50% 82%, #ffffff 0 34%, transparent 35%);
}

.login-dropdown[hidden],
.auth-modal[hidden],
.profile-modal[hidden],
.image-modal[hidden] {
  display: none !important;
}

.login-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  display: grid;
  min-width: 240px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 8px;
}

.auth-modal,
.profile-modal,
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-backdrop,
.image-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 28, 24, 0.45);
}

.image-backdrop {
  border: 0;
  padding: 0;
}

.auth-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.image-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 1120px);
  max-height: min(88vh, 920px);
  border-radius: 8px;
}

.image-dialog img {
  display: block;
  max-height: min(88vh, 920px);
  width: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.image-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.auth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.auth-head h2 {
  margin-bottom: 4px;
}

.auth-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.auth-options {
  display: grid;
  gap: 8px;
}

.password-login {
  display: grid;
  gap: 12px;
}

.password-login .primary-action {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
}

.profile-preview strong,
.profile-preview span {
  display: block;
}

.profile-preview span {
  color: var(--muted);
  font-size: 13px;
}

.login-option {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.login-option:hover:not(:disabled) {
  background: var(--surface-strong);
}

.login-option:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.68;
}

.provider-mark {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #edf1ea;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.hero-band {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 8px;
  background: #27312c;
  box-shadow: var(--shadow);
}

.hero-band img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-band::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(23, 30, 25, 0.82), rgba(23, 30, 25, 0.34) 48%, rgba(23, 30, 25, 0.16)),
    linear-gradient(0deg, rgba(23, 30, 25, 0.28), transparent 48%);
}

.hero-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 220px;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.nav-item .nav-unread-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #e02d3c;
  color: #fff;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 0 0 2px var(--surface);
  cursor: pointer;
}

.nav-item .nav-unread-badge[hidden] {
  display: none !important;
}

.ticket-id-cluster {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ticket-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e02d3c;
  box-shadow: 0 0 0 3px rgba(224, 45, 60, 0.16);
}

.ticket-unread-dot[hidden] {
  display: none !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stat-block {
  min-height: 96px;
  background: var(--surface);
  padding: 18px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-block strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.view-panel {
  display: none;
}

.view-panel.is-visible {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0 16px;
}

.toolbar,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  min-width: min(360px, 46vw);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
}

.search-box input {
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
}

.icon-button,
.primary-action,
.secondary-action,
.danger-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.primary-action {
  border: 0;
  background: var(--green);
  color: #fff;
  padding: 0 16px;
}

.primary-action:hover {
  background: var(--green-dark);
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 16px;
}

.danger-action {
  border: 1px solid rgba(189, 59, 59, 0.35);
  background: #fff5f5;
  color: var(--red);
  padding: 0 16px;
}

.danger-action:hover {
  border-color: rgba(189, 59, 59, 0.55);
  background: #ffe8e8;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.attachment-picker {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: 0;
  padding: 9px 11px;
}

textarea {
  min-height: 122px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(40, 124, 91, 0.14);
}

input[readonly] {
  background: var(--surface-strong);
  color: var(--muted);
  cursor: default;
}
