:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
  color: #23282c;
  background: #e7e7e8;
  font-size: 16px;
  --blue: #5d819c;
  --edge: #e4e7e9;
  --muted: #657480;
  --ink: #1e2a32;
  --paper: #fff;
  --bluebg: #edf2f5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--edge);
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 14px;
  line-height: 1.35;
}
button:hover {
  border-color: #839cad;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #8cb3d1;
  outline-offset: 2px;
}
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-weight: 650;
}
button.soft {
  background: var(--bluebg);
  color: #2a5677;
  border-color: transparent;
}
button.ghost {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 7px 4px;
}
button.tiny {
  padding: 6px 10px;
  font-size: 14px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(27px, 3vw, 37px);
  letter-spacing: -0.04em;
  font-weight: 680;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 17px;
}
p {
  line-height: 1.65;
}
.muted,
small {
  color: var(--muted);
}
small {
  font-size: 13px;
}
.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.top,
.bar,
.line,
.tools,
.actions,
.section-title,
.seg {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top,
.bar,
.section-title {
  justify-content: space-between;
}
.top {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
}
.flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 20px;
  background: #f6f9fa;
  border: 1px solid #d9e2e7;
  font-size: 13px;
  color: #3b5769;
}
.flag i {
  width: 6px;
  height: 6px;
  border-radius: 6px;
  background: #789bb0;
}
.bar {
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.bar p {
  margin-top: 5px;
  font-size: 15px;
  color: var(--muted);
}
.card {
  background: #fff;
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 23px;
}
.card + .card,
.tools + .card {
  margin-top: 16px;
}
.section-title {
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tools {
  flex-wrap: wrap;
  margin: 0 0 15px;
}
.tools input {
  max-width: 320px;
}
.tools select {
  width: auto;
  min-width: 140px;
}
.seg {
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.seg button {
  border-color: transparent;
  background: #ffffff8a;
  font-size: 14px;
}
.seg .on {
  background: #fff;
  color: var(--blue);
  border-color: #a6bdcd;
  font-weight: 650;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #cdd7dd;
  background: #fff;
  border-radius: 9px;
  padding: 10px 12px;
  min-height: 43px;
  color: #182730;
}
select {
  appearance: none;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10'%3E%3Cpath d='m2 2 5 5 5-5' fill='none' stroke='%23546b7a' stroke-width='1.7'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  padding-right: 35px;
}
textarea {
  min-height: 75px;
  resize: vertical;
}
label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #40525f;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.fields .full {
  grid-column: 1/-1;
}
.actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}
.notice {
  background: #edf4f7;
  color: #385a6b;
  border-radius: 9px;
  padding: 10px 13px;
  margin: 14px 0;
  font-size: 14px;
}
.err {
  color: #982e30;
  background: #fff1ef;
  padding: 9px 12px;
  border-radius: 8px;
  margin-top: 12px;
}
.err:empty {
  display: none;
}
.tablebox {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
th {
  font-weight: 500;
  color: #677782;
  background: #f5f7f8;
  white-space: nowrap;
}
th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e7ecef;
  text-align: left;
}
td {
  line-height: 1.5;
}
td b,
td small {
  display: block;
}
td b {
  font-size: 15px;
}
td small {
  margin-top: 2px;
}
tr:last-child td {
  border-bottom: 0;
}
.num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.tag {
  display: inline-block;
  border-radius: 6px;
  background: #edf3f7;
  color: #426681;
  font-size: 13px;
  padding: 3px 8px;
  white-space: nowrap;
}
.empty {
  padding: 25px;
  color: var(--muted);
  text-align: center;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.pair .card {
  margin: 0;
}
.convert {
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 14px;
  margin-top: 13px;
}
.convert .fields {
  grid-template-columns: 1.4fr 1fr 0.7fr auto;
  align-items: end;
  margin-top: 12px;
}
.rowend {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.login {
  max-width: 440px;
  margin: 12vh auto;
  padding: 32px;
}
.login h1 {
  font-size: 28px;
  margin: 12px 0 22px;
}
.login label {
  margin-bottom: 13px;
}
.login button {
  width: 100%;
  margin-top: 7px;
}
dialog {
  width: min(660px, 95vw);
  max-height: 90dvh;
  border: 1px solid #d1dce1;
  border-radius: 16px;
  padding: 22px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 80px #20374533;
}
dialog::backdrop {
  background: #1c323c55;
  backdrop-filter: blur(3px);
}
.details p {
  margin: 7px 0;
}
.details .tablebox {
  margin-top: 13px;
}
#toast:not(:empty) {
  pointer-events: none;
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: #213847;
  color: white;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 4px 20px #18344533;
}
.wrap {
  flex-wrap: wrap;
}
.subnote {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0;
}
.metric-fields {
  margin: 16px 0;
}
.metric-fields summary {
  cursor: pointer;
  font-weight: 650;
  padding: 8px 0;
}
#item-profile {
  margin-top: 14px;
}
#modal .tablebox + .section-title {
  margin-top: 20px;
}
.daily-grid th,
.daily-grid td {
  min-width: 54px;
  white-space: nowrap;
}
.daily-grid th:first-child,
.daily-grid td:first-child {
  position: sticky;
  left: 0;
  background: var(--paper);
  min-width: 125px;
}
.daily-grid td:nth-child(2) {
  color: var(--muted);
  font-size: 13px;
}
.tools {
  align-items: flex-end;
}

