:root {
  --ink: #181817;
  --muted: #827d76;
  --line: #e8e5df;
  --soft: #f7f6f3;
  --accent: #f05a32;
  --green: #287c57;
  --font: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f7f7f5; font-family: var(--font); }
button, input { font: inherit; }
[hidden] { display: none !important; }

.admin-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 0%, rgba(240, 90, 50, 0.08), transparent 28%), #f7f7f5;
}

.login-card {
  width: min(410px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 65px rgba(35, 29, 23, 0.1);
}

.login-brand {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
}

.eyebrow {
  margin: 20px 0 7px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.login-card h1, .admin-top h1 { margin: 0; font-size: 25px; letter-spacing: -0.04em; }
.muted { color: var(--muted); font-size: 11px; line-height: 1.7; }
label { display: block; margin: 15px 0 6px; font-size: 10px; color: #625d55; }
input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #ddd8d0; border-radius: 9px; outline: 0; background: #fff; }
input:focus { border-color: #c3b9ad; box-shadow: 0 0 0 3px rgba(240, 90, 50, 0.06); }
.form-error { min-height: 18px; margin: 10px 0 2px; color: #b23f29; font-size: 10px; }
#adminLoginButton { width: 100%; height: 43px; border: 0; border-radius: 9px; color: #fff; background: var(--ink); font-weight: 700; }
.back-link { display: block; margin-top: 18px; color: #978f86; font-size: 9px; text-decoration: none; text-align: center; }

.admin-app {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 24px;
  color: var(--ink);
  text-decoration: none;
}

.admin-brand span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  font-family: Georgia, serif;
  font-style: italic;
}

.admin-brand strong { font-family: Georgia, serif; font-size: 19px; }

.admin-sidebar nav { display: grid; gap: 3px; }
.admin-sidebar nav button, .admin-side-bottom button, .admin-side-bottom a {
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  color: #746e66;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  text-align: left;
  text-decoration: none;
}
.admin-sidebar nav button.active { color: var(--ink); background: var(--soft); font-weight: 700; }
.admin-side-bottom { display: grid; gap: 5px; margin-top: auto; }
.admin-side-bottom button { color: #aa432f; }

.admin-main { min-width: 0; padding: 24px clamp(20px, 4vw, 48px) 50px; }
.admin-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-top .eyebrow { margin-top: 0; }
.admin-status { padding: 6px 10px; border-radius: 999px; color: var(--green); background: #eaf6ef; font-size: 9px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.stat span { color: var(--muted); font-size: 9px; }
.stat b { display: block; margin-top: 8px; font-size: 24px; }

.admin-section { margin-bottom: 16px; padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 14px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.package-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.package-card { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #fcfbf8; }
.package-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.package-top h3 { margin: 0; font-size: 12px; }
.package-top span { color: var(--accent); font-weight: 800; }
.package-card p { margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.7; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 10px 8px; border-bottom: 1px solid #efede8; text-align: left; white-space: nowrap; }
th { color: #918a81; background: #fbfaf7; font-weight: 600; }
td small { color: #a19a91; }
.empty { padding: 24px !important; color: #99928a !important; text-align: center !important; }
.status { padding: 3px 6px; border-radius: 5px; color: var(--green); background: #eaf6ef; }
.status.off { color: #a04732; background: #fff0eb; }
.status.neutral { color: #77716a; background: #f1efe9; }
.actions { display: flex; gap: 4px; }
.actions button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; color: #655f57; background: #fff; cursor: pointer; font-size: 8px; }
.search-input { width: 190px; height: 34px; font-size: 10px; }
.invoice-orders-head { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; padding: 10px 14px; border-radius: 8px; color: #fff; background: #1e1b18; font-size: 10px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: 180ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.view-image-button { padding: 7px 12px; border: 1px solid #d8cfc4; border-radius: 8px; background: #fff; color: #211c18; cursor: pointer; white-space: nowrap; }
.view-image-button:hover { border-color: #b89e85; background: #f8f3ec; }
.admin-image-viewer { position: fixed; z-index: 100; inset: 0; display: grid; padding: 28px; background: rgba(22,18,14,.72); backdrop-filter: blur(8px); place-items: center; }
.admin-image-viewer[hidden] { display: none; }
.admin-image-dialog { display: grid; max-width: min(1100px,96vw); max-height: 94vh; overflow: hidden; border-radius: 18px; background: #fffdf9; box-shadow: 0 28px 100px rgba(0,0,0,.35); }
.admin-image-dialog img { display: block; max-width: min(1080px,94vw); max-height: calc(94vh - 74px); object-fit: contain; background: #f7f3ed; }
.admin-image-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; }
.admin-image-meta span { color: #81786f; font-size: 12px; }
.admin-image-close { position: fixed; top: 18px; right: 22px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.94); color: #211c18; font-size: 25px; cursor: pointer; }

@media (max-width: 860px) {
  .admin-app { grid-template-columns: 1fr; }
  .admin-sidebar { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar nav { grid-template-columns: repeat(4, 1fr); }
  .admin-side-bottom { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .package-grid { grid-template-columns: 1fr; }
}
