:root {
  --accent: #2563eb;
  --accent-dark: #1747bd;
  --success: #159947;
  --danger: #dc2626;
  --warning: #b45309;
  --ink: #172033;
  --muted: #64748b;
  --line: #dfe7f0;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --side: #1f2937;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: #eef3f8;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

input,
textarea,
select {
  color: var(--ink);
}

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

[hidden] {
  display: none !important;
}

.report-body {
  background: #fff;
  font-size: 16px;
}

.report-shell {
  width: 100%;
  min-height: 100dvh;
  background: #fff;
}

.flow-view {
  min-height: 100dvh;
  background: #fff;
}

.flow-topbar {
  height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
  padding: 0 14px;
}

.top-back {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  position: relative;
}

.top-back::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 7px;
  width: 13px;
  height: 13px;
  border-left: 3px solid #111;
  border-bottom: 3px solid #111;
  transform: rotate(45deg);
  border-radius: 2px;
}

.flow-kicker {
  min-height: 40px;
  display: flex;
  align-items: center;
  background: #f7f7f7;
  color: #9aa0a6;
  padding: 0 14px;
  font-size: 16px;
  border-bottom: 1px solid #eeeeee;
}

.choice-list {
  background: #fff;
}

.choice-item {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-bottom: 1px solid #eeeeee;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 14px;
  text-align: left;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.35;
}

.choice-item:active {
  background: #f8fafc;
}

.flow-footer {
  min-height: 72px;
  display: flex;
  justify-content: center;
  align-items: end;
  padding-bottom: 14px;
  background: #fafafa;
}

.plain-link {
  border: 0;
  background: transparent;
  color: #4b6590;
  font-size: 14px;
}

.selection-summary {
  margin: 0;
  padding: 0 14px;
  border: 1px solid #dbeafe;
  border-left: 0;
  border-right: 0;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 0;
  font-size: 14px;
  min-height: 40px;
  display: flex;
  align-items: center;
  line-height: 1.5;
}

.form-flow {
  background: #f7f7f7;
}

.report-form {
  padding: 0 0 14px;
}

.form-card {
  background: #fff;
  border: 0;
  margin-bottom: 8px;
}

.field {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid #eeeeee;
}

.field:last-child {
  border-bottom: 0;
}

.field label {
  color: #737373;
  font-size: 14px;
  line-height: 1.2;
}

.field input,
.field textarea {
  width: 100%;
  border: 0;
  outline: none;
  background: #fff;
  color: #111827;
  font-size: 16px;
  line-height: 1.35;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a3a3a3;
}

.field input:focus,
.field textarea:focus {
  box-shadow: 0 1px 0 var(--success);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.field .small-textarea {
  min-height: 80px;
}

.field.textarea-field,
.field.upload-field {
  align-content: start;
  gap: 8px;
  padding: 10px 14px 12px;
}

.image-upload-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.image-upload-box {
  width: 88px;
  height: 88px;
  background: #eeeeee;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}

.image-upload-box input {
  display: none;
}

.upload-plus {
  width: 26px;
  height: 26px;
  position: relative;
}

.upload-plus::before,
.upload-plus::after {
  content: "";
  position: absolute;
  background: #9f9f9f;
  border-radius: 999px;
}

.upload-plus::before {
  left: 12px;
  top: 0;
  width: 2px;
  height: 26px;
}

.upload-plus::after {
  left: 0;
  top: 12px;
  width: 26px;
  height: 2px;
}

.image-upload-box.has-image .upload-plus {
  display: none;
}

.image-upload-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image-btn {
  min-height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #374151;
  padding: 0 10px;
  font-size: 14px;
}

.submit-report {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  background: var(--success);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.submit-report:active {
  transform: translateY(1px);
}

.success-panel {
  padding: 0 20px 56px;
  text-align: center;
}

.success-panel .flow-topbar {
  margin: 0 -20px 52px;
}

.success-panel h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.success-panel p {
  margin: 0 0 24px;
  color: #64748b;
  line-height: 1.6;
}

.success-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: var(--success);
  position: relative;
}

.success-mark::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 12px;
  width: 14px;
  height: 22px;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: rotate(45deg);
}

.notice-dialog,
.report-dialog {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgb(15 23 42 / 0.25);
}

.notice-dialog {
  width: min(360px, calc(100% - 40px));
  padding: 22px;
}

.notice-dialog::backdrop,
.report-dialog::backdrop {
  background: rgb(15 23 42 / 0.35);
}

.dialog-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
}

.notice-dialog p {
  color: #475569;
  line-height: 1.65;
  margin: 0 0 18px;
}

