:root {
  --bg: #f6f9ff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-soft: rgba(247, 251, 255, 0.86);
  --line: rgba(135, 164, 199, 0.18);
  --line-strong: rgba(126, 156, 194, 0.28);
  --ink: #243246;
  --muted: #6d7e92;
  --accent: #78a8da;
  --accent-deep: #5d8fc7;
  --accent-soft: rgba(120, 168, 218, 0.12);
  --warm-soft: rgba(248, 227, 154, 0.22);
  --ok: #1a8f5a;
  --shadow: 0 20px 60px rgba(88, 118, 156, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(249, 226, 148, 0.32), transparent 24%),
    radial-gradient(circle at top right, rgba(195, 223, 255, 0.3), transparent 30%),
    linear-gradient(135deg, #f5f9ff, #f8fbff 48%, #fffdf1);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.72);
  backdrop-filter: blur(18px);
}

.nav-group {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.nav-button {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  color: #486683;
  border: 1px solid var(--line);
  box-shadow: none;
}

.nav-button.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  box-shadow: 0 12px 26px rgba(93, 143, 199, 0.18);
}

.sidebar-card,
.card,
dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sidebar-card {
  margin-top: 28px;
  padding: 16px;
  border-radius: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(26, 143, 90, 0.16);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}

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

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

.export-link {
  display: inline-flex;
  align-items: center;
  margin-top: 24px;
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(93, 143, 199, 0.22);
}

.main-content {
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}

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

.view-panel.is-hidden {
  display: none;
}

.panel-header,
.list-header,
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.template-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 18px;
}

.record-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: none;
  min-height: 0;
  min-width: 122px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.overview-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.overview-value {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}

.card,
dialog {
  border-radius: 24px;
  padding: 16px;
}

.records-table-card {
  min-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
}

.template-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: var(--panel-soft);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.template-item h3 {
  margin-bottom: 8px;
}

.template-item:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(88, 118, 156, 0.08);
}

.template-item .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warm-soft);
  color: #7a6a2d;
  font-size: 12px;
  font-weight: 600;
}

form,
.field-editor-list,
.filters {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

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

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(120, 168, 218, 0.52);
  box-shadow: 0 0 0 4px rgba(120, 168, 218, 0.12);
  background: rgba(255, 255, 255, 0.98);
}

button {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  box-shadow: 0 12px 26px rgba(93, 143, 199, 0.2);
}

.ghost-button {
  background: var(--accent-soft);
  color: #486683;
}

.danger-button {
  background: rgba(184, 37, 37, 0.1);
  color: #8f2828;
}

button:hover {
  transform: translateY(-1px);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.field-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-row {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.field-row-main,
.field-row-sub {
  display: grid;
  gap: 10px;
}

.field-row-main {
  grid-template-columns: 1.4fr 1fr 180px;
}

.field-row-sub {
  grid-template-columns: 1.4fr 1.4fr 160px auto auto auto;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label input {
  width: auto;
}

.filters {
  grid-template-columns: 160px 200px 1fr;
  align-items: end;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  margin-top: 6px;
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: #5a6e86;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(247, 250, 255, 0.92);
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: rgba(244, 249, 255, 0.86);
}

.empty-row {
  padding: 40px 12px;
  text-align: center;
  color: var(--muted);
}

dialog {
  width: min(920px, calc(100vw - 48px));
}

dialog::backdrop {
  background: rgba(36, 50, 70, 0.28);
}

.record-detail-layout {
  display: grid;
  gap: 16px;
}

.detail-section {
  background: rgba(250, 252, 255, 0.84);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--line);
}

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

.detail-item {
  display: grid;
  gap: 4px;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.answer-list,
.media-list {
  display: grid;
  gap: 12px;
}

.answer-item,
.media-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 14px;
}

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

.media-links {
  align-items: center;
}

.map-frame {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.88);
}

.map-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.media-preview {
  margin-top: 12px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(248, 251, 255, 0.88);
  border: 1px solid var(--line);
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.media-preview audio {
  display: block;
  width: 100%;
}

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

.json-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(248, 251, 255, 0.84);
  border-radius: 18px;
  padding: 16px;
}

@media (max-width: 1100px) {
  .app-shell,
  .record-overview,
  .template-grid,
  .form-row.split,
  .field-row-main,
  .field-row-sub,
  .filters,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .records-table-card {
    min-height: auto;
  }
}
