:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #14212b;
  --muted: #647282;
  --line: #d8e0e7;
  --line-strong: #c3ced8;
  --brand: #0f6b5b;
  --brand-strong: #0a5146;
  --brand-soft: #e7f4f1;
  --accent: #2457a6;
  --warn: #9a5b00;
  --error: #b42318;
  --ok: #067647;
  --shadow: 0 18px 40px rgba(20, 33, 43, 0.08);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

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

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

button.ghost {
  background: transparent;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 107, 91, 0.12);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.muted,
.runtime {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef2f5 0%, #dde8e5 100%);
}

.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.login-aside {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 44px;
  background: #102821;
  color: #fff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.login-aside .brand-mark {
  background: #d8f3e9;
  color: #102821;
}

.login-aside p {
  max-width: 360px;
  color: #c8d9d4;
  line-height: 1.7;
}

.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-points span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 10px;
  color: #d8f3e9;
  font-size: 12px;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 44px;
}

.form-title {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}

.form-title p {
  color: var(--muted);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  padding: 20px;
  background: #102821;
  color: #fff;
}

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

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

.brand span {
  margin-top: 3px;
  color: #9fb8b1;
  font-size: 12px;
}

nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

nav a {
  border-radius: 8px;
  padding: 11px 12px;
  color: #c8d9d4;
  text-decoration: none;
  font-weight: 700;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.side-note {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.side-note span {
  color: #9fb8b1;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 22px 26px 40px;
}

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

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

.top-actions span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stats article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(20, 33, 43, 0.03);
}

.stats article {
  padding: 15px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.layout {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.layout.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel {
  padding: 18px;
}

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

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.panel > label,
.field-grid,
.auth-tools,
.action-panel .muted,
.action-panel .switch {
  margin-bottom: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  width: auto;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.switch input {
  width: 16px;
}

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

.table-wrap.compact table {
  min-width: 520px;
}

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

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

th {
  color: var(--muted);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  min-width: 46px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

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

.badge.shipped {
  color: var(--ok);
  background: #ecfdf3;
}

.badge.failed {
  color: var(--error);
  background: #fff1f0;
}

.logs {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.log {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 7px;
  background: var(--surface-soft);
  font-size: 13px;
}

.log time {
  color: var(--muted);
  font-size: 12px;
}

.log.error {
  border-left-color: var(--error);
}

.log.warn {
  border-left-color: var(--warn);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #102821;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--error);
}

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
  }

  nav {
    display: flex;
    overflow-x: auto;
  }

  nav a {
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .login-shell,
  .layout.two {
    grid-template-columns: 1fr;
  }

  .login-aside {
    padding: 28px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .panel-head,
  .top-actions,
  .auth-tools,
  .fulfill-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sidebar {
    padding: 16px;
  }

  .side-note {
    display: none;
  }

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