:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --text: #17211c;
  --muted: #66736b;
  --line: #dce3de;
  --strong-line: #b8c4bd;
  --green: #0f766e;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #c2410c;
  --ink: #111827;
  --shadow: 0 18px 42px rgba(23, 33, 28, 0.12);
  --radius: 8px;
  font-family:
    "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(245, 247, 244, 0.92)),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-visual {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark,
.sidebar-brand,
.user-chip,
.account-note,
.metric-card,
.action-card,
.ticket-toolbar,
.table-row,
.lane-title,
.architecture-card,
.permission-row {
  display: flex;
  align-items: center;
}

.brand-mark,
.sidebar-brand {
  gap: 12px;
}

.brand-symbol {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark strong,
.sidebar-brand strong {
  display: block;
  font-size: 16px;
}

.brand-mark span:not(.brand-symbol),
.sidebar-brand span:not(.brand-symbol) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.workflow-image {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.visual-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.visual-strip span {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  text-align: center;
}

.login-panel {
  width: min(100%, 460px);
  align-self: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

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

.login-brand span:not(.brand-symbol) {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: 0;
}

.login-copy,
.section-copy,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

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

.role-card {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  text-align: left;
}

.role-card:hover,
.role-card.is-selected {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.role-card span,
.role-card strong {
  display: block;
}

.role-card span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.role-card strong {
  font-size: 15px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.6;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.form-error {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--red);
  font-size: 13px;
}

.primary-button,
.ghost-button,
.mini-button,
.tab-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--green);
  color: #fff;
  background: var(--green);
}

.ghost-button,
.mini-button,
.tab-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
}

.primary-button:hover,
.mini-button:not(:disabled):hover,
.ghost-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.mini-button:disabled {
  cursor: not-allowed;
  color: #8a948e;
  background: #f1f3f1;
}

.account-note {
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed var(--strong-line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
}

.account-note strong {
  color: var(--text);
}

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

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

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

.tab-button {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 12px;
}

.tab-button.is-active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(15, 118, 110, 0.08);
}

.logout-button {
  margin-top: auto;
}

.top-logout {
  padding: 8px 12px;
}

.main-panel {
  min-width: 0;
  padding: 24px 28px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
}

.user-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.metric-card,
.content-card,
.action-card,
.architecture-card,
.permission-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-card {
  min-height: 110px;
  justify-content: space-between;
  padding: 18px;
}

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

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.metric-tag {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.content-card {
  padding: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  align-items: start;
  margin-top: 14px;
}

.create-card {
  max-width: 1040px;
}

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

.wide-field {
  margin-top: 4px;
}

.file-panel {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 14px;
  border: 1px dashed var(--strong-line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.file-panel span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.file-panel input {
  align-self: end;
  max-width: 100%;
}

.create-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.create-summary strong,
.create-summary span {
  display: block;
}

.create-summary span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.submit-ticket-button {
  width: 100%;
}

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

.action-card {
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.action-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.badge-row,
.button-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  border-color: rgba(15, 118, 110, 0.25);
  color: var(--green);
  background: rgba(15, 118, 110, 0.08);
}

.badge.blue {
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--blue);
  background: rgba(37, 99, 235, 0.08);
}

.badge.amber {
  border-color: rgba(183, 121, 31, 0.28);
  color: var(--amber);
  background: rgba(183, 121, 31, 0.1);
}

.badge.red {
  border-color: rgba(194, 65, 12, 0.28);
  color: var(--red);
  background: rgba(194, 65, 12, 0.1);
}

.ticket-toolbar {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.search-input {
  width: min(100%, 360px);
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.ticket-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(150px, 0.45fr) minmax(150px, 0.45fr);
  gap: 12px;
  padding: 14px 16px;
}

.table-head {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.table-row {
  width: 100%;
  min-height: 86px;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  text-align: left;
}

.table-row > div {
  min-width: 0;
}

.ticket-list-row:hover {
  background: rgba(15, 118, 110, 0.045);
}

.ticket-list-row:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: -3px;
}

.empty-row {
  grid-template-columns: 1fr;
}

.ticket-title {
  display: block;
  margin-bottom: 5px;
  font-weight: 800;
}

.ticket-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.back-button {
  padding: 8px 12px;
}

.detail-card,
.detail-actions-card {
  max-width: 1080px;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.detail-item {
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.detail-item span,
.detail-item strong {
  display: block;
}

.detail-item span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-item strong {
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-section p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.timeline-list span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
}

.attachment-counts {
  margin-bottom: 12px;
}

.attachment-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.attachment-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  text-align: left;
}

.attachment-card:hover:not(:disabled) {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.3);
}

.attachment-card:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.attachment-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.attachment-thumb img,
.attachment-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-placeholder {
  color: var(--muted);
  font-weight: 800;
}

.attachment-name,
.attachment-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-name {
  font-weight: 800;
}

.attachment-meta {
  color: var(--muted);
  font-size: 12px;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 33, 28, 0.72);
}

.preview-dialog {
  width: min(100%, 1040px);
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.preview-body {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 12px;
  background: var(--surface-2);
}

.preview-body img,
.preview-body video {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(23, 33, 28, 0.18);
}

.detail-actions-card {
  margin-top: 14px;
}

.detail-action-form {
  width: 100%;
}

.detail-action-form .ticket-toolbar {
  margin-bottom: 10px;
}

.action-upload-grid {
  margin-bottom: 14px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action-button {
  min-width: 150px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: start;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.admin-submit {
  width: auto;
  min-width: 160px;
}

.account-table,
.flow-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-table-head,
.admin-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.7fr) minmax(92px, 0.35fr) minmax(170px, 0.55fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.admin-table-head,
.flow-head {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.admin-table-row {
  border-top: 1px solid var(--line);
  background: #fff;
}

.admin-table-row strong,
.admin-table-row span {
  display: block;
}

.admin-table-row div > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.flow-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(180px, 1fr) minmax(140px, 0.7fr) minmax(120px, 0.55fr) minmax(100px, 0.35fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.flow-head {
  border-top: 0;
}

.workflow-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr 0.9fr;
  gap: 14px;
  align-items: start;
}

.lane {
  padding: 16px;
  border: 2px dashed var(--strong-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.lane-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.step {
  position: relative;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.step strong {
  display: block;
  margin-bottom: 6px;
}

.step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.step::after {
  content: "↓";
  position: absolute;
  right: 12px;
  bottom: -14px;
  color: var(--muted);
  font-weight: 800;
}

.step:last-child::after {
  display: none;
}

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

.architecture-card {
  min-height: 190px;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.architecture-card .metric-tag {
  background: var(--ink);
}

.architecture-card ul,
.permission-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.permission-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.permission-card {
  padding: 16px;
}

.permission-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  border-top: 1px solid var(--line);
}

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

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

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

@media (max-width: 1100px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: auto;
  }

  .workflow-image {
    max-height: 520px;
  }

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

  .dashboard-grid,
  .permission-layout,
  .workflow-grid,
  .detail-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-view {
    padding: 12px;
  }

  .login-panel,
  .login-visual {
    padding: 16px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 23px;
  }

  .role-picker,
  .visual-strip,
  .metrics-grid,
  .architecture-grid,
  .form-grid,
  .file-grid,
  .create-summary {
    grid-template-columns: 1fr;
  }

  .workflow-image {
    min-height: 300px;
    padding: 8px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-panel {
    padding: 18px 14px 92px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .user-chip {
    max-width: 100%;
    justify-content: flex-start;
    white-space: normal;
  }

  .top-logout {
    width: 100%;
  }

  .ticket-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }

  .table-head {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-table-head,
  .admin-table-row,
  .flow-row {
    grid-template-columns: 1fr;
  }

  .detail-heading,
  .detail-title-row,
  .detail-actions-card {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-actions {
    justify-content: stretch;
  }

  .action-button {
    width: 100%;
  }

  .mobile-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
  }

  .mobile-nav .tab-button {
    min-height: 46px;
    justify-content: center;
    padding: 8px 4px;
    font-size: 11px;
  }
}
