:root {
  --bg: #080807;
  --panel: #151312;
  --panel-2: #1c1815;
  --line: #2f2822;
  --text: #f3e6d3;
  --muted: #a99a8a;
  --soft: #76685c;
  --green: #173421;
  --green-2: #215337;
  --copper: #c18452;
  --copper-2: #d9975b;
  --danger: #ca5f55;
  --success: #5da878;
  --warning: #d7a34e;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(193, 132, 82, 0.14), transparent 34%), #080807;
}

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

.login-panel img {
  display: block;
  width: 76px;
  height: 76px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
}

.login-panel h1 {
  margin-top: 18px;
  font-size: 24px;
}

.login-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

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

.login-panel input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #0f0d0c;
  padding: 0 12px;
  outline: none;
}

.login-panel button {
  width: 100%;
  height: 42px;
  margin-top: 22px;
  border: 0;
  border-radius: var(--radius);
  color: #130f0d;
  background: var(--copper);
  font-weight: 800;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: #f2aaa3;
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #0f0d0c;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 88px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}

.brand strong,
.store-state strong {
  display: block;
  font-size: 15px;
}

.brand span,
.store-state span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

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

.nav-button + .nav-button {
  margin-top: 4px;
}

.nav-button:hover,
.nav-button.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

.nav-icon {
  width: 22px;
  color: var(--copper);
  text-align: center;
}

.store-state {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-button {
  padding: 0 16px;
  color: #130f0d;
  background: var(--copper);
  font-weight: 700;
}

.secondary-button {
  padding: 0 14px;
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

.danger-button {
  padding: 0 14px;
  color: #fff;
  background: var(--danger);
}

.icon-button {
  width: 36px;
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
  font-size: 18px;
}

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

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

.input,
.select,
.textarea {
  height: 36px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #0f0d0c;
  padding: 0 12px;
  outline: none;
}

.textarea {
  height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

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

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.stat-card em {
  display: block;
  margin-top: 8px;
  color: var(--success);
  font-size: 12px;
  font-style: normal;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 16px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-weight: 600;
  background: #100e0d;
}

td {
  color: var(--text);
}

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

.row-actions {
  display: flex;
  gap: 8px;
}

.mini-button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #100e0d;
}

.mini-button.warn {
  color: #140f0b;
  border-color: var(--warning);
  background: var(--warning);
}

.mini-button.danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--copper-2);
  background: rgba(193, 132, 82, 0.14);
  font-size: 12px;
}

.tag.green {
  color: #9fd2aa;
  background: rgba(93, 168, 120, 0.14);
}

.tag.red {
  color: #f2aaa3;
  background: rgba(202, 95, 85, 0.15);
}

.tag.gray {
  color: var(--muted);
  background: rgba(169, 154, 138, 0.12);
}

.table-image {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #090807;
}

.image-empty {
  color: var(--soft);
  font-size: 12px;
}

.image-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.image-field .input {
  min-width: 0;
}

.upload-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #130f0d;
  background: var(--copper);
  font-size: 13px;
  font-weight: 700;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 128px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #0c0a09;
}

.image-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.list {
  padding: 8px 16px 16px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item strong {
  font-size: 13px;
}

.list-item span {
  color: var(--muted);
  font-size: 12px;
}

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

.rule-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.rule-card h3 {
  font-size: 15px;
}

.rule-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.modal-mask {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
}

.hidden {
  display: none;
}

.modal {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-head h2 {
  font-size: 16px;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

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

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field .input,
.field .select,
.field .textarea {
  width: 100%;
  min-width: 0;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    height: 72px;
  }

  .brand img {
    width: 44px;
    height: 44px;
  }

  .nav {
    display: flex;
    padding: 8px 10px 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 116px;
    height: 38px;
  }

  .store-state {
    display: none;
  }

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

  .stats-grid,
  .content-grid,
  .rule-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    background: #070605;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .topbar p {
    max-width: 92vw;
    line-height: 1.5;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 36px 1fr 1fr;
  }

  .top-actions .secondary-button,
  .top-actions .primary-button {
    width: 100%;
    padding: 0 8px;
  }

  .toolbar {
    gap: 10px;
  }

  .filters,
  .filters .input,
  .filters .select,
  .toolbar > .secondary-button {
    width: 100%;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .panel-head {
    padding: 14px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    padding: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #100e0d;
  }

  tr + tr {
    margin-top: 10px;
  }

  td {
    min-height: 38px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    text-align: right;
  }

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

  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    text-align: left;
  }

  .row-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .list {
    padding: 4px 14px 14px;
  }

  .rule-card {
    padding: 14px;
  }

  .modal-mask {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }

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

  .modal-foot {
    position: sticky;
    bottom: 0;
    background: var(--panel);
  }

  .modal-foot .secondary-button,
  .modal-foot .primary-button {
    flex: 1;
  }
}
