:root {
  color-scheme: light;
  --bg: #eef3f6;
  --paper: #ffffff;
  --soft: #f5f8fa;
  --ink: #0f1f2f;
  --muted: #65758a;
  --line: #d6e0ea;
  --blue: #2563eb;
  --teal: #0f766e;
  --orange: #c56a1a;
  --red: #b42318;
  --violet: #7c5cc4;
  --nav: #122033;
  --nav-soft: #1b2d45;
  --shadow: 0 1px 2px rgba(15, 31, 47, 0.06), 0 14px 34px rgba(15, 31, 47, 0.08);
  --shadow-soft: 0 8px 22px rgba(15, 31, 47, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 0, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at 84% 8%, rgba(15, 118, 110, 0.1), transparent 26%),
    linear-gradient(180deg, #f7fafc 0, var(--bg) 340px);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.actionable {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.actionable:hover,
.actionable:focus-visible {
  border-color: #8fb7ef;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12), var(--shadow);
  transform: translateY(-1px);
  outline: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: clip;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, var(--nav) 0, #14273e 52%, #10243d 100%);
  color: #e7eef8;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: linear-gradient(135deg, #4f7cff, #10a19a);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

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

.brand small,
.sidebar-card span,
.sidebar-card small {
  color: #9fb0c4;
}

.nav {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.nav-section {
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav-section[open] {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
}

.nav-section summary {
  display: flex;
  align-items: center;
  min-height: 39px;
  padding: 0 10px;
  color: #f4f8fc;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-section summary::after {
  content: "⌄";
  margin-left: auto;
  color: #9fb0c4;
  font-size: 17px;
  line-height: 1;
}

.nav-section:not([open]) summary::after {
  transform: rotate(-90deg);
}

.nav-sub {
  display: grid;
  gap: 2px;
  padding: 0 6px 8px 22px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 10px;
  background: transparent;
  color: #cbd7e6;
  text-align: left;
  font-weight: 700;
}

.nav-link.sub-link {
  min-height: 34px;
  padding: 0 8px;
  color: #c1cedf;
  font-weight: 600;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-link.active {
  border-color: rgba(111, 176, 255, 0.45);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.32), rgba(15, 118, 110, 0.22));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #62d3c8;
}

.sidebar-card {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
}

.period-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.period-tabs button,
.sidebar select,
.top-actions button,
.top-actions input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.sidebar select,
.sidebar .period-tabs button {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

.period-tabs button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.sidebar select {
  width: 100%;
  padding: 0 10px;
}

.muted-card strong {
  font-size: 15px;
}

.manager-link,
.manager-link-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  background: linear-gradient(135deg, #e7f7f3, #eef4ff);
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.manager-link {
  width: 100%;
}

.manager-link-inline {
  padding: 0 12px;
}

.content {
  min-width: 0;
  max-width: 100%;
  padding: 20px 24px 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  font-size: 31px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.topbar p,
.panel-head p,
.kpi small,
.task small,
.product-card small {
  color: var(--muted);
}

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

.top-actions input {
  width: min(330px, 40vw);
  padding: 0 12px;
  box-shadow: inset 0 1px 1px rgba(15, 31, 47, 0.03);
}

.top-actions button {
  padding: 0 13px;
  border-color: #10243d;
  background: linear-gradient(135deg, #10243d, #1b395f);
  color: #fff;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

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

.kpi {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 13px;
  border-top: 3px solid #c9d6e6;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.kpi:nth-child(1) {
  border-top-color: var(--blue);
}

.kpi:nth-child(2) {
  border-top-color: var(--teal);
}

.kpi:nth-child(3) {
  border-top-color: var(--violet);
}

.kpi:nth-child(4) {
  border-top-color: #64748b;
}

.kpi:nth-child(5) {
  border-top-color: var(--orange);
}

.kpi:nth-child(6) {
  border-top-color: var(--red);
}

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

.kpi strong {
  font-size: 23px;
  line-height: 1.05;
}

.view {
  display: none;
  min-width: 0;
  max-width: 100%;
}

.view.active {
  display: block;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.85fr);
  gap: 12px;
  margin-bottom: 12px;
}

.work-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  max-width: 100%;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.panel-actions span {
  display: block;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.panel-actions button {
  min-height: 36px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--teal), #0b8f86);
  color: #fff;
  font-weight: 800;
}

.audit-date-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audit-date-control span {
  width: auto;
  white-space: nowrap;
}

.purchase-days {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.purchase-days button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.purchase-days button.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--teal), #0b8f86);
  color: #fff;
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(var(--bars, 30), minmax(9px, 1fr));
  align-items: end;
  gap: 5px;
  height: 248px;
  padding: 10px 2px 0;
}

.bar {
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #477eea, var(--teal));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.bar.empty {
  background: #d9e2ec;
}

.bar span,
.bar b {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #344054;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.bar span {
  bottom: -18px;
}

.bar b {
  top: -18px;
}

.bar:hover span,
.bar:hover b,
.bar:focus-visible span,
.bar:focus-visible b {
  opacity: 1;
}

.trend-breakdown {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-top: 26px;
}

.trend-breakdown button {
  display: grid;
  gap: 4px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #f6f9fc);
  color: var(--ink);
}

.trend-breakdown span {
  color: var(--muted);
  font-size: 11px;
}

.task-list,
.stack-list,
.cards-list,
.warehouse-groups,
.improvement-grid {
  display: grid;
  gap: 9px;
}

.task,
.stack-row,
.product-card,
.warehouse-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}

.task {
  display: grid;
  gap: 6px;
  padding: 11px;
}

.task strong {
  font-size: 15px;
}

.task.warn {
  border-left: 4px solid var(--orange);
}

.task.bad {
  border-left: 4px solid var(--red);
}

.task.good {
  border-left: 4px solid var(--teal);
}

.stack-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 11px;
  box-shadow: var(--shadow-soft);
}

.stack-row > * {
  min-width: 0;
}

.stack-row > div strong,
.stack-row > div small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.stack-row > strong:last-child {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.stack-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.progress {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: #e4ebf2;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

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

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

th {
  color: #536274;
  font-size: 12px;
  text-transform: uppercase;
  background: #f1f6fa;
}

tbody tr:hover {
  background: #f7fbff;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 6px;
  padding: 0 9px;
  background: #e8f0fe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: #fff4e5;
  color: var(--orange);
}

.badge.bad {
  background: #fef1f1;
  color: var(--red);
}

.badge.good {
  background: #e7f7f3;
  color: var(--teal);
}

.warehouse-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 13px;
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
}

.warehouse-group summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  white-space: nowrap;
}

.warehouse-group summary span {
  justify-self: end;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.warehouse-table {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.warehouse-table table {
  min-width: 1320px;
}

.warehouse-table input[type="date"],
.stock-input,
.comment-input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.stock-input.narrow-input {
  width: 74px;
  text-align: center;
}

.date-input {
  width: 146px;
}

.comment-input {
  width: 220px;
}

.sku-input {
  width: 150px;
}

.oem-input {
  width: 190px;
}

.name-input {
  width: 360px;
}

.row-actions-cell {
  white-space: nowrap;
}

.row-action {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #10243d;
  font-weight: 900;
}

.row-action:hover:not(:disabled) {
  border-color: var(--teal);
  background: #eefafa;
}

.row-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.row-action.danger {
  color: #b42318;
}

[contenteditable="true"] {
  min-width: 70px;
  outline: 0;
  border-radius: 5px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.manager-body {
  background: var(--bg);
}

.manager-shell {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.manager-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.manager-topbar p {
  color: var(--muted);
}

.manager-actions {
  display: flex;
  gap: 9px;
}

.manager-actions input,
.manager-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.manager-actions input {
  width: min(360px, 42vw);
  padding: 0 12px;
}

.manager-actions button {
  padding: 0 16px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.manager-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.manager-summary article {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.manager-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.manager-summary strong {
  font-size: 22px;
}

.manager-table table {
  min-width: 1180px;
}

.product-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
}

.product-card img,
.empty-image {
  width: 72px;
  height: 72px;
  border-radius: 7px;
  object-fit: cover;
  background: linear-gradient(135deg, #dce7f1, #f4f7fa);
}

.purchase-card {
  grid-template-columns: 56px minmax(0, 1fr) auto;
}

.purchase-card img,
.purchase-card .empty-image {
  width: 56px;
  height: 56px;
}

.product-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.product-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.suggestion-line {
  margin-top: 8px;
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
}

.suggestion-line b {
  color: var(--ink);
}

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

.feedback-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.feedback-kpi {
  min-height: 96px;
}

.feedback-errors {
  margin-bottom: 12px;
}

.feedback-warning {
  border-color: #f2c98a;
  background: #fffaf2;
}

.feedback-error-row {
  grid-template-columns: minmax(180px, 0.8fr) auto minmax(260px, 1.6fr);
}

.feedback-error-row p {
  color: #344054;
  line-height: 1.35;
}

.feedback-duplicates {
  display: grid;
  gap: 9px;
}

.abc-chart {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.abc-donut {
  position: relative;
  width: min(360px, 78vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 0 42%, transparent 43%),
    conic-gradient(
      var(--teal) 0 var(--abc-a, 64%),
      var(--orange) var(--abc-a, 64%) var(--abc-b, 86%),
      var(--red) var(--abc-b, 86%) 100%
    );
  box-shadow: inset 0 0 0 1px rgba(15, 31, 47, 0.08), var(--shadow);
}

.abc-center {
  position: absolute;
  inset: 35%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border-radius: 50%;
  background: #ffffff;
  text-align: center;
}

.abc-center strong {
  font-size: 18px;
}

.abc-center span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.abc-hit {
  position: absolute;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.abc-hit-a {
  top: 14%;
  right: 18%;
  background: var(--teal);
}

.abc-hit-b {
  right: 5%;
  bottom: 24%;
  background: var(--orange);
}

.abc-hit-c {
  left: 11%;
  bottom: 14%;
  background: var(--red);
}

.abc-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.abc-legend button {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.abc-legend span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.abc-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.abc-a,
.abc-progress-a {
  background: var(--teal);
}

.abc-b,
.abc-progress-b {
  background: var(--orange);
}

.abc-c,
.abc-progress-c {
  background: var(--red);
}

.duplicate-card {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.duplicate-card p {
  margin: 5px 0;
  color: #344054;
  line-height: 1.35;
}

.duplicate-card small {
  display: block;
  color: var(--muted);
}

.improvement-grid .product-card {
  grid-template-columns: 68px minmax(0, 1fr);
}

.improvement-grid .product-card > .card-value {
  grid-column: 1 / -1;
}

.card-value {
  text-align: right;
  font-weight: 800;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.detail-drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 24, 40, 0.42);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(980px, 94vw);
  height: 100%;
  padding: 22px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -24px 0 50px rgba(16, 24, 40, 0.22);
}

.drawer-close {
  float: right;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.drawer-subtitle {
  margin: 8px 0 16px;
  color: var(--muted);
}

.detail-body {
  clear: both;
}

.detail-section-title {
  margin: 18px 0 9px;
  font-size: 15px;
}

.detail-table table {
  min-width: 860px;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav,
  .period-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .work-grid,
  .work-grid.three,
  .improvement-grid,
  .feedback-summary,
  .abc-legend {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    background: #f6f7f9;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 22px rgba(16, 24, 40, 0.08);
  }

  .brand {
    margin-bottom: 8px;
    padding: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav {
    display: flex;
    gap: 7px;
    margin: 0 -10px 9px;
    padding: 0 10px 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .nav-section {
    flex: 0 0 auto;
    min-width: 210px;
    max-height: 190px;
    overflow-y: auto;
    background: #fff;
  }

  .nav-section summary {
    min-height: 38px;
    white-space: nowrap;
  }

  .nav-sub {
    padding: 0 8px 8px 18px;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .sidebar-card {
    display: inline-grid;
    width: calc(50% - 7px);
    min-height: 86px;
    margin: 0 4px 8px 0;
    vertical-align: top;
  }

  .period-tabs {
    grid-template-columns: repeat(3, minmax(38px, 1fr));
  }

  .manager-link {
    min-height: 40px;
  }

  .content {
    padding: 12px 10px 24px;
  }

  .topbar,
  .top-actions,
  .panel-head {
    display: grid;
    gap: 10px;
  }

  .topbar {
    padding: 14px;
    margin-bottom: 10px;
  }

  .top-actions input {
    width: 100%;
  }

  h1 {
    font-size: 24px;
    line-height: 1.12;
  }

  h2 {
    font-size: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .kpi {
    min-height: 94px;
    padding: 11px;
  }

  .kpi strong {
    font-size: 19px;
    word-break: break-word;
  }

  .kpi span,
  .kpi small {
    font-size: 12px;
  }

  .work-grid,
  .work-grid.three {
    gap: 10px;
    margin-bottom: 10px;
  }

  .panel {
    padding: 12px;
  }

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

  .purchase-days {
    justify-content: stretch;
  }

  .purchase-days button {
    flex: 1 1 110px;
  }

  .panel-actions button,
  .panel-actions span,
  .audit-date-control {
    width: 100%;
  }

  .audit-date-control {
    align-items: flex-start;
    flex-direction: column;
  }

  .trend-chart {
    height: 190px;
    gap: 3px;
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: 16px;
    grid-template-columns: none;
    padding-bottom: 22px;
  }

  .bar {
    min-width: 16px;
  }

  .bar span {
    opacity: 1;
    bottom: -18px;
    font-size: 9px;
  }

  .bar b {
    display: none;
  }

  .trend-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
  }

  .stack-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .progress {
    grid-column: auto;
  }

  .table-scroll,
  .warehouse-table {
    margin: 0 -12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 880px;
  }

  th,
  td {
    padding: 10px;
  }

  .warehouse-table table {
    min-width: 940px;
  }

  .warehouse-group summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .stock-input.narrow-input {
    width: 64px;
    min-height: 36px;
  }

  .date-input {
    width: 132px;
    min-height: 36px;
  }

  .product-card {
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: start;
    padding: 10px;
  }

  .product-card img,
  .empty-image {
    width: 58px;
    height: 58px;
  }

  .purchase-card img,
  .purchase-card .empty-image {
    width: 52px;
    height: 52px;
  }

  .product-card .card-value {
    grid-column: 1 / -1;
    text-align: left;
  }

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

  .abc-donut {
    width: min(300px, 84vw);
  }

  .abc-hit {
    width: 48px;
    height: 48px;
  }

  .detail-drawer.open {
    display: block;
  }

  .drawer-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 16px 12px 24px;
    border-left: 0;
  }

  .drawer-close {
    position: sticky;
    top: 0;
    z-index: 2;
    float: none;
    width: 100%;
    margin-bottom: 10px;
  }

  .detail-table table {
    min-width: 820px;
  }

  .manager-shell {
    width: min(100% - 20px, 1500px);
    padding: 12px 0 24px;
  }

  .manager-topbar,
  .manager-actions {
    display: grid;
  }

  .manager-actions input,
  .manager-actions button {
    width: 100%;
  }

  .manager-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .manager-summary strong {
    font-size: 19px;
  }
}

@media (max-width: 420px) {
  .sidebar-card {
    width: 100%;
    min-height: auto;
  }

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

  .kpi {
    min-height: auto;
  }

  .trend-breakdown,
  .manager-summary {
    grid-template-columns: 1fr;
  }
}
