:root {
  --ink: #172033;
  --muted: #697587;
  --line: #d8dee6;
  --surface: #fff;
  --page: #f3f5f7;
  --accent: #1f6a74;
  --accent-soft: #e8f2f2;
  --danger: #a53f3f;
  --danger-soft: #f8eaea;
  --success: #256a57;
  --success-soft: #e8f3ef;
  --amber: #96611f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

[hidden] {
  display: none !important;
}

.container {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.button:hover {
  border-color: #aeb8c4;
}

.button.primary {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.button.primary:hover {
  background: #185b64;
}

.button.secondary {
  color: var(--accent);
  border-color: #a7c2c5;
}

.button.danger {
  color: var(--danger);
  border-color: #ddbcbc;
}

.button.full {
  width: 100%;
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  text-decoration: underline;
}

.muted {
  color: var(--muted);
  font-size: 11px;
}

.message {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #e3cfa8;
  color: var(--amber);
  background: #fbf5e8;
  font-size: 12px;
}

.message.success {
  color: var(--success);
  border-color: #bfd9d0;
  background: var(--success-soft);
}

.message.error {
  color: var(--danger);
  border-color: #e4c1c1;
  background: var(--danger-soft);
}

.message.floating {
  position: fixed;
  z-index: 30;
  top: 14px;
  right: 14px;
  width: min(420px, calc(100% - 28px));
  margin: 0;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.12);
}

.public-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.header-inner {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 18px;
}

.header-inner h1 {
  margin-bottom: 8px;
  font-size: 25px;
  line-height: 1.25;
}

.person-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.person-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.person-picker span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.person-picker select {
  width: min(220px, 100%);
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #b8c3cf;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.person-line > strong {
  margin-right: 4px;
  font-size: 17px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 3px;
  color: #28555a;
  background: var(--accent-soft);
  font-size: 11px;
}

.deadline {
  display: grid;
  gap: 3px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
  text-align: right;
}

.deadline span {
  color: var(--muted);
  font-size: 11px;
}

.deadline strong {
  font-size: 13px;
}

.public-main {
  padding-block: 24px 80px;
}

.form-section {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.section-heading h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
}

.record-list {
  display: grid;
  gap: 9px;
}

.record-card {
  display: grid;
  grid-template-columns: 92px 150px minmax(150px, 1fr) minmax(140px, 1fr) 138px 138px 32px;
  gap: 9px;
  align-items: end;
  padding: 11px;
  border: 1px solid #e0e5eb;
  border-radius: 5px;
  background: #fbfcfd;
}

.field {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.field > span {
  color: var(--muted);
  font-size: 10px;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 35px;
  padding: 0 9px;
  border: 1px solid #c8d0da;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(31, 106, 116, 0.15);
}

.field input[type="file"] {
  padding: 5px 7px;
  font-size: 10px;
}

.field input[type="file"]:disabled {
  color: #98a2b3;
  background: #f1f3f5;
  cursor: not-allowed;
}

.icon-button {
  width: 32px;
  height: 35px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
}

.icon-button:hover {
  color: var(--danger);
  border-color: #dcbaba;
  background: var(--danger-soft);
}

.material-groups {
  display: grid;
  gap: 10px;
}

.material-group {
  border: 1px solid #e0e5eb;
  border-radius: 5px;
  overflow: hidden;
}

.material-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  background: #f7f8fa;
  border-bottom: 1px solid #e4e8ee;
}

.material-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-mark {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
}

.material-list {
  display: grid;
  gap: 8px;
  padding: 9px 11px 10px;
}

.material-list:empty {
  display: none;
}

.material-row {
  display: grid;
  grid-template-columns: 92px minmax(210px, 1.2fr) minmax(170px, 0.8fr) minmax(150px, 1fr) 32px;
  gap: 9px;
  align-items: end;
  padding: 9px;
  border: 1px solid #e4e8ee;
  border-radius: 4px;
  background: #fff;
}

.material-files {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-self: center;
}

.material-files > span {
  color: var(--muted);
  font-size: 10px;
}

.file-list {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.file-name {
  max-width: 100%;
  overflow: hidden;
  color: #3d4a5d;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.submit-bar {
  position: sticky;
  z-index: 8;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  border: 1px solid #bfc8d3;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.12);
}

.submit-bar > span {
  color: var(--muted);
  font-size: 10px;
}

.submit-actions,
.header-actions,
.row-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.landing-panel,
.login-form {
  width: min(390px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.landing-panel h1,
.login-form h1 {
  margin-bottom: 16px;
  font-size: 22px;
}

.landing-panel p {
  color: var(--muted);
}

.login-form .field {
  margin-bottom: 14px;
}

.error-code {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 34px;
  font-weight: 700;
}

.admin-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-header-inner {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 17px;
}

.admin-header h1 {
  margin-bottom: 4px;
  font-size: 22px;
}

.admin-header span {
  color: var(--muted);
  font-size: 11px;
}

.admin-main {
  padding-block: 22px 60px;
}

.shared-link-band {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 13px 15px;
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.shared-link-main,
.shared-link-expiry {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.shared-link-main span,
.shared-link-expiry span {
  color: var(--muted);
  font-size: 10px;
}

.shared-link-main code {
  overflow: hidden;
  color: #3c4a5d;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.shared-link-expiry strong {
  font-size: 12px;
}

.shared-link-actions {
  display: flex;
  gap: 8px;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #e6eaef;
  text-align: left;
  vertical-align: top;
  font-size: 11px;
}

.data-table th {
  color: var(--muted);
  background: #f6f8f9;
  font-size: 10px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table th:nth-child(1) { width: 10%; }
.data-table th:nth-child(2) { width: 30%; }
.data-table th:nth-child(3),
.data-table th:nth-child(4),
.data-table th:nth-child(5) { width: 9%; }
.data-table th:nth-child(6) { width: 10%; }
.data-table th:nth-child(7) { width: 23%; }

.role-list {
  display: grid;
  gap: 3px;
}

.role-list span {
  color: #475367;
  font-size: 10px;
}

.status {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}

.status.draft {
  color: var(--amber);
  background: #faf0df;
}

.status.submitted {
  color: var(--success);
  background: var(--success-soft);
}

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

.row-actions {
  flex-wrap: wrap;
}

.detail-dialog {
  width: min(850px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid #bfc8d3;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.detail-dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin-bottom: 3px;
  font-size: 18px;
}

.dialog-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
}

.dialog-content {
  padding: 15px 17px;
  overflow-y: auto;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 12px 17px;
  border-top: 1px solid var(--line);
  background: #f8f9fb;
}

.detail-block {
  margin-bottom: 20px;
}

.detail-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.detail-block p {
  color: var(--muted);
  font-size: 11px;
}

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

.mini-table th,
.mini-table td {
  padding: 7px 8px;
  border: 1px solid #e3e8ee;
  text-align: left;
  font-size: 10px;
}

.mini-table th {
  color: var(--muted);
  background: #f7f8fa;
}

.attachment-link {
  display: block;
  margin: 3px 0;
  font-size: 10px;
}

@media (max-width: 980px) {
  .record-card {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 32px;
  }

  .record-card .icon-button {
    grid-row: 1;
    grid-column: 3;
  }

  .material-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 32px;
  }

  .material-row .material-files {
    grid-column: 1 / 3;
  }

  .material-row .icon-button {
    grid-row: 1;
    grid-column: 3;
  }
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 24px, 1180px);
  }

  .header-inner,
  .admin-header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .header-inner h1 {
    font-size: 21px;
  }

  .deadline {
    width: 100%;
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }

  .public-main {
    padding-block: 14px 20px;
  }

  .form-section {
    padding: 14px 12px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .record-card,
  .material-row {
    grid-template-columns: 1fr 1fr 32px;
    padding: 9px;
  }

  .record-card .field,
  .material-row .field {
    grid-column: span 3;
  }

  .record-card .field:nth-of-type(1),
  .record-card .field:nth-of-type(2),
  .record-card .field:nth-of-type(5),
  .record-card .field:nth-of-type(6) {
    grid-column: span 1;
  }

  .material-row .field:nth-of-type(1) {
    grid-column: span 1;
  }

  .material-row .field:nth-of-type(2),
  .material-row .field:nth-of-type(3) {
    grid-column: span 3;
  }

  .record-card .icon-button,
  .material-row .icon-button {
    grid-row: 1;
    grid-column: 3;
  }

  .material-row .material-files {
    grid-column: 1 / 4;
  }

  .submit-bar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .submit-actions,
  .header-actions {
    width: 100%;
  }

  .submit-actions .button,
  .header-actions .button {
    flex: 1;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
  }

  .data-table tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
  }

  .shared-link-band {
    grid-template-columns: 1fr;
  }

  .shared-link-actions {
    flex-wrap: wrap;
  }

  .shared-link-actions .button {
    flex: 1;
  }
}

@media (max-width: 430px) {
  .record-card .field,
  .material-row .field {
    grid-column: span 3 !important;
  }
}
