:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #1463ff;
  --brand-dark: #0d47bc;
  --success: #087f5b;
  --warning: #b54708;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(21, 35, 67, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans CJK TC", Arial, sans-serif;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 5vw, 56px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.section-heading h2 {
  margin: 0;
}

.topbar__note {
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 22px;
  padding: 24px clamp(18px, 5vw, 56px) 48px;
}

.single-layout,
.portal {
  padding: 24px clamp(18px, 5vw, 56px) 48px;
}

.single-layout {
  max-width: 1180px;
  margin: 0 auto;
}

.portal {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 22px;
  max-width: 980px;
  margin: 0 auto;
}

.portal-single {
  grid-template-columns: minmax(260px, 620px);
  justify-content: center;
}

.portal-card {
  display: grid;
  gap: 12px;
  min-height: 260px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 26px;
  text-decoration: none;
}

a.portal-card:hover {
  border-color: #9db8ff;
  transform: translateY(-2px);
}

.portal-card h2,
.portal-card p {
  margin: 0;
}

.portal-card p {
  color: var(--muted);
  line-height: 1.7;
}

.portal-card strong {
  margin-top: auto;
  color: var(--brand-dark);
}

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

.seller-panel {
  align-self: start;
}

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

.heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 99, 255, 0.14);
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  padding: 11px 15px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary,
.button-link.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

button.secondary:hover,
.button-link.secondary:hover {
  background: #f8fafc;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 11px 15px;
  font-weight: 800;
  text-decoration: none;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 14px;
}

.seller-query {
  grid-template-columns: 1fr 120px;
}

.orders {
  display: grid;
  gap: 12px;
}

.empty {
  border: 1px dashed #b7c2d2;
  border-radius: 8px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

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

.order__head,
.order__actions,
.order__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.order__head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.order__title {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.order__title strong {
  font-size: 18px;
}

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

.order__body {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px 18px;
  margin-bottom: 14px;
  color: #344054;
}

.field span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.copyable code {
  border-radius: 6px;
  background: #f1f5f9;
  color: #1e293b;
  padding: 5px 7px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

button.copy-btn {
  padding: 6px 10px;
  font-size: 13px;
}

.status-log {
  display: grid;
  gap: 8px;
}

.status-log > span {
  margin-bottom: 0;
}

.status-log__item {
  display: grid;
  gap: 3px;
  border-left: 3px solid #9db8ff;
  background: #f8fafc;
  border-radius: 6px;
  padding: 8px 10px;
}

.status-log__item small,
.status-log__item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.address {
  grid-column: 1 / -1;
}

.status {
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff7ed;
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
}

.status.shipped,
.status.done {
  background: #ecfdf3;
  color: var(--success);
}

.status.issue {
  background: #fef3f2;
  color: var(--danger);
}

.order__meta {
  color: var(--muted);
  font-size: 13px;
  justify-content: space-between;
}

.link {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: min(420px, calc(100vw - 32px));
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-form {
  display: grid;
  gap: 14px;
}

.dialog-form h3 {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  padding: 12px 14px;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .topbar,
  .layout,
  .portal {
    display: block;
  }

  .topbar__note {
    margin-top: 10px;
  }

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

  .portal-card + .portal-card {
    margin-top: 18px;
  }

  .filters,
  .seller-query,
  .form-grid,
  .order__body {
    grid-template-columns: 1fr;
  }
}