.empty-state {
  padding: 28px;
  color: #94a3b8;
  text-align: center;
}

.admin-body {
  background: #eef2f6;
}

.admin-login-body {
  min-height: 100dvh;
  background: #f6f8fb;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 44%) minmax(0, 56%);
}

.login-visual {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(rgb(0 0 0 / 0.2), rgb(0 0 0 / 0.2)),
    linear-gradient(145deg, rgb(10 24 43 / 0.9), rgb(14 52 76 / 0.58)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1400&q=82") center / cover;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(0 0 0 / 0.08), rgb(0 0 0 / 0.42));
}

.login-visual-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 44px 44px;
  color: #fff;
  font-weight: 800;
}

.login-visual-copy p {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.login-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f8fafc;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.18);
  position: relative;
}

.login-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid #1a365d;
  border-radius: 50%;
}

.login-panel {
  min-width: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 48px 28px;
  background: #f7f9fc;
}

.login-form {
  width: min(100%, 390px);
  display: grid;
  gap: 18px;
}

.login-heading {
  margin-bottom: 10px;
}

.login-heading h1 {
  margin: 0;
  color: #333;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 900;
  text-wrap: balance;
}

.login-heading p {
  margin: 10px 0 0;
  color: #667085;
  line-height: 1.5;
}

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

.login-field > span:first-child {
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.login-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  padding: 10px 12px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.login-field input:focus {
  border-color: #1a365d;
  box-shadow: 0 0 0 3px rgb(26 54 93 / 0.12);
}

.password-input {
  position: relative;
  display: block;
}

.password-input input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  display: grid;
  place-items: center;
  transition: color 180ms ease, background 180ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #1a365d;
  background: #edf2f7;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  opacity: 0.72;
}

.login-submit {
  min-height: 46px;
  border: 1px solid #1a365d;
  border-radius: 6px;
  background: #1a365d;
  color: #fff;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

.login-submit:hover:not(:disabled),
.login-submit:focus-visible {
  background: #183154;
  box-shadow: 0 8px 18px rgb(26 54 93 / 0.18);
}

.login-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.login-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: login-spin 800ms linear infinite;
}

.login-submit.is-loading .login-spinner {
  display: inline-block;
}

.login-submit.is-loading .login-submit-text {
  opacity: 0.82;
}

.login-error {
  min-height: 22px;
  margin: 0;
  color: #e53e3e;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.login-form.shake {
  animation: login-shake 260ms ease;
}

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

@keyframes login-shake {
  0%, 100% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-7px);
  }
  44% {
    transform: translateX(7px);
  }
  66% {
    transform: translateX(-4px);
  }
  82% {
    transform: translateX(4px);
  }
}

.admin-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100dvh;
}

.admin-side {
  background: var(--side);
  color: #dbe2ea;
  padding: 18px 12px;
}

.admin-brand {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid #fff;
  border-radius: 50%;
}

.admin-nav {
  margin-top: 12px;
  display: grid;
  gap: 4px;
}

.admin-nav button {
  height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 0 12px;
}

.admin-nav button:hover {
  background: rgb(255 255 255 / 0.07);
}

.admin-nav button.active {
  background: var(--accent);
  color: #fff;
}

.admin-main {
  min-width: 0;
  padding: 18px;
}

.admin-top {
  min-height: 70px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.admin-top h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.admin-top p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-actions,
.button-row,
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

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

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  line-height: 1;
}

.admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.admin-card-title {
  padding: 14px 16px;
  border-bottom: 1px solid #e8eef5;
  font-weight: 900;
}

.admin-card-body {
  padding: 16px;
}

.bordered-top {
  border-top: 1px solid #e8eef5;
}

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

.settings-split {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
}

.admin-field {
  display: grid;
  gap: 6px;
}

.admin-field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-field input,
.admin-field textarea,
.admin-field select,
.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 10px;
  outline: none;
}

.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.admin-field textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.55;
}

