:root {
  font-family: Inter, "Microsoft YaHei", Arial, sans-serif;
  color: #202827;
  background: #f5f7f7;
  font-size: 14px;
  letter-spacing: 0;
  --accent: #087f72;
  --line: #e0e7e5;
  --muted: #687873;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: white;
  color: #26342f;
  border-radius: 5px;
  padding: 9px 13px;
  min-height: 38px;
}
button:hover {
  background: #edf5f2;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.danger {
  color: #b14437;
}
.lucide {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.7;
}
.shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 27px 15px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin: 0 5px 40px;
  font-size: 15px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  background: var(--accent);
  color: white;
  border-radius: 5px;
  font-size: 22px;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 5px;
}
nav {
  display: grid;
  gap: 7px;
}
nav button {
  justify-content: flex-start;
  border: 0;
  color: #64716d;
  background: none;
  padding: 12px;
}
nav button.active {
  background: #e8f4ef;
  color: #087460;
  font-weight: 600;
}
nav button span {
  margin-left: auto;
  font-size: 12px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 18px 10px;
  color: #3d5d51;
  font-size: 12px;
}
.sidebar-footer small {
  display: block;
  color: var(--muted);
  margin-top: 10px;
}
.dot {
  width: 7px;
  height: 7px;
  background: #25a278;
  display: inline-block;
  border-radius: 50%;
  margin-right: 5px;
}
main {
  min-width: 0;
  padding: 30px 36px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 12px;
  color: var(--muted);
}
h1 {
  font-size: 26px;
  font-weight: 650;
  margin: 8px 0 0;
}
h2 {
  font-size: 18px;
  margin: 0 0 18px;
}
h3 {
  font-size: 15px;
  margin: 0 0 15px;
}
.header-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.icon-button {
  width: 38px;
  height: 38px;
  padding: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 4px;
  background: #edf1ef;
  font-size: 12px;
  white-space: nowrap;
}
.badge.good {
  background: #e0f3e9;
  color: #176c4d;
}
.badge.warn {
  background: #fff1d8;
  color: #936219;
}
.badge.bad {
  background: #fae7e4;
  color: #a74336;
}
.connection-bar {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 25px;
  font-size: 12px;
  color: var(--muted);
}
.connection-bar span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.connection-bar .lucide {
  width: 15px;
  height: 15px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 22px;
  gap: 20px;
}
.metric {
  border-right: 1px solid var(--line);
}
.metric:last-child {
  border: 0;
}
.metric small {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}
.metric strong {
  font-size: 29px;
  font-weight: 550;
}
.metric small .lucide {
  vertical-align: middle;
  margin-right: 5px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  padding: 0 11px;
  flex: 1;
  max-width: 360px;
  min-width: 180px;
}
.search input {
  border: 0;
  width: 100%;
  outline: 0;
  padding: 10px 0;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}
th {
  font-size: 12px;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  background: #fafcfb;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 13px 15px;
  border-bottom: 1px solid #edf0ef;
  vertical-align: middle;
}
tr:last-child td {
  border: 0;
}
tbody tr[data-product]:hover {
  background: #f7fbf9;
  cursor: pointer;
}
.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  max-width: 350px;
}
.product-cell img,
.thumb-placeholder {
  width: 50px;
  height: 50px;
  object-fit: contain;
  background: #f1f5f3;
  border: 1px solid var(--line);
  border-radius: 4px;
  flex-shrink: 0;
}
.thumb-placeholder {
  display: grid;
  place-items: center;
  color: #91a49b;
}
.product-cell strong {
  display: block;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.product-cell small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}
