:root {
  color-scheme: light;
  --ink: #18251f;
  --muted: #718078;
  --line: #dfe8e2;
  --paper: #f3f6f3;
  --card: #ffffff;
  --green: #173f35;
  --green-2: #2f6c53;
  --orange: #ff5c35;
  --soft-orange: #fff0eb;
  --shadow: 0 18px 48px rgba(25, 52, 40, 0.08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-view {
  min-height: 100vh;
  padding: 48px clamp(24px, 6vw, 96px);
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(340px, 0.8fr);
  align-items: center;
  gap: 7vw;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 92, 53, 0.2), transparent 26%),
    radial-gradient(circle at 70% 70%, rgba(125, 176, 143, 0.25), transparent 30%),
    linear-gradient(145deg, #102f27 0%, #173f35 56%, #0b261f 100%);
}
.login-brand { position: absolute; top: 42px; left: clamp(24px, 6vw, 96px); display: flex; align-items: center; gap: 15px; color: #fff; }
.login-brand b { display: block; font-size: 22px; letter-spacing: 1px; }
.login-brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.62); font-size: 13px; }
.brand-mark { width: 46px; height: 46px; padding: 11px; border-radius: 13px; background: #fff; position: relative; }
.brand-mark i { display: block; width: 7px; height: 25px; border-radius: 5px; background: var(--green); }
.brand-mark i + i { margin-left: 10px; margin-top: -25px; }
.brand-mark::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 8px; height: 4px; border-radius: 4px; background: var(--orange); }
.login-copy { color: #fff; position: relative; z-index: 1; }
.eyebrow, .topbar-kicker { margin: 0 0 12px; color: #ff947c; font-size: 12px; font-weight: 800; letter-spacing: 4px; }
.login-copy h1 { margin: 0; font-size: clamp(44px, 6vw, 82px); line-height: 1.05; letter-spacing: -3px; }
.login-copy > p:last-child { max-width: 430px; margin-top: 24px; color: rgba(255,255,255,.66); font-size: 16px; line-height: 1.8; }
.login-card {
  position: relative;
  z-index: 2;
  width: min(100%, 470px);
  padding: clamp(30px, 4vw, 48px);
  border-radius: 28px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 30px 80px rgba(0,0,0,.24);
}
.demo-badge { display: inline-flex; padding: 7px 12px; border-radius: 999px; color: #b33d25; background: #fff0eb; font-size: 11px; font-weight: 800; letter-spacing: 1px; }
.login-card h2 { margin: 22px 0 26px; font-size: 30px; }
.login-card label { display: block; margin-top: 18px; }
.login-card label span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.login-card input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid #d9e3dd;
  border-radius: 13px;
  outline: none;
  background: #f7faf8;
  transition: .2s ease;
}
.login-card input:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(47,108,83,.1); background: #fff; }
.login-card button {
  width: 100%;
  height: 54px;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--orange);
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(255,92,53,.25);
}
.login-card small { display: block; margin-top: 15px; color: #8b9891; text-align: center; }
.login-error { min-height: 20px; margin: 10px 0 0; color: #dc4329; font-size: 13px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: linear-gradient(180deg, #13392e 0%, #0c2b22 100%);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand .brand-mark { width: 38px; height: 38px; padding: 9px; }
.sidebar-brand .brand-mark i { height: 20px; width: 6px; }
.sidebar-brand .brand-mark i + i { margin-left: 8px; margin-top: -20px; }
.sidebar-brand b, .sidebar-brand span { display: block; }
.sidebar-brand b { font-size: 17px; }
.sidebar-brand span { margin-top: 3px; color: rgba(255,255,255,.5); font-size: 11px; }
.nav-group { margin-top: 26px; }
.nav-title { display: block; padding: 0 12px 10px; color: rgba(255,255,255,.38); font-size: 10px; font-weight: 800; letter-spacing: 2px; }
.nav-item {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 11px;
  color: rgba(255,255,255,.65);
  background: transparent;
  text-align: left;
}
.nav-item em { width: 22px; color: rgba(255,255,255,.4); font-style: normal; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: #ff5c35; box-shadow: 0 8px 22px rgba(255,92,53,.2); }
.nav-item.active em { color: #fff; }
.sidebar-foot { margin-top: auto; padding: 16px 12px 0; display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.52); font-size: 11px; border-top: 1px solid rgba(255,255,255,.08); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #6fe19d; box-shadow: 0 0 0 4px rgba(111,225,157,.1); }

.main { min-width: 0; }
.topbar {
  height: 94px;
  padding: 0 clamp(22px, 3vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
}
.topbar-kicker { margin-bottom: 5px; color: #91a098; font-size: 10px; letter-spacing: 1.5px; }
.topbar h2 { margin: 0; font-size: 24px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.demo-pill { padding: 8px 12px; border-radius: 999px; color: #a63c26; background: #fff1ec; font-size: 11px; font-weight: 800; }
.demo-pill span { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--orange); }
.admin-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--green); font-weight: 900; }
.admin-meta b, .admin-meta span { display: block; }
.admin-meta b { font-size: 12px; }
.admin-meta span { margin-top: 3px; color: #8b9891; font-size: 10px; }
.logout { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; color: #617068; background: #fff; }
.content { padding: clamp(22px, 3vw, 40px); }

.hero-strip {
  min-height: 140px;
  padding: 28px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 86% 15%, rgba(255,122,92,.34), transparent 27%),
    linear-gradient(125deg, #163c31, #245b46);
  box-shadow: var(--shadow);
}
.hero-strip h1 { margin: 0; font-size: 29px; }
.hero-strip p { max-width: 540px; margin: 10px 0 0; color: rgba(255,255,255,.65); font-size: 13px; line-height: 1.7; }
.hero-tag { padding: 11px 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: rgba(255,255,255,.8); font-size: 12px; white-space: nowrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-top: 18px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 10px 28px rgba(25,52,40,.045); }
.stat-card { padding: 20px; }
.stat-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: #e9f3ed; }
.stat-value { margin-top: 18px; font-size: 29px; font-weight: 900; letter-spacing: -1px; }
.stat-foot { margin-top: 8px; color: #89968f; font-size: 11px; }
.positive { color: #23825c; font-weight: 800; }
.layout-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 18px; margin-top: 18px; }
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h3 { margin: 0; font-size: 17px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.chart { height: 230px; display: flex; align-items: flex-end; gap: 16px; padding: 18px 8px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0 54px, #edf2ef 54px 55px); }
.bar-wrap { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bar { width: min(46px, 70%); min-height: 12px; border-radius: 8px 8px 3px 3px; background: linear-gradient(#ff7856, #ff5c35); transition: height .7s ease; }
.bar-label { color: #7a8981; font-size: 10px; }
.rank-list { display: flex; flex-direction: column; gap: 13px; }
.rank-item { padding: 13px; display: flex; align-items: center; gap: 12px; border-radius: 12px; background: #f7faf8; }
.rank-no { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: #b5462e; background: #ffebe4; font-size: 10px; font-weight: 900; }
.rank-main { min-width: 0; flex: 1; }
.rank-main b, .rank-main span { display: block; }
.rank-main b { font-size: 12px; }
.rank-main span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.rank-value { color: var(--green); font-size: 12px; font-weight: 900; }

.table-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 14px 12px; border-bottom: 1px solid #edf2ef; text-align: left; font-size: 12px; }
th { color: #87948d; background: #f8faf9; font-size: 10px; letter-spacing: .5px; }
tbody tr:hover { background: #fcfdfc; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge-green { color: #18704e; background: #e7f6ee; }
.badge-orange { color: #b5462e; background: #fff0eb; }
.badge-gray { color: #6d7972; background: #edf1ee; }
.badge-red { color: #b33b35; background: #fdebea; }
.toolbar { display: flex; align-items: center; gap: 10px; }
.search { height: 38px; width: min(260px, 38vw); padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #fff; }
.filter-button { height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.setting-row { padding: 16px 0; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid #edf2ef; }
.setting-row:last-child { border-bottom: 0; }
.setting-row b { display: block; font-size: 13px; }
.setting-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.switch { width: 38px; height: 22px; padding: 3px; border-radius: 99px; background: #ced9d2; }
.switch::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--green-2); }
.switch.on::after { transform: translateX(16px); }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 17px; border-radius: 12px; color: #fff; background: #1b342a; box-shadow: 0 12px 34px rgba(0,0,0,.22); font-size: 12px; }

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar-brand div:last-child, .nav-title, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item em { width: auto; font-size: 18px; }
  .nav-item.active { font-size: 0; }
  .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-brand .brand-mark { margin: 0; }
  .sidebar-foot span:last-child { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .login-view { grid-template-columns: 1fr; padding-top: 120px; }
  .login-copy { display: none; }
  .login-card { width: 100%; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 16px; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar-brand, .nav-title, .sidebar-foot { display: none; }
  .nav-group { margin: 0; display: flex; gap: 5px; }
  .nav-item { width: 45px; flex: none; }
  .topbar { height: auto; padding: 18px 16px; align-items: flex-start; }
  .admin-meta, .demo-pill { display: none; }
  .content { padding: 16px; }
  .hero-strip { align-items: flex-start; flex-direction: column; }
  .hero-tag { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 15px; }
  .stat-value { font-size: 23px; }
  .settings-grid { grid-template-columns: 1fr; }
}

button, input, select, textarea { font: inherit; }
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
}
select:focus, textarea:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 4px rgba(47, 108, 83, .1);
}
textarea { padding: 13px; resize: vertical; }

.topbar-button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.toolbar { flex-wrap: wrap; justify-content: flex-end; }
.filter-button.primary,
.button-primary {
  border: 0;
  color: #fff;
  background: var(--orange);
  box-shadow: 0 8px 20px rgba(255, 92, 53, .2);
}
.button-secondary {
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}
.button-primary,
.button-secondary {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 800;
}
.button-primary:disabled { opacity: .55; cursor: wait; }
.loading-card,
.empty-state {
  padding: 48px 24px;
  border: 1px dashed #d5e1da;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255,255,255,.72);
  text-align: center;
}
.empty-state.compact { padding: 24px; border: 0; background: transparent; }
.empty-cell { padding: 44px 20px; color: var(--muted); text-align: center; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.text-button {
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  color: var(--green-2);
  background: #edf5f0;
  font-size: 11px;
  font-weight: 800;
}
.text-button.danger { color: #b53b32; background: #fdecea; }
.table-select {
  width: auto;
  min-width: 92px;
  height: 33px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
}
.material-thumb {
  width: 62px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #8a9690;
  background:
    linear-gradient(45deg, #edf1ee 25%, transparent 25%),
    linear-gradient(-45deg, #edf1ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf1ee 75%),
    linear-gradient(-45deg, transparent 75%, #edf1ee 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  font-size: 10px;
}
.material-thumb img { width: 100%; height: 100%; object-fit: contain; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.modal-grid { padding-top: 2px; }
.modal-grid.single { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field > span { color: #65736c; font-size: 11px; font-weight: 800; }
.form-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
}
.form-field input:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 4px rgba(47,108,83,.1);
}
.form-field input[type="file"] { height: auto; padding: 9px; }
.material-preview {
  min-height: 130px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #f4f7f5;
}
.material-preview img { max-width: 100%; max-height: 220px; object-fit: contain; }
.feature-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.feature-row {
  padding: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #edf2ef;
  border-radius: 12px;
  background: #f9fbfa;
}
.feature-row b, .feature-row span { display: block; }
.feature-row b { font-size: 12px; }
.feature-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.feature-row input { width: 20px; height: 20px; accent-color: var(--green-2); }
.settings-actions { margin-top: 18px; text-align: right; }
.credit-summary {
  margin-bottom: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  background: #f1f6f3;
}
.credit-summary span { color: var(--muted); font-size: 12px; }
.credit-summary b { color: var(--green); font-size: 28px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 24px;
  display: grid;
  place-items: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 26, 20, .52);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0,0,0,.3);
}
.modal-head {
  flex: none;
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 21px; }
.modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  color: #68766f;
  background: #edf2ef;
  font-size: 22px;
  line-height: 1;
}
.modal-card form { min-height: 0; display: flex; flex-direction: column; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  flex: none;
  padding: 15px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}

@media (max-width: 700px) {
  .form-grid, .modal-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .topbar-button { display: none; }
  .row-actions { align-items: flex-start; flex-direction: column; }
  .modal { padding: 10px; }
  .modal-card { max-height: 94vh; border-radius: 16px; }
}
