:root {
  --bg: #eef5f5;
  --bg-deep: #d9e8e7;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(11, 78, 74, 0.14);
  --ink: #153233;
  --muted: #5d7d7d;
  --accent: #0f766e;
  --accent-strong: #0a5d56;
  --accent-soft: #d5f1ec;
  --gold: #b88a32;
  --danger: #c23b2f;
  --shadow: 0 28px 70px rgba(21, 50, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 138, 50, 0.18), transparent 28%),
    radial-gradient(circle at right 12% bottom 18%, rgba(15, 118, 110, 0.18), transparent 26%),
    linear-gradient(180deg, var(--bg) 0%, #f8fbfb 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto;
  padding: 48px 0 60px;
  overflow-x: clip;
}

.admin-page-shell {
  width: min(920px, calc(100% - 32px));
}

.login-page-shell {
  width: min(560px, calc(100% - 24px));
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.hero-glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.55;
  pointer-events: none;
}

.hero-glow-left {
  top: -50px;
  left: -90px;
  background: rgba(184, 138, 50, 0.16);
}

.hero-glow-right {
  top: 130px;
  right: -80px;
  background: rgba(15, 118, 110, 0.16);
}

.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 28px;
}

.hero > div,
.panel-header > div {
  min-width: 0;
}

.hero-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 12px;
  color: var(--gold);
}

h1,
h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", "Microsoft YaHei", serif;
}

h1 {
  max-width: 780px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.15;
}

h2 {
  font-size: clamp(24px, 2.4vw, 32px);
}

.hero-copy {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.status-pill {
  flex-shrink: 0;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--panel-border);
  color: var(--accent-strong);
  box-shadow: 0 12px 30px rgba(21, 50, 51, 0.08);
}

.settings-button {
  min-width: 124px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
}

.page-footer {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-bottom: 4px;
}

.logout-button {
  width: min(320px, 100%);
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.login-layout {
  display: grid;
  align-items: center;
}

.login-panel {
  padding: 28px;
}

.login-copy {
  margin-bottom: 20px;
}

.panel {
  position: relative;
  padding: 26px;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.panel-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.clock-block {
  text-align: right;
  color: var(--muted);
}

.clock-block span {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.clock-block strong {
  font-size: 16px;
  color: var(--accent-strong);
}

.record-form,
.search-form {
  position: relative;
  display: grid;
  gap: 18px;
}

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

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

.upload-split-card,
.detail-subsection {
  min-width: 0;
}

.upload-split-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(248, 251, 251, 0.88);
  border: 1px solid rgba(21, 50, 51, 0.08);
}

.field-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.field span {
  font-weight: 600;
  line-height: 1.35;
}

.field input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(21, 50, 51, 0.12);
  border-radius: 18px;
  background: rgba(248, 251, 251, 0.92);
  color: var(--ink);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.record-time-editor {
  display: grid;
  gap: 10px;
}

.editor-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.inline-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
}

.field input:focus,
.field select:focus,
.search-form input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.52);
  box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.09);
  transform: translateY(-1px);
}

.field select {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(21, 50, 51, 0.12);
  border-radius: 18px;
  background: rgba(248, 251, 251, 0.92);
  color: var(--ink);
  appearance: none;
}

.field small {
  color: var(--muted);
  line-height: 1.55;
}

.field input[type="file"] {
  padding: 12px;
  min-height: auto;
}

.field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(20, 144, 133, 0.24));
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
}

.search-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 18px;
}

.search-form input {
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(21, 50, 51, 0.12);
  border-radius: 18px;
  background: rgba(248, 251, 251, 0.92);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.primary-button,
.secondary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #149085 100%);
  box-shadow: 0 18px 30px rgba(15, 118, 110, 0.18);
}

.ghost-button {
  color: var(--accent-strong);
  background: rgba(15, 118, 110, 0.08);
}

.danger-button {
  color: var(--danger);
  background: rgba(194, 59, 47, 0.08);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.inline-message,
.results-meta {
  color: var(--muted);
  min-height: 24px;
}

.hidden {
  display: none !important;
}

.inline-message.success {
  color: var(--accent-strong);
}

.inline-message.error {
  color: var(--danger);
}

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

.result-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 248, 0.98));
  border: 1px solid rgba(21, 50, 51, 0.08);
  min-width: 0;
}

.summary-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  align-items: stretch;
  gap: 12px;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(21, 50, 51, 0.08);
}

.summary-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 14px;
  align-items: center;
}

.summary-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.result-number {
  justify-self: start;
}

.result-name,
.result-time,
.result-date {
  margin: 0;
}

.result-name {
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-time,
.result-date {
  color: var(--muted);
}

.summary-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.result-thumbnail {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(213, 241, 236, 0.78), rgba(233, 243, 242, 0.92));
  border: 1px solid rgba(21, 50, 51, 0.08);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.result-thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-thumbnail-empty {
  padding: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.summary-action {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
}

.result-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  white-space: nowrap;
}

.empty-card {
  grid-column: 1 / -1;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 30, 31, 0.42);
  backdrop-filter: blur(6px);
}

