:root {
  --detail-background: #f3f5f8;
  --detail-surface: #ffffff;
  --detail-border: rgba(226, 232, 240, 0.9);
  --detail-muted: #64748b;
  --detail-strong: #0f172a;
  --detail-accent: #2563eb;
  --detail-accent-strong: #1d4ed8;
  --detail-success: #0f766e;
  --detail-progress: #b45309;
  --detail-new: #475569;
  --detail-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  --detail-soft-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  --header-height: 64px;
}

@media (max-width: 768px) {
  :root {
    --header-height: 72px;
  }
}

body {
  font-family: var(--font-family-sans);
  background: var(--detail-background);
  color: var(--detail-strong);
  -webkit-font-smoothing: antialiased;
  font-weight: var(--font-weight-regular);
  font-size: clamp(15px, 1.55vw, 17px);
  line-height: 1.55;
}

.main-content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 24px) clamp(32px, 6vh, 56px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 18px);
}

.detail-topbar {
  position: sticky;
  top: calc(var(--header-height) + 6px);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.2rem 0;
  margin-bottom: clamp(10px, 1.6vh, 16px);
  z-index: 10;
  background: rgba(248, 249, 252, 0.92);
  backdrop-filter: blur(4px);
  border-radius: 12px;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: var(--detail-surface);
  color: var(--detail-muted);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--detail-soft-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.detail-back:hover,
.detail-back:focus-visible {
  color: var(--detail-accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
  outline: none;
}

.detail-back i {
  font-size: 0.9rem;
}

.detail-shell {
  display: grid;
  gap: clamp(14px, 2vh, 18px);
  background: var(--detail-surface);
  border-radius: 18px;
  border: 1px solid var(--detail-border);
  box-shadow: var(--detail-shadow);
  padding: clamp(18px, 3vw, 24px);
  min-height: 0;
}

.detail-article {
  display: grid;
  gap: clamp(18px, 2.5vh, 24px);
}


.detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(0.75rem, 1.5vw, 1rem);
}



.detail-title__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  font-size: 0.82rem;
  font-weight: 600;
}

.detail-title__badge i {
  font-size: 0.85rem;
}

.detail-title {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}


.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--detail-muted);
  font-size: 0.8rem;
}

.detail-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.85);
}

.detail-meta__item i {
  font-size: 0.85rem;
  color: var(--detail-muted);
}

.detail-body {
  font-size: 0.9rem;
  color: var(--detail-strong);
  line-height: 1.6;
}

.content-preline {
  white-space: pre-line;
}

.detail-attachments {
  padding: 0.8rem;
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.7);
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: grid;
  gap: 0.6rem;
}

.detail-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--detail-strong);
  margin: 0;
}

.detail-attachments__empty {
  font-size: 0.88rem;
  color: var(--detail-muted);
}

.detail-attachments__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.detail-attachments__item {
  display: flex;
  align-items: center;
}

.detail-attachments__item--disabled {
  opacity: 0.6;
}

.detail-attachments__link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--detail-accent-strong);
  font-weight: 600;
}

.detail-attachments__link:hover,
.detail-attachments__link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.detail-attachments__name {
  overflow-wrap: anywhere;
}

.detail-error {
  padding: 1rem 1.2rem;
  border-radius: 14px;
  background: rgba(248, 113, 113, 0.16);
  color: #b91c1c;
  border: 1px solid rgba(248, 113, 113, 0.35);
  font-size: 0.95rem;
}

.comment-section {
  margin-top: clamp(10px, 2vh, 16px);
  background: var(--detail-surface);
  border-radius: 16px;
  border: 1px solid var(--detail-border);
  box-shadow: var(--detail-shadow);
  padding: clamp(16px, 3vw, 24px);
  display: grid;
  gap: clamp(12px, 1.6vh, 18px);
}

.comment-section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.comment-section__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--detail-strong);
  margin: 0;
}

.comment-section__meta {
  font-size: 0.82rem;
  color: var(--detail-muted);
}

.comment-section__body {
  display: grid;
  gap: 0.9rem;
}

.comment-section__empty {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.73);
  color: var(--detail-muted);
  font-size: 0.9rem;
  text-align: center;
}

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.comment-card {
  position: relative;
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.95));
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: var(--detail-soft-shadow);
}

.comment-card--staff {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.12);
}

.comment-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.comment-card__name {
  font-weight: 700;
  color: var(--detail-strong);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.comment-card__role {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.12);
  color: var(--detail-accent-strong);
}

.comment-card__timestamp {
  font-size: 0.8rem;
  color: var(--detail-muted);
}

.comment-card__body {
  font-size: 0.88rem;
  color: var(--detail-strong);
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-word;
}

.comment-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: rgba(100, 116, 139, 0.9);
}

.comment-card__actions {
  margin-left: auto;
  display: inline-flex;
  gap: 0.4rem;
}

.comment-action {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--detail-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.comment-action:hover,
.comment-action:focus-visible {
  text-decoration: underline;
  outline: none;
}

.comment-system-message {
  font-size: 0.82rem;
  color: var(--detail-muted);
}

.comment-system-message--error {
  color: #b91c1c;
}

.comment-composer {
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem;
  background: rgba(248, 250, 252, 0.92);
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.comment-composer__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.comment-composer__label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--detail-strong);
}

.comment-composer__label i {
  color: var(--detail-accent-strong);
}

.comment-composer textarea,
.comment-composer input,
.comment-composer select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  padding: 0.65rem 0.8rem;
  background: #fff;
}

.comment-composer__field {
  position: relative;
}

.comment-textarea {
  min-height: 120px;
  resize: vertical;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.45;
  padding-right: 7.4rem;
  padding-bottom: 2.8rem;
}

.comment-composer textarea:focus,
.comment-composer input:focus,
.comment-composer select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.comment-composer__status {
  font-size: 0.82rem;
  color: var(--detail-muted);
}

.comment-composer__inline-actions {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.comment-composer__inline-actions .btn-primary {
  padding: 0.45rem 0.95rem;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.comment-composer__inline-actions .btn-secondary {
  background: transparent;
  color: var(--detail-muted);
  padding: 0.3rem 0.6rem;
  box-shadow: none;
  border: 1px solid transparent;
}

.comment-composer__inline-actions .btn-secondary:hover,
.comment-composer__inline-actions .btn-secondary:focus-visible {
  color: var(--detail-accent-strong);
  background: rgba(148, 163, 184, 0.14);
  outline: none;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.28);
  outline: none;
}

.btn-primary[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.2);
  color: var(--detail-muted);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  opacity: 0.85;
  outline: none;
}

.comment-login-link {
  font-weight: 600;
  color: var(--detail-accent-strong);
  text-decoration: underline;
  margin-left: 0.25rem;
}

.comment-login-link:hover,
.comment-login-link:focus-visible {
  opacity: 0.85;
  outline: none;
}

@media (max-height: 820px) {
  .main-content {
    padding-top: 64px;
  }

  .detail-shell {
    padding: 20px;
  }

  .comment-section {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  .detail-topbar {
    justify-content: flex-start;
    background: transparent;
    position: static;
    margin-bottom: 0;
  }

  .detail-shell {
    padding: 20px;
    border-radius: 20px;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-status {
    width: 100%;
    justify-content: center;
  }

  .detail-meta {
    gap: 0.5rem;
  }

  .comment-section {
    padding: 18px;
  }

  .comment-composer__inline-actions {
    position: static;
    justify-content: flex-end;
    margin-top: 0.5rem;
  }

  .comment-textarea {
    padding-right: 0.8rem;
    padding-bottom: 1.1rem;
  }
}

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