:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #69717d;
  --line: #dfe4ea;
  --primary: #1b7f79;
  --primary-strong: #11645f;
  --danger: #bd3c3c;
  --warning: #a96913;
  --sidebar: #25292f;
  --sidebar-active: #e9f5f3;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f4;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  width: 100%;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(28, 35, 43, 0.09);
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #fff;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 24px;
}

.brand-lockup p,
.sidebar-brand span,
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

label {
  display: grid;
  gap: 6px;
  color: #38404a;
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 127, 121, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-weight: 700;
  white-space: nowrap;
}

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

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

.secondary-btn {
  border-color: #c9d5dc;
  background: #fff;
  color: #25313d;
}

.ghost-btn {
  border-color: transparent;
  background: transparent;
  color: #34404d;
}

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

.full-width {
  width: 100%;
}

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

.sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 22px 16px;
}

.sidebar-top {
  display: grid;
  gap: 16px;
  padding: 0 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.sidebar-brand > div:last-child {
  min-width: 0;
}

.sidebar-brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand span {
  color: #adb6bf;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.nav-item {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e8ecef;
  padding: 12px;
  text-align: left;
  font-weight: 700;
}

.nav-item span {
  color: #aeb7c0;
  font-size: 12px;
  font-weight: 600;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #103d3a;
}

.nav-item.active span {
  color: #39726e;
}

.main-area {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.user-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-user-area {
  margin-left: auto;
}

.role-badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.role-badge.admin {
  background: #e9f5f3;
  color: #11645f;
}

.role-badge.user {
  background: #fff2dc;
  color: var(--warning);
}

.module-panel {
  min-height: calc(100vh - 104px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.empty-module {
  display: grid;
  place-items: start;
  padding: 24px;
}

.empty-page-title {
  color: #323b45;
  font-size: 16px;
  font-weight: 700;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.toolbar-summary strong {
  font-size: 22px;
}

.toolbar-summary span {
  color: var(--muted);
}

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

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message {
  margin: 12px 18px 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: #edf3f7;
  color: #2a4658;
}

.message.success {
  background: #eaf7ef;
  color: #237244;
}

.message.error,
.error-message {
  background: #fff0f0;
  color: #b22626;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 1480px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  height: 42px;
  border-bottom: 1px solid #e8edf1;
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f6f8;
  color: #4b5561;
  font-weight: 800;
}

.data-table td {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
}

.pagination select {
  width: 110px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px;
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 560px) {
  .main-area {
    padding: 14px;
  }

  .login-panel {
    padding: 24px;
  }

  .sidebar-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-list,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions,
  .filter-actions,
  .pagination {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .toolbar-actions > *,
  .filter-actions > *,
  .pagination > * {
    width: 100%;
  }
}
