:root {
  --ink: #20252b;
  --muted: #667085;
  --line: #dff2df;
  --paper: #ffffff;
  --brand: #18bf7a;
  --brand-dark: #0f8f5f;
  --brand-weak: #e7faef;
  --mint: #13a8a0;
  --coral: #ff7658;
  --coral-weak: #fff0eb;
  --blue: #188cc8;
  --blue-weak: #e8f6ff;
  --blue-text: #1375ad;
  --warn-weak: #fff3e7;
  --shadow: 0 14px 30px rgba(24, 191, 122, 0.1);
}

* {
  box-sizing: border-box;
}

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

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 22% 8%, rgba(24, 191, 122, 0.16), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(255, 118, 88, 0.16), transparent 24%),
    linear-gradient(180deg, #f0fff6 0%, #ffffff 100%);
}

.login-screen[hidden],
.shell[hidden] {
  display: none;
}

.login-card {
  display: grid;
  width: min(380px, 100%);
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.login-brand {
  padding: 0 0 14px;
  border-bottom: none;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-card input,
.pricing-tools input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f0fff6 0%, #ffffff 52%, #f6fbff 100%);
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--mint));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(24, 191, 122, 0.2);
}

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

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

nav {
  flex: 1;
  padding: 14px;
}

nav a {
  display: block;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

nav a.active {
  background: var(--brand-weak);
  color: var(--brand-dark);
}

.account-menu {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px 6px 6px;
  border: 1px solid rgba(24, 191, 122, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-weak);
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 900;
}

.account-menu-info {
  min-width: 96px;
}

.account-menu-info strong,
.account-menu-info span {
  display: block;
}

.account-menu-info strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-info span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-action-btn,
.logout-btn {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #f4fff8;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.account-action-btn:hover {
  border-color: #9be8bf;
  background: var(--brand-weak);
}

.logout-btn {
  border-color: #ffd9c7;
  background: #fff7f3;
  color: #c25a2c;
}

.logout-btn:hover {
  border-color: #ffc2a5;
  background: #fff0e8;
}

.content {
  position: relative;
  min-width: 0;
  padding: 72px 22px 22px;
  background:
    radial-gradient(circle at 20% 0%, rgba(24, 191, 122, 0.12), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(24, 140, 200, 0.12), transparent 24%),
    linear-gradient(180deg, #f6fff7 0%, #ffffff 44%, #f8fbff 100%);
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
}

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

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

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

.metrics,
.grid {
  display: grid;
  gap: 14px;
}

.metrics {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
}

.grid.two {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

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

.metric {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metric::after {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  content: "";
  opacity: 0.18;
}

.metric.green::after {
  background: var(--brand);
}

.metric.mint::after {
  background: var(--mint);
}

.metric.blue::after {
  background: var(--blue);
}

.metric.coral::after {
  background: var(--coral);
}

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

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 28px;
}

.panel {
  overflow: hidden;
  padding: 16px;
}

.panel + .panel {
  margin-top: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.orders-table-wrap {
  width: 100%;
  overflow-x: hidden;
}

.orders-table {
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.orders-table th:nth-child(1),
.orders-table td:nth-child(1) {
  width: 12%;
}

.orders-table th:nth-child(2),
.orders-table td:nth-child(2) {
  width: 25%;
}

.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
  width: 9%;
}

.orders-table th:nth-child(4),
.orders-table td:nth-child(4) {
  width: 10%;
}

.orders-table th:nth-child(5),
.orders-table td:nth-child(5) {
  width: 16%;
}

.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
  width: 8%;
}

.orders-table th:nth-child(7),
.orders-table td:nth-child(7) {
  width: 7%;
}

.orders-table th:nth-child(8),
.orders-table td:nth-child(8) {
  width: 8%;
}

.orders-table th:nth-child(9),
.orders-table td:nth-child(9) {
  width: 5%;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf5ef;
  text-align: left;
  white-space: nowrap;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #d7efe1;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfffd 0%, #f6fff9 100%);
}

.filter-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-field span {
  line-height: 1;
}

.filter-field select,
.filter-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.filter-field select:focus,
.filter-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24, 191, 122, 0.12);
}

.date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
}

.date-range[hidden] {
  display: none;
}

.filter-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.filter-actions .btn {
  min-height: 38px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f1fff6;
  font-weight: 700;
}

.total-row {
  background: #f4fff8;
  font-weight: 800;
}

.btn {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  box-shadow: 0 10px 18px rgba(24, 191, 122, 0.12);
  transform: translateY(-1px);
}

.btn.primary {
  border-color: var(--brand);
  background: linear-gradient(135deg, var(--brand), var(--mint));
  color: #fff;
}

.btn.warn {
  border-color: #ffe0c2;
  background: var(--warn-weak);
  color: #c25a2c;
}

.btn.full {
  width: 100%;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-weak);
  color: var(--blue-text);
  font-size: 12px;
  font-weight: 700;
}

.badge.owner,
.badge.ok {
  background: var(--brand-weak);
  color: var(--brand-dark);
}

