:root {
  --bg: #fff8f2;
  --panel: #ffffff;
  --ink: #171923;
  --muted: #747887;
  --line: #f0e3d8;
  --orange: #ff6b18;
  --orange-dark: #e95400;
  --green: #31b96e;
  --red: #e5484d;
  --blue: #276ef1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.hidden {
  display: none !important;
}

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

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  background: #191a20;
  color: #ffffff;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--orange);
  font-weight: 800;
}

.brand-mark.large {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  color: #ffffff;
  font-size: 24px;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #fff8f2 0%, #fff0e5 100%);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(116, 73, 34, 0.14);
}

.login-card h1 {
  text-align: center;
  font-size: 26px;
}

.login-card p {
  margin-bottom: 4px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #a9adba;
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  color: #d6d8df;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 107, 24, 0.22);
}

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

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

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

.admin-identity {
  display: flex;
  min-width: 132px;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
}

.admin-identity:empty {
  display: none;
}

.admin-identity span {
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.25;
}

.topbar p,
.panel-title span,
.preview-line,
.muted {
  color: var(--muted);
}

.topbar p {
  margin-top: 8px;
}

.ghost-button,
.primary-button,
.small-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.ghost-button {
  padding: 10px 14px;
  color: var(--orange-dark);
  background: #fff0e7;
}

.primary-button {
  padding: 12px 18px;
  color: #ffffff;
  background: var(--orange);
  font-weight: 700;
}

.small-button {
  padding: 7px 10px;
  color: var(--orange-dark);
  background: #fff0e7;
}

.small-button.danger {
  color: var(--red);
  background: #fff0f0;
}

.small-button.success {
  color: var(--green);
  background: #ecfbf2;
}

.small-button.blue {
  color: var(--blue);
  background: #edf4ff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric,
.panel,
.list-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

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

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 20px;
}

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

.todo {
  padding: 14px;
  border-radius: 8px;
  background: #fff7f0;
}

.todo strong {
  display: block;
  margin-bottom: 6px;
}

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

.breakdown-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.breakdown-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.breakdown-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.breakdown-card span {
  color: var(--muted);
}

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

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

.filters select {
  width: auto;
  min-width: 150px;
}

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

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #555b6b;
  font-size: 13px;
  font-weight: 700;
  background: #fffaf6;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--orange-dark);
  background: #fff0e7;
  font-size: 13px;
}

.status.off {
  color: #697181;
  background: #f1f3f5;
}

.order-route {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  max-width: 420px;
}

.route-chip {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  color: #555b6b;
  font-size: 12px;
  line-height: 1.45;
}

.route-chip b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--orange);
  font-size: 12px;
}

.route-chip em {
  display: block;
  grid-column: 2;
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.order-route-meta {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 700;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 14px;
}

.list-item h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.list-item p {
  color: var(--muted);
  line-height: 1.65;
}

.complaint-note {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  color: #5a3b21;
  background: #fff7f0;
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  color: #303442;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input[type="file"] {
  padding: 9px 10px;
  cursor: pointer;
}

textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.65;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  color: #5a3b21;
  background: #fff7f0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.service-form {
  align-items: end;
}

.banner-form {
  align-items: end;
}

.coupon-form {
  align-items: end;
}

.announcement-form {
  align-items: end;
}

.user-form {
  align-items: end;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.service-form-actions,
.banner-form-actions,
.coupon-form-actions,
.announcement-form-actions,
.user-form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

#serviceCancelButton,
#bannerCancelButton,
#couponCancelButton,
#announcementCancelButton,
#userCancelButton {
  display: none;
}

#serviceCancelButton.show-inline,
#bannerCancelButton.show-inline,
#couponCancelButton.show-inline,
#announcementCancelButton.show-inline,
#userCancelButton.show-inline {
  display: inline-block;
}

.service-table,
.banner-table,
.coupon-table,
.announcement-table,
.user-table {
  min-width: 980px;
}

.user-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-title strong,
.user-title span {
  display: block;
}

.user-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--orange);
  font-weight: 800;
}

.service-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-title strong,
.service-title span {
  display: block;
}

.service-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.service-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
}

.service-icon.orange {
  background: #ff7a1a;
}

.service-icon.blue {
  background: #3b82f6;
}

.service-icon.green {
  background: #31b96e;
}

.service-icon.purple {
  background: #7c5cff;
}

.service-icon.pink {
  background: #f05287;
}

.service-icon.gray {
  background: #8d95a5;
}

.service-icon-thumb {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff3e8;
  box-shadow: inset 0 0 0 1px rgba(255, 107, 24, 0.14);
}

.service-icon-thumb img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.service-icon-thumb.blue {
  background: #eef7ff;
}

.service-icon-thumb.green {
  background: #edfbf3;
}

.service-icon-thumb.purple {
  background: #f2efff;
}

.service-icon-thumb.pink {
  background: #fff0f5;
}

.service-icon-thumb.gray {
  background: #f3f4f6;
}

.banner-thumb {
  width: 128px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff7f0;
  border: 1px solid var(--line);
}

.asset-field {
  align-self: stretch;
}

.asset-upload {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.asset-preview {
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7f0;
}

.asset-preview.small {
  width: 46px;
  height: 46px;
  object-fit: contain;
  padding: 4px;
}

.asset-preview.wide {
  width: 160px;
  height: 64px;
}

.asset-preview.empty {
  display: none;
}

.preview-line {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: #fffaf6;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.system-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf6;
}

.system-card span {
  color: var(--muted);
  font-size: 13px;
}

.system-card strong {
  display: block;
  margin: 8px 0;
  font-size: 22px;
}

.system-card p {
  color: var(--muted);
  line-height: 1.5;
}

.config-issue {
  border-left: 4px solid #f6ad55;
}

.config-issue.error {
  border-left-color: #ef4444;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(25, 26, 32, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.toast.show {
  opacity: 1;
}

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

  .sidebar {
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }

  .nav-item {
    text-align: center;
  }

  .main {
    padding: 22px 18px 30px;
  }

  .metrics,
  .todo-grid,
  .form-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}
