:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #748094;
  --line: #e6ebf2;
  --green: #11b56a;
  --green-dark: #0b8f53;
  --blue: #2563eb;
  --amber: #b7791f;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.admin-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
  background: linear-gradient(120deg, #edfdf6 0%, #f5f7ff 48%, #fceefe 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 20px 18px 42px;
}

.panel,
.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h1,
.panel h2,
.panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.panel p,
.panel-head span {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-row,
.search-row {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 10px;
}

input[type="file"],
input[type="text"],
input[type="date"],
select,
#keyword {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

input[type="file"] {
  padding: 9px 12px;
}

input[type="date"] {
  cursor: pointer;
}

#uploadBtn,
#queryBtn,
#adminUploadBtn,
#loginBtn {
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.single-action {
  margin-top: 16px;
}

.single-action button {
  width: 116px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.admin-sidebar {
  min-height: 100vh;
  padding: 18px 14px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.admin-logo strong,
.admin-logo span {
  display: block;
}

.admin-logo span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav button,
.admin-nav a {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  color: var(--text);
  background: transparent;
  text-decoration: none;
}

.admin-nav button.active {
  color: var(--green-dark);
  background: #ecfdf5;
  font-weight: 800;
}

.admin-main {
  min-width: 0;
  padding: 22px 26px 48px;
}

.admin-topbar {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

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

.admin-topbar p,
.section-head p,
.login-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-card {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.admin-card h2 {
  margin: 0;
  font-size: 18px;
}

.admin-card label {
  display: block;
  margin-top: 14px;
  font-weight: 800;
}

.combo-field {
  position: relative;
  max-width: 520px;
}

.combo-field input {
  padding-right: 48px;
}

.combo-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--muted);
  background: #eef2f7;
  font-size: 18px;
}

.combo-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(520px, 100%);
  max-height: 292px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
}

.combo-menu button {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  display: block;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.combo-menu button:hover,
.combo-menu button:focus {
  background: #f1f5f9;
}

.combo-menu strong,
.combo-menu span {
  display: block;
}

.combo-menu span,
.combo-empty {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.combo-empty {
  padding: 10px;
}

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

.notice-box {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 8px;
  color: #475569;
  background: #f8fafc;
}

.upload-plain {
  margin-top: 14px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.plain-file-label {
  grid-column: 1 / -1;
  margin: 0 !important;
}

.upload-plain input[type="file"] {
  width: 100%;
  height: auto;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.upload-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-actions button {
  min-width: 150px;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.upload-actions .ghost-btn {
  color: var(--green-dark);
  background: #ecfdf5;
}

.selected-files {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f8fafc;
  text-align: left;
}

.selected-files strong {
  color: var(--green-dark);
  font-size: 14px;
}

.selected-files span {
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) 116px;
  gap: 12px;
  align-items: end;
}

.admin-filter-grid button {
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.clean-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 116px 116px;
}

.org-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 116px;
  margin-bottom: 18px;
}

.danger-btn {
  background: #e11d48 !important;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.admin-stats div {
  padding: 14px;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-stats strong,
.admin-stats span {
  display: block;
}

.admin-stats strong {
  font-size: 20px;
}

.admin-stats span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.admin-table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.admin-table-wrap th,
.admin-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.admin-table-wrap th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
}

.trend-bars {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.trend-row {
  display: grid;
  grid-template-columns: 120px 1fr 110px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.trend-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.trend-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11b56a, #7c3aed);
}

.trend-row b {
  color: var(--green-dark);
  text-align: right;
}

.trend-ranking {
  margin-top: 18px;
}

.mini-danger {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: #be123c;
  background: #ffe4e6;
  font-weight: 800;
}

.org-list .simple-row {
  grid-template-columns: 1fr auto;
}

@media (max-width: 900px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    min-height: auto;
  }

  .admin-filter-grid,
  .clean-grid,
  .org-grid,
  .upload-plain,
  .admin-stats {
    grid-template-columns: 1fr;
  }
}

.ghost-link {
  height: 34px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--green-dark);
  background: #ecfdf5;
  font-weight: 800;
  text-decoration: none;
}

.ghost-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--text);
}

.primary-ghost {
  color: var(--green-dark);
  background: #ecfdf5;
}

.compact-head {
  align-items: center;
}

.quick-row button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--text);
}

.query-panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.filter-label {
  margin-top: 14px;
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.date-grid label {
  color: var(--muted);
  font-weight: 700;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.summary-card {
  min-height: 118px;
  padding: 22px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  border-left: 4px solid var(--green);
}

.summary-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.summary-money {
  margin-top: 8px;
  color: var(--green-dark);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 900;
}

.summary-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.day-badge {
  min-width: 72px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ecfdf5;
  color: var(--green-dark);
  font-weight: 800;
}

.dashboard-grid {
  display: block;
}

.rank-list,
.daily-list {
  display: grid;
  gap: 10px;
}

.rank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.rank-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.rank-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.rank-money {
  color: var(--green-dark);
  font-weight: 900;
}

.day-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.day-main {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 0 16px;
  background: #fff;
  color: var(--text);
}

.day-date {
  font-weight: 900;
}

.day-money {
  color: var(--green-dark);
  font-weight: 900;
}

.day-children {
  display: none;
  padding: 8px 16px 14px;
  background: #f8fafc;
}

.day-row.open .day-children {
  display: grid;
  gap: 8px;
}

.child {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.child strong {
  color: var(--text);
}

.simple-list {
  display: grid;
  gap: 8px;
}

.simple-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.simple-row strong,
.simple-row span {
  display: block;
}

.simple-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.simple-row b {
  color: var(--green-dark);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 32, 51, 0.94);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .shell {
    padding: 14px 10px 32px;
  }

  .search-row,
  .date-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .summary-card,
  .panel-head {
    flex-direction: column;
  }

  .day-badge {
    align-self: flex-start;
  }
}