/* One window surface behind the sidebar and the work area. Business surfaces are white. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(234, 234, 235, 0.74);
  -webkit-backdrop-filter: blur(28px);
  backdrop-filter: blur(28px);
}
.shell {
  --top-space: clamp(14px, 2.2vh, 24px);
  grid-template-rows: auto 1fr;
  display: grid;
  grid-template-columns: clamp(158px, 13vw, 208px) minmax(0, 1fr);
  gap: clamp(12px, 1.4vw, 25px);
  min-height: 100dvh;
  padding: var(--top-space) clamp(16px, 1.7vw, 32px) 18px
    clamp(16px, 1.55vw, 30px);
}
.side {
  position: sticky;
  top: var(--top-space);
  height: calc(100dvh - var(--top-space) - 86px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.masthead {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 19px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d4d8db;
}
.masthead .flag {
  margin-left: auto;
}
.department-switch {
  display: inline-grid;
  position: relative;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  isolation: isolate;
  padding: 3px;
  border-radius: 22px;
  background: #dce0e3;
}
.department-switch button {
  position: relative;
  padding: 8px 13px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 540;
  color: #505f68;
  border: 0;
  border-radius: 19px;
  background: transparent;
}
.department-switch button[aria-pressed="true"] {
  color: #284d66;
  font-weight: 680;
}
.department-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 2);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 4px #35485624;
}
.department-switch[data-side="right"] .department-thumb {
  transform: translateX(100%);
}

.brand b {
  font-size: 20px;
  font-weight: 680;
  display: block;
  line-height: 1.35;
}
.brand small {
  font-size: 13px;
  display: block;
  margin-top: 4px;
  color: #637380;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  min-height: 0;
  margin-left: -3px;
  padding: 2px 3px;
}
.nav button,
.nav-group summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  min-height: 41px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  width: 100%;
  font:
    500 14px/1.35 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: #333b42;
}
.nav .icon {
  width: 17px;
  height: 17px;
  color: #77818a;
}
.nav button:hover,
.nav-group summary:hover {
  background: #ffffff70;
}
.nav button.on {
  background: white;
  font-weight: 650;
  color: #29353d;
}
.nav button.on .icon {
  color: var(--blue);
}
.nav-group summary {
  cursor: pointer;
  list-style: none;
}
.nav-group summary:focus-visible {
  outline: 2px solid #8cb3d1;
  outline-offset: -2px;
}
.nav-group summary::-webkit-details-marker {
  display: none;
}
.nav-chevron {
  width: 6px;
  height: 6px;
  border: solid #869098;
  border-width: 0 1.5px 1.5px 0;
  margin-left: auto;
  transform: rotate(-45deg);
}
.nav-group[open] .nav-chevron {
  transform: rotate(45deg);
}
.nav-children {
  margin: 0 0 4px 18px;
  padding: 0 0 0 10px;
  border-left: 1px solid #cfd3d6;
}
.nav-children button {
  font-size: 14px;
  padding: 8px 10px;
  min-height: 36px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 15px 0 2px;
  border: 0;
  border-top: 1px solid #d6d8da;
  border-radius: 0;
  background: transparent;
  text-align: left;
}
.avatar {
  border: 1px solid white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #dfe6eb;
  color: #465a6a;
  font-weight: 650;
}
.identity b,
.identity small {
  display: block;
}
.identity b {
  font-size: 15px;
}
.identity small {
  font-size: 12px;
  margin-top: 3px;
}
.phone-tabs {
  display: none;
}
.workspace {
  width: 100%;
  min-width: 0;
  align-self: start;
}
.top {
  font-size: 13px;
  margin: 0 0 14px;
}
.flag {
  white-space: nowrap;
  color: #6d7a84;
  font-size: 12px;
  background: #f4f5f6;
  border-color: #ffffffab;
}
.bar {
  max-width: 100%;
  margin: 0 0 17px;
  gap: 20px;
}
.bar > div:first-child {
  width: fit-content;
  max-width: 100%;
  padding: 13px 18px;
  background: white;
  border-radius: 16px;
}
.bar h1 {
  font-size: clamp(21px, 2.1vw, 29px);
  letter-spacing: -0.025em;
}
.bar p {
  font-size: 14px;
}
.seg button,
.card,
dialog,
.convert {
  background: white;
}
button.primary {
  background: var(--blue);
  border-radius: 22px;
  padding-inline: 20px;
}
.home-heading {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 19px clamp(20px, 2.5vw, 38px);
  border-radius: 18px;
  color: #f9faf9;
  background: #203c46;
}
.home-heading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      #203c46 12%,
      #203c46ee 32%,
      #203c4660 57%,
      #203c4608 85%
    ),
    url("/workshop-mold.webp") right 52% / 77% auto no-repeat;
}
.home-place {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d1e1df;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0.08em;
}
.home-place::before {
  content: "";
  width: 18px;
  height: 2px;
  background: #9fc5bd;
}
.back-today {
  position: absolute;
  top: 5px;
  right: clamp(14px, 2vw, 28px);
  padding: 4px 10px;
  min-height: 32px;
  background: #203c46ed;
  border: 1px solid #b2c1c5;
  color: white;
  font-size: 13px;
}
.home-heading h1 {
  color: white;
  margin: 5px 0 8px;
  font-size: clamp(26px, 2.4vw, 35px);
  font-weight: 660;
  line-height: 1.2;
  letter-spacing: 0.015em;
}
.home-date {
  position: relative;
  width: fit-content;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d4e0e2;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.home-date:focus-within { outline: 2px solid white; }
.home-date input { position: absolute; inset: 0; width: 100%; min-height: 0; height: 100%; opacity: 0; cursor: pointer; }
.home-date input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.home-date .icon {
  width: 14px;
  height: 14px;
}
.dashboard-refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: absolute;
  right: clamp(14px, 2vw, 28px);
  bottom: 16px;
  min-height: 38px;
  padding: 6px 12px;
  background: #203c46ed;
  border: 1px solid #b2c1c5;
  color: white;
  font-size: 13px;
}
.dashboard-refresh .icon {
  width: 15px;
  height: 15px;
}
.dashboard-refresh:hover {
  background: #142e37;
}
.home-metrics,
.home-card {
  background: white;
  border: 1px solid #dfe4e4;
  border-radius: 16px;
  box-shadow: 0 3px 10px #273b4306;
}
.home-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0;
  padding: 18px 0;
}
.home-metric {
  min-width: 0;
  padding: 0 clamp(12px, 1.8vw, 28px);
  overflow-wrap: anywhere;
}
.home-metric + .home-metric {
  border-left: 1px solid #e3e9e9;
}
.home-metric dt {
  color: #455b61;
  font-size: 14px;
  font-weight: 600;
}
.home-metric dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.home-metric dd strong {
  color: #243e46;
  font-size: clamp(26px, 2.65vw, 40px);
  line-height: 1.45;
  font-weight: 640;
  letter-spacing: -0.04em;
}
.home-metric:first-child dd strong {
  color: #276353;
}
.home-metric dd span {
  margin-left: 5px;
  font-size: 13px;
  color: #4d6568;
}
.home-metric .metric-note {
  color: #5e6f74;
  font-size: 12px;
  line-height: 1.5;
}
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  grid-template-areas: "production attention" "activity activity";
  gap: 14px;
  align-items: stretch;
}
.home-production {
  grid-area: production;
}
.home-grid.with-stock-summary {
  grid-template-areas: "production attention" "ledgers ledgers" "activity activity";
}
.home-ledgers {
  grid-area: ledgers;
}
.home-ledgers .tablebox table {
  min-width: 0;
}
.home-production .tablebox table {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.home-production th,
.home-production td {
  padding: 10px 0;
  text-align: right;
}
.home-production th {
  background: transparent;
  color: #64777c;
  font-size: 12px;
}
.home-production th:first-child,
.home-production td:first-child {
  text-align: left;
}
.home-attention {
  grid-area: attention;
}
.home-movements {
  grid-area: activity;
}
.home-card {
  min-width: 0;
  padding: 0 clamp(14px, 1.6vw, 24px) 12px;
}
.home-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 51px;
  gap: 8px;
  border-bottom: 1px solid #e4eaea;
}
.home-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #233a42;
  font-size: 17px;
  font-weight: 650;
}
.home-card header small {
  font-size: 12px;
}
.home-empty {
  padding: 18px 0 8px;
  color: var(--muted);
  font-size: 14px;
}
.production-columns,
.production-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1.9fr) minmax(48px, 1fr) minmax(48px, 1fr)
    9px;
  gap: 5px;
  align-items: center;
  text-align: right;
}
.production-columns {
  padding-block: 10px 7px;
  color: #64777c;
  font-size: 12px;
}
.production-columns > :first-child,
.production-row > :first-child {
  text-align: left;
}
.production-row,
.home-row {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  font-variant-numeric: tabular-nums;
}
.production-row {
  color: #29454b;
  font-size: 16px;
  font-weight: 580;
  overflow-wrap: anywhere;
}
.home-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.production-row + .production-row,
.activity-row + .activity-row {
  border-top: 1px solid #edf0ef;
}
.production-row:hover,
.activity-row:hover {
  background: #f4f8f7;
}
.home-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}
.home-copy b {
  display: block;
  color: #273a41;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}
.home-copy small {
  display: block;
  margin-top: 3px;
  color: #627178;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}
.home-chevron {
  margin-left: auto;
  color: #75878b;
  font-size: 18px;
}
.alert-count {
  padding: 1px 7px;
  border-radius: 5px;
  background: #f7ead3;
  color: #825322;
  font-size: 12px;
}
.alert-row {
  margin-top: 9px;
  border-radius: 6px;
  border-left: 3px solid #d3a35f;
  padding: 9px 12px;
  background: #fbf7ef;
}
.alert-row:hover {
  background: #f7eedc;
}
.home-status {
  display: inline-block;
  color: #825420;
  font-size: 12px;
  font-weight: 620;
  margin-bottom: 3px;
}
[data-flow="入库"] {
  --flow-ink: #155e43;
  --flow-bg: #e3f3e9;
  --flow-mark: #31865f;
}
[data-flow="出库"] {
  --flow-ink: #8d4219;
  --flow-bg: #fff0e1;
  --flow-mark: #ba652e;
}
.movement-type {
  display: inline-block;
  flex: none;
  white-space: nowrap;
  vertical-align: middle;
  padding: 3px 7px;
  border-inline-start: 3px solid var(--flow-mark);
  border-radius: 4px;
  color: var(--flow-ink);
  background: var(--flow-bg);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
}
.direction-filter {
  display: inline-flex;
  flex: none;
  align-items: center;
  padding: 2px;
  border: 1px solid #dae3e1;
  border-radius: 10px;
  background: #f3f6f5;
}
.direction-filter button {
  min-width: 44px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #475958;
  font-size: 13px;
  font-weight: 550;
}
.direction-filter button[aria-pressed="true"] {
  border-color: var(--flow-mark, #a9b8b3);
  background: var(--flow-bg, #fff);
  color: var(--flow-ink, #263c32);
  font-weight: 700;
}
button:is([data-flow="入库"], [data-flow="出库"])::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 4px;
  border-radius: 50%;
  background: var(--flow-mark);
  content: "";
  vertical-align: .12em;
}
button:is([data-action="modulePost"], [data-action="carbonNew"]):is([data-flow="入库"], [data-flow="出库"]) {
  background: var(--flow-bg);
  color: var(--flow-ink);
  border-color: var(--flow-mark);
}
.home-movements header { flex-wrap: wrap; padding-block: 6px; }
.card + .home-movements { margin-top: 16px; }
.movement-qty {
  margin-left: auto;
  color: #29454b;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}
.home-more summary {
  width: fit-content;
  cursor: pointer;
  padding-block: 10px;
  color: #42696b;
  font-size: 13px;
}
html:has(.dashboard-shell) {
  overscroll-behavior-y: none;
}
body:has(.dashboard-shell) {
  min-height: 100dvh;
}
@media (min-width: 721px) and (min-height: 521px) {
  .dashboard-shell {
    height: 100vh;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .dashboard-shell .side {
    height: auto;
    min-height: 0;
  }
  .dashboard-shell .workspace {
    align-self: stretch;
    min-height: 0;
  }
  .dashboard-shell #body {
    display: grid;
    height: 100%;
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  .dashboard-shell .home-grid {
    min-height: 0;
    grid-template-rows: repeat(2, minmax(0, auto));
  }
  .dashboard-shell .home-grid.with-stock-summary {
    grid-template-areas: "production attention" "ledgers activity";
  }
  .dashboard-shell .home-card {
    min-height: 0;
    padding-bottom: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-padding-top: 54px;
  }
  .dashboard-shell .home-card header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: white;
  }
}
@media (min-width: 721px) and (min-height: 521px) and (max-height: 720px) {
  .dashboard-shell .home-heading { padding-block: 12px; }
  .dashboard-shell .home-metrics { margin-block: 8px; padding-block: 8px; }
  .dashboard-shell .home-grid { row-gap: 8px; }
}
@media (min-width: 721px) and (max-width: 1050px) {
  .shell {
    grid-template-columns: 144px minmax(0, 1fr);
    gap: 13px;
    padding-inline: 12px;
  }
  .home-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }
}
@media (max-width: 720px), (pointer: coarse) and (max-width: 1050px) and (max-height: 520px) {
  body::before {
    background: #e9eaeb;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  dialog::backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  button, summary {
    touch-action: manipulation;
  }
  .shell {
    display: block;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
      calc(76px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .dashboard-shell {
    /* Three pixels above/below the 51px tabs plus their top border. */
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }
  .side {
    display: none;
  }
  .brand {
    margin: 0;
  }
  .brand b {
    font-size: 19px;
  }
  .brand small {
    font-size: 11px;
    margin: 0;
  }
  html {
    scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .phone-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    z-index: 5;
    inset: auto 0 0;
    padding: 3px max(6px, env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: #fff;
    border-top: 1px solid #d4dfdd;
  }
  .phone-tabs button {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    min-height: 51px;
    padding: 3px 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #52635f;
    font-size: 12px;
    font-weight: 560;
  }
  .phone-tabs .icon { width: 21px; height: 21px; }
  .phone-tabs button[aria-current] {
    color: #175842;
    background: #e7f2eb;
    font-weight: 700;
  }
  #toast:not(:empty) { bottom: calc(73px + env(safe-area-inset-bottom)); }
  dialog.phone-sheet {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    margin: 0 auto;
    border: 0;
    border-radius: 20px 20px 0 0;
    padding: 12px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .phone-menu-group { margin: 12px 0; }
  .phone-menu-group h3 {
    margin: 0 0 6px;
    font-size: 13px;
    color: #51645d;
  }
  .phone-menu-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .phone-menu-links button, .phone-account {
    text-align: left;
    font-size: 14px;
    border-radius: 9px;
    background: #f6f8f7;
  }
  .phone-menu-links button.on {
    background: #e7f2eb;
    color: #175842;
    border-color: #96b6a6;
  }
  .phone-account { width: 100%; }
  .phone-menu-dept {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid var(--edge);
    margin-top: 14px;
    padding-top: 10px;
    color: #365548;
    font-size: 14px;
    font-weight: 600;
  }
  .top {
    flex-wrap: wrap;
    gap: 4px 10px;
  }
  .bar {
    gap: 9px;
    margin-bottom: 12px;
  }
  .masthead {
    gap: 9px;
    margin-bottom: 10px;
    padding-bottom: 9px;
  }
  .masthead .flag {
    font-size: 11px;
    padding: 4px 7px;
  }
  .department-switch button {
    padding: 8px 9px;
    font-size: 13px;
  }
  .home-heading {
    padding: 13px 17px;
    border-radius: 14px;
  }
  .home-heading::before {
    background-size:
      auto,
      85% auto;
  }
  .home-heading h1 {
    font-size: 25px;
    margin: 3px 0 6px;
  }
  .home-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 10px 0;
    padding: 0;
    border-radius: 14px;
  }
  .home-metric {
    padding: 10px 14px;
  }
  .home-metric:nth-child(3) {
    border-left: 0;
  }
  .home-metric:nth-child(n + 3) {
    border-top: 1px solid #e3e9e9;
  }
  .home-metric dd strong {
    font-size: 27px;
  }
  .dashboard-refresh {
    min-height: 44px;
    bottom: 12px;
    right: 12px;
  }
  .home-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "attention" "production" "activity";
    gap: 10px;
  }
  .home-grid.with-stock-summary {
    grid-template-areas: "production" "attention" "ledgers" "activity";
  }
  .home-card {
    padding: 0 13px 10px;
    border-radius: 14px;
  }
  .home-card header {
    min-height: 45px;
  }
  .home-more summary {
    min-height: 44px;
  }
  .fields,
  .pair {
    grid-template-columns: 1fr;
  }
  .convert .fields {
    grid-template-columns: 1fr 1fr;
  }
  .card {
    padding: 15px;
    border-radius: 16px;
  }
  .tablebox table {
    min-width: 530px;
  }
  .login {
    margin: 10vh 14px;
  }
  .seg {
    gap: 5px;
  }
  .seg button {
    padding: 7px 9px;
  }
  .tools input {
    max-width: none;
  }
  .tools select {
    min-width: 0;
  }
}
@media (max-width: 360px) {
  .dashboard-refresh {
    justify-content: center;
    min-width: 44px;
  }
  .dashboard-refresh span {
    display: none;
  }
}
.carbon-heading {
  margin: 3px 0 20px;
}
.carbon-heading p {
  font-size: 13px;
  color: #546a70;
  margin-bottom: 4px;
}
.carbon-heading h1 {
  font-size: clamp(24px, 2.5vw, 34px);
  color: #233a42;
}
.carbon-stock,
.carbon-archive {
  padding: clamp(16px, 2vw, 28px);
  background: white;
  border: 1px solid var(--edge);
  border-radius: 16px;
}
.carbon-stock h2,
.carbon-archive h2 {
  color: #233a42;
  font-size: 19px;
}
.carbon-stock p,
.carbon-archive p {
  margin-top: 4px;
  font-size: 14px;
  color: #52656b;
}
.carbon-ledgers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
}
.carbon-ledgers > li {
  padding: 14px 0 0;
  border-top: 3px solid #72998b;
}
.carbon-ledgers > li:nth-child(2) {
  border-color: #7294a1;
}
.carbon-ledgers > li:nth-child(3) {
  border-color: #9d896a;
}
.carbon-ledgers h3 {
  color: #293e43;
  font-size: 17px;
}
.carbon-ledgers h4 {
  margin: 16px 0 7px;
  color: #53666b;
  font-size: 13px;
}
.carbon-ledgers ul,
.carbon-archive ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.carbon-ledgers ul li,
.carbon-archive li {
  padding: 4px 9px;
  border-radius: 5px;
  background: #f0f4f3;
  color: #30494a;
  font-size: 14px;
}
.carbon-archive {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 820px) {
  .carbon-ledgers {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .carbon-ledgers > li {
    padding: 0 0 0 12px;
    border-top: 0;
    border-left: 3px solid #72998b;
  }
  .carbon-ledgers h4 {
    margin-top: 8px;
  }
}
.custom-value[hidden] {
  display: none;
}
.worksheet-block {
  margin-bottom: 24px;
}
.sheet-days {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.sheet-days td,
.sheet-days th {
  padding: 5px;
  text-align: left;
}
.sheet-days input {
  min-width: 0;
}
.day-picker {
  width: auto;
}
.readonly-sheet {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.sheet-post-link {
  border-top: 1px solid var(--edge);
  padding-top: 14px;
  margin-top: 15px;
}
@media (max-width: 720px), (pointer: coarse) and (max-width: 1050px) and (max-height: 520px) {
  dialog {
    --side-gap: max(6px, env(safe-area-inset-left), env(safe-area-inset-right));
    --top-gap: max(6px, env(safe-area-inset-top));
    --bottom-gap: max(6px, env(safe-area-inset-bottom));
    width: min(660px, calc(100% - 2 * var(--side-gap)));
    max-width: 100%;
    top: calc(var(--keyboard-top, 0px) + var(--top-gap));
    bottom: calc(var(--keyboard-bottom, 0px) + var(--bottom-gap));
    max-height: calc(100vh - var(--top-gap) - var(--bottom-gap));
    max-height: calc(var(--keyboard-height, 100dvh) - var(--top-gap) - var(--bottom-gap));
    scroll-padding-block: 64px 74px;
    padding: 13px 14px max(16px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  #modal > .section-title:first-child {
    position: sticky;
    top: -13px;
    z-index: 1;
    background: white;
    padding-block: 5px;
    border-bottom: 1px solid var(--edge);
  }
  input,
  select,
  textarea {
    font-size: 16px;
    min-width: 0;
  }
  input:not([type="hidden"]),
  select,
  button,
  .nav button,
  .nav-group summary,
  .metric-fields summary,
  .back-today,
  .home-date {
    min-height: 44px;
  }
  .tablebox.compact table {
    min-width: 0;
    table-layout: fixed;
  }
  .tablebox.compact th:first-child {
    width: 36%;
  }
  .tablebox.compact td,
  .tablebox.compact th {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #modal .fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  #modal .actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 8px 0;
    border-top: 1px solid var(--edge);
  }
  .sheet-days {
    table-layout: fixed;
  }
  .sheet-days th:first-child {
    width: 52px;
  }
}

.carbon-customer + .carbon-customer {
  margin-top: 24px;
}
.carbon-customer a {
  overflow-wrap: anywhere;
}

.stock-record-table tbody tr, .carbon-movement-table tbody tr { position: relative; cursor: pointer; }
.stock-record-table tbody button, .carbon-movement-table [data-action="carbonView"] { position: static; }
.stock-record-table tbody button::after, .carbon-movement-table [data-action="carbonView"]::after { content: ""; position: absolute; inset: 0; }
.carbon-movement-table tbody tr:hover { background: #f3f7f7; }
.confirm-summary { flex: 1 0 100%; margin: 0 0 4px; }
.actions:has(.confirm-summary) { flex-wrap: wrap; }
.actions .danger { color: #98382d; }


.carbon-file-links { display: grid; justify-items: start; gap: 3px; }
.carbon-file-links .carbon-file-name { white-space: normal; overflow-wrap: anywhere; }
.carbon-file-links > span { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.carbon-file-links a { color: #126164; text-underline-offset: 3px; }
.carbon-file-links > span a { padding: 4px 0; }
.carbon-current-file { margin: 12px 0; }

.daily-heading .bar {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.report-sheet {
  margin-block: 12px 18px;
  border-block: 1px solid var(--edge);
}
.report-sheet-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  align-items: start;
  padding-block: 6px;
}
.report-sheet-row + .report-sheet-row {
  border-top: 1px solid #edf0f1;
}
.report-sheet-row.report-process-start {
  margin-top: 8px;
  border-top-color: var(--edge);
}
.report-sheet-row :is(label, .report-value) {
  display: grid;
  grid-template-columns: 10em minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 14px;
}
.report-sheet-row :is(input, textarea) {
  min-width: 0;
}
.report-note-row {
  grid-template-columns: minmax(0, 1fr);
}
.report-value dt {
  color: #40525f;
  font-weight: 600;
}
.report-value dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.report-sheet-row:has(.report-value) {
  padding-block: 10px;
}
@media (min-width: 721px) {
  dialog:has(.report-sheet) {
    width: min(810px, 95vw);
  }
}
@media (min-width: 721px) and (pointer: fine) {
  .report-sheet-row {
    padding-block: 3px;
  }
  .report-sheet-row input {
    min-height: 34px;
    padding: 6px 9px;
  }
  .report-sheet-row textarea {
    min-height: 50px;
    padding: 6px 9px;
  }
}
@media (max-width: 720px) {
  .report-sheet-row {
    column-gap: 12px;
    padding-block: 8px;
  }
  .report-sheet-row :is(label, .report-value) {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 4px;
  }
  .report-sheet-row input {
    padding-inline: 8px;
  }
}
