* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f7f5;
  color: #17252c;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hidden {
  display: none !important;
}

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

button {
  cursor: pointer;
}

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

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
  background: #edf2f1;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid #e2eee8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(32, 74, 62, 0.1);
}

.login-brand {
  padding: 0 0 8px;
}

.login-button {
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: #16835f;
  color: #ffffff;
  font-weight: 900;
}

.login-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.login-message {
  min-height: 20px;
  margin: -6px 0 0;
  color: #c9473f;
  font-size: 13px;
  font-weight: 800;
}

.login-debug {
  margin: 8px 0 0;
  color: #77808e;
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
}

.login-tip {
  margin: 0;
  color: #7b8a92;
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #ffffff;
  border-right: 1px solid #e8efeb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 24px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #20c576;
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
}

.user-avatar {
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef3f0;
}

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

.brand-subtitle {
  margin-top: 3px;
  color: #829098;
  font-size: 12px;
}

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

.nav-item {
  position: relative;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #596970;
  text-align: left;
  font-weight: 800;
}

.nav-item.has-notice::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d63848;
}

.request-content {
  min-width: 180px;
  max-width: 460px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nav-item.active,
.nav-item:hover {
  background: #e9fff3;
  color: #138858;
}

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

.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 24px;
  background: #f4f7f5;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

p {
  margin: 7px 0 0;
  color: #788891;
  line-height: 1.55;
}

.admin-user,
.pill,
.status-badge,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
}

.admin-user {
  gap: 8px;
  padding: 10px 14px;
  background: #ffffff;
  color: #506067;
  font-weight: 800;
}

.logout-button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: #f0f4f2;
  color: #607078;
  font-size: 12px;
  font-weight: 900;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #20c576;
}

.content {
  display: grid;
  gap: 18px;
}

.card {
  border: 1px solid #e7eeea;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(43, 66, 72, 0.05);
}

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

.stat-card {
  padding: 20px;
}

.stat-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
}

.stat-label {
  color: #7b8a92;
  font-size: 13px;
  font-weight: 800;
}

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

.search-input,
.field-input,
.field-textarea,
.field-select {
  width: 100%;
  border: 1px solid #dfe8e4;
  border-radius: 14px;
  background: #f8fbfa;
  color: #1d282e;
  outline: none;
}

.search-input {
  max-width: 360px;
  height: 42px;
  padding: 0 14px;
}

.table-card {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 16px;
  border-top: 1px solid #edf2ef;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfdfc;
  color: #718088;
  font-size: 13px;
}

.item-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.item-cell-clickable {
  cursor: pointer;
  border-radius: 12px;
  padding: 4px;
  transition: background 0.16s ease;
}

