:root {
  color-scheme: light;
  --page: #F7F9F7;
  --surface: #ffffff;
  --surface-soft: #eef5f0;
  --ink: #17231d;
  --ink-soft: #53635a;
  --line: #dce5df;
  --line-strong: #c7d5cc;
  --primary: #087a46;
  --primary-hover: #05683b;
  --primary-soft: #e2f2e8;
  --warning: #8a5a10;
  --warning-soft: #fff7df;
  --danger: #a23b3b;
  --danger-soft: #fff0ee;
  --shadow: 0 16px 45px rgba(25, 48, 35, 0.07);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 92% 4%, rgba(8, 122, 70, 0.06), transparent 22rem),
    var(--page);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

button,
select,
label[for],
a {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
label[for],
a[href] {
  cursor: pointer;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

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

h1,
h2,
h3 {
  letter-spacing: -0.025em;
  line-height: 1.22;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 9vw, 3.25rem);
  font-weight: 680;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  font-weight: 650;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

:focus-visible {
  outline: 3px solid rgba(8, 122, 70, 0.42);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 50;
  top: 10px;
  left: 10px;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid rgba(199, 213, 204, 0.7);
  background: rgba(247, 249, 247, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  width: min(100% - 32px, 1120px);
  min-height: 84px;
  margin-inline: auto;
  gap: 14px;
}

.brand {
  display: grid;
  width: 78px;
  min-height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
}

.brand-logo {
  width: 78px;
  height: auto;
  object-fit: contain;
}

.header-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  font-weight: 650;
  line-height: 1.25;
}

.eyebrow,
.step-label {
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-title .eyebrow {
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.page-shell {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
  padding: 48px 0 80px;
}

.detail-shell {
  padding-top: 26px;
}

.hero {
  max-width: 660px;
  margin-bottom: 30px;
}

.hero-copy {
  max-width: 570px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.content-grid,
.detail-grid {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.detail-main,
.detail-aside {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 20px;
}

.card,
.state-card,
.status-summary {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.card {
  padding: 22px 18px;
}

.state-card {
  padding: 30px 22px;
  text-align: center;
}

.state-card svg {
  width: 32px;
  height: 32px;
  margin: 0 auto 14px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.state-card h1,
.state-card h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.state-card p {
  max-width: 520px;
  margin: 0 auto 20px;
  color: var(--ink-soft);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 16px;
}

.compact-heading {
  margin-bottom: 20px;
}

.identity-note,
.optional {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 550;
}

.identity-note {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.field-label {
  display: block;
  margin-bottom: 14px;
  font-weight: 650;
}

.field-grid {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.field {
  min-width: 0;
}

.field label,
.label-row label {
  display: inline-block;
  margin-bottom: 7px;
  font-size: 0.92rem;
  font-weight: 600;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.label-row output {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input,
select {
  padding: 0 13px;
}

textarea {
  min-height: 132px;
  padding: 12px 13px;
  line-height: 1.6;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9db1a5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(8, 122, 70, 0.1);
  outline: 0;
}

input::placeholder,
textarea::placeholder {
  color: #66736c;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  padding-right: 42px;
  appearance: none;
}

.select-icon {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 20px;
  height: 20px;
  fill: none;
  pointer-events: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transform: translateY(-50%);
}

.field-hint {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.problem-field {
  margin-top: 26px;
}

.button svg,
.back-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.ticket-list,
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.field-error {
  min-height: 1.2em;
  margin-top: 7px;
  color: var(--danger);
  font-size: 0.82rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 48px;
  padding: 0 18px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

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

.button-primary {
  margin-top: 24px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(8, 122, 70, 0.18);
}

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

.button-secondary {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.button-secondary:hover:not(:disabled) {
  border-color: #9db1a5;
  background: var(--surface-soft);
}

.button-danger {
  border-color: #e3bcbc;
  background: #ffffff;
  color: var(--danger);
}

.button-danger:hover:not(:disabled) {
  background: var(--danger-soft);
}

.button-wide {
  width: 100%;
}

.button.is-loading::before {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  content: "";
}

.button.is-loading > svg {
  display: none;
}

.form-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.error-message {
  border: 1px solid #edc5c1;
  background: var(--danger-soft);
  color: #7d2929;
}

.warning-message {
  border: 1px solid #ead29e;
  background: var(--warning-soft);
  color: #704708;
}

.list-error {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #edc5c1;
  border-radius: 12px;
  background: var(--danger-soft);
}

.list-error p {
  margin: 0 0 10px;
  color: #7d2929;
}

.submit-result {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #b9dac5;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}

.submit-result h3 {
  color: #075f38;
}

.submit-result p {
  margin-bottom: 0;
  color: #315941;
}

.tickets-card {
  align-self: start;
}

.inline-status {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  gap: 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1s ease-in-out infinite;
}

.ticket-list {
  display: grid;
  gap: 10px;
}

.ticket-item {
  min-width: 0;
}

.ticket-link {
  display: block;
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.ticket-link:hover {
  border-color: #a9bcae;
  background: var(--surface-soft);
}

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

.ticket-number {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-description {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 7px;
  font-weight: 590;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ticket-meta {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pending {
  border-color: #d8c38b;
  background: #fff8e5;
  color: #765311;
}

.status-processing {
  border-color: #a9cadd;
  background: #edf7fc;
  color: #265d7b;
}

.status-awaiting_confirmation {
  border-color: #abd3b8;
  background: var(--primary-soft);
  color: #08603a;
}

.status-completed {
  border-color: #cdd8d1;
  background: #eff3f0;
  color: #42534a;
}

.status-cancelled {
  border-color: #decaca;
  background: #f8f1f1;
  color: #784747;
}

#loadMoreTickets {
  margin-top: 14px;
}

.page-skeleton {
  display: grid;
  gap: 14px;
}

.skeleton {
  overflow: hidden;
  border-radius: 12px;
  background: #e7ece8;
}

.skeleton::after {
  display: block;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.66), transparent);
  content: "";
  animation: shimmer 1.25s ease-in-out infinite;
}

.skeleton-title {
  width: min(72%, 390px);
  height: 48px;
}

.skeleton-line {
  width: min(90%, 560px);
  height: 20px;
}

.skeleton-card {
  height: 350px;
  margin-top: 18px;
}

.skeleton-card.short {
  height: 190px;
  margin-top: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 22px;
  padding: 0 6px;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--primary);
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 18px;
}

.detail-hero h1 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 8vw, 2.6rem);
}

.status-summary {
  position: relative;
  margin-bottom: 20px;
  padding: 18px 18px 18px 52px;
  box-shadow: none;
}

.status-summary::before {
  position: absolute;
  top: 21px;
  left: 20px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  content: "";
}

.status-summary h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.status-summary p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.problem-copy {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.deadline-text {
  margin-bottom: 6px;
  color: var(--primary);
  font-weight: 650;
}

.rating-fieldset {
  margin-top: 24px;
}

.rating-group {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 2px;
}

.rating-group input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
}

.rating-group label {
  display: grid;
  width: 48px;
  min-height: 48px;
  margin: 0;
  place-items: center;
  border-radius: 10px;
  color: #7f8b84;
  transition: color 160ms ease, background-color 160ms ease;
}

.rating-group label:hover,
.rating-group label.is-active {
  background: #fff8df;
  color: #9a6800;
}

.rating-group input:focus-visible + label {
  outline: 3px solid rgba(8, 122, 70, 0.42);
  outline-offset: 2px;
}

.rating-group svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

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

.completed-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.completion-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}

.completion-mark svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.completed-card h2,
.quiet-card h2 {
  margin-bottom: 6px;
}

.completed-card p,
.quiet-card p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.quiet-card .button {
  margin-top: 18px;
}

.description-list {
  display: grid;
  margin: 0;
  gap: 14px;
}

.description-item {
  min-width: 0;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

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

.description-item dt {
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.description-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 590;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  position: relative;
  padding: 0 0 22px 25px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  position: absolute;
  top: 7px;
  bottom: -7px;
  left: 5px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-item::after {
  position: absolute;
  top: 6px;
  left: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  content: "";
}

.timeline-title {
  margin-bottom: 2px;
  font-size: 0.9rem;
  font-weight: 650;
}

.timeline-note,
.timeline-time {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.workspace-header {
  flex-wrap: wrap;
  padding-block: 12px;
}

.workspace-nav {
  display: flex;
  width: 100%;
  order: 3;
  gap: 5px;
  overflow-x: auto;
}

.workspace-nav a {
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 180ms ease, color 180ms ease;
}

.workspace-nav a:hover,
.workspace-nav a[aria-current="page"] {
  background: var(--surface-soft);
  color: var(--primary);
}

.current-identity {
  max-width: 44%;
  margin-left: auto;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-shell,
.admin-shell {
  padding-top: 38px;
}

.workspace-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 18px;
}

.workspace-hero > div {
  min-width: 0;
  max-width: 720px;
}

.workspace-hero h1 {
  font-size: clamp(2rem, 8vw, 3.1rem);
}

.workspace-hero .button,
.workspace-ticket-actions .button,
.drawer-actions .button,
.section-heading .button {
  margin-top: 0;
}

.workspace-feedback {
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #b8d9c4;
  border-radius: 12px;
  background: var(--primary-soft);
  color: #315941;
  font-size: 0.9rem;
}

.feedback-warning {
  border-color: #ead29e;
  background: var(--warning-soft);
  color: #704708;
}

.feedback-error {
  border-color: #edc5c1;
  background: var(--danger-soft);
  color: #7d2929;
}

.workspace-card,
.admin-card {
  box-shadow: 0 14px 42px rgba(25, 48, 35, 0.055);
}

.workspace-section-heading {
  align-items: center;
}

.segmented-control {
  display: grid;
  width: 100%;
  padding: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 7px 10px;
  gap: 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 650;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.segment:hover,
.segment.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(23, 35, 29, 0.07);
}

.count-badge {
  display: inline-grid;
  min-width: 23px;
  min-height: 23px;
  padding: 1px 6px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
}

.workspace-ticket-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.workspace-ticket {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.workspace-ticket-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.workspace-ticket-header > div {
  min-width: 0;
}

.workspace-ticket-header h3 {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 1.06rem;
}

.workspace-ticket .ticket-number {
  margin: 0;
  color: var(--ink-soft);
}

.ticket-facts {
  display: grid;
  margin: 16px 0 0;
  gap: 10px;
}

.ticket-fact {
  min-width: 0;
}

.ticket-fact dt {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.ticket-fact dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  font-weight: 580;
}

.workspace-ticket-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.resolution-field {
  flex: 1 0 100%;
}

.resolution-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.9rem;
  font-weight: 650;
}

.resolution-field textarea {
  min-height: 104px;
}

.resolution-field .button {
  width: 100%;
  margin-top: 8px;
}

.waiting-note {
  margin: 0;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 620;
}

.empty-state {
  margin: 0;
  padding: 28px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  text-align: center;
}

#loadMoreItTickets {
  margin-top: 16px;
}

.metric-grid {
  display: grid;
  margin-bottom: 26px;
  gap: 12px;
}

.metric-card {
  display: flex;
  min-width: 0;
  min-height: 152px;
  padding: 20px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid #bad8c4;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #ffffff, #edf7f1);
  box-shadow: 0 13px 32px rgba(25, 48, 35, 0.045);
}

.metric-card-muted {
  border-color: var(--line);
  background: linear-gradient(145deg, #ffffff, #f0f3f1);
}

.metric-label,
.metric-note {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.metric-label {
  font-weight: 650;
}

.metric-value {
  margin-block: 8px;
  color: var(--ink);
  font-size: clamp(2rem, 10vw, 2.75rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.skeleton-metric {
  min-height: 152px;
}

.admin-grid {
  display: grid;
  gap: 20px;
}

.admin-tabs {
  display: flex;
  max-width: 100%;
  margin-bottom: 30px;
  padding: 5px;
  gap: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #edf2ef;
}

.admin-tab {
  min-width: 104px;
  min-height: 46px;
  padding: 8px 18px;
  flex: 1;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 680;
  white-space: nowrap;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.admin-tab:hover,
.admin-tab.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 5px 18px rgba(23, 35, 29, 0.075);
}

.admin-panel {
  min-width: 0;
}

.panel-intro {
  margin-bottom: 22px;
}

.panel-intro h2 {
  margin-top: 3px;
}

.panel-intro p:last-child {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--ink-soft);
}

.admin-data-card {
  min-width: 0;
}

.filter-bar {
  display: grid;
  margin-bottom: 20px;
  padding: 16px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.filter-bar .field {
  min-width: 0;
  margin: 0;
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.filter-actions .button {
  flex: 1;
  margin: 0;
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.button-quiet:hover {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.list-status {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.list-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
  gap: 12px;
  border: 1px solid #edc5c1;
  border-radius: 12px;
  background: var(--danger-soft);
  color: #7d2929;
  font-size: 0.86rem;
}

.data-link {
  color: var(--primary);
  font-weight: 720;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.data-link:hover {
  color: var(--primary-hover);
}

#loadMoreAdminTickets,
#loadMoreAuditLogs {
  margin-top: 16px;
}

.button-compact {
  min-height: 44px;
  padding-inline: 13px;
  font-size: 0.84rem;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table {
  min-width: 1040px;
}

.audit-table {
  min-width: 820px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 680;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.table-primary {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.table-primary strong,
.table-secondary {
  overflow-wrap: anywhere;
}

.table-secondary {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.record-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 680;
  white-space: nowrap;
}

.record-status.is-active {
  border-color: #abd3b8;
  background: var(--primary-soft);
  color: #08603a;
}

.record-status.is-inactive {
  border-color: #d4d9d6;
  background: #f0f2f1;
  color: #59645e;
}

.drawer-dialog {
  width: min(100% - 20px, 560px);
  max-width: none;
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(23, 35, 29, 0.22);
}

.drawer-dialog::backdrop {
  background: rgba(23, 35, 29, 0.36);
  backdrop-filter: blur(3px);
}

.drawer-form {
  display: grid;
  max-height: calc(100dvh - 20px);
  padding: 22px;
  gap: 18px;
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.drawer-header h2 {
  font-size: 1.45rem;
}

.icon-button {
  display: grid;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  color: var(--ink-soft);
  transition: background-color 180ms ease, color 180ms ease;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

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

.drawer-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  gap: 10px;
}

.switch-row,
.member-option {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 10px 12px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.switch-row span,
.member-option span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.switch-row small,
.member-option small {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 450;
}

.switch-row input,
.member-option input {
  width: 22px;
  min-width: 22px;
  min-height: 22px;
  accent-color: var(--primary);
}

.member-options {
  display: grid;
  gap: 9px;
}

@media (max-width: 767px) {
  .workspace-hero,
  .workspace-section-heading,
  .admin-card .section-heading {
    flex-direction: column;
  }

  .workspace-hero .button,
  .admin-card .section-heading .button {
    width: 100%;
  }

  .workspace-section-heading {
    align-items: stretch;
  }

  .table-scroll {
    border: 0;
  }

  .data-table,
  .audit-table {
    min-width: 0;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  td {
    display: grid;
    min-width: 0;
    padding: 8px 0;
    grid-template-columns: minmax(82px, 0.35fr) minmax(0, 1fr);
    gap: 10px;
    border: 0;
  }

  td::before {
    color: var(--ink-soft);
    content: attr(data-label);
    font-size: 0.74rem;
    font-weight: 650;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .list-error {
    align-items: stretch;
    flex-direction: column;
  }

  .list-error .button {
    width: 100%;
  }

  .drawer-actions .button {
    flex: 1;
  }
}

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

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(220%);
  }
}

@media (min-width: 768px) {
  .header-inner,
  .page-shell {
    width: min(100% - 64px, 1120px);
  }

  .page-shell {
    padding-top: 64px;
  }

  .detail-shell {
    padding-top: 30px;
  }

  .card {
    padding: 28px;
  }

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

  .workspace-header {
    flex-wrap: nowrap;
  }

  .workspace-nav {
    width: auto;
    margin-left: auto;
    order: initial;
    overflow: visible;
  }

  .current-identity {
    margin-left: 8px;
  }

  .segmented-control {
    width: auto;
    min-width: 320px;
  }

  .ticket-facts {
    grid-template-columns: 0.8fr 1.35fr 0.85fr;
  }

  .resolution-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0 12px;
  }

  .resolution-field label,
  .resolution-field .field-error {
    grid-column: 1 / -1;
  }

  .resolution-field .button {
    width: auto;
    margin-bottom: 0;
  }

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

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

  .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .filter-actions .button {
    flex: 0 0 auto;
  }

  .drawer-dialog {
    width: min(560px, calc(100% - 44px));
    height: 100dvh;
    max-height: none;
    margin: 0 0 0 auto;
    border-block: 0;
    border-right: 0;
    border-radius: 22px 0 0 22px;
  }

  .drawer-form {
    max-height: 100dvh;
    padding: 30px;
  }
}

@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
    align-items: start;
  }

  .detail-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
    align-items: start;
  }

  .detail-aside {
    position: sticky;
    top: 24px;
  }

  .filter-bar {
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 1fr));
    align-items: end;
  }

  .audit-filter-bar {
    grid-template-columns: minmax(280px, 1fr) minmax(180px, 0.45fr) auto;
  }

  .filter-actions {
    grid-column: auto;
  }
}

@media (min-width: 1440px) {
  .header-inner,
  .page-shell {
    width: min(100% - 96px, 1180px);
  }
}

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