:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --ink: #23262b;
  --muted: #6e7178;
  --line: #e2ddd0;
  --accent: #2f5d62;
  --accent-soft: #e3edec;
  --danger: #b3434b;
  --danger-soft: #f7e7e8;
  --radius: 6px;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--accent); }

button {
  font-family: inherit;
  cursor: pointer;
}

.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
}
.login-box h1 {
  font-size: 20px;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
.login-box .sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}
.btn:hover { opacity: 0.92; }
.btn.secondary {
  background: transparent;
  color: var(--accent);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; text-align: center; }
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* ---------- 应用主体布局 ---------- */
#app-screen { display: flex; min-height: 100vh; }

.sidebar {
  width: 190px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  font-size: 16px;
  font-weight: 600;
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.nav-item {
  padding: 11px 20px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--ink); background: var(--bg); }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}
.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.main {
  flex: 1;
  padding: 26px 32px;
  max-width: 1100px;
}
.page-title {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type=text], .toolbar input[type=number] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}
.toolbar .spacer { flex: 1; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody tr:hover { background: var(--bg); }
.table-scroll { overflow-x: auto; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 18px;
}
.form-grid .field.span-2 { grid-column: span 2; }
.form-grid .field.span-3 { grid-column: span 3; }

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13.5px;
  display: none;
  z-index: 200;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(35,38,43,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px;
  width: 380px;
  max-width: 90vw;
}
.modal h2 { font-size: 16px; margin: 0 0 14px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}
.badge.admin { background: var(--accent-soft); color: var(--accent); }
.badge.staff { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.dropzone {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 800px) {
  #app-screen { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 0; }
  .sidebar .brand { display: none; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav-item.active { border-left: none; border-bottom-color: var(--accent); }
  .sidebar-footer { display: none; }
  .main { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field.span-2, .form-grid .field.span-3 { grid-column: span 1; }
}
