:root {
  --bg: #f5f2ec;
  --panel: #fffdf8;
  --panel-strong: #eee8dc;
  --ink: #24231f;
  --muted: #6e6a60;
  --line: #ddd5c8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --warning: #b7791f;
  --ok: #1f7a4d;
  --shadow: 0 18px 48px rgba(47, 43, 35, 0.12);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 38%),
    linear-gradient(180deg, #fbf8f1, var(--bg));
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.field input:disabled,
.field select:disabled {
  background: #f5f6f7;
  border-color: #d9dde3;
  color: #98a2b3;
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  white-space: nowrap;
}

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

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.link-btn {
  height: 28px;
  padding: 0;
  color: var(--accent);
  background: transparent;
}

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

.demo-note {
  margin-top: 18px;
  padding: 12px;
  border-radius: 6px;
  background: #f7efe0;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
}

.side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 22px;
}

.side-head .brand-mark {
  margin: 0;
  width: 36px;
  height: 36px;
}

.side-title {
  font-weight: 800;
}

.side-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 242, 236, 0.9);
  backdrop-filter: blur(12px);
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.content {
  padding: 28px;
}

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters input,
.filters select {
  width: 180px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
}

.section {
  margin-bottom: 20px;
}

.section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  background: #f6f1e7;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

th:last-child,
td:last-child {
  min-width: 140px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.status.ok {
  color: var(--ok);
  background: rgba(31, 122, 77, 0.1);
}

.status.warn {
  color: var(--warning);
  background: rgba(183, 121, 31, 0.12);
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 128px;
  white-space: nowrap;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 35, 31, 0.36);
}

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--ink);
  font-size: 14px;
}

.check-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.permission-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf6ee;
}

.permission-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.permission-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 12px;
}

.mobile-menu {
  display: none;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 18px 16px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 24px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters select,
  .actions button {
    width: 100%;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }

  .permission-list {
    grid-template-columns: 1fr;
  }
}
.loading-modal {
  display: grid;
  place-items: center;
  gap: 20px;
  padding: 48px 32px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.import-summary p {
  margin: 6px 0;
  font-size: 15px;
}

.import-errors-preview {
  max-height: 260px;
  overflow: auto;
  padding: 10px 14px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  line-height: 1.7;
}

.import-errors-preview p {
  margin: 3px 0;
}

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