.badge.pending {
  background: var(--warn-weak);
  color: #b46500;
}

.badge.disabled {
  background: #f1f5f9;
  color: #64748b;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 2px 4px 2px 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef8ff;
  color: #1375ad;
  font-size: 12px;
  font-weight: 700;
}

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

.lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.lines strong {
  color: var(--ink);
}

.tracking {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.tracking div {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px dashed #bfead3;
  border-radius: 8px;
  background: #f7fffa;
  font-size: 13px;
}

.order-item-copy {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: copy;
  font: inherit;
  text-align: left;
}

.order-item-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 100%;
}

.order-item-row {
  display: grid;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: 14px auto minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid #d7efe1;
  border-radius: 8px;
  background: #f7fffa;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.order-item-row span:nth-child(3) {
  min-width: 0;
  color: var(--muted);
}

.order-item-row strong {
  white-space: nowrap;
}

.order-item-color {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 1px solid rgba(32, 37, 43, 0.12);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.32);
}

@media (max-width: 900px) {
  .orders-table,
  .orders-table tbody,
  .orders-table tr,
  .orders-table td {
    display: block;
    width: 100%;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table tr {
    padding: 10px 0;
    border-bottom: 1px solid #edf5ef;
  }

  .orders-table td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: none;
  }

  .orders-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .orders-table td[data-label="色号明细"] {
    grid-template-columns: 1fr;
  }

  .orders-table td[data-label="色号明细"]::before {
    margin-bottom: -2px;
  }
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.empty,
.error {
  padding: 12px;
  border-radius: 8px;
  background: #f4fff8;
  color: var(--muted);
  font-size: 13px;
}

.error {
  margin-bottom: 14px;
  background: #fff0f0;
  color: #b42318;
}

.ship-form {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  margin-top: 12px;
}

.ship-order-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed #bfead3;
  border-radius: 8px;
  background: #f7fffa;
  color: var(--muted);
  font-size: 13px;
}

.ship-order-card strong {
  color: var(--ink);
}

.shipment-package-section {
  display: grid;
  gap: 10px;
}

.shipment-package-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shipment-package-head strong {
  font-size: 14px;
}

.shipment-package-rows {
  display: grid;
  gap: 10px;
}

.shipment-package-row {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid #edf5ef;
  border-radius: 8px;
  background: #fbfffd;
}

.shipment-package-fields {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(180px, 1.3fr);
  gap: 8px;
}

.shipment-remove {
  width: 36px;
  height: 36px;
}

.shipment-remove:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.ship-form label,
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ship-form input,
.form-grid input,
.form-grid select,
.price-card input {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.form-grid input[readonly] {
  background: #f4fff8;
  color: var(--muted);
  cursor: default;
}

.price-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.price-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.price-card input {
  width: 180px;
}

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

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
}

.product-tile {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 12px;
  border: 1px solid #edf5ef;
  border-radius: 8px;
  background: #fbfffd;
}

.product-tile strong {
  font-size: 18px;
}

.product-tile span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.color-chip {
  display: block;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(32, 37, 43, 0.12);
  border-radius: 7px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.role-card h2 {
  margin-bottom: 4px;
}

.role-name-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.role-name-field input {
  width: min(220px, 100%);
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.role-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.role-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.permission-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: flex-start;
  padding: 9px;
  border: 1px solid #edf5ef;
  border-radius: 8px;
  background: #fbfffd;
  cursor: pointer;
}

.permission-item input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.permission-item strong,
.permission-item em {
  display: block;
}

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

.permission-item em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.permission-item:has(input:checked) {
  border-color: #bfead3;
  background: var(--brand-weak);
}

.subtle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

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

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.36);
}

.modal-card {
  width: min(480px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.modal-card.wide {
  width: min(760px, 100%);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.icon-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  padding: 12px 14px;
  border-radius: 8px;
  background: #12382d;
  color: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.22);
  font-size: 13px;
  font-weight: 700;
}

.toast.error {
  background: #b42318;
}

.withdrawal-qr {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: center;
}

.withdrawal-qr img {
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.withdrawal-qr strong {
  display: block;
  color: var(--green-700);
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.withdrawal-qr span {
  display: block;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 10px;
}

.withdrawal-qr code {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: #f0fbf5;
  color: #17694a;
  white-space: normal;
  word-break: break-all;
  line-height: 1.55;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  nav {
    display: flex;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  nav a {
    flex: 0 0 auto;
  }

  .account-menu {
    position: static;
    margin-bottom: 14px;
    width: fit-content;
  }

  .content {
    padding: 16px;
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .metrics,
  .grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .account-menu {
    width: 100%;
  }

  .filter-bar,
  .date-range {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .shipment-package-row,
  .shipment-package-fields {
    grid-template-columns: 1fr;
  }

  .shipment-remove {
    width: 100%;
  }

  .withdrawal-qr {
    grid-template-columns: 1fr;
  }

  .withdrawal-qr img {
    width: 100%;
    height: auto;
    max-width: 260px;
  }
}