.detail-sheet {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  max-width: 100%;
  margin: 0 auto;
  padding: 22px;
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 40px 80px rgba(13, 30, 31, 0.2);
  overscroll-behavior: contain;
}

.settings-sheet {
  width: min(820px, calc(100% - 24px));
}

.detail-sheet-header,
.detail-section-header,
.detail-row,
.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detail-sheet-header {
  margin-bottom: 18px;
}

.detail-close {
  width: auto;
  min-width: 92px;
}

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

.detail-section {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(248, 251, 251, 0.98), rgba(240, 248, 248, 0.98));
  border: 1px solid rgba(21, 50, 51, 0.08);
  min-width: 0;
}

.detail-subsection {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(21, 50, 51, 0.08);
  min-width: 0;
}

.detail-row + .detail-row {
  margin-top: 14px;
}

.detail-row span,
.detail-hint {
  color: var(--muted);
}

.detail-row strong {
  text-align: right;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-section h3 {
  margin: 0;
  font-size: 18px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.compact-header {
  margin-bottom: 4px;
}

.detail-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

.detail-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.detail-media-link {
  display: block;
  text-decoration: none;
}

.detail-media-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-media-open {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-upload-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.detail-upload-field {
  margin-top: 0;
}

.detail-upload-button {
  width: 100%;
}

.detail-upload-message {
  margin-top: 10px;
}

.detail-image {
  display: block;
  width: 100%;
  border-radius: 18px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg-deep);
}

.detail-empty {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

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

.detail-form {
  display: grid;
  gap: 0;
}

.follow-up-fields {
  display: grid;
  gap: 0;
}

.review-preview {
  margin-top: 16px;
}

.review-preview-header {
  margin-bottom: 0;
}

.detail-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.detail-actions .primary-button,
.detail-actions .danger-button {
  width: 100%;
}

.result-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg-deep);
}

@media (max-width: 920px) {
  .hero {
    flex-direction: column;
    align-items: start;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  .upload-split-grid,
  .detail-split-grid {
    grid-template-columns: 1fr;
  }

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

  .summary-body {
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  .result-thumbnail {
    width: 78px;
    height: 78px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: 100%;
    max-width: 100%;
    padding: 18px 8px calc(92px + env(safe-area-inset-bottom));
  }

  .hero-glow {
    width: 200px;
    height: 200px;
    filter: blur(28px);
  }

  .panel {
    padding: 18px 16px;
    border-radius: 22px;
  }

  .panel-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .clock-block {
    text-align: left;
  }

  .hero {
    gap: 14px;
    margin-bottom: 18px;
  }

  .eyebrow,
  .panel-kicker {
    margin-bottom: 8px;
    letter-spacing: 0.16em;
    font-size: 11px;
  }

  h1 {
    font-size: clamp(28px, 9vw, 38px);
    line-height: 1.18;
  }

  h2 {
    font-size: 24px;
  }

  .hero-copy {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.65;
  }

  .status-pill {
    width: 100%;
    padding: 12px 14px;
    text-align: center;
  }

  .hero-actions {
    width: 100%;
    justify-items: stretch;
  }

  .layout {
    gap: 14px;
  }

  .record-form,
  .search-form {
    gap: 12px;
  }

  .field {
    gap: 6px;
    padding: 14px;
    border-radius: 20px;
    background: rgba(241, 248, 247, 0.88);
    border: 1px solid rgba(21, 50, 51, 0.08);
  }

  .field input {
    min-height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
  }

  .field-inline {
    grid-template-columns: 1fr;
  }

  .field select {
    min-height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
  }

  .field input[type="file"] {
    padding: 10px;
  }

  .field input[type="file"]::file-selector-button {
    display: block;
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
    border-radius: 14px;
  }

  .field small {
    font-size: 13px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
    min-height: 52px;
    font-weight: 600;
  }

  .editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-panel .primary-button {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 3;
    box-shadow: 0 22px 34px rgba(15, 118, 110, 0.22);
  }

  .search-form {
    grid-template-columns: 1fr;
    margin-bottom: 14px;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .result-card {
    padding: 14px;
    border-radius: 18px;
  }

  .summary-body {
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 12px;
  }

  .result-thumbnail {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .summary-action-row,
  .detail-sheet-header,
  .detail-section-header,
  .detail-row {
    flex-direction: column;
    align-items: start;
  }

  .result-badge {
    width: fit-content;
  }

  .detail-modal {
    align-items: flex-end;
    padding: 0;
  }

  .detail-sheet {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    overflow-x: hidden;
  }

  .detail-section {
    padding: 14px;
    border-radius: 18px;
  }

  .detail-sheet-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 10px;
    background: rgba(255, 255, 255, 0.96);
  }

  .detail-content {
    gap: 12px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

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

  .detail-image {
    aspect-ratio: 1 / 1;
  }

  .detail-row strong {
    text-align: left;
  }

  .inline-message,
  .results-meta {
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .page-shell {
    padding-left: 6px;
    padding-right: 6px;
  }

  h1 {
    font-size: 26px;
  }

  .panel {
    padding: 16px 14px;
  }

  .field {
    padding: 12px;
  }
}
