:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d8dde6;
  --text: #1f2933;
  --muted: #697386;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #b42318;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}
.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
}
.login-logo {
  width: min(238px, 73%);
  max-height: 70px;
  justify-self: center;
  margin-bottom: 2px;
}
.login-box h1 { font-size: 22px; }
#loginHint { color: var(--danger); min-height: 20px; font-size: 13px; }
.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  padding: 0;
  justify-self: start;
}
.forgot-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
}
#resetHint {
  color: var(--muted);
  min-height: 20px;
  font-size: 13px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
}
.topbar-logo {
  width: clamp(110px, 12vw, 180px);
  max-height: 54px;
  flex: 0 0 auto;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; }
.topbar p { color: var(--muted); margin-top: 4px; font-size: 13px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#currentUser { color: var(--muted); font-size: 13px; }
.search-wrap {
  position: relative;
  display: block;
  min-width: min(420px, 100%);
}
.search-wrap input {
  padding-left: 38px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-55%);
  pointer-events: none;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  right: -7px;
  bottom: -4px;
  background: var(--muted);
  transform: rotate(45deg);
  transform-origin: left center;
}
input, select, textarea, button, .button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
input, select, textarea { padding: 9px 10px; width: 100%; }
button, .button {
  padding: 9px 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
button.primary, .primary { background: var(--accent); color: white; border-color: var(--accent); }
button.danger { color: white; background: var(--danger); border-color: var(--danger); }
button.ghost { background: transparent; }

main { padding: 18px 24px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.stat strong { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
.all-details {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.account-files {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin: 12px 0;
  padding: 0;
}
.list {
  display: grid;
  gap: 8px;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}
.list-row small, .path-note {
  color: var(--muted);
  font-size: 12px;
}
.path-note { margin-top: 8px; }
.form-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
  margin: 4px 0 10px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
table { width: 100%; border-collapse: collapse; min-width: 1480px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); background: #fafbfc; }
tr:hover td { background: #f8fafc; }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; background: #e0f2fe; color: #075985; font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.table-logo {
  width: 82px;
  height: 48px;
  object-fit: contain;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
}

dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
form, .detail { padding: 18px; }
.modal-head, .modal-actions, .detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-actions { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.spacer { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
label input, label select, label textarea { color: var(--text); font-size: 14px; }
.wide { grid-column: span 3; }

.photo-row { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.photo-row img { width: 180px; height: 120px; object-fit: contain; background: #eef2f7; border: 1px solid var(--line); border-radius: 6px; }
.photo-row img[src=""] { display: none; }
.upload input { margin-top: 6px; }
.inline-details {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.inline-details h3 {
  font-size: 16px;
  margin-bottom: 10px;
}
.inline-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.inline-detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 10px;
  padding: 12px;
}
.inline-detail-card h4 {
  margin: 0;
  font-size: 14px;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.inline-photo-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: center;
}
.inline-photo-row img {
  width: 92px;
  height: 68px;
  object-fit: contain;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.inline-photo-row img[src=""] { display: none; }

.detail { border-top: 1px solid var(--line); background: #fbfcfe; }
.detail-head { margin: 14px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.card img { width: 100%; height: 140px; object-fit: contain; border-radius: 6px; background: #eef2f7; margin: 8px 0; }
.card .meta { color: var(--muted); font-size: 13px; line-height: 1.6; }
.card h4 { margin: 0; font-size: 15px; }

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: white;
  padding: 10px 12px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s;
}
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .actions { align-items: stretch; }
  .stats, .grid { grid-template-columns: 1fr; }
  .wide { grid-column: span 1; }
  .split { grid-template-columns: 1fr; }
  .account-files { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
}