.item-cell-clickable:hover { background: #f0fbf5; }

.title-link { cursor: pointer; }
.title-link:hover { color: #138858; text-decoration: underline; }

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(23, 37, 44, 0.48);
}

.detail-dialog {
  width: min(760px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  padding: 24px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(23, 37, 44, 0.22);
}

.detail-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-dialog-head h2 { margin: 0; font-size: 22px; }
.detail-dialog-head p { margin: 5px 0 0; color: #819098; font-size: 13px; }

.detail-close {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: #f0f4f2;
  color: #52636a;
  font-weight: 800;
}

.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 22px; padding: 16px; border-radius: 14px; background: #f6faf8; }
.detail-field { display: flex; justify-content: space-between; gap: 12px; color: #77878e; font-size: 13px; }
.detail-field strong { overflow: hidden; color: #203036; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.detail-description { margin-top: 18px; padding: 14px 16px; border: 1px solid #e7eeea; border-radius: 14px; color: #314148; line-height: 1.65; white-space: pre-wrap; }
.detail-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.detail-media { display: block; width: 100%; aspect-ratio: 1; border-radius: 12px; background: #eef3f1; cursor: zoom-in; object-fit: cover; }
.detail-no-media { grid-column: 1 / -1; padding: 30px; color: #8a989f; text-align: center; }

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 20, 24, 0.84);
}

.image-preview-dialog { position: relative; max-width: min(92vw, 1100px); max-height: 92vh; }
.image-preview-dialog img { display: block; max-width: 92vw; max-height: 88vh; border-radius: 12px; object-fit: contain; }
.image-preview-close { position: absolute; top: -42px; right: 0; padding: 7px 13px; border: 0; border-radius: 999px; background: #ffffff; color: #33434a; font-weight: 900; }

.quote-table-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.quote-table-card { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px; }
.quote-table-image, .quote-table-empty { display: block; width: 160px; height: 160px; border-radius: 12px; background: #eef3f1; object-fit: contain; }
.quote-table-image { cursor: zoom-in; }
.quote-table-empty { display: flex; align-items: center; justify-content: center; color: #8a989f; font-size: 13px; }
.quote-table-copy { min-width: 0; }
.quote-table-copy .actions-row { margin-top: 14px; }
.platform-mode-card { max-width: 760px; padding: 26px; border: 1px solid #dfe8e3; }
.platform-mode-card.maintenance { border-color: #edc383; background: #fffaf2; }
.platform-mode-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.platform-mode-status { margin-top: 8px; color: #16835f; font-size: 18px; font-weight: 800; }
.maintenance .platform-mode-status { color: #b7650b; }
.platform-mode-dot { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%; background: #19b46b; box-shadow: 0 0 0 6px rgba(25,180,107,.12); }
.maintenance .platform-mode-dot { background: #e58a1f; box-shadow: 0 0 0 6px rgba(229,138,31,.12); }
.platform-mode-card p { margin: 22px 0 0; color: #52615b; line-height: 1.7; }
.platform-mode-note { margin-top: 18px; padding: 16px; border-radius: 6px; background: rgba(22,131,95,.07); color: #52615b; line-height: 1.7; }
.platform-mode-action { margin-top: 22px; min-width: 220px; }
.platform-mode-action.restore { background: #16835f; color: #fff; }

@media (max-width: 720px) {
  .detail-overlay { padding: 14px; }
  .detail-dialog { padding: 18px; }
  .detail-fields { grid-template-columns: 1fr; }
  .quote-table-grid { grid-template-columns: 1fr; }
  .quote-table-card { grid-template-columns: 112px minmax(0, 1fr); }
  .quote-table-image, .quote-table-empty { width: 112px; height: 112px; }
}

.thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  background: #eef3f1;
}

.title-main {
  font-weight: 900;
}

.title-sub {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: #7c8b92;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.status-badge {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.status-online,
.status-normal,
.status-quoted,
.status-done {
  background: #e9fff3;
  color: #138858;
}

.status-pending,
.status-processing {
  background: #fff4e5;
  color: #bd6a18;
}

.status-new {
  background: #fff0f0;
  color: #d64b45;
}

.status-offline,
.status-rejected,
.status-muted,
.status-blocked {
  background: #f0f2f3;
  color: #6c7980;
}

.server-notice {
  padding: 12px 16px;
  border: 1px solid #d8eee2;
  border-radius: 14px;
  background: #effbf5;
  color: #17784f;
  font-size: 13px;
  font-weight: 800;
}

.server-notice.error {
  border-color: #ffd8d5;
  background: #fff4f3;
  color: #c9473f;
}

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

.action-button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  background: #eef8f2;
  color: #16835f;
  font-size: 13px;
  font-weight: 900;
}

.action-button.warn {
  background: #fff0e7;
  color: #c76819;
}

.action-button.danger {
  background: #fff0f0;
  color: #d64b45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.form-field {
  display: grid;
  gap: 8px;
}

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

.field-label {
  color: #54646b;
  font-size: 13px;
  font-weight: 900;
}

.field-input,
.field-select {
  height: 42px;
  padding: 0 12px;
}

.field-textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  min-width: 180px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(23, 37, 44, 0.92);
  color: #ffffff;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.site-return { display:block; padding:12px 0; color:#16835f; text-decoration:none; font-size:14px; }
.site-return:hover { text-decoration:underline; }
.login-card .site-return { text-align:center; }
.sidebar { overflow-y:auto; }
.nav-item,.field-input,.field-select,.field-textarea,.search-input,.login-button,.brand-mark,.detail-dialog,.thumb,.quote-table-card,.quote-table-image,.quote-table-empty { border-radius:6px; }
.card { border-radius:8px; box-shadow:none; }
.table-card { border-radius:0; }
.nav-item { font-weight:600; }
.nav-item.active { box-shadow:inset 3px 0 #16835f; background:#e8f3ed; }
.action-button { border-radius:4px; }
.action-button.danger { background:#ffe5e6; color:#a32332; }
.action-button.warn { background:#fff0d9; color:#885417; }
.restricted-user-name { color:#b42318; }
.user-restriction-text { margin-top:4px; color:#b42318; font-size:13px; white-space:normal; overflow-wrap:anywhere; }
.field-input:focus,.field-textarea:focus,.search-input:focus { border-color:#16835f; box-shadow:0 0 0 2px #d3ebe0; }
button:focus-visible,a:focus-visible { outline:2px solid #2367a6; outline-offset:3px; }
.detail-field strong { white-space:normal; overflow-wrap:anywhere; }
.brand-mark { background:#16835f; }
@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .stats-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width:560px) {
  .main { padding:16px; }
  .topbar { position:static; flex-wrap:wrap; gap:12px; }
  .topbar h1 { font-size:24px; }
  .admin-user { flex-wrap:wrap; padding:8px; }
  .nav-list { grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
  .nav-item { padding:12px 8px; font-size:14px; }
  .toolbar { flex-wrap:wrap; }
  .form-grid { grid-template-columns:1fr; }
  .login-panel { padding:16px; }
}
