:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --line: #dce3ea;
  --text: #17212b;
  --muted: #667789;
  --primary: #176b5f;
  --primary-strong: #0f5148;
  --accent: #b9802f;
  --danger: #a04747;
  --shadow: 0 18px 48px rgba(22, 36, 48, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #101820;
  color: #f4f7f9;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 800;
  border-radius: 8px;
}

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

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

.search-box {
  display: grid;
  gap: 8px;
  color: #b9c6d2;
  font-size: 13px;
}

.search-box input {
  width: 100%;
  border: 1px solid #344554;
  background: #18242e;
  color: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

.search-box input:focus {
  border-color: #7fc2b8;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-title,
.section-heading {
  width: 100%;
  color: #718294;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.filter-chip {
  border: 1px solid #334553;
  background: transparent;
  color: #d5dee6;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
}

.filter-chip.active {
  background: #d7efe9;
  border-color: #d7efe9;
  color: #0e554c;
}

.side-section {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.manager-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.manager-item {
  width: 100%;
  border: 1px solid #2f4050;
  background: #17232c;
  color: #eef4f7;
  text-align: left;
  border-radius: 8px;
  padding: 12px;
}

.manager-item.active {
  border-color: #8fd4c9;
  background: #21373a;
}

.manager-item strong,
.manager-item span {
  display: block;
}

.manager-item span {
  margin-top: 4px;
  color: #a7b5c1;
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar,
.panel-head,
.detail-header,
.chart-head,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

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

.primary-action,
.secondary-action {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 700;
}

.primary-action {
  background: var(--primary);
  color: white;
}

.primary-action:hover {
  background: var(--primary-strong);
}

.secondary-action {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.metric,
.product-panel,
.detail-panel,
.chart-card,
.nav-table-card,
.memo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(16, 24, 32, 0.03);
}

.metric {
  padding: 16px;
}

.metric span,
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(440px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.product-panel,
.detail-panel {
  min-width: 0;
}

.product-panel {
  padding: 18px;
}

.detail-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--primary);
}

.table-scroll {
  overflow: auto;
  margin-top: 14px;
}

.table-scroll.small {
  max-height: 260px;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: #eef7f4;
}

.status-pill {
  border-radius: 999px;
  padding: 7px 10px;
  background: #e9f5f2;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.watch {
  background: #fff3df;
  color: #8d5b17;
}

.status-pill.done {
  background: #f1f3f5;
  color: #5d6872;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.detail-grid div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
}

.chart-card,
.nav-table-card,
.memo-card {
  padding: 14px;
  box-shadow: none;
}

.chart-card canvas {
  width: 100%;
  height: 260px;
  display: block;
  margin-top: 12px;
  background: linear-gradient(180deg, #f8fbfc, #ffffff);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.chart-head strong {
  color: var(--accent);
}

.memo-card p {
  margin: 10px 0 0;
  color: #425160;
  line-height: 1.7;
}

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

dialog::backdrop {
  background: rgba(14, 24, 32, 0.48);
}

#productForm {
  padding: 20px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

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

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

.full-label textarea {
  resize: vertical;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

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

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

  .sidebar {
    min-height: auto;
  }

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

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 560px) {
  .metrics-grid,
  .detail-grid,
  .form-grid,
  .manager-list {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions button {
    flex: 1;
  }
}
