:root {
  --bg: #e7e8e8;
  --ink: #202124;
  --muted: #737373;
  --panel: #f8f8f7;
  --line: #e4e4e2;
  --dark: #363737;
  --dark-soft: #4c4d4d;
  --accent: #e86543;
  --accent-soft: #faebe5;
  --return: #ececec;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
}

.sidebar {
  background: var(--dark);
  color: #fff;
  border-radius: 22px;
  padding: 18px;
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.brand strong { font-size: 14px; }

.bear-logo {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.bear-logo .ear {
  position: absolute;
  top: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #df9f30;
}
.bear-logo .ear.left { left: 7px; }
.bear-logo .ear.right { right: 7px; }
.bear-logo .face {
  position: absolute;
  left: 7px;
  top: 8px;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f5be49;
}
.bear-logo i {
  position: absolute;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #342b22;
}
.bear-logo i:first-child { left: 8px; }
.bear-logo i:nth-child(2) { right: 8px; }
.bear-logo b {
  position: absolute;
  left: 13px;
  top: 16px;
  width: 5px;
  height: 4px;
  border-radius: 50%;
  background: #342b22;
}
.bear-logo em {
  position: absolute;
  left: 8px;
  bottom: -1px;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.bear-logo .scarf {
  position: absolute;
  left: 13px;
  bottom: 5px;
  width: 19px;
  height: 5px;
  border-radius: 999px;
  background: #c6362e;
}

.nav {
  border: 0;
  background: transparent;
  color: #d5d5d5;
  text-align: left;
  padding: 10px 12px;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
}
.nav:hover, .nav.active { background: var(--dark-soft); color: #fff; }
.side-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: #464747;
  color: #f3f3f3;
  font-weight: 700;
  line-height: 1.5;
}

.shell { min-width: 0; }
.topbar {
  height: 62px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
h1, h2, p { margin: 0; }
h1 { font-size: 34px; line-height: 1; }
.topbar p { color: var(--muted); margin-top: 8px; }

button, .ghost-file {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}
button:hover, .ghost-file:hover { filter: brightness(0.97); }
.primary { background: var(--accent); color: #fff; }
.danger { color: #b42318; }
.ghost-file input { display: none; }
.top-actions { display: flex; gap: 10px; }

.layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 110px);
}
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: 0 18px 55px rgba(43, 43, 43, 0.08);
}
.form-panel {
  padding: 18px;
  overflow: auto;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-title h2 { font-size: 18px; }
.panel-title span { color: var(--muted); font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 101, 67, 0.12);
}
#profit { background: #f1f1f1; }
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.table-panel { padding: 18px; min-width: 0; }
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar input { max-width: 360px; }
.toolbar select { max-width: 140px; }
.table-wrap {
  overflow: auto;
  border-radius: 18px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}
th {
  background: #eeeeee;
  color: #545454;
  font-weight: 700;
  position: sticky;
  top: 0;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f7f7; }
tr.sold { background: var(--accent-soft); }
tr.returned { background: var(--return); color: #555; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f2f2f2;
}
.sold .pill { background: #fff1eb; color: var(--accent); }
.returned .pill { background: #e0e0e0; color: #555; }

.stats-panel {
  padding: 20px;
  min-height: calc(100vh - 110px);
}
.summary-strip {
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  line-height: 1.8;
}
.stats-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}
.stats-controls label { width: 160px; }
.hidden { display: none !important; }

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { min-height: auto; flex-direction: row; overflow: auto; border-radius: 18px; }
  .brand, .side-note { display: none; }
  .layout { grid-template-columns: 1fr; }
  .topbar { height: auto; margin-bottom: 16px; gap: 12px; flex-direction: column; }
}


.login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(0,0,0,0.78), rgba(0,0,0,0.38)),
    radial-gradient(circle at 20% 20%, rgba(232,101,67,0.55), transparent 32%),
    #151515;
}
.login-shell { width: min(430px, 100%); }
.login-card {
  background: rgba(248, 248, 247, 0.95);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 28px 90px rgba(0,0,0,0.32);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.login-logo strong { font-size: 18px; }
.login-card h1 { font-size: 32px; margin-bottom: 10px; }
.login-card p { color: var(--muted); line-height: 1.7; margin-bottom: 20px; }
.login-form {
  display: grid;
  gap: 14px;
}
.login-form button {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}
.login-hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}