.empty {
  text-align: center;
  padding: 65px 15px;
  background: #fff;
}
.empty .lucide {
  width: 35px;
  height: 35px;
  color: #97aaa2;
  margin-bottom: 8px;
}
.empty p {
  color: var(--muted);
  font-size: 13px;
}
.path-band {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0;
  overflow-wrap: anywhere;
}
.panel-section {
  border-bottom: 1px solid var(--line);
  padding: 0 0 28px;
  margin-bottom: 28px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: #53655c;
  min-width: 0;
}
input,
select,
textarea {
  border: 1px solid #cfdad5;
  border-radius: 4px;
  padding: 10px;
  background: white;
  width: 100%;
  color: #243a2f;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #87bca7;
  outline-offset: 1px;
}
textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}
.wide {
  grid-column: 1/-1;
}
.span2 {
  grid-column: span 2;
}
.check {
  flex-direction: row;
  align-items: center;
  line-height: 1.5;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 15px;
}
.section-title h2 {
  margin: 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.formula {
  padding: 14px 0;
  line-height: 1.9;
  font-family: inherit;
  color: #365849;
  font-size: 13px;
}
.event-line {
  display: grid;
  grid-template-columns: 150px 80px minmax(0, 1fr);
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.event-line time {
  color: var(--muted);
  font-size: 12px;
}
dialog {
  width: min(1020px, calc(100% - 32px));
  max-height: 92vh;
  border: 1px solid var(--line);
  padding: 0;
  border-radius: 7px;
  background: #fff;
  color: inherit;
}
dialog::backdrop {
  background: #16282070;
}
.detail-header {
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}
.detail-header h2 {
  margin: 0;
  font-size: 20px;
}
.detail-body {
  padding: 24px;
}
.detail-footer {
  position: sticky;
  bottom: 0;
  background: white;
  border-top: 1px solid var(--line);
  padding: 15px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.image-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 15px 0;
}
.image-item {
  border: 1px solid var(--line);
  padding: 7px;
  border-radius: 5px;
}
.image-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #f6f8f7;
}
.image-item small {
  overflow-wrap: anywhere;
  font-size: 10px;
}
.issues {
  background: #fff5e5;
  color: #845918;
  padding: 12px 16px;
  line-height: 1.8;
  font-size: 12px;
  border-left: 3px solid #d5a452;
  margin-bottom: 22px;
}
.preview-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  padding: 18px 0;
}
.preview-values strong {
  display: block;
  font-size: 21px;
  margin-top: 5px;
  color: var(--accent);
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(650px, 90vw);
  padding: 13px 20px;
  color: #fff;
  background: #203e32;
  border-radius: 5px;
  display: none;
  z-index: 99;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
#toast.error {
  background: #9d4034;
}
a {
  color: var(--accent);
  overflow-wrap: anywhere;
}
.busy {
  opacity: 0.6;
  pointer-events: none;
}
.file-button input {
  display: none;
}
.file-button {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  padding: 9px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  color: #26342f;
}
@media (max-width: 1000px) {
  main {
    padding: 24px;
  }
  .shell {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  aside {
    padding: 24px 10px;
  }
  .brand {
    font-size: 12px;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .image-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  .shell {
    display: block;
  }
  aside {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    margin: 0 0 15px;
  }
  .brand small {
    display: none;
  }
  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }
  nav button {
    font-size: 11px;
    justify-content: center;
    flex-direction: column;
    padding: 8px 3px;
    gap: 4px;
  }
  nav button span {
    display: none;
  }
  .sidebar-footer {
    display: none;
  }
  main {
    padding: 20px 14px;
  }
  h1 {
    font-size: 23px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .metric:nth-child(2) {
    border: 0;
  }
  .connection-bar {
    gap: 10px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span2 {
    grid-column: auto;
  }
  .image-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .detail-body {
    padding: 15px;
  }
  .detail-header {
    padding: 15px;
  }
  .preview-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .event-line {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px;
  }
  .event-line > span:last-child {
    grid-column: 1/-1;
  }
  .header-actions {
    gap: 5px;
  }
  .badge {
    font-size: 11px;
  }
  .toolbar .actions {
    width: 100%;
  }
  .search {
    max-width: none;
  }
  .detail-footer {
    padding: 12px;
    flex-wrap: wrap;
  }
  button {
    font-size: 13px;
  }
}

/* Product list: supplier cost and package measurements. */
[hidden] { display: none !important; }
.login-card { max-width: 420px; margin: 10vh auto; background: white; padding: 32px; border-radius: 12px; border: 1px solid var(--line); }
.login-card form { display: grid; gap: 20px; }
.cloud-header { margin: 0 32px; padding: 28px 0; }
.cloud-main { margin: 0; padding: 20px 32px; }
.cloud-search { min-width: 310px; }
.detail-cover { width: 220px; max-height: 240px; object-fit: contain; }
.conflict, #login-error { display: block; color: #ae3c31; }
.product-table { min-width: 1250px; }
.product-table th { white-space: nowrap; }
.product-table .product-cell { min-width: 220px; max-width: 300px; }
.product-table .supplier-cell { min-width: 130px; max-width: 200px; overflow-wrap: anywhere; }
.product-table .numeric-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.product-table .measurement-note { display: block; margin-top: 5px; font-size: 11px; color: var(--muted); }

.cloud-content { min-width: 0; }
.cloud-header { margin: 0 28px; padding: 28px 0 20px; border-bottom: 1px solid var(--line); }
.cloud-main { padding: 20px 28px; }
.settings-form { max-width: 650px; }
.settings-form form > button, #backup-plan > button { margin-top: 22px; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.settings-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.settings-grid small { color: var(--muted); }
#account-error { color: #ae3c31; }
#summary { margin: 24px 0 28px; }
@media(max-width:800px) { #workspace.shell { display:block; } #workspace aside { position:static; height:auto; padding:14px; } #workspace aside .brand { margin:0 0 12px; } #workspace aside .brand>div { display:block; } #workspace nav { display:flex; flex-wrap:wrap; gap:4px; } #workspace nav button { flex-direction:row; padding:8px 10px; } .cloud-header { margin:0 14px; padding:20px 0; } .cloud-main { padding:14px; } .settings-grid { grid-template-columns:1fr; } .cloud-search { min-width:0; width:100%; } }

.product-table .publication-sort { padding:0; min-height:0; border:0; background:transparent; color:inherit; font:inherit; white-space:nowrap; }
.product-table .publication-sort:hover { color:var(--accent); }
.product-table .publication-sort:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
