:root {
  --ink: #142b30;
  --muted: #6f7f82;
  --line: #dfe7e5;
  --paper: #ffffff;
  --canvas: #f6f8f7;
  --teal: #0f8678;
  --teal-dark: #097064;
  --teal-soft: #e9f5f2;
  --shadow: 0 18px 45px rgba(16, 48, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  overflow: hidden;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

.page {
  width: min(1380px, calc(100% - 48px));
  height: 100vh;
  margin: 0 auto;
  padding: 14px 0;
}

.screen {
  display: none;
  height: calc(100vh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.screen-active {
  display: block;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #edf2f0;
  background: white;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.3px;
}

.hero h1 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(28px, 3vw, 36px);
  letter-spacing: -1.8px;
  line-height: 1.05;
}

.hero p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.date-chip {
  min-width: 170px;
  margin-top: 13px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #607174;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

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

.admin-portal-link {
  margin-top: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.admin-portal-link:hover {
  background: var(--teal-dark);
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 62px;
  row-gap: 18px;
  align-items: start;
  padding: 14px 10px 14px;
  background: white;
}

.panel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 0 0 0 4px;
}

.panel-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 230px;
  width: fit-content;
  margin-bottom: 14px;
  padding: 11px 26px;
  border-radius: 9px;
  background: var(--teal);
  color: white;
}

.panel-title h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 18px;
  letter-spacing: -0.4px;
}

.hint {
  display: none;
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

label {
  display: block;
  margin-top: 10px;
  color: #385157;
  font-size: 12px;
  font-weight: 800;
}

label b {
  color: #c45656;
}

input,
textarea {
  display: block;
  min-width: 0;
  width: 100%;
  margin-top: 9px;
  border: 1px solid #cbd9d7;
  border-radius: 5px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 15px;
}

input {
  height: 40px;
  padding: 0 14px;
}

textarea {
  height: 40px;
  min-height: 40px;
  padding: 13px 14px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 134, 120, 0.1);
}

.quote {
  display: flex;
  min-height: 40px;
  margin-top: 0;
  padding: 10px 16px;
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  color: #23494c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  align-items: center;
  overflow-wrap: anywhere;
  user-select: none;
}

.declaration-instruction {
  margin: 10px 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.validation-message {
  position: relative;
  z-index: 1;
  height: 0;
  min-height: 0;
  margin: 0;
  color: #a75454;
  font-size: 12px;
  opacity: 0;
  transform: translateY(4px);
}

.declaration-panel label {
  margin-top: 12px;
}

.validation-message.visible {
  opacity: 1;
}

.combined-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  grid-column: 1 / -1;
  justify-content: center;
  gap: 8px;
  padding-top: 2px;
}

.combined-submit {
  width: min(100%, 340px);
  min-height: 44px;
}

.access-validation {
  display: none;
  max-width: 720px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #e5caca;
  border-radius: 6px;
  background: #fff7f7;
  color: #984848;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.access-validation.visible {
  display: block;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 22px;
  padding-top: 0;
}

.button {
  min-height: 38px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.button.primary {
  background: var(--teal);
  color: white;
}

.button.primary:hover {
  background: var(--teal-dark);
}

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

.button.ghost {
  border-color: var(--line);
  background: white;
  color: #5f7073;
}

.my-list,
.directory {
  margin-top: 12px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 24px rgba(16, 48, 51, 0.035);
}

.my-list {
  margin-top: 10px;
  padding: 13px 18px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.directory-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.section-heading h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 19px;
}

.section-heading > p,
#registryCount {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-table {
  display: grid;
  gap: 6px;
  max-height: 92px;
  overflow: auto;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid #edf1ef;
  border-radius: 8px;
  background: #fbfcfb;
}

.row strong {
  display: block;
  font-size: 13px;
}

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

.row-actions {
  display: flex;
  gap: 10px;
}

.row button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.row button[data-edit] {
  color: var(--teal);
}

.row button[data-delete] {
  color: #a55454;
}

.declaration-record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 11px 12px;
  border: 1px solid #d4e5e1;
  border-radius: 8px;
  background: #f2fbf8;
}

.declaration-record[hidden] {
  display: none;
}

.declaration-record > div {
  display: grid;
  gap: 3px;
}

.declaration-record strong {
  color: var(--ink);
  font-size: 13px;
}

.declaration-record span {
  color: var(--muted);
  font-size: 12px;
}

.declaration-record button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #d8bcbc;
  border-radius: 5px;
  background: white;
  color: #9a4949;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.directory-controls {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(230px, 0.85fr) minmax(420px, 1.8fr) minmax(180px, 0.65fr);
  gap: 18px;
}

.directory-toolbar {
  display: block;
  margin-bottom: 12px;
}

/* ---- Application for Database Usage（入口按钮 + 弹窗）---- */
.application-trigger {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  background: white;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.application-trigger:hover {
  background: var(--teal-soft);
}

.application-modal {
  width: min(560px, calc(100% - 40px));
  padding: 0;
  border: none;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.application-modal::backdrop {
  background: rgba(20, 43, 48, 0.35);
}
.application-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.application-modal-header h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
}
.close-button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.application-modal-body {
  padding: 20px 24px 24px;
}
.application-steps {
  margin: 0 0 18px;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
.application-steps li {
  margin-bottom: 8px;
}
.application-steps a {
  color: var(--teal);
  font-weight: 700;
  text-decoration: underline;
}
.application-modal-body h3 {
  margin: 18px 0 8px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
}
.application-modal-body h3:first-child {
  margin-top: 0;
}
.application-text {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

#directorySearch,
#descriptionSearch,
#contributorFilter {
  margin-top: 0;
  height: 42px;
  font-size: 13px;
}

#contributorFilter {
  width: 100%;
  padding: 0 12px;
  border: 1px solid #cbd9d7;
  border-radius: 5px;
  background: white;
  color: var(--ink);
  outline: none;
}

.directory-list {
  display: grid;
  max-height: calc(100vh - 190px);
  overflow: auto;
  border-top: 1px solid var(--line);
}

.directory-card {
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) minmax(420px, 1.8fr) minmax(180px, 0.65fr);
  gap: 18px;
  align-items: center;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.directory-card strong {
  font-size: 13px;
}

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

.directory-card small {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.directory-empty {
  grid-template-columns: 1fr;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 18px;
  border-radius: 8px;
  background: #123a3d;
  color: white;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .action-grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .directory-controls,
  .directory-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 24px, 1380px);
    padding-top: 16px;
  }

  .hero,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .date-chip,
  #directorySearch,
  #descriptionSearch,
  #contributorFilter {
    width: 100%;
    max-width: none;
    margin-top: 8px;
  }

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

  .admin-portal-link {
    margin-top: 0;
    text-align: center;
  }

  .panel-title {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

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