:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --line: #d8e0e7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --success: #087443;
  --success-bg: #e8f8ef;
  --success-line: #8fd4ad;
  --danger-bg: #fff1f0;
  --danger-line: #f0a29b;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  padding: 28px;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.admin-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.masked-input {
  -webkit-text-security: disc;
}

.total-line {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  background: #f8fafc;
}

.total-line span,
.stats span {
  color: var(--muted);
  font-weight: 700;
}

.total-line strong,
.stats strong {
  font-size: 22px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 13px 18px;
}

button:hover {
  background: var(--accent-dark);
}

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

button.secondary {
  background: #334155;
}

button.secondary:hover {
  background: #1f2937;
}

button.small {
  width: auto;
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}

button.danger {
  background: #b42318;
}

button.danger:hover {
  background: #8f1d14;
}

.message {
  min-height: 24px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.success {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: var(--success);
  padding: 12px 14px;
}

.error {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
  padding: 12px 14px;
}

.admin-panel {
  padding-bottom: 20px;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}

.password-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #f8fafc;
}

.password-box summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
}

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

.stats > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #e8f0f7;
  font-weight: 700;
  white-space: nowrap;
}

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

td input,
td textarea {
  min-width: 96px;
  padding: 8px 9px;
  font-size: 13px;
}

td textarea {
  min-width: 220px;
}

.amount-cell {
  font-weight: 700;
  white-space: nowrap;
}

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 16px 0;
  }

  .form-panel {
    padding: 18px;
  }

  .title-row {
    align-items: flex-start;
  }

  h1 {
    font-size: 22px;
  }

  .entry-form,
  .admin-tools,
  .stats,
  .password-grid {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