.block-field {
  margin-top: 14px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 34px;
  border-radius: var(--radius);
  padding: 0 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.ghost-btn {
  border: 1px solid #c7d2e0;
  background: #fff;
  color: #263242;
}

.ghost-btn:hover {
  background: #f8fafc;
}

.danger-btn {
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: var(--danger);
}

.toolbar {
  margin-bottom: 12px;
}

.toolbar select {
  max-width: 140px;
}

.toolbar input {
  max-width: 360px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  border-bottom: 1px solid #e8eef5;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  background: #f8fafc;
  white-space: nowrap;
}

.table small {
  color: #94a3b8;
}

.summary-cell {
  min-width: 240px;
  max-width: 360px;
  line-height: 1.55;
}

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

.nowrap {
  white-space: nowrap;
}

.empty-cell {
  text-align: center;
  color: #94a3b8;
  padding: 28px;
}

.status,
.notify {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.pending {
  color: var(--warning);
  background: #fef3c7;
}

.status.processing {
  color: #1d4ed8;
  background: #dbeafe;
}

.status.closed {
  color: #047857;
  background: #d1fae5;
}

.notify.disabled {
  color: #64748b;
  background: #f1f5f9;
}

.notify.sent {
  color: #047857;
  background: #d1fae5;
}

.notify.failed {
  color: #b91c1c;
  background: #fee2e2;
}

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

.recent-item {
  width: 100%;
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: #fff;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.recent-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.recent-item strong {
  display: block;
}

.recent-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.recent-item em {
  color: var(--muted);
  font-style: normal;
  white-space: nowrap;
  font-size: 12px;
}

.preview-frame {
  width: 430px;
  max-width: 100%;
  height: 760px;
  border: 1px solid #cfd8e3;
  margin-top: 16px;
  background: #fff;
}

.report-dialog {
  width: min(760px, calc(100% - 36px));
  max-height: min(760px, calc(100dvh - 36px));
  padding: 0;
  overflow: hidden;
}

.dialog-head {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #e8eef5;
}

.icon-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  position: relative;
}

.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 8px;
  width: 2px;
  height: 18px;
  background: #111827;
  transform: rotate(45deg);
}

.icon-close::after {
  transform: rotate(-45deg);
}

.report-detail {
  padding: 16px;
  overflow: auto;
  max-height: calc(min(760px, 100dvh - 36px) - 52px);
}

.report-detail dl {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0 0 16px;
}

.report-detail .field-value-list {
  margin-bottom: 0;
}

.report-detail dt {
  color: var(--muted);
  font-weight: 700;
}

.report-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.muted-text {
  color: var(--muted);
}

.report-detail section {
  border-top: 1px solid #e8eef5;
  padding-top: 14px;
  margin-top: 14px;
}

.report-detail h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.report-detail p {
  margin: 0;
  color: #334155;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.evidence-image-link {
  display: inline-block;
  max-width: 100%;
}

.evidence-image {
  display: block;
  max-width: min(100%, 420px);
  max-height: 420px;
  object-fit: contain;
  border: 1px solid #d8e1ec;
  border-radius: var(--radius);
  background: #f8fafc;
}

.report-detail .evidence-image-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.report-detail textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  padding: 10px;
  resize: vertical;
  outline: none;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(480px, calc(100% - 28px));
  background: rgb(15 23 42 / 0.92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  display: none;
  z-index: 30;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .login-field input,
  .password-toggle,
  .login-submit,
  .login-error {
    transition: none;
  }

  .login-spinner,
  .login-form.shake {
    animation: none;
  }
}

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

  .login-visual {
    min-height: 34dvh;
  }

  .login-panel {
    min-height: 66dvh;
    place-items: start center;
    padding-top: 42px;
  }

  .login-visual-copy {
    padding: 0 28px 28px;
  }

  .choice-item {
    min-height: 50px;
    font-size: 16px;
  }

  .flow-topbar {
    height: 40px;
    padding: 0 12px;
  }

  .flow-kicker {
    min-height: 40px;
    padding: 0 12px;
    font-size: 16px;
  }

  .admin-layout,
  .stat-grid,
  .admin-grid,
  .field-config-grid,
  .settings-split {
    grid-template-columns: 1fr;
  }

  .admin-side {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .admin-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow-x: auto;
  }

  .admin-nav button {
    text-align: center;
    padding: 0 8px;
    white-space: nowrap;
  }

  .admin-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar input,
  .toolbar select {
    max-width: none;
    flex: 1 1 220px;
  }
}

@media (max-width: 480px) {
  .login-visual {
    min-height: 28dvh;
  }

  .login-panel {
    min-height: 72dvh;
    padding: 34px 20px;
  }

  .login-heading h1 {
    font-size: 26px;
  }

  .choice-item {
    font-size: 16px;
  }

  .image-upload-box {
    width: 88px;
    height: 88px;
  }

  .admin-main {
    padding: 12px;
  }

  .admin-side {
    padding: 12px;
  }

  .admin-brand {
    height: 42px;
  }

  .admin-nav {
    grid-template-columns: repeat(6, 86px);
  }

  .report-detail dl {
    grid-template-columns: 1fr;
  }
}
