:root {
  --gold: #9c7953;
  --ink: #292a27;
  --muted: #70716d;
  --line: #e3e2dc;
  --paper: #f5f4ef;
  --radius: 8px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    14px/1.6 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
[hidden] {
  display: none !important;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover {
  background: #eae7e0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.primary:hover {
  background: #45483e;
}
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d3d2ca;
  border-radius: 5px;
  background: white;
  color: var(--ink);
}
textarea {
  min-height: 100px;
  resize: vertical;
}
label {
  display: block;
  color: #62635f;
  margin: 12px 0;
}
label input,
label textarea,
label select {
  display: block;
  margin-top: 6px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 30px;
  font-weight: 550;
  letter-spacing: -0.03em;
}
h2 {
  font-size: 22px;
  font-weight: 550;
}
.eyebrow {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.16em;
}
.login {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
  background: white;
}
.login-art {
  background:
    linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.08)),
    url("/media/images/case-modern.jpg") center/cover;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 64px;
}
.login-art span {
  margin-bottom: auto;
  letter-spacing: 0.3em;
}
.login-art h1 {
  font-size: 44px;
  line-height: 1.5;
  margin-bottom: 24px;
}
.login form {
  width: min(370px, 85%);
  margin: auto;
}
.login h2 {
  font-size: 30px;
  margin: 10px 0;
}
.login p {
  color: var(--muted);
  margin-bottom: 28px;
}
.login button {
  width: 100%;
  margin: 15px 0;
}
.login small {
  color: var(--muted);
}
#login-error,
#edit-error {
  color: #a23d2d;
  white-space: pre-wrap;
}
aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 216px;
  background: #eae9e2;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.brand {
  font-size: 26px;
  letter-spacing: 0.12em;
  padding: 0 12px 28px;
}
.brand span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.13em;
  color: var(--muted);
}
nav {
  overflow-y: auto;
  flex: 1;
}
nav small {
  display: block;
  margin: 20px 12px 8px;
  color: var(--muted);
  font-size: 11px;
}
nav button {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
  margin-bottom: 3px;
  padding-left: 14px;
}
nav button.active {
  background: #fff;
  color: var(--gold);
  box-shadow: 0 1px 3px #0000000a;
}
main {
  margin-left: 216px;
  padding: 38px 44px;
  max-width: 1800px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
header p {
  color: var(--muted);
  margin-top: 8px;
}
.environment {
  background: #eee3cc;
  color: #795c30;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar input {
  max-width: 300px;
  margin-right: auto;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}
th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  background: #fafaf7;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 16px 18px;
  border-bottom: 1px solid #eeeee8;
}
tbody tr:last-child td {
  border: 0;
}
tbody tr:hover {
  background: #faf9f6;
}
.identity {
  display: flex;
  gap: 14px;
  align-items: center;
}
.identity img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--paper);
}
.identity small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.tag {
  display: inline-block;
  background: #f0f0e9;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
}
.tag.good {
  background: #edf1e9;
  color: #546948;
}
.amount {
  font-variant-numeric: tabular-nums;
}
.empty {
  padding: 65px 25px;
  text-align: center;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 28px 0 36px;
}
.stat {
  padding: 26px 0;
}
.stat span {
  color: var(--muted);
}
.stat strong {
  display: block;
  font-size: 40px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.welcome-photo {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 8px;
}
.work-note {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  background: white;
  padding: 24px;
  border-radius: 8px;
  margin-top: 24px;
}
.work-note p {
  color: var(--muted);
  margin-top: 8px;
}
dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(820px, calc(100% - 24px));
  max-height: 90vh;
  box-shadow: 0 24px 80px #0003;
}
dialog::backdrop {
  background: #15191166;
}
dialog form {
  padding: 26px;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.dialog-heading button {
  font-size: 22px;
  border: 0;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.field-grid .wide {
  grid-column: 1/-1;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 16px 0;
  padding: 14px;
}
legend {
  padding: 0 8px;
  color: var(--gold);
}
details {
  margin: 15px 0;
}
summary {
  cursor: pointer;
  color: var(--muted);
  padding: 10px 0;
}
.array-item {
  background: var(--paper);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.field-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.field-tools input {
  flex: 1;
}
.field-tools button {
  flex-shrink: 0;
}
.form-image {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  background: var(--paper);
  border-radius: 5px;
  margin-top: 10px;
}
footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: -26px;
  background: white;
  padding: 18px 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.detail-row span {
  color: var(--muted);
  flex-shrink: 0;
}
.detail-row strong {
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}
.message {
  padding: 16px;
  background: var(--paper);
  margin: 12px 0;
  border-radius: 8px;
}
.message small {
  color: var(--muted);
}
.message p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #292a27;
  color: white;
  border-radius: 7px;
  z-index: 10;
}
a {
  color: var(--gold);
}
@media (max-width: 800px) {
  aside {
    width: 166px;
    padding: 22px 10px;
  }
  .brand {
    font-size: 22px;
  }
  main {
    margin-left: 166px;
    padding: 26px 20px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .login {
    grid-template-columns: 1fr;
  }
  .login-art {
    min-height: 250px;
    padding: 30px;
  }
  .login-art h1 {
    font-size: 28px;
  }
  .login form {
    padding: 36px 0;
  }
  .work-note {
    flex-direction: column;
  }
}
@media (max-width: 520px) {
  aside {
    position: static;
    width: 100%;
    padding: 14px;
    display: block;
  }
  .brand {
    padding: 0 4px 10px;
    font-size: 20px;
  }
  .brand span {
    display: inline;
    font-size: 9px;
    margin-left: 12px;
  }
  nav {
    display: flex;
    gap: 5px;
    overflow: auto;
  }
  nav small {
    display: none;
  }
  nav button {
    width: auto;
    flex-shrink: 0;
  }
  #logout {
    position: absolute;
    right: 14px;
    top: 12px;
    font-size: 11px;
    padding: 4px 8px;
    min-height: 32px;
  }
  main {
    margin: 0;
    padding: 24px 16px;
  }
  h1 {
    font-size: 25px;
  }
  .environment {
    font-size: 12px;
    padding: 4px 10px;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  dialog form {
    padding: 18px;
  }
  .work-note {
    padding: 18px;
  }
  .welcome-photo {
    height: 180px;
  }
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pagination-info {
  color: var(--muted);
  font-size: 13px;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pagination-controls select {
  width: auto;
  padding: 6px 10px;
}
.pagination-controls button